Package org.openbp.core.model.item.process

Examples of org.openbp.core.model.item.process.Node


  public static NodeSocket updateSocketReference(NodeSocket socket, ProcessItem process)
  {
    String nodeName = socket.getNode().getName();
    String socketName = socket.getName();

    Node newNode = process.getNodeByName(nodeName);
    if (newNode != null)
    {
      NodeSocket newSocket = newNode.getSocketByName(socketName);
      if (newSocket != null)
        return newSocket;
    }

    return null;
View Full Code Here


          if (i >= 0)
          {
            nodeName = objectPath.substring(0, i);
            socketName = objectPath.substring(i + 1);

            Node node = process.getNodeByName(nodeName);

            return node != null ? node.getSocketByName(socketName) : null;
          }
        }
      }
      catch (ModelException e)
      {
View Full Code Here

  {
    List foundReferences = new ArrayList();
    Iterator nodeList = scaned.getNodes();
    while (nodeList.hasNext())
    {
      Node node = (Node) nodeList.next();
      if (node instanceof SubprocessNode)
      {
        SubprocessNode subprocessNode = (SubprocessNode) node;
        ProcessItem subprocess = subprocessNode.getSubprocess();
        if (subprocess == null || !subprocess.getQualifier().matches(searchFor.getQualifier(), ModelQualifier.COMPARE_ALL))
View Full Code Here

    {
      // The default exit socket of the initial node of the sub process
      // that has the same name as the initial node of this sub process
      // node is our initial socket for execution of the sub process.
      String entryName = entrySocket.getName();
      Node subprocessInitialNode = subprocess.getNodeByName(entryName);

      if (subprocessInitialNode == null)
      {
        String msg = LogUtil.error(getClass(), "Initial node $0 called by $1 not found in process $2. [{3}]", entryName, node.getQualifier(), subprocess.getQualifier(), context);
        throw new EngineException("InitialNodeNotFound", msg);
      }

      if (!(subprocessInitialNode instanceof InitialNode))
      {
        String msg = LogUtil.error(getClass(), "Node $0 called by $1 is not an initial node. [{2}]", subprocessInitialNode.getQualifier(), node.getQualifier(), context);
        throw new EngineException("NotAnInitialNode", msg);
      }

      // Continue with the initial node of the sub process
      nextSocket = subprocessInitialNode.getDefaultExitSocket();
      if (nextSocket == null)
      {
        String msg = LogUtil.error(getClass(), "No default exit socket present for sub process initial node $0. [{1}]", subprocessInitialNode.getQualifier(), context);
        throw new EngineException("NoDefaultExitSocket", msg);
      }

      // Push the current position onto the call stack
      context.getCallStack().pushSubprocess(entrySocket);
View Full Code Here

      if (token.getCurrentSocket() == null)
      {
        System.out.println("Process ended normally.");
        return false;
      }
      Node node = token.getCurrentSocket().getNode();

      if (node instanceof WaitStateNode)
      {
        System.out.println("Wait state node " + node.getName() + " encountered.");
      }
      else if (node instanceof WorkflowNode)
      {
        WorkflowTaskDescriptor task = ((WorkflowNode) node).getWorkflowTaskDescriptor();
        System.out.println("Task " + task.getStepDisplayName() + " encountered.");
      }
      else
      {
        System.out.println("Process end at node " + node.getName() + ".");
        /*
         if (node instanceof FinalNode)
         {
         return false;
         }
View Full Code Here

        throw new ModelException("NoDefaultProcess", msg);
      }
    }

    // Get the entry socket
    Node node;
    if (entryName != null)
    {
      node = process.getNodeByName(entryName);
      if (node == null)
      {
        String msg = LogUtil.error(getClass(), "Initial node $0 not found in process $1 (position reference: $2). [{3}]", entryName, process.getQualifier(), ref, context);
        throw new ModelException("NodeNotFound", msg);
      }
    }
    else
    {
      node = process.getDefaultInitialNode();
      if (node == null)
      {
        String msg = LogUtil.error(getClass(), "Process $0 does not have a default initial node (position reference: $1). [{2}]", process.getQualifier(), ref, context);
        throw new ModelException("NoDefaultNode", msg);
      }
    }

    if (! (node instanceof InitialNode))
    {
      String msg = LogUtil.error(getClass(), "Node $0 is not an initial node (position reference: $1). [{2}]", node.getQualifier(), ref, context);
      throw new ModelException("NoInitialNode", msg);
    }

    NodeSocket initialSocket = ((InitialNode) node).getSocket();
View Full Code Here

    }

    // Try to determine the socket to start with using the usual socket search strategy
    if (ref != null)
    {
      Node currentNode = currentSocket.getNode();
      String socketName;

      int index = ref.indexOf(ModelQualifier.OBJECT_DELIMITER_CHAR);
      if (index >= 0)
      {
        // "Node.Socket"
        String nodeName = ref.substring (0, index);
        socketName = ref.substring(index + 1);

        currentNode = currentSocket.getProcess().getNodeByName(nodeName);
        if (currentNode == null)
        {
          String msg = LogUtil.error(getClass(), "Initial node $0 not found (position reference: $1). [{2}]", nodeName, ref, context);
          throw new ModelException("NodeNotFound", msg);
        }
        if (! (currentNode instanceof InitialNode))
        {
          String msg = LogUtil.error(getClass(), "Node $0 is not an initial node (position reference: $1). [{2}]", currentNode.getQualifier(), ref, context);
          throw new ModelException("NoInitialNode", msg);
        }
      }
      else if (index == 0)
      {
        // ".Socket"
        socketName = ref.substring(1);
      }
      else
      {
        // "Socket"
        socketName = ref;
      }

      startSocket = currentNode.getSocketByName(socketName);
      if (startSocket == null)
      {
        if (mustExist)
        {
          String msg = LogUtil.error(getClass(), "Exit socket $0 not found. [{1}]", socketName, context);
View Full Code Here

    {
      ProcessItem process = (ProcessItem) processes.next();
      Iterator nodes = process.getNodes();
      while (nodes.hasNext())
      {
        Node node = (Node) nodes.next();
        List modelObjects = findModelObjectInNode(node, mo);
        if (modelObjects.size() != 0)
          foundModelObjects.addAll(modelObjects);
      }
    }
View Full Code Here

    {
      ProcessItem process = (ProcessItem) processes.next();
      Iterator nodes = process.getNodes();
      while (nodes.hasNext())
      {
        Node node = (Node) nodes.next();
        List modelObjects = findInNode(node, item);
        if (modelObjects.size() != 0)
          foundModelObjects.addAll(modelObjects);
      }
    }
View Full Code Here

      if (currentSocket == null)
        // There is no executable socket; the process has stopped
        return;

      Node currentNode = currentSocket.getNode();
      NodeSocket entrySocket = currentSocket;
      boolean isEntrySocket = currentSocket.isEntrySocket();

      if (isEntrySocket)
      {
        // We have an entry socket; Regular node execution

        // Evaluate any input parameter expressions or scripts and
        // ensure that any required parameters are present.
        prepareSocket(entrySocket);

        // By default, we copy the parameters of the entry socket to parameters
        // of the same name at the exit sockets
        EngineUtil.copySocketParameters(entrySocket, null, context);

        if (engine.hasActiveObservers(EngineTraceEvent.NODE_ENTRY, context))
        {
          engine.fireEngineEvent(new EngineTraceEvent(EngineTraceEvent.NODE_ENTRY, context, entrySocket, engine));
        }
        // Reassign the entry socket if the process has been updated while waiting for a debugger command ("hot code replace")
        entrySocket = context.getCurrentSocket();
        currentNode = entrySocket.getNode();

        /////////////////////////////////////////////////
        // Execute the node connected to the socket
        /////////////////////////////////////////////////

        if (LogUtil.isTraceEnabled(getClass()))
        {
          String nodeType = currentNode.getModelObjectSymbolName();
          LogUtil.trace(getClass(), "Executing {0}Node $1. [{2}]", nodeType, currentNode.getQualifier(), context);
        }

        // Execute the NodeEntry handler, if any
        HandlerContext hc = engine.executeHandler(currentNode.getEventHandlerDefinition(), HandlerTypes.NODE_ENTRY, context, entrySocket,
          currentNode.getDefaultExitSocket());
        if (hc != null && hc.hasNextSocketChanged())
        {
          // Handler changed the flow of control...
          if (hc.getNextSocket() == null)
            throw new EngineException("MissingNextSocket", "Handler of node  '" + currentNode.getQualifier()
              + "' has set a null next socket.\nThe process cannot be continued.");
          context.setCurrentSocket(hc.getNextSocket());
          return;
        }

        // *** Execute the node ***
        ModelObjectExecutor executor = engine.getModelObjectExecutorMgr().getExecutor(currentNode);
        executor.executeModelObject(currentNode, this);
      }
      else
      {
        // We have an exit socket; Node has been executed already, process is being continued now.
      }

      // *** Handle any lifecycle state requests and perform the transaction handling ***
      handleLifecycleRequest();

      if (context.getLifecycleState() == LifecycleState.RUNNING)
      {
        NodeSocket nextSocket = context.getCurrentSocket();
        if (nextSocket != null)
        {
          // Execute the node exit handler, if any and if not executing an error socket
          if (! nextSocket.getName().equals(CoreConstants.ERROR_SOCKET_NAME))
          {
            HandlerContext hc2 = engine.executeHandler(currentNode.getEventHandlerDefinition(), HandlerTypes.NODE_EXIT, context, entrySocket, nextSocket);
            if (hc2 != null && hc2.hasNextSocketChanged())
            {
              // Handler changed the flow of control...
              nextSocket = hc2.getNextSocket();
              context.setCurrentSocket(nextSocket);
View Full Code Here

TOP

Related Classes of org.openbp.core.model.item.process.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.