Package org.jbpm.graph.def

Examples of org.jbpm.graph.def.Node


   */
  public void end(String transitionName) {
    Transition leavingTransition = null;

    if (task != null) {
      Node node = task.getTaskNode();
      if (node == null) {
        node = (Node) task.getParent();
      }

      if (node != null) {
        leavingTransition = node.getLeavingTransition(transitionName);
      }
    }
    if (leavingTransition == null) {
      throw new JbpmException("task node does not have leaving transition '" + transitionName + "'");
    }
View Full Code Here


      // get the node type
      Class<?> nodeType = NodeTypes.getNodeType(nodeName);
      if (nodeType != null)
      {

        Node node = null;
        try
        {
          // create a new instance
          node = (Node)nodeType.newInstance();
        }
        catch (Exception e)
        {
          log.error("couldn't instantiate node '" + nodeName + "', of type '" + nodeType.getName() + "'", e);
          continue;
        }

        node.setProcessDefinition(processDefinition);

        // check for duplicate start-states
        if ((node instanceof StartState) && (processDefinition.getStartState() != null))
        {
          addError("max one start-state allowed in a process");

        }
        else
        {
          // read the common node parts of the element
          readNode(nodeElement, node, nodeCollection);

          // if the node is parsable
          // (meaning: if the node has special configuration to parse, other then the
          // common node data)
          node.read(nodeElement, this);
        }
      }
    }
  }
View Full Code Here

  public void resolveTransitionDestinations()
  {
    for (Object[] unresolvedTransition : unresolvedTransitionDestinations)
    {
      Element nodeElement = (Element)unresolvedTransition[0];
      Node node = (Node)unresolvedTransition[1];
      resolveTransitionDestinations(nodeElement.elements("transition"), node);
    }
  }
View Full Code Here

    {
      addWarning("node '" + node.getFullyQualifiedName() + "' has a transition without a 'to'-attribute to specify its destinationNode");
    }
    else
    {
      Node to = ((NodeCollection)node.getParent()).findNode(toName);
      if (to == null)
      {
        addWarning("transition to='" + toName + "' on node '" + node.getFullyQualifiedName() + "' cannot be resolved");
      }
      else
      {
        to.addArrivingTransition(transition);
      }
    }

    // read the actions
    readActions(transitionElement, transition, Event.EVENTTYPE_TRANSITION);
View Full Code Here

  {   
    ProcessDefinition newDef = getNewProcessDefinition(token);
    log.debug("change token id " + token.getId() + " to new version " + newDef.getVersion());

    // change node reference on token (current node)
    Node oldNode = token.getNode();
    Node newNode = findReplacementNode(newDef, oldNode);
    token.setNode(newNode);

    // Change timers too!
    adjustTimersForToken(token);
View Full Code Here

    {
      TaskInstance ti = iter.next();

      // find new task
      Task oldTask = ti.getTask();
      Node oldNode = oldTask.getTaskNode();
     
      Task newTask = findReplacementTask(newDef, oldNode, oldTask);
      ti.setTask(newTask);
      log.debug("change dependent task-instance with id " + oldTask.getId());
    }
View Full Code Here

  }
 
  private Node findReplacementNode(ProcessDefinition newDef, GraphElement oldNode)
  {
    String name = getReplacementNodeName( oldNode );
    Node newNode = newDef.findNode(name);
    if (newNode == null)
    {
      throw new JbpmException("node with name '" + name + "' not found in new process definition");
    }
    return newNode;
View Full Code Here

  }

  private Task findReplacementTask(ProcessDefinition newDef, Node oldNode, Task oldTask)
  {
    String replacementTaskName = getReplacementTaskName( oldTask );   
    Node newTaskNode = findReplacementNode(newDef, oldNode);
   
    Query q = getJbpmContext().getSession().getNamedQuery("TaskMgmtSession.findTaskForNode");
    q.setString("taskName", replacementTaskName);
    q.setLong("taskNodeId", newTaskNode.getId());

    Task newTask = (Task)q.uniqueResult();   
    if (newTask == null)
    {
      throw new JbpmException("Task '" + replacementTaskName + "' for node '" + newTaskNode.getName() + "' not found in new process definition");
    }
    return newTask;
  }
View Full Code Here

    startCompositeLog(new SignalLog(transition));
    try
    {
      // fire the event before-signal
      Node signalNode = node;
      signalNode.fireEvent(Event.EVENTTYPE_BEFORE_SIGNAL, executionContext);

      // start calculating the next state
      node.leave(executionContext, transition);

      // if required, check if this token is implicitly terminated
      checkImplicitTermination();

      // fire the event after-signal
      signalNode.fireEvent(Event.EVENTTYPE_AFTER_SIGNAL, executionContext);

    }
    finally
    {
      endCompositeLog();
View Full Code Here

      pd.addNode( createNode( nodes[i] ) );
    }

    for ( int i = 0; i < transitions.length; i++ ) {
      String[] parsedTransition = cutTransitionText( transitions[i] );
      Node from = pd.getNode( parsedTransition[0] );
      Node to = pd.getNode( parsedTransition[2] );
      Transition t = new Transition( parsedTransition[1] );
      from.addLeavingTransition(t);
      to.addArrivingTransition(t);
    }
  }
View Full Code Here

TOP

Related Classes of org.jbpm.graph.def.Node

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.