Examples of Join


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

import org.xml.sax.SAXException;

public class JoinNodeHandler extends AbstractNodeHandler {

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

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

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

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

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

  public void writeNode(Node node, StringBuilder xmlDump, boolean includeMeta) {
    Join joinNode = (Join) node;
    writeNode("join", joinNode, xmlDump, includeMeta);
        int type = joinNode.getType();
        if (type != 0) {
            xmlDump.append("type=\"" + type + "\" ");
        }
        if (type == Join.TYPE_N_OF_M) {
          String n = joinNode.getN();
          if (n != null && n.length() != 0) {
              xmlDump.append("n=\"" + n + "\" ");
          }
        }
        if (includeMeta && containsMetaData(joinNode)) {
View Full Code Here

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

public class ExclusiveGatewayHandler extends AbstractNodeHandler {
   
    protected Node createNode(Attributes attrs) {
        final String type = attrs.getValue("gatewayDirection");
        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");
View Full Code Here

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

public class ParallelGatewayHandler extends AbstractNodeHandler {
   
    protected Node createNode(Attributes attrs) {
        final String type = attrs.getValue("gatewayDirection");
        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;
View Full Code Here

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

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

  public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) {
    Join join = (Join) node;
    switch (join.getType()) {
      case Join.TYPE_AND:
        writeNode("parallelGateway", node, xmlDump, metaDataType);
        break;
      case Join.TYPE_XOR:
        writeNode("exclusiveGateway", node, xmlDump, metaDataType);
View Full Code Here

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

public class ComplexGatewayHandler extends AbstractNodeHandler {
   
    protected Node createNode(Attributes attrs) {
        final String type = attrs.getValue("gatewayDirection");
        if ("Converging".equals(type)) {
          Join join = new Join();
          join.setType(Join.TYPE_UNDEFINED);
          return join;
        } else if ("Diverging".equals(type)) {
          Split split = new Split();
          split.setType(Split.TYPE_UNDEFINED);
          return split;
View Full Code Here

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

    public JoinFactory(RuleFlowNodeContainerFactory nodeContainerFactory, NodeContainer nodeContainer, long id) {
        super(nodeContainerFactory, nodeContainer, id);
    }

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

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

                                "Split node '" + node.getName() + "' [" + node.getId() + "] does not have a constraint for " + connection.toString() + "."));
                        }
                    }
                }
            } else if (node instanceof Join) {
                final Join join = (Join) node;
                if (join.getType() == Join.TYPE_UNDEFINED) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "Join node '" + node.getName() + "' [" + node.getId() + "] has no type."));
                }
                if (join.getDefaultIncomingConnections().size() < 2) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "Join node '" + node.getName() + "' [" + node.getId() + "] does not have more than one incoming connection: " + join.getIncomingConnections().size() + "."));
                }
                if (join.getTo() == null && !acceptsNoOutgoingConnections(node)) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "Join node '" + node.getName() + "' [" + node.getId() + "] has no outgoing connection."));
                }
                if (join.getType() == Join.TYPE_N_OF_M) {
                  String n = join.getN();
                  if (!n.startsWith("#{") || !n.endsWith("}")) {
                    try {
                      new Integer(n);
                    } catch (NumberFormatException e) {
                            errors.add(new ProcessValidationErrorImpl(process,
View Full Code Here

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

    public void internalTrigger(final NodeInstance from, String type) {
        if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
            throw new IllegalArgumentException(
                "An ActionNode only accepts default incoming connections!");
        }
        final Join join = getJoin();
        switch ( join.getType() ) {
            case Join.TYPE_XOR :
                triggerCompleted();
                break;
            case Join.TYPE_AND :
                Integer count = (Integer) this.triggers.get( from.getNodeId() );
                if ( count == null ) {
                    this.triggers.put( from.getNodeId(),
                                       1 );
                } else {
                    this.triggers.put( from.getNodeId(),
                                       count.intValue() + 1 );
                }
                if (checkAllActivated()) {
                    decreaseAllTriggers();
                    triggerCompleted();
                }
                break;
            case Join.TYPE_DISCRIMINATOR :
                boolean triggerCompleted = triggers.isEmpty();
                triggers.put( from.getNodeId(), new Integer( 1 ) );
                if (checkAllActivated()) {
                    resetAllTriggers();
                }
                if (triggerCompleted) {
                    triggerCompleted();
                }
                break;
            case Join.TYPE_N_OF_M :
                count = (Integer) this.triggers.get( from.getNodeId() );
                if ( count == null ) {
                    this.triggers.put( from.getNodeId(),
                                       1 );
                } else {
                    this.triggers.put( from.getNodeId(),
                                       count.intValue() + 1 );
                }
                int counter = 0;
                for (final Connection connection: getJoin().getDefaultIncomingConnections()) {
                    if ( this.triggers.get( connection.getFrom().getId() ) != null ) {
                        counter++;
                    }
                }
                String n = join.getN();
                Integer number = null;
                if (n.startsWith("#{") && n.endsWith("}")) {
                  n = n.substring(2, n.length() - 1);
                  VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                    resolveContextInstance(VariableScope.VARIABLE_SCOPE, n);
                  if (variableScopeInstance == null) {
                    throw new IllegalArgumentException(
                    "Could not find variable " + n + " when executing join.");
                  }
                  Object value = variableScopeInstance.getVariable(n);
                  if (value instanceof Number) {
                    number = ((Number) value).intValue();
                  } else {
                    throw new IllegalArgumentException(
                    "Variable " + n + " did not return a number when executing join: " + value);
                  }
                } else {
                number = new Integer(n);
                }
                if (counter >= number) {
                    resetAllTriggers();
                    triggerCompleted();
                }
                break;
            default :
                throw new IllegalArgumentException( "Illegal join type " + join.getType() );
        }
    }
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.