Attribute Propagation and Custom Object Persistence when Generating Service Structures
During the generation and regeneration of service structures, the OOTB service NodeResolutionService resolves the nodes or elements for copy, reuse and removal in the generated structure. You can extend this service to implement your custom logic to propagate attribute values and create custom objects in the generated or regenerated service structure. Register the implementation service using the xconfmanager utility. The completion of node resolution after generating or regenerating a service structure is a prerequisite to the implementation of the customization described here.
Fields
The following fields are provided in the OOTB service implementation to allow the caching of custom objects created or copied during the execution of any customized code, so that they may be persisted later as configurable links.
List<WTCollection> customObjects;
Methods
Use the following methods once all the node resolution is complete:
postGenerate
/**
* Copy forward any attributes from the originals to their copies
*
* @param originalsToCopies An array of CopyObjectInfo objects containing the originals and copied objects
*/
void postGenerate(CopyObjectInfo[] originalsToCopies);
persistCustomCollections
This is an OOTB method that persists any objects that were created for the service structure outside the OOTB logic that is, configurable links, or anything specific to the custom logic. The customization should add the collections to the class field List<WTCollection>, with a new collection added to the list for each object type that needs to be persisted.
/**
* Persists any custom objects created during the generate/regenerate process i.e. configurable links
*
* @throws WTException
*/
void persistCustomCollections() throws WTException;
External Helper Methods
Use the following external helper methods to retrieve attributes for an object and also to set attributes on an object.
getAttributesFromPersistables
/**
* Retrieves the list of attribute values from passed in persistables
*
* @param objToattrNames Map with key as the persistable object to
* retrieve the values from and values as the list of attributes to
* attempt to retrieve the value for.
* @return A map containing the attribute and the attribute value
* retrieved from each passed in persistable
* @throws WTException
*/
public static WTKeyedMap getAttributesFromPersistables(
WTKeyedMap objToattrNames)
throws WTException
setAttributesOnPersistables
/**
* Sets the specified attributes with the specified values on the
* collection of specified objects assuming all target objects are
* checked in.
*
* @param updateTargets A map of persistable keys mapped to a map
* containing attribute name and attribute value pairs
* @param persist boolean to specify if the updated persistables
* should be persisted once the update has been processed
* @throws WTException
*/
SisCoreHelper.setAttributesOnPersistables(Map<Persistable, Map<String, Object>> updateTargets)
Было ли это полезно?