Shept uses Hibernate for data provisioning and while that is not carved in stone a pluggable architecture would require some extra work in a couple of places. First it is important to understand the design of data provider integration. All parts of a shept page that wish to reload data from their defined data source need to implement the Refreshable interface. This is true for the default datagrid backing class FilteredListHolder
and it is a recommendation for all custom implementations as well. Refreshable demands for a FilterDefintion
and keeps track of the filter in use that the calling handler can decide if a reload is required on #refresh() when the filter didn't change. FilterDefintion
is the main entry point for filter specifications and out-of-the box shept provides 4 default implementations - 2 of these are hibernate specific and support the Hibernate query API
and criteria API
.
More details and a decision matrix can be found on the filter definition page.
The FilterDefinition interface serves a double purpose: as a marker interface requiring a concrete SubInterface implementation for retrieving data and demanding the #getNewModelTemplate() method returning a ModelCreation object. If the returned object is 'NULL' the segment doesn't support the 'C' in CRUD - creation of new objects. Otherwise the segment handler needs to take care that #getNewModelTemplate() returns a populated instance of the object that serves as a template to be created for that row. This is documented in more detail in the subform lifecycle. Filters and the FilterDefinition interface are documented in the reference.
When the Refreshable interface is triggered to perform a #refresh() its execution is delegated to the ScrollingListProviderFactory which provides an appropriate ScrollingListProvider
for the FilterDefinition in use. Currently there are only providers for hibernate implemented. The ScrollingListProviderFactory needs to be extended or better should be rewritten to support plug-ins for other providers. There are also a couple of places (DaoUtils
... ) where Hibernate Metadata
is the last resort to supply generic copies of entity model objects.