easysoa/EasySOA — Issue #81: Use DocumentModel adapters in EasySOA-core
Author: tiry
Created: 2011-12-28 13:55:54+00:00
State: open

Nuxeo Platform supports adapters on the Document Models.

This allows to wrap DocumentModels in a Java Object that implements a dedicated interface.

Since I see in the code at several places the usage of consts to retrieve propertise of DocumentModels this could make sense to encapsulate all this in adapters.

This way the EasySOA code only depends on a Java interface and does not have to care about DocumentModels and properties that are a details of the storage impl.

Typically everything inside org.easysoa.doctypes could be adapters.

There are very few examples of Adapters in Nuxeo Platform source code because this feature is usually mainly used in implementation projet to hold the "Domain Model" of the application.
But inside the platform, we use Adapters for technical features :

- getting a Blob from a DocumentModel : BlobHolder adapter

- getting the HTML Preview of a DocumentModel : HtmlPreviewAdapter adapter

- commenting a DocumentModel : CommentableDocument adapter

- accessing differents views on a Picture DocumentModel : PictureResourceAdapter adapter

- accessing differents versions of a DocumentModel : VersioningDocumentAdapter adapter

- ...

You can get more info [here](http://explorer.nuxeo.org/nuxeo/site/distribution/current/viewComponent/org.nuxeo.ecm.core.api.DocumentAdapterService).

Anyway, this is something we should consider for EasySOA Domain Model.

=> My guess is that Marwane and me should work on that ASAP :

- this is simple to do

- this would make the Domain Model explicit

- this would decouple the API from Nuxeo DocumentModels