API Business Services - Custom data section
11.28
This extension allows to expose in APIs, for any object, supplementary data. To do this, implements com.noheto.restapi.APICustomSectionAdapter
,
Methods
boolean isEnabled(ObjectCustomSectionContext)
By default returns true. If this method returns false, the component is ignored and does not contribute to the custom data section.ObjectCustomSectionContext invocation context
void customSection(CustomSectionContext, IObjectReadOnly, JSONObject)
Implement this method to insert your data in the custom data section.CustomSectionContext invocation context
IObjectReadOnly the concerned object instance
JSONObject a JSON object that represents the custom data section
void swaggerContrib(ObjectCustomSectionContext, JSONObject)
Optionally, implement this method to enrich the API documentation with the properties you add in the custom data section.int getPriority()
This method allows to define a call order if there are several APICustomSectionAdapter. By default, the components are called in a non-determinable order. Modify this method to return an integer : the components are called in the increasing order of this number.Set<String> getFieldnames(ObjectCustomSectionContext context, String pathProps, String objectName, IObjectStructureReadOnly structure)
2024.3
For optimized instance loading (partial loading), allows you to specify the fields to be loaded for the purposes of the custom section. If you don't specify the fields you need for the object, you may have to reload it to retrieve the fields you require.
If the method returnsnull: nothing changes when loading the object
an empty set: all object fields are loaded (pay attention to performance)
an not empty set: contains the names of fields to load
Arguments areObjectCustomSectionContext context: invocation context
String pathProps: the path to the current field (empty for root, else a dot separated list of fieldnames)
String objectName: the current object name (the same as in the context in the case of the root (if pathProps is an empty string)
IObjectStructureReadOnly structure: the structure corresponding to object name
ObjectCustomSectionContext
String getServiceId()
Returns service idString getConfigId()
Returns the configuration name (resource name)String getObjectName()
Returns the current object name
CustomSectionContext
HttpServletRequest getRequest()
Returns request.CTSurfer getSurfer()
Returns surferboolean isI18N()
Returns true if exported data must be localized (get Locale with getLocale() method, not getSurfer().getLocale())Locale getLocale()
Returns request localeString getServiceId()
Returns service idString getConfigId()
Returns the configuration name (resource name)String getObjectName()
Returns the current object namevoid put(String key, Object data)
Store data in context.Object get(String key)
Get previously stored data from context.
See more details here : https://crossmedia.atlassian.net/browse/WXM-9056