Each lifecycle configuration contains one or more state elements. More information on lifecycle configuration and the various elements in it, can be found in Configuring Lifecycles.
The client-side scripting support is available for lifecycle state transition event. This can be done by adding something similar to the following under the datamodel element.
...
Each lifecycle configuration contains one or more state elements. More information on lifecycle configuration and the various elements in it, can be found in Configuring Lifecycles.
The client-side scripting support is available for lifecycle state transition event. This can be done by adding something similar to the following under the datamodel element.
Code Block |
---|
<data name="transitionScripts"> <!--name - defines that this element contains the set of transition scripts. It is required to be set to <!'transitionScripts'--name> - defines that this element contains the set of transition scripts. It is required to be <js forEvent=""> set to 'transitionScripts'--> <!--forEvent - defines the event that this script block will execute--> <js forEvent=""> <console function=""> <!--forEvent - defines the event that this script block will execute--> <!--function - defines the name of the <console function=""function--> <!--function - defines the name of the function--><script type="text/javascript"> <script type="text/javascript"> <<!--contains the script--> </script> </console> <server function=""> <script type="text/javascript"></script> </server> </js> </data> |
...
Code Block |
---|
<aspect name="ServiceLifeCycle" class="org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle">
<configuration type="literal">
<lifecycle>
<scxml xmlns="http://www.w3.org/2005/07/scxml"
version="1.0"
initialstate="Development">
<state id="Development">
<datamodel>
<data name="checkItems">
<item name="Code Completed" forEvent="">
<!--<permissions>
<permission roles=""/>
</permissions>
<validations>
<validation forEvent="" class="">
<parameter name="" value=""/>
</validation>
</validations>-->
</item>
<item name="WSDL, Schema Created" forEvent="">
</item>
<item name="QoS Created" forEvent="">
</item>
</data>
<!--<data name="transitionValidation">
<validation forEvent="" class="">
<parameter name="" value=""/>
</validation>
</data>
<data name="transitionPermission">
<permission forEvent="" roles=""/>
</data>-->
<data name="transitionScripts">
<js forEvent="Promote">
<console function="doPromote">
<script type="text/javascript">
doPromote = function() {
window.location = unescape("../listService/service.jsp?region=region3%26item=governance_list_services_menu");
}
</script>
</console>
</js>
</data>
</datamodel>
<transition event="Promote" target="Tested"/>
</state>
<state id="Tested">
<datamodel>
<data name="checkItems">
<item name="Effective Inspection Completed" forEvent="">
</item>
<item name="Test Cases Passed" forEvent="">
</item>
<item name="Smoke Test Passed" forEvent="">
</item>
</data>
</datamodel>
<transition event="Promote" target="Production"/>
<transition event="Demote" target="Development"/>
</state>
<state id="Production">
<transition event="Demote" target="Tested"/>
</state>
</scxml>
</lifecycle>
</configuration>
</aspect>
|
2. After saving this configuration (See Adding Lifecycles), add the ServiceLifeCycle
to a Service (or any other resource/collection). See Managing Lifecycle.
3. Tick all the check-boxes, and click on the "Promote" button. See Managing Lifecycle.
4. You will get an information dialog followed by the alert added.
You can add any valid executable JavaScript that is capable of performing some task that you require.
Excerpt | ||
---|---|---|
| ||
Instructions on how to handle client-side scripting for lifecycles in the Governance Registry. |
<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>
...
</configuration>
</aspect>
|
2. After saving this configuration (See Adding Lifecycles), add the ServiceLifeCycle
to a Service (or any other resource/collection). See Managing Lifecycle.
3. Tick all the check-boxes, and click on the "Promote" button. See Managing Lifecycle.
4. You will get an information dialog followed by the alert added.
You can add any valid executable JavaScript that is capable of performing some task that you require.
Excerpt | ||
---|---|---|
| ||
Instructions on how to handle client-side scripting for lifecycles in the Governance Registry. |