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 current Node of the pageflow.
    */
   public Node getNode()
   {
      if (processInstance==null) return null;
      Node node = getSubProcessInstance().getRootToken().getNode();
      if (node==null)
      {
         throw new IllegalStateException("pageflow has not yet started");
      }
      return node;
View Full Code Here

      if (processInstance==null)
      {
         throw new IllegalStateException("no pageflow in progress");
      }
      ProcessInstance subProcess = getSubProcessInstance();
      Node node = subProcess.getProcessDefinition().getNode(nodeName);
      if (node==null)
      {
         throw new IllegalArgumentException(
               "no node named: " + nodeName +
               " for pageflow: " + subProcess.getProcessDefinition().getName()
View Full Code Here

   /**
    * Get the current Page of the pageflow.
    */
   public Page getPage()
   {
      Node node = getNode();
      if ( node!=null && !(node instanceof Page) )
      {
         throw new IllegalStateException("pageflow is not currently at a <page> or <start-page> node (note that pageflows that begin during the RENDER_RESPONSE phase should use <start-page> instead of <start-state>)");
      }
      return (Page) node;
View Full Code Here

   }
  
   public String getNoConversationViewId(String pageflowName, String pageflowNodeName)
   {
      ProcessDefinition pageflowProcessDefinition = getPageflowProcessDefinition(pageflowName);
      Node node = pageflowProcessDefinition.getNode(pageflowNodeName);
      if (node!=null && node instanceof Page)
      {
         return ( (Page) node ).getNoConversationViewId();
      }
      else
View Full Code Here

         && (variables!=null)
       ) {
      contextInstance.addVariables(variables);
    }

    Node initialNode = rootToken.getNode();
    // fire the process start event
    if (initialNode!=null) {
      ExecutionContext executionContext = new ExecutionContext(rootToken);
      processDefinition.fireEvent(Event.EVENTTYPE_PROCESS_START, executionContext);

      // execute the start node
      initialNode.execute(executionContext);
    }
  }
View Full Code Here

    log.debug("job["+id+"] executes "+action);
    ExecutionContext executionContext = new ExecutionContext(token);
    executionContext.setAction(action);
    executionContext.setEvent(action.getEvent());
   
    Node node = (token!=null ? token.getNode() : null);
    if (node!=null) {
      node.executeAction(action, executionContext);
    } else {
      action.execute(executionContext);
    }

    jbpmContext.save(token);
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

        changeProcessVersion(pi);
      }
    }

    private void changeTokenVersion(JbpmContext jbpmContext, Token token) {
        Node oldNode = token.getNode();

        ProcessDefinition oldDef = token.getProcessInstance().getProcessDefinition();
        ProcessDefinition newDef = getNewDef(oldDef.getName());
       
        Node newNode = newDef.findNode(getNewNodeName(oldNode));

        if (newNode == null) {
            throw new JbpmException("node with name '" + getNewNodeName(oldNode) + "' not found in new process definition");
        }

        log.debug("change token id " + token.getId() + " from version " + oldDef.getVersion() + " to new version " + newDef.getVersion());

        token.setNode(newNode);

        // TODO: Change timers too!

        // change tasks
        Iterator iter = getTasksForToken(token).iterator();
        while (iter.hasNext()) {
            TaskInstance ti = (TaskInstance) iter.next();

            Task oldTask = ti.getTask();
            // find new task
            Query q = jbpmContext.getSession().getNamedQuery("TaskMgmtSession.findTaskForNode");
            q.setString("taskName", oldTask.getName());
            q.setLong("taskNodeId", newNode.getId());
            // TODO: q.setLong("processDefinitionId", newDef.getId());

            Task newTask = (Task) q.uniqueResult();

            if (newTask == null) {
                throw new JbpmException("node '" + newNode.getName() + "' has no Task configured! Check the new process definition");
            }

            ti.setTask(newTask);
            log.debug("change dependent task-instance with id " + oldTask.getId());
        }
View Full Code Here

      String nodeName = nodeElement.getName();
      // 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);
        }
       
        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

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.