This Was Really Helpul. Many Thanks. On Tue, Jun 23, 2015 at 12:05 PM, Dan Haywood <[email protected]> wrote:
> On 23 June 2015 at 07:22, Reza Rasouli <[email protected]> wrote: > > > Hi, > > > > Is it possible to provide data for apache isis from custom sources other > > than Database? > > > > > > > for example a data provider class which calls various REST services in > it's > > implementation of CRUD functions, and make apache isis to use these CRUD > > functions from this custom data provider class, so that the apache isis > > only provides/generates the UIs and callbacks and the server side code > > attaches hooks to these callbacks and uses that custom data provider for > > CRUD. > > > > > There are a couple of approaches. > > The most straightforward is to simply use view models instead of persistent > entities. You could for example define a service that makes the REST calls > and returns a view model to wrap the external entity. This would normally > be annotated with @DomainObject(nature=Nature.EXTERNAL_ENTITY) [1], though > you could also use just @ViewModel [2] Note that view models are > immutable and have no change tracking. Also, while they can hold simple > properties, Isis does not serialize the state of any collections. > (Contributed collections are supported though, so this may suffice). > > > A much more advanced (but also flexible) approach is to define a custom > DataNucleus StoreManager, as per [3] and [4]. Here the external objects > would be mapped as DN @PersistenceCapable. I've never done this, though. > > HTH > Dan > > > > > > > Thanks. > > > > > [1] > > http://isis.apache.org/guides/rg.html#_rg_annotations_manpage-DomainObject_nature > [2] > http://isis.apache.org/guides/rg.html#_rg_annotations_manpage-ViewModel > [3] http://www.datanucleus.org/extensions/store_manager.html > [4] > > http://www.datanucleus.org/documentation/development/new_store_plugin_howto.html > -- *Warm Regards,* *Reza Rasouli.*
