Page History
...
DataSource layer is represented currently by the
DataSourceManager
interface. As it is shown in the listing below - it is capable of converting item ids to and from strings, fetching Vaadin Items by ids and verifying their existence. It is also capable of providing the Vaadin Containers to the content views/presenters. The naming of the interface is probably not the best one, alternative suggestion -DataSourceService
or simplyDataSource
.Code Block public interface DataSourceManager { String getItemPath(Object itemId); Object getItemIdFromPath(String strPath); Object getRootItemId(); Item getItem(Object itemId); Container getContainerForViewType(String viewType); boolean itemExists(Object itemId); }
The additional features that are/might be required by sub-apps are represented by additional interfaces (currently there're two of them -
SupportsVersions
andSupportsCreation
)- Currently DataSource is configured per sub-app (JCRDatasource is default). Ideally it should be injectable right away, but currently it is fetched from provider class. Proposal: we create data source on app/sub-app ComponentProvider creation.
- DataSource provides Vaadin containers for content views and items for actions and detail sub-apps. Even though the ids are shared and must have the same meaning for the both cases - the actual Vaadin Items stored in container and standalone ones can be different. E.g. for
FileSystemDataSource
use case items displayed in tables simply carry the meta info of the file, whereas the one used in DetailSubApp also provide access to the binary data of the file and allow to modify it through Vaadin property. However, Item Id is the same for both cases - java.io.File. ImageProvider
interface now looks like this:Code Block public interface ImageProvider { String getPortraitPath(Object itemId); String getThumbnailPath(Object itemId); String resolveIconClassName(String mimeType); Object getThumbnailResource(Object itemId, String generator); }
All the events that were carrying JCR items now carry inly Object item ids. E.g.
SelectionChangedEvent
:Code Block public class SelectionChangedEvent implements Event<SelectionChangedEvent.Handler> { private final Set<Object> itemsIds; public SelectionChangedEvent(Set<Object> itemIds) { this.itemsIds = itemIds; } public Object getFirstItemId() { if (itemsIds != null && !itemsIds.isEmpty()) { return itemsIds.iterator().next(); } return null; } public Set<Object> getItemIds() { return itemsIds; } }
JCR-Agnostic content app artefacts and deliverables
...