This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Lifecycle Configuration Elements
Shown below is the list of main XML elements of the lifecycle configuration model. Click on each element to view details of its implementation.
- <aspect>
- <configuration>
- <scxml>
- <state>
- <datamodel>
- <data name="">
- <item name="" forEvent="">
- <permissions>
- <permission roles=""/>
- <permissions>
- <validations>
- <validation forEvent="" class="">
- <execution forEvent="" class="">
- <parameter name="" value=""/>
- <ui forEvent="" href=""/>
- <js forEvent="">
- <console function="">
- <server function="">
- <script type="text/javascript">
- <item name="" forEvent="">
- <data name="">
- <transition event="" target=""/>
- <datamodel>
- <state>
- <scxml>
- <configuration>
Â
<aspect>Â
<aspect name="" class="">
This element defines the aspect and the Governance Registry has defined lifeCycles as aspects too. It has two attributes.
Attributes | Description | Default Value | Notes |
---|---|---|---|
name | Contains the name of the lifeCycle. Governance Registry does not allow you to create two lifeCycles with the same name. | N/A | Â |
class | Defines the class that is associated with the lifeCycle. |
| A user has the ability to define his/her own class as shown here, but the default class provided with the Governance Registry distribution has the capability to handle any configuration that follows the above template. |
Sample Implementation:
<aspect name="Test" class="org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle">
<configuration>Â
<configuration type="">
Attributes | Values | Notes |
---|---|---|
type |
|
|
Sample:
<configuration type="resource">
<scxml>Â
<scxml xmlns="" version="" initialstate="">
This is the element that contains the new, SCXML-based configuration. SCXML is one of many standards supported by the WSO2 Governance Registry. Read more on Supported APIs & Standards for a complete list of standards supported by WSO2 Governance Registry.
Up to this point of the configuration, there can be only one of each of the elements described above. They all provide meta data about the lifecycle (name, class, and other information). The elements that appear after this one contain the actual configuration.
The scxml element has 3 attributes:
Attributes | Description |
---|---|
xmlns | Â |
version | Â |
initialstate | Defines the initial state of the lifecycle. The initial state does not have to be the first state of the configuration. Also, by changing the value of this attribute, a user can quickly modify the initial state and the flow of the lifeCycle. |
Sample:
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="">
<state>Â
The state
element defines the states of the lifecycle. A lifecycle can have multiple states, and in the configuration, more than one state element can be given.
The id
attribute of the state
element defines the name of that state.
Note
Governance Registry does not support multiple states with the same name and, therefore, all the state names of a lifecycle should be unique.
<datamodel>Â
This element contains all the custom elements which are defined in the lifeCycles model. The SCXML specification allows users to define a data model to a state and this extension is used to define custom elements.
Â
<data name="checkItems/transitionValidations/transitionPermission/transitionScripts/transitionExecution/transitionUI">
Custom data
elements (according to the SCXML specification) serve to define check items, transition permission, transition validations, transition scripts, transition executions, and transition UIs.
This element describes the data of its child elements.
Note
The user can define only one such element of each kind, since the underline implementation will ignore multiple elements and take only one into consideration.
The name
attribute - Defines the data that this element contains. This attribute should be set to:
checkItems
- If the user is defining check items as its child elements.transitionValidations
- If thedata
element defines transition validations.transitionPermission
- If thedata
element defines transition permissions.transitionScripts
- If thedata
element describes the transition scripts.transitionExecution
- If thedata
element defines programmable executions for transitions.transitionUI
- If thedata
element defines custom UIs accepting user input for transitions.
<item name="" forEvent="">
These elements contain the check items for each state. There can be more than one of these elements.
The name
attribute - Defines the name of the check item.
Governance Registry allows you to define check items that are required for each transition. The forEvent
attribute defines whether this check item is required for a specific transition. A check item can be required for more than one event and in such a scenario, a user can give a comma (",") separated list for the forEvent
attribute. Keeping the forEvent
attribute empty means that a specific check item is not required for any transition event.
<permissions>
The permissions
element defines permissions for that specified action. A permission
element can hold more than one child element which defines permissions. Under check items, the permissions
element defines the users that have the capability of checking (check/uncheck) that check item. If a user does not have permissions to check a check item, then the management console will display that specific item in disabled mode. The idea behind this is to let the user know that there are some more check items in that state, but that he or she does not have permission to check them (so as to avoid user confusion).
<permission roles=""/>
This element is a child element of the permissions
element and will define the roles that have permissions to do the specified action. Here, the attribute roles
accepts a comma (",") separated list and these roles should be present in Governance Registry.
<validations>
The validations
element defines the validations that need to be completed for each action. This element can contain one or more validation
elements (see below).
<validation forEvent="" class="">
Validations are an important part of lifeCycles. The validation
element defines the event and the validation class that has to be invoked at runtime.
- The
forEvent
attribute - Defines the event for which this validation should be performed. This gives user the flexibility to define validations for each event. The user has the ability to define validations for check items, which makes it easy to validate different things at different levels. - The
class
attribute - Defines the class that needs to be executed at runtime to perform the validation. A user must give the full, qualified name of a class that implements theCustomValidations
interface, as the value of the attributeclass
.
<execution forEvent="" class="">
An executor is business logic that is executed once a state transition happens in a lifecycle. The execution
element defines the event and the execution class that will be invoked at runtime.
- The
forEvent
attribute - Defines the event for which this execution should be performed. This gives user the flexibility to define executions for each event. - The
class
attribute - Defines the class that needs to be executed at runtime. A user must give the full, qualified name of a class that implements theExecution
interface, as the value of the attributeclass
.
<parameter name="" value=""/>
The parameter
elements are used to give parameters to the validation and execution classes. It is up to the user to define the name value
pairs, and the parameter element has attributes to define these values. A validation
element or an execution
element can have more than one parameter
element and it is up to the user code to handle this. The underline implementation of the DefaultLifeCycle
class will pass all the parameters in a map object.
<ui forEvent="" href=""/>
A UI element is a mechanism to associate a user interface with a particular event during a given transition. This provides a convinient way for a user to pass input
that would be utilized when performing a transition.
- The
forEvent
attribute - Defines the event for which this UI will be presented. - The
href
attribute - Defines the hyperlink that will be opened and presented to the user, when a lifecycle operation is performed from the Management Console.
<js forEvent="">
Governance Registry lifeCycle configuration has the ability to allow JavaScript functions to execute on both the server side and the client side. The js
element defines the scripts that need to be executed for different events.
The forEvent
attribute defines the transition action where this JavaScript function needs to be executed.
<console function="">
The console
element defines the JavaScript function that needs to be executed on the client side.
The function
attribute defines the name of the function which will be executed at a transition of one state to another.
<script type="text/javascript">
This element contains the actual JavaScript code segment. A user has the ability to define any code segment here.
The type
attribute is set to text/javascript
because, at the time of this writing, Governance Registry only supports JavaScript as a scripting language.
<server function="">
This is the same as the console
function and the only difference is that this element defines the scripts that need to be executed on the server side.
The function
attribute defines the function name.
<transition event="" target=""/>
This element defines the transitions of a state. In Governance Registry 4.1.1, users are allowed to define the transitions (the name and the target state) instead of using static transitions.
Previously, the configuration did not have a direct method of defining the transition event names or, most importantly, the target of the transition. There were only two transitions that were supported by default.
With the new, SCXML-based configuration model, any number of transitions from one state are supported. Also, this model has the capacity to define the target state of the transition and the name of the event as well.
- The
event
attribute is used to define the transition event name, for example, to "Promote" or "Demote" or any name that the user specifies. - The
target
attribute is used to define the target state of the transition.