In the navigator under "Extensions" click on "Lifecycles". A list of available lifecycles is shown.
In the above lifecycle configuration page, click on "Add Lifecycle". A configuration page with a sample lifecycle configuration is shown. Click on save to save the configuration or cancel to return to available lifecycle configuration list.
Click on corresponding "Edit" link found under each lifecycle configuration, from lifecycle configuration list. A configuration page with the lifecycle configuration is shown.
Note that, if the lifecycle configuration is in use, editing is not allowed
Click on corresponding "Delete" link found under each lifecycle configuration, from lifecycle configuration list. A confirmation prompt is shown. Note that, if the lifecycle configuration is in use, deletion is not allowed.
You can search for resources/collections with any lifecycle by clicking "Find Resources/Collections With Lifecycles". To search for resources/collections having a specific lifecycle, click on the corresponding "Find Usage" button.
Following is the template of the life cycle configuration. In the configuration, the xml element structure should strictly followed. The configuration elements and their usage is defined inline with the elements.
<aspect name="" class="org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle"> <!-- name - used to give the name of the life cycle class - gives the default life cycle class. This can be any class that extends an aspect --> <configuration type=""> <!--type - can have either 'literal' or 'resource' as values --> <lifecycle> <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate=""> <!--initialstate - defines the starting state of the life cycle and can not be null or empty--> <state id=""> <!-- state element - defines a life cycle state id - defines the name of the state--> <datamodel> <!--contains 4 data elements that defines check items, transition validations, transition permissions and transition scripts--> <data name="checkItems"> <!--name - defines that this element contains the set of check items. It is required to be set to 'checkItems'--> <item name="" forEvent=""> <!--name - defines the check item name forEvent - de fines the set of transitions that this check item is required. Accepts a ',' separated list--> <permissions> <permission roles=""/> <!--roles - defines the set of roles that has the ability to check/un-check this check item--> </permissions> <validations> <validation forEvent="" class=""> <!--forEvent - defines the event that the custom validation should be done class - defines the full qualified name of the custom validations class --> <parameter name="" value=""/> <!--name - defines the custom parameter name value - defines the custom parameter value--> </validation> </validations> </item> </data> <data name="transitionValidation"> <!--name - defines that this element contains the set of transition validations. It is required to be set to 'transitionValidation'--> <validation forEvent="" class=""> <parameter name="" value=""/> </validation> </data> <data name="transitionPermission"> <!--name - defines that this element contains the set of transition permissions. It is required to be set to 'transitionPermission'--> <permission forEvent="" roles=""/> </data> <data name="transitionScripts"> <!--name - defines that this element contains the set of transition scripts. It is required to be set to 'transitionScripts'--> <js forEvent=""> <!--forEvent - defines the event that this script block will execute--> <console function=""> <!--function - defines the name of the function--> <script type="text/javascript"> <!--contains the script--> </script> </console> <server function=""> <script type="text/javascript"></script> </server> </js> </data> </datamodel> <transition event="" target=""/> <!--event - defines the name of the transition event target - defines the next state of the transition--> </state> </scxml> </lifecycle> </configuration> </aspect>
The life cycle configuration give the user the ability to define custom validations. This can be done by providing a custom class for the "class" parameter in the following element. The "class" attribute in the above element should be filled with the full qualified name of the custom class. Eg:- org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle
<validation forEvent="" class=""> <parameter name="" value=""/> </validation>
The custom class has to implement the CustomValidations interface which has the following structure. The values in the parameter elements are passed to the init method of the custom class at runtime.
public interface CustomValidations { void init(Map parameterMap); boolean validate(RequestContext context); }