Example usage for org.apache.commons.scxml.model Datamodel getData

List of usage examples for org.apache.commons.scxml.model Datamodel getData

Introduction

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

Prototype

public final List<Data> getData() 

Source Link

Document

Get all the data children of this datamodel.

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);/* www .j  ava  2 s.c  o  m*/
        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);/*  w  ww  . jav  a 2 s .  co  m*/
        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  ww . j a  v a2 s. c om
        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);
    }
}