Package org.jbpm.ui.jpdl3.figure

Examples of org.jbpm.ui.jpdl3.figure.MailNodeFigure


        String targetName = getAttribute(node, TO_ATTR);
        TRANSITION_TARGETS.put(transition, targetName);
    }

    private void parseAction(Node node, GraphElement parent, String eventType) {
        ActionImpl action = JpdlVersionRegistry.getElementTypeDefinition(jpdlVersion, ACTION_NODE).createElement();
        action.setDelegationClassName(getAttribute(node, CLASS_ATTR));
        action.setDelegationConfiguration(getTextContent(node));
        parent.addAction(action, -1);
        action.setEventType(eventType);
    }
View Full Code Here


        List<ActionNode> actionNodeNodes = definition.getChildren(ActionNode.class);
        for (ActionNode actionNode : actionNodeNodes) {
            Element actionNodeElement = writeNode(document, root, actionNode, null);
            for (Action action : actionNode.getActions()) {
                ActionImpl actionImpl = (ActionImpl) action;
                if (!Event.NODE_ACTION.equals(actionImpl.getEventType())) {
                    writeEvent(document, actionNodeElement, new Event(actionImpl.getEventType()), actionImpl);
                }
            }
        }

        List<Decision> decisions = definition.getChildren(Decision.class);
        for (Decision decision : decisions) {
            writeNode(document, root, decision, HANDLER_NODE);
        }

        List<TaskState> states = definition.getChildren(TaskState.class);
        for (TaskState state : states) {
            Element stateElement = writeTaskState(document, root, state);
            if (state.timerExist()) {
                Element timerElement = document.createElement(TIMER_NODE);
                setAttribute(timerElement, DUEDATE_ATTR, state.getDuration().getDuration());
                if (!state.hasTimeoutTransition() && state.getTimerAction() != null) {
                    if (state.getTimerAction().getRepeat().hasDuration()) {
                        setAttribute(timerElement, REPEAT_ATTR, state.getTimerAction().getRepeat().getDuration());
                    }
                    writeDelegation(document, timerElement, ACTION_NODE, state.getTimerAction());
                } else {
                    setAttribute(timerElement, TRANSITION_NODE, PluginConstants.TIMER_TRANSITION_NAME);
                }
                stateElement.appendChild(timerElement);
            }
            writeTransitions(document, stateElement, state);
        }

        List<WaitState> waitStates = definition.getChildren(WaitState.class);
        for (WaitState waitState : waitStates) {
            Element stateElement = writeWaitState(document, root, waitState);
            writeTransitions(document, stateElement, waitState);
        }

        List<MailNode> mailNodes = definition.getChildren(MailNode.class);
        for (MailNode mailNode : mailNodes) {
            Element nodeElement = writeNode(document, root, mailNode, null);
            setAttribute(nodeElement, "to", mailNode.getRecipient());
            writeTransitions(document, nodeElement, mailNode);
            Element subject = document.createElement("subject");
            setNodeValue(subject, mailNode.getSubject());
            nodeElement.appendChild(subject);
            Element body = document.createElement("body");
            setNodeValue(body, mailNode.getMailBody());
            nodeElement.appendChild(body);
        }

        List<Fork> forks = definition.getChildren(Fork.class);
        for (org.jbpm.ui.common.model.Node node : forks) {
            writeNode(document, root, node, null);
        }

        List<Join> joins = definition.getChildren(Join.class);
        for (org.jbpm.ui.common.model.Node node : joins) {
            writeNode(document, root, node, null);
        }

        List<Subprocess> subprocesses = definition.getChildren(Subprocess.class);
        boolean addSubprocessPermissionHandler = false;
        for (Subprocess subprocess : subprocesses) {
            addSubprocessPermissionHandler = true;
            Element processStateElement = writeNode(document, root, subprocess, null);
            Element subProcessElement = document.createElement(SUB_PROCESS_NODE);
            setAttribute(subProcessElement, NAME_ATTR, subprocess.getSubProcessName());
            setAttribute(subProcessElement, "binding", "late");
            processStateElement.appendChild(subProcessElement);
            for (VariableMapping variable : subprocess.getVariablesList()) {
                Element variableElement = document.createElement(VARIABLE_NODE);
                setAttribute(variableElement, NAME_ATTR, variable.getProcessVariable());
                setAttribute(variableElement, MAPPED_NAME_ATTR, variable.getSubprocessVariable());
                setAttribute(variableElement, ACCESS_ATTR, variable.getUsage());
                processStateElement.appendChild(variableElement);
            }
        }

        /*
        List<MultiInstance> multiInstances = definition.getChildren(MultiInstance.class);
        for (MultiInstance multiInstance : multiInstances) {
            addSubprocessPermissionHandler = true;
            Element processStateElement = writeNode(document, root, multiInstance, null);
            Element subProcessElement = document.createElement(SUB_PROCESS_NODE);
            setAttribute(subProcessElement, NAME_ATTR, multiInstance.getSubProcessName());
            setAttribute(subProcessElement, "binding", "late");
            processStateElement.appendChild(subProcessElement);
            for (VariableMapping variable : multiInstance.getVariablesList()) {
                Element variableElement = document.createElement(VARIABLE_NODE);
                setAttribute(variableElement, NAME_ATTR, variable.getProcessVariable());
                setAttribute(variableElement, MAPPED_NAME_ATTR, variable.getSubprocessVariable());
                setAttribute(variableElement, ACCESS_ATTR, variable.getAccess());
                processStateElement.appendChild(variableElement);
            }
        }
        */

        if (addSubprocessPermissionHandler) {
            // TODO add XML comment and move to own method (after event support will be added)
            ActionImpl action = new ActionImpl();
            action.setDelegationClassName("ru.runa.wf.jbpm.delegation.action.SetSubProcessPermissionsActionHandler");
            writeEvent(document, root, new Event(Event.SUBPROCESS_CREATED), action);
        }

        EndState endState = definition.getFirstChild(EndState.class);
        if (endState != null) {
View Full Code Here

        setAttribute(taskElement, SWIMLANE_NODE, state.getSwimlaneName());
        if (state instanceof State && ((State) state).isReassignmentEnabled()) {
            setAttribute(taskElement, REASSIGN_ATTR, "true");
        }
        for (Action action : state.getActions()) {
            ActionImpl actionImpl = (ActionImpl) action;
            writeEvent(document, taskElement, new Event(actionImpl.getEventType()), actionImpl);
        }
        nodeElement.appendChild(taskElement);
        if (state instanceof ITimed && ((ITimed) state).timerExist()) {
            setAttribute(nodeElement, END_TASKS_ATTR, "true");
        }
View Full Code Here

        }

        NodeList actionNodeNodes = document.getElementsByTagName(ACTION_NODE_NODE);
        for (int i = 0; i < actionNodeNodes.getLength(); i++) {
            Node node = actionNodeNodes.item(i);
            ActionNode actionNode = create(node, definition);
            NodeList aaa = node.getChildNodes();
            for (int k = 0; k < aaa.getLength(); k++) {
                Node a = aaa.item(k);
                if (EVENT_NODE.equals(a.getNodeName())) {
                    String eventType = getAttribute(a, "type");
View Full Code Here

        for (ActionNode actionNode : actionNodeNodes) {
            Element actionNodeElement = writeNode(document, root, actionNode, null);
            for (Action action : actionNode.getActions()) {
                ActionImpl actionImpl = (ActionImpl) action;
                if (!Event.NODE_ACTION.equals(actionImpl.getEventType())) {
                    writeEvent(document, actionNodeElement, new Event(actionImpl.getEventType()), actionImpl);
                }
            }
        }

        List<Decision> decisions = definition.getChildren(Decision.class);
        for (Decision decision : decisions) {
            writeNode(document, root, decision, HANDLER_NODE);
        }

        List<TaskState> states = definition.getChildren(TaskState.class);
        for (TaskState state : states) {
            Element stateElement = writeTaskState(document, root, state);
            if (state.timerExist()) {
                Element timerElement = document.createElement(TIMER_NODE);
                setAttribute(timerElement, DUEDATE_ATTR, state.getDuration().getDuration());
                if (!state.hasTimeoutTransition() && state.getTimerAction() != null) {
                    if (state.getTimerAction().getRepeat().hasDuration()) {
                        setAttribute(timerElement, REPEAT_ATTR, state.getTimerAction().getRepeat().getDuration());
                    }
                    writeDelegation(document, timerElement, ACTION_NODE, state.getTimerAction());
                } else {
                    setAttribute(timerElement, TRANSITION_NODE, PluginConstants.TIMER_TRANSITION_NAME);
                }
                stateElement.appendChild(timerElement);
            }
            writeTransitions(document, stateElement, state);
        }

        List<WaitState> waitStates = definition.getChildren(WaitState.class);
        for (WaitState waitState : waitStates) {
            Element stateElement = writeWaitState(document, root, waitState);
            writeTransitions(document, stateElement, waitState);
        }

        List<MailNode> mailNodes = definition.getChildren(MailNode.class);
        for (MailNode mailNode : mailNodes) {
            Element nodeElement = writeNode(document, root, mailNode, null);
            setAttribute(nodeElement, "to", mailNode.getRecipient());
            writeTransitions(document, nodeElement, mailNode);
            Element subject = document.createElement("subject");
            setNodeValue(subject, mailNode.getSubject());
            nodeElement.appendChild(subject);
            Element body = document.createElement("body");
            setNodeValue(body, mailNode.getMailBody());
            nodeElement.appendChild(body);
        }

        List<Fork> forks = definition.getChildren(Fork.class);
        for (org.jbpm.ui.common.model.Node node : forks) {
            writeNode(document, root, node, null);
        }

        List<Join> joins = definition.getChildren(Join.class);
        for (org.jbpm.ui.common.model.Node node : joins) {
            writeNode(document, root, node, null);
        }

        List<Subprocess> subprocesses = definition.getChildren(Subprocess.class);
        boolean addSubprocessPermissionHandler = false;
        for (Subprocess subprocess : subprocesses) {
            addSubprocessPermissionHandler = true;
            Element processStateElement = writeNode(document, root, subprocess, null);
            Element subProcessElement = document.createElement(SUB_PROCESS_NODE);
            setAttribute(subProcessElement, NAME_ATTR, subprocess.getSubProcessName());
            setAttribute(subProcessElement, "binding", "late");
            processStateElement.appendChild(subProcessElement);
            for (VariableMapping variable : subprocess.getVariablesList()) {
                Element variableElement = document.createElement(VARIABLE_NODE);
                setAttribute(variableElement, NAME_ATTR, variable.getProcessVariable());
                setAttribute(variableElement, MAPPED_NAME_ATTR, variable.getSubprocessVariable());
                setAttribute(variableElement, ACCESS_ATTR, variable.getUsage());
                processStateElement.appendChild(variableElement);
            }
        }

        /*
        List<MultiInstance> multiInstances = definition.getChildren(MultiInstance.class);
        for (MultiInstance multiInstance : multiInstances) {
            addSubprocessPermissionHandler = true;
            Element processStateElement = writeNode(document, root, multiInstance, null);
            Element subProcessElement = document.createElement(SUB_PROCESS_NODE);
            setAttribute(subProcessElement, NAME_ATTR, multiInstance.getSubProcessName());
            setAttribute(subProcessElement, "binding", "late");
            processStateElement.appendChild(subProcessElement);
            for (VariableMapping variable : multiInstance.getVariablesList()) {
                Element variableElement = document.createElement(VARIABLE_NODE);
                setAttribute(variableElement, NAME_ATTR, variable.getProcessVariable());
                setAttribute(variableElement, MAPPED_NAME_ATTR, variable.getSubprocessVariable());
                setAttribute(variableElement, ACCESS_ATTR, variable.getAccess());
                processStateElement.appendChild(variableElement);
            }
        }
        */

        if (addSubprocessPermissionHandler) {
            // TODO add XML comment and move to own method (after event support will be added)
            ActionImpl action = new ActionImpl();
            action.setDelegationClassName("ru.runa.wf.jbpm.delegation.action.SetSubProcessPermissionsActionHandler");
            writeEvent(document, root, new Event(Event.SUBPROCESS_CREATED), action);
        }

        EndState endState = definition.getFirstChild(EndState.class);
        if (endState != null) {
            writeElement(document, root, endState);
View Full Code Here

        if (state instanceof State && ((State) state).isReassignmentEnabled()) {
            setAttribute(taskElement, REASSIGN_ATTR, "true");
        }
        for (Action action : state.getActions()) {
            ActionImpl actionImpl = (ActionImpl) action;
            writeEvent(document, taskElement, new Event(actionImpl.getEventType()), actionImpl);
        }
        nodeElement.appendChild(taskElement);
        if (state instanceof ITimed && ((ITimed) state).timerExist()) {
            setAttribute(nodeElement, END_TASKS_ATTR, "true");
        }
View Full Code Here

        }

        NodeList mailNodes = document.getElementsByTagName(MAIL_NODE);
        for (int i = 0; i < mailNodes.getLength(); i++) {
            Node node = mailNodes.item(i);
            MailNode mailNode = create(node, definition);
            mailNode.setRecipient(getAttribute(node, "to"));
            NodeList mailNodeChilds = node.getChildNodes();
            for (int j = 0; j < mailNodeChilds.getLength(); j++) {
                Node mailNodeChild = mailNodeChilds.item(i);
                if ("body".equals(mailNodeChild.getNodeName())) {
                    mailNode.setMailBody(getTextContent(mailNodeChild));
                }
                if ("subject".equals(mailNodeChild.getNodeName())) {
                    mailNode.setSubject(getTextContent(mailNodeChild));
                }
            }
        }

        NodeList forks = document.getElementsByTagName(FORK_NODE);
View Full Code Here

        }

        NodeList multiInstanceStates = document.getElementsByTagName(MULTI_INSTANCE_STATE_NODE);
        for (int i = 0; i < multiInstanceStates.getLength(); i++) {
            Node node = multiInstanceStates.item(i);
            MultiInstance multiInstance = create(node, definition);
            List<VariableMapping> variablesList = new ArrayList<VariableMapping>();
            NodeList nodeList = node.getChildNodes();
            for (int j = 0; j < nodeList.getLength(); j++) {
                Node childNode = nodeList.item(j);
                if (SUB_PROCESS_NODE.equals(childNode.getNodeName())) {
                    multiInstance.setSubProcessName(getAttribute(childNode, NAME_ATTR));
                }
                if (VARIABLE_NODE.equals(childNode.getNodeName())) {
                    VariableMapping variable = new VariableMapping();
                    variable.setProcessVariable(getAttribute(childNode, NAME_ATTR));
                    variable.setSubprocessVariable(getAttribute(childNode, MAPPED_NAME_ATTR));
                    variable.setUsage(getAttribute(childNode, ACCESS_ATTR));
                    variablesList.add(variable);
                }
            }
            multiInstance.setVariablesList(variablesList);
        }

        NodeList endStates = document.getElementsByTagName(END_STATE_NODE);
        for (int i = 0; i < endStates.getLength(); i++) {
            Node node = endStates.item(i);
View Full Code Here

        }

        NodeList startStates = document.getElementsByTagName(START_STATE_NODE);
        if (startStates.getLength() == 1) {
            Node node = startStates.item(0);
            StartState startState = create(node, definition);
            NodeList stateChilds = node.getChildNodes();
            for (int j = 0; j < stateChilds.getLength(); j++) {
                Node stateNodeChild = stateChilds.item(j);
                if (TASK_NODE.equals(stateNodeChild.getNodeName())) {
                    String swimlaneName = getAttribute(stateNodeChild, SWIMLANE_NODE);
                    Swimlane swimlane = definition.getSwimlaneByName(swimlaneName);
                    startState.setSwimlane(swimlane);
                }
            }
        }

        NodeList actionNodeNodes = document.getElementsByTagName(ACTION_NODE_NODE);
View Full Code Here

        for (Swimlane swimlane : swimlanes) {
            Element swimlaneElement = writeElement(document, root, swimlane);
            writeDelegation(document, swimlaneElement, ASSIGNMENT_NODE, swimlane);
        }

        StartState startState = definition.getFirstChild(StartState.class);
        if (startState != null) {
            Element startStateElement = writeTaskState(document, root, startState);
            writeTransitions(document, startStateElement, startState);
        }
View Full Code Here

TOP

Related Classes of org.jbpm.ui.jpdl3.figure.MailNodeFigure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.