Examples of ActionNode


Examples of org.jbpm.workflow.core.node.ActionNode

    public void build(Process process,
                      ProcessDescr processDescr,
                      ProcessBuildContext context,
                      Node node) {
      super.build(process, processDescr, context, node);
        ActionNode actionNode = ( ActionNode ) node;
        DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
        ActionDescr actionDescr = new ActionDescr();
        actionDescr.setText( action.getConsequence() );  
        ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() );           
        dialect.getActionBuilder().build( context, action, actionDescr, (NodeImpl) node );
    }
View Full Code Here

Examples of org.jbpm.workflow.core.node.ActionNode

import org.xml.sax.SAXException;

public class IntermediateThrowEventHandler extends AbstractNodeHandler {
   
    protected Node createNode(Attributes attrs) {
        return new ActionNode();
    }
View Full Code Here

Examples of org.jbpm.workflow.core.node.ActionNode

    }

    public Object end(final String uri, final String localName,
                      final ExtensibleXmlParser parser) throws SAXException {
        final Element element = parser.endElementBuilder();
        ActionNode node = (ActionNode) parser.getCurrent();
        // determine type of event definition, so the correct type of node
        // can be generated
        org.w3c.dom.Node xmlNode = element.getFirstChild();
        while (xmlNode != null) {
            String nodeName = xmlNode.getNodeName();
            if ("signalEventDefinition".equals(nodeName)) {
                // reuse already created ActionNode
                handleSignalNode(node, element, uri, localName, parser);
                break;
            } else if ("messageEventDefinition".equals(nodeName)) {
                // reuse already created ActionNode
                handleMessageNode(node, element, uri, localName, parser);
                break;
            } else if ("escalationEventDefinition".equals(nodeName)) {
                // reuse already created ActionNode
                handleEscalationNode(node, element, uri, localName, parser);
                break;
            } else if ("compensateEventDefinition".equals(nodeName)) {
                // reuse already created ActionNode
                handleCompensationNode(node, element, uri, localName, parser);
                break;
            }
            xmlNode = xmlNode.getNextSibling();
        }
        // none event definition
        if (node.getAction() == null) {
            node.setAction(new DroolsConsequenceAction("mvel", ""));
            node.setMetaData("NodeType", "IntermediateThrowEvent-None");
        }
        NodeContainer nodeContainer = (NodeContainer) parser.getParent();
        nodeContainer.addNode(node);
        return node;
    }
View Full Code Here

Examples of org.jbpm.workflow.core.node.ActionNode

        return node;
    }
   
    public void handleSignalNode(final Node node, final Element element, final String uri,
            final String localName, final ExtensibleXmlParser parser) throws SAXException {
        ActionNode actionNode = (ActionNode) node;
        org.w3c.dom.Node xmlNode = element.getFirstChild();
        while (xmlNode != null) {
            String nodeName = xmlNode.getNodeName();
            if ("dataInputAssociation".equals(nodeName)) {
                readDataInputAssociation(xmlNode, actionNode);
            } else if ("signalEventDefinition".equals(nodeName)) {
                String signalName = ((Element) xmlNode).getAttribute("signalRef");
                String variable = (String) actionNode.getMetaData("MappingVariable");
                actionNode.setAction(new DroolsConsequenceAction("mvel",
                    "kcontext.getKnowledgeRuntime().signalEvent(\""
                        + signalName + "\", " + (variable == null ? "null" : variable) + ")"));
            }
            xmlNode = xmlNode.getNextSibling();
        }
View Full Code Here

Examples of org.jbpm.workflow.core.node.ActionNode

    }
   
    @SuppressWarnings("unchecked")
    public void handleMessageNode(final Node node, final Element element, final String uri,
            final String localName, final ExtensibleXmlParser parser) throws SAXException {
        ActionNode actionNode = (ActionNode) node;
        org.w3c.dom.Node xmlNode = element.getFirstChild();
        while (xmlNode != null) {
            String nodeName = xmlNode.getNodeName();
            if ("dataInputAssociation".equals(nodeName)) {
                readDataInputAssociation(xmlNode, actionNode);
            } else if ("messageEventDefinition".equals(nodeName)) {
                String messageRef = ((Element) xmlNode).getAttribute("messageRef");
                Map<String, Message> messages = (Map<String, Message>)
                    ((ProcessBuildData) parser.getData()).getMetaData("Messages");
                if (messages == null) {
                    throw new IllegalArgumentException("No messages found");
                }
                Message message = messages.get(messageRef);
                if (message == null) {
                    throw new IllegalArgumentException("Could not find message " + messageRef);
                }
                String variable = (String) actionNode.getMetaData("MappingVariable");
                actionNode.setMetaData("MessageType", message.getType());
                actionNode.setAction(new DroolsConsequenceAction("java",
                    "org.drools.process.instance.impl.WorkItemImpl workItem = new org.drools.process.instance.impl.WorkItemImpl();" + EOL +
                    "workItem.setName(\"Send Task\");" + EOL +
                    "workItem.setParameter(\"MessageType\", \"" + message.getType() + "\");" + EOL +
                    (variable == null ? "" : "workItem.setParameter(\"Message\", " + variable + ");" + EOL) +
                    "((org.drools.process.instance.WorkItemManager) kcontext.getKnowledgeRuntime().getWorkItemManager()).internalExecuteWorkItem(workItem);"));
View Full Code Here

Examples of org.jbpm.workflow.core.node.ActionNode

    }
   
    @SuppressWarnings("unchecked")
  public void handleEscalationNode(final Node node, final Element element, final String uri,
            final String localName, final ExtensibleXmlParser parser) throws SAXException {
        ActionNode actionNode = (ActionNode) node;
        org.w3c.dom.Node xmlNode = element.getFirstChild();
        while (xmlNode != null) {
            String nodeName = xmlNode.getNodeName();
            if ("dataInputAssociation".equals(nodeName)) {
                readDataInputAssociation(xmlNode, actionNode);
            } else if ("escalationEventDefinition".equals(nodeName)) {
              String escalationRef = ((Element) xmlNode).getAttribute("escalationRef");
                if (escalationRef != null && escalationRef.trim().length() > 0) {
                    Map<String, Escalation> escalations = (Map<String, Escalation>)
                    ((ProcessBuildData) parser.getData()).getMetaData("Escalations");
                if (escalations == null) {
                    throw new IllegalArgumentException("No escalations found");
                }
                Escalation escalation = escalations.get(escalationRef);
                if (escalation == null) {
                    throw new IllegalArgumentException("Could not find escalation " + escalationRef);
                }
                String faultName = escalation.getEscalationCode();
                    actionNode.setAction(new DroolsConsequenceAction("java",
                        "org.jbpm.process.instance.context.exception.ExceptionScopeInstance scopeInstance = (org.jbpm.process.instance.context.exception.ExceptionScopeInstance) ((org.jbpm.workflow.instance.NodeInstance) kcontext.getNodeInstance()).resolveContextInstance(org.jbpm.process.core.context.exception.ExceptionScope.EXCEPTION_SCOPE, \"" + faultName + "\");" + EOL +
                        "if (scopeInstance != null) {" + EOL +
                        "  scopeInstance.handleException(\"" + faultName + "\", null);" + EOL +
                        "} else {" + EOL +
                        "    ((org.jbpm.process.instance.ProcessInstance) kcontext.getProcessInstance()).setState(org.jbpm.process.instance.ProcessInstance.STATE_ABORTED);" + EOL +
View Full Code Here

Examples of org.jbpm.workflow.core.node.ActionNode

        }
    }
   
    public void handleCompensationNode(final Node node, final Element element, final String uri,
            final String localName, final ExtensibleXmlParser parser) throws SAXException {
        ActionNode actionNode = (ActionNode) node;
        org.w3c.dom.Node xmlNode = element.getFirstChild();
        while (xmlNode != null) {
            String nodeName = xmlNode.getNodeName();
            if ("compensateEventDefinition".equals(nodeName)) {
                String activityRef = ((Element) xmlNode).getAttribute("activityRef");
                if (activityRef != null && activityRef.trim().length() > 0) {
                  actionNode.setMetaData("Compensate", activityRef);
                  actionNode.setAction(new DroolsConsequenceAction("java",
                  "kcontext.getProcessInstance().signalEvent(\"Compensate-" + activityRef + "\", null);"));
                }
//                boolean waitForCompletion = true;
//                String waitForCompletionString = ((Element) xmlNode).getAttribute("waitForCompletion");
//                if ("false".equals(waitForCompletionString)) {
View Full Code Here

Examples of org.jbpm.workflow.core.node.ActionNode

import org.xml.sax.SAXException;

public class ScriptTaskHandler extends AbstractNodeHandler {
   
    protected Node createNode(Attributes attrs) {
        ActionNode result = new ActionNode();
        result.setAction(new DroolsConsequenceAction());
        return result;
    }
View Full Code Here

Examples of org.jbpm.workflow.core.node.ActionNode

    }

    protected void handleNode(final Node node, final Element element, final String uri,
            final String localName, final ExtensibleXmlParser parser) throws SAXException {
      super.handleNode(node, element, uri, localName, parser);
        ActionNode actionNode = (ActionNode) node;
        DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
        if (action == null) {
          action = new DroolsConsequenceAction();
          actionNode.setAction(action);
        }
    String language = element.getAttribute("scriptFormat");
    if (XmlBPMNProcessDumper.JAVA_LANGUAGE.equals(language)) {
      action.setDialect(JavaDialect.ID);
    }
View Full Code Here

Examples of org.jbpm.workflow.core.node.ActionNode

                      xmlDump.append(
                          "  <escalation id=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(escalationCode) + "\" escalationCode=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(escalationCode) + "\" />" + EOL);
                }
                }
            } else if (node instanceof ActionNode) {
              ActionNode actionNode = (ActionNode) node;
              DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
            if (action != null) {
                String s = action.getConsequence();
                if (s.startsWith("org.drools.process.instance.context.exception.ExceptionScopeInstance scopeInstance = (org.drools.process.instance.context.exception.ExceptionScopeInstance) ((org.drools.workflow.instance.NodeInstance) kcontext.getNodeInstance()).resolveContextInstance(org.drools.process.core.context.exception.ExceptionScope.EXCEPTION_SCOPE, \"")) {
                  s = s.substring(327);
                      String type = s.substring(0, s.indexOf("\""));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.