In our application, we stripped out a model layer for accessing our %Persistent classes. The model classes inherit from %ZEN.DataModel.ObjectDataModel. They include business logic as triggers on loading or data manipulation, as well as in dedicated methods. We would like to reuse our model layer in a RESTful API. This would enable an evolutionary migration to alternative web frontend frameworks, while the current UI stays fully functional.
CRUD operations could work as follows, distinguishing (R)eading one (R-1) and querying many (R-n) entities. The latter should be realized via %Persistent classes, bypassing the model's initialization logic invoked when loading a dedicated entity for viewing and/or editing.
%ZEN.DataModel.ObjectDataModel
R-1: HTTP GET, (single ID) via %OnLoadModel
C, U: HTTP POST/PUT, via %OnStoreModel
D: HTTP DELETE, via %OnDeleteSource
%Persistent
R-n: HTTP GET, query "%pkg.isc.rest.model.adaptor flavour"
With isc-rest being a brilliant approach for REST-ifying existing %Persistent classes, extending its functionality for architectures with model layers could be beneficial for many applications.
In our application, we stripped out a model layer for accessing our
%Persistentclasses. The model classes inherit from%ZEN.DataModel.ObjectDataModel. They include business logic as triggers on loading or data manipulation, as well as in dedicated methods. We would like to reuse our model layer in a RESTful API. This would enable an evolutionary migration to alternative web frontend frameworks, while the current UI stays fully functional.CRUDoperations could work as follows, distinguishing (R)eading one (R-1) and querying many (R-n) entities. The latter should be realized via%Persistentclasses, bypassing the model's initialization logic invoked when loading a dedicated entity for viewing and/or editing.%ZEN.DataModel.ObjectDataModelR-1: HTTP GET, (single ID) via%OnLoadModelC, U: HTTP POST/PUT, via%OnStoreModelD: HTTP DELETE, via%OnDeleteSource%PersistentR-n: HTTP GET, query "%pkg.isc.rest.model.adaptorflavour"With isc-rest being a brilliant approach for REST-ifying existing
%Persistentclasses, extending its functionality for architectures with model layers could be beneficial for many applications.