task #3485
openobject graph returned by REST services can be specified by initstrategy
0%
Description
The extend of the object graph retured by REST services is defined by three mechanisms:
The
CardinalityPropertyFilter
Bean initialization strategies defined in the web service controllers
The
AutoPropertyInitializer
see CdmRestServicesEntitySerialization and CdmEntityInitalization for more on this.
The two main REST service sections: generic REST API, Portal REST API are configured differently weheras the generic api id returning rather atomized entities and the portal service returns rather big object graphs.
Both service section could be merged into one if it would be possible to request for a specific object graph by supplying a initStrategy to the REST service. This would not only simplify the REST service layer but would also mean to improve the performance of client applications as the data portal since it would be possible to request exactly for the data which is needed.
Basically two things must be implemented for this:
- All REST controllers must generally allow to specify the object bounds in form of an initStrategy / property path as request parameter: e.g.:
bounds=media,authors.titleCache
the properties defined in this parameter must be initialized and also those defined in theAutoPropertyInitializer
What is a good name for this parameter? properties, bounds, ... ???
- The serialization must also respect this request parameter and thus must only serialize the
properties defined in the initStrategy of in the {{AutoPropertyInitializer}}}s. It seems as if the BeanInitializer
is the best place to implement this. The BeanInitializer
therefore set all unwanted properties to NULL. Null properties are not initialized.