Example usage for org.apache.commons.scxml.model Data getNode

List of usage examples for org.apache.commons.scxml.model Data getNode

Introduction

In this page you can find the example usage for org.apache.commons.scxml.model Data getNode.

Prototype

public final Node getNode() 

Source Link

Document

Get the XML data tree.

Usage

From source file:org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle.java

private void populateItems() throws Exception {
    Map stateList = scxml.getChildren();

    for (Object stateObject : stateList.entrySet()) {

        Map.Entry state = (Map.Entry) stateObject;

        String currentStateName = (String) state.getKey();
        State currentState = (State) state.getValue();
        Datamodel model = currentState.getDatamodel();

        states.add(currentStateName);//from  www .j  ava  2 s.  com
        if (model != null) {
            List dataList = model.getData();
            for (Object dataObject : dataList) {
                Data data = (Data) dataObject;
                OMElement node = XMLUtils.toOM((Element) data.getNode());
                /*
                * when associating we will map the custom data model to a set of beans.
                * These will be used for further actions.
                * */
                populateCheckItems(currentStateName, node, checkListItems);
                populateTransitionValidations(currentStateName, node, transitionValidations);
                populateTransitionPermissions(currentStateName, node, transitionPermission);
                populateTransitionScripts(currentStateName, node, scriptElements);
                populateTransitionUIs(currentStateName, node, transitionUIs);
                populateTransitionExecutors(currentStateName, node, transitionExecution);
                populateTransitionApprovals(currentStateName, node, transitionApproval);
            }
        }

        List<String> events = new ArrayList<String>();
        for (Object t : currentState.getTransitionsList()) {
            Transition transition = (Transition) t;
            events.add(transition.getEvent());
        }
        stateEvents.put(currentStateName, events);
    }
}

From source file:org.wso2.carbon.pc.core.extensions.aspects.ProcessLifeCycle.java

private void populateItems() throws Exception {
    Map stateList = scxml.getChildren();

    for (Object stateObject : stateList.entrySet()) {

        Map.Entry state = (Map.Entry) stateObject;

        String currentStateName = (String) state.getKey();
        State currentState = (State) state.getValue();
        Datamodel model = currentState.getDatamodel();

        states.add(currentStateName);//  ww  w .  j  a va  2s.c om
        if (model != null) {
            List dataList = model.getData();
            for (Object dataObject : dataList) {
                Data data = (Data) dataObject;
                OMElement node = XMLUtils.toOM((Element) data.getNode());

                populateCheckItems(currentStateName, node, checkListItems);
                populateTransitionValidations(currentStateName, node, transitionValidations);
                populateTransitionPermissions(currentStateName, node, transitionPermission);
                populateTransitionScripts(currentStateName, node, scriptElements);
                populateTransitionUIs(currentStateName, node, transitionUIs);
                populateTransitionExecutors(currentStateName, node, transitionExecution);
                populateTransitionApprovals(currentStateName, node, transitionApproval);
                populateTransitionInputs(currentStateName, node, transitionInputs);
            }
        }

        List<String> events = new ArrayList<String>();
        for (Object t : currentState.getTransitionsList()) {
            Transition transition = (Transition) t;
            events.add(transition.getEvent());
        }
        stateEvents.put(currentStateName, events);
    }
}

From source file:org.wso2.jaggery.scxml.aspects.JaggeryTravellingPermissionLifeCycle.java

private void populateItems() throws Exception {
    Map stateList = scxml.getChildren();

    for (Object stateObject : stateList.entrySet()) {

        Map.Entry state = (Map.Entry) stateObject;

        String currentStateName = (String) state.getKey();
        State currentState = (State) state.getValue();
        Datamodel model = currentState.getDatamodel();

        states.add(currentStateName);/*from   w w w  .  j  ava2  s  .  com*/
        if (model != null) {
            List dataList = model.getData();
            for (Object dataObject : dataList) {
                Data data = (Data) dataObject;
                OMElement node = XMLUtils.toOM((Element) data.getNode());
                /*
                * when associating we will map the custom data model to a set of beans.
                * These will be used for further actions.
                * */
                Utils.populateCheckItems(currentStateName, node, checkListItems);
                Utils.populateTransitionValidations(currentStateName, node, transitionValidations);
                Utils.populateTransitionPermissions(currentStateName, node, transitionPermission);
                Utils.populateTransitionScripts(currentStateName, node, scriptElements);
                Utils.populateTransitionUIs(currentStateName, node, transitionUIs);
                Utils.populateTransitionExecutors(currentStateName, node, transitionExecution);
                Utils.populateTransitionApprovals(currentStateName, node, transitionApproval);
            }
        }

        List<String> events = new ArrayList<String>();
        for (Object t : currentState.getTransitionsList()) {
            Transition transition = (Transition) t;
            events.add(transition.getEvent());
        }
        stateEvents.put(currentStateName, events);
    }
}