Package org.jbpm.workflow.core.node

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


            }
        };
        process.addNode(new StartNode());
        process.addNode(new EndNode());
        process.addNode(new ActionNode());
        process.addNode(new Split());
        process.addNode(new Join());
        process.addNode(new MilestoneNode());
        process.addNode(new RuleSetNode());
        process.addNode(new SubProcessNode());
        process.addNode(new WorkItemNode());
View Full Code Here


        faultNode.setMetaData("height", 4);
        faultNode.setFaultName("faultName");
        faultNode.setFaultVariable("faultVariable");
        process.addNode(faultNode);
       
        Split split = new Split();
        split.setName("split");
        split.setMetaData("x", 1);
        split.setMetaData("y", 2);
        split.setMetaData("width", 3);
        split.setMetaData("height", 4);
        split.setType(Split.TYPE_XOR);
        Connection connection = new ConnectionImpl(split, Node.CONNECTION_DEFAULT_TYPE, actionNode, Node.CONNECTION_DEFAULT_TYPE);
        Constraint constraint = new ConstraintImpl();
        constraint.setName("constraint1 ><&&");
        constraint.setPriority(1);
        constraint.setDialect("dialect1");
        constraint.setType("type1");
        constraint.setConstraint("constraint-text1");
        split.setConstraint(connection, constraint);
        connection = new ConnectionImpl(split, Node.CONNECTION_DEFAULT_TYPE, ruleSetNode, Node.CONNECTION_DEFAULT_TYPE);
        constraint = new ConstraintImpl();
        constraint.setName("constraint2");
        constraint.setPriority(2);
        constraint.setDialect("dialect2");
        constraint.setType("type2");
        constraint.setConstraint("constraint-text2");
        split.setConstraint(connection, constraint);
        process.addNode(split);
        new ConnectionImpl(startNode, Node.CONNECTION_DEFAULT_TYPE, split, Node.CONNECTION_DEFAULT_TYPE);
       
        EventNode eventNode = new EventNode();
        eventNode.setName("action");
View Full Code Here

import org.xml.sax.SAXException;

public class SplitNodeHandler extends AbstractNodeHandler {

    protected Node createNode() {
        return new Split();
    }
View Full Code Here

    public 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);
        Split splitNode = (Split) node;
        String type = element.getAttribute("type");
        if (type != null && type.length() != 0 ) {
            splitNode.setType(new Integer(type));
        }
    }
