Jump to: navigation, search

SCXML State Block

Use to write custom SCXML code for Composer to include in the SCXML document that it generates based on the workflow diagram. The SCXML State block has the following properties:

Name Property

Click under Value and enter the block name. Composer will use the name to identify the block in the diagram and as the state name in the SCXML code.

Block Notes Property

Find this property's details under Common Properties.

Exceptions Property

Use to configure the exception nodes, with each port being hooked up to an event  configured by you and selectable using Add Custom Event. Find this property's details under Common Properties.

Body Property

This property contains all the executable content of the <state> element (<onentry>, <onexit>, <final>, …).

  1. Click opposite Body under Value. This brings up the OpenDialogBoxButton.gif button.
  2. Click the OpenDialogBoxButton.gif button to bring up the Configure Body dialog box.

SCXMLStateBody.gif

  1. Enter the executable content of the <state> element. .  All content (children) of the state are editable. You also have the option of adding code to <onentry> and <onexit>.
  2. When through, click OK. Note: The editor does not validate against the SCXML schema.

Transitions Property

Use this property to add additional outports (transitions) using the block's custom Transitions dialog.

  1. Click opposite Transitions under Value. This brings up the OpenDialogBoxButton.gif button.
  2. Click the OpenDialogBoxButton.gif button to bring up the Configure Transitions dialog box.
  3. Click Add. The dialog box now appears as shown below.

SCXMLStateTransitions.gif
 
  1. For each transition, specify at least one name, event, condition, or target (you are not required to complete all three fields). An output port is created for every transition
  • Name--Composer uses the name of the transition to label the outport.
  • Event--Use to select the event that will trigger this transition.
  • Condition--The guard condition for this transition. The transition is selected only if the condition evaluates to true.
  • Target--If true, an output port is created and the user can connect it to the block this transition will transition to when it is executed. If false, the transition will not cause a change in the state configuration when it is executed. The executable content contained in the transition will still be executed, so the transition will function as a simple event handler.

If a target is set, an outport for that transition will appear and you can connect it to other blocks. If a target is not set, an outport for that transition does not appear; in this case, you can add some SCXML code to handle the event. When through in the dialog box, click OK.

Condition Property

Find this property's details under Common Properties.

Logging Details Property

Find this property's details under Common Properties.

Log Level Property

Find this property's details under Common Properties.

Enable Status Property

Find this property's details under Common Properties.

Using the SCXML State Block

The sample below demonstrates one way of using the SCXML State block to:

  1. Register an Agent-DN (Needed in order to send a Logoff request)
  2. Logoff Request for an Agent
  3. Unregister the Agent-DN

Below is an example diagram using the SCXML State block and example code. If you do not have the Agent information, retrieve it from the Configuration Database with FindCfgObjURS. Register the Agent, make the Agent not ready, and then log out the Agent, all using the URS trek function. The details of this function can be found by the http request—for example:

http://< urs host>:< urs http port>/urs/help/misc/trek

where the http port is defined in the URS options section http. Also you must enable this method by setting methods to all in the same section.

SCXMLStateEx.png


For this example, create the following Project variable: vursFetchReqID.

[+] Restrictions, Disclaimer and Copyright Notice

[+] Example SCXML Code


Feedback

Comment on this article:

blog comments powered by Disqus
This page was last modified on 17 October 2016, at 09:49.