View Full Code Here

  public Class generateNodeFor() {
        return Split.class;
    }

  public void writeNode(Node node, StringBuilder xmlDump, boolean includeMeta) {
    Split splitNode = (Split) node;
    writeNode("split", splitNode, xmlDump, includeMeta);
        int type = splitNode.getType();
        if (type != 0) {
            xmlDump.append("type=\"" + type + "\" ");
        }
        if (splitNode.getConstraints().isEmpty()) {
            endNode(xmlDump);
        } else {
            xmlDump.append(">" + EOL);
            if (includeMeta) {
              writeMetaData(splitNode, xmlDump);
            }
            xmlDump.append("      <constraints>" + EOL);
            for (Map.Entry<ConnectionRef, Constraint> entry: splitNode.getConstraints().entrySet()) {
                ConnectionRef connection = entry.getKey();
                Constraint constraint = entry.getValue();
                xmlDump.append("        <constraint "
                    + "toNodeId=\"" + connection.getNodeId() + "\" "
                    + "toType=\"" + connection.getToType() + "\" ");
View Full Code Here

        if ("Converging".equals(type)) {
          Join join = new Join();
          join.setType(Join.TYPE_XOR);
          return join;
        } else if ("Diverging".equals(type)) {
          Split split = new Split();
          split.setType(Split.TYPE_XOR);
          String isDefault = attrs.getValue("default");
          split.setMetaData("Default", isDefault);
          return split;
        } else {
          throw new IllegalArgumentException(
          "Unknown gateway direction: " + type);
        }
View Full Code Here

    public void build(Process process,
                      ProcessDescr processDescr,
                      ProcessBuildContext context,
                      Node node) {
        Split splitNode = ( Split ) node;
       
        if ( splitNode.getType() != Split.TYPE_XOR && splitNode.getType() != Split.TYPE_OR ) {
            // we only process or/xor
            return;
        }
        // we need to clone the map, so we can update the original while iterating.
        Map<ConnectionRef, Constraint> map = new HashMap<ConnectionRef, Constraint>( splitNode.getConstraints() );
        for ( Iterator<Map.Entry<ConnectionRef, Constraint>> it = map.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry<ConnectionRef, Constraint> entry = it.next();
            ConnectionRef connection = entry.getKey();
            ConstraintImpl constraint = (ConstraintImpl) entry.getValue();
            Connection outgoingConnection = null;
            for (Connection out: splitNode.getDefaultOutgoingConnections()) {
                if (out.getToType().equals(connection.getToType())
                    && out.getTo().getId() == connection.getNodeId()) {
                    outgoingConnection = out;
                }
            }
            if (outgoingConnection == null) {
                throw new IllegalArgumentException("Could not find outgoing connection");
            }
            if ( "rule".equals( constraint.getType() )) {
                RuleConstraintEvaluator ruleConstraint = new RuleConstraintEvaluator();
                ruleConstraint.setDialect( constraint.getDialect() );
                ruleConstraint.setName( constraint.getName() );
                ruleConstraint.setPriority( constraint.getPriority() );
                ruleConstraint.setDefault( constraint.isDefault() );
                splitNode.setConstraint( outgoingConnection, ruleConstraint );
            } else if ( "code".equals( constraint.getType() ) ) {
                ReturnValueConstraintEvaluator returnValueConstraint = new ReturnValueConstraintEvaluator();
                returnValueConstraint.setDialect( constraint.getDialect() );
                returnValueConstraint.setName( constraint.getName() );
                returnValueConstraint.setPriority( constraint.getPriority() );
                returnValueConstraint.setDefault( constraint.isDefault() );
                splitNode.setConstraint( outgoingConnection, returnValueConstraint );           
               
                ReturnValueDescr returnValueDescr = new ReturnValueDescr();
                returnValueDescr.setText( constraint.getConstraint() );
               
                ProcessDialect dialect = ProcessDialectRegistry.getDialect( constraint.getDialect() );           
View Full Code Here

public class InclusiveGatewayHandler extends AbstractNodeHandler {
   
    protected Node createNode(Attributes attrs) {
        final String type = attrs.getValue("gatewayDirection");
        if ("Diverging".equals(type)) {
          Split split = new Split();
          split.setType(Split.TYPE_OR);
          String isDefault = attrs.getValue("default");
          split.setMetaData("Default", isDefault);
          return split;
        } else {
          throw new IllegalArgumentException(
          "Unknown gateway direction: " + type);
        }
View Full Code Here

        if ("Converging".equals(type)) {
          Join join = new Join();
          join.setType(Join.TYPE_AND);
          return join;
        } else if ("Diverging".equals(type)) {
          Split split = new Split();
          split.setType(Split.TYPE_AND);
          return split;
        } else {
          throw new IllegalArgumentException(
          "Unknown gateway direction: " + type);
        }
View Full Code Here

          source, NodeImpl.CONNECTION_DEFAULT_TYPE,
          target, NodeImpl.CONNECTION_DEFAULT_TYPE);
        result.setMetaData("bendpoints", connection.getBendpoints());
        result.setMetaData("UniqueId", connection.getId());
        if (source instanceof Split) {
          Split split = (Split) source;
          Constraint constraint = new ConstraintImpl();
          String defaultConnection = (String) split.getMetaData("Default");
          if (defaultConnection != null && defaultConnection.equals(connection.getId())) {
            constraint.setDefault(true);
          }
          if (connection.getName() != null) {
            constraint.setName(connection.getName());
          } else {
            constraint.setName("");
          }
          if (connection.getType() != null) {
            constraint.setType(connection.getType());
          } else {
            constraint.setType("code");
          }
          if (connection.getLanguage() != null) {
            constraint.setDialect(connection.getLanguage());
          }
          if (connection.getExpression() != null) {
            constraint.setConstraint(connection.getExpression());
          }
          constraint.setPriority(connection.getPriority());
          split.addConstraint(
            new ConnectionRef(target.getId(), NodeImpl.CONNECTION_DEFAULT_TYPE),
            constraint);
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.jbpm.workflow.core.node.Split

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.