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

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


   * - A fully qualified reference was supplied and the specified process/node/socket does not exist.<br>
   * - The mustExist flag was specified and no such socket or no default socket could be found.
   */
  public NodeSocket resolveSocketRef(String ref, NodeSocket currentSocket, TokenContext context, boolean mustExist)
  {
    NodeSocket ret;
    if (ref != null && ref.startsWith(ModelQualifier.PATH_DELIMITER))
    {
      // Absolute reference
      ret = determineInitialPosition(context, ref, this);
    }
View Full Code Here


    {
      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();

    if (! initialSocket.hasControlLinks())
    {
      String msg = LogUtil.error(getClass(), "There are no control links attached to socket $0. [{1}]", initialSocket.getQualifier().toUntypedString(), context);
      throw new EngineException("NoControlLink", msg);
    }

    return initialSocket;
  }
View Full Code Here

   * @param mustExist If true the method will throw an exception if the specified socket does not exist.
   * @return The socket
   */
  private NodeSocket determineResumptionPosition(TokenContext context, NodeSocket currentSocket, String ref, Engine engine, boolean mustExist)
  {
    NodeSocket startSocket = null;

    // Relative execution request, the current process of the context should be continued with the specified entry name.
    if (currentSocket == null)
    {
      // No current position we can search the relative entry from.
      // The user either tries to access the application using a relative request
      // or the session context has timed out.

      // Log and create an exception
      String msg = LogUtil.error(getClass(), "Session does not have a current position or session has expired for socket reference $0. [{1}]", ref, context);
      throw new EngineException("NoCurrentPosition", msg);
    }

    // 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);
          throw new EngineException("NoExitSocket", msg);
        }
      }
    }
    else
    {
      // Resuming at an entry socket of a wait state node would lead to an endless loop.
      if (currentSocket.isExitSocket())
      {
        startSocket = currentSocket;
      }
      else
      {
        startSocket = currentSocket.getNode().getDefaultExitSocket();
      }
    }

    if (startSocket != null && ! mustExist)
    {
      if (! startSocket.hasControlLinks())
      {
        // Accept connected sockets only when looking for an optional socket
        startSocket = null;
      }
    }
View Full Code Here

    Engine engine = ec.getEngine();
    TokenContext memContext = ec.getTokenContext();
    Object contextId = memContext.getId();

    // Save variable values before we perform the rollback
    NodeSocket memCurrentSocket = memContext.getCurrentSocket();
    int memPriority = memContext.getPriority();
    String memQueueType = memContext.getQueueType();
    CallStack memCallStack = null;
    ProgressInfo memProgressInfo = null;
    Map memProcessVariables = null;
View Full Code Here

    boolean result = true;

    for (int i = 0; i < stackItems.size(); i++)
    {
      StackItem stackItem = (StackItem) stackItems.get(i);
      NodeSocket nodeSocket = stackItem.getNodeSocket();

      if (nodeSocket != null && nodeSocket.getProcess() == process)
      {
        NodeSocket updatedNodeSocket = EngineUtil.updateSocketReference(nodeSocket, process);
        if (updatedNodeSocket != null)
        {
          stackItem.setNodeSocket(updatedNodeSocket);
        }
        else
View Full Code Here

   * @throws OpenBPException On error
   */
  public void executeModelObject(ModelObject mo, EngineExecutor ee)
  {
    TokenContext context = ee.getTokenContext();
    NodeSocket entrySocket = context.getCurrentSocket();
    ActivityNode node = (ActivityNode) entrySocket.getNode();

    NodeSocket nextSocket = node.getDefaultExitSocket();

    // Activity reference missing, try the node's handler
    TokenContext oldContext = context;
    HandlerContext hc = getEngine().executeHandler(node.getActivityHandlerDefinition(), HandlerTypes.ACTIVITY, context, context.getCurrentSocket(), nextSocket);
    if (hc != null)
    {
      context = hc.getTokenContext();
      if (context != oldContext)
      {
        // Token context instance has changed due to rollback
        ee.setTokenContext(context);
      }

      nextSocket = hc.getNextSocket();
      if (nextSocket == null)
      {
        String msg = LogUtil.error(getClass(), "Handler of node $0 has set a null next socket. [{1}]", node.getQualifier(), context);
        throw new EngineException("MissingNextSocket", msg);
      }
    }
    else
    {
      // No handler present, try the default socket
      if (nextSocket != null)
      {
        LogUtil.warn(getClass(), "No activity handler defined for activity node $0, using default exit socket $1.", node.getQualifier(), nextSocket.getName());
      }
      else
      {
        String msg = LogUtil.error(getClass(), "No activity handler found for activity node $0 and no default socket present. [{1}]", node.getQualifier(), context);
        throw new EngineException("NoDefaultExitSocket", msg);
View Full Code Here

   * @throws OpenBPException On error
   */
  public void executeModelObject(ModelObject mo, EngineExecutor ee)
  {
    TokenContext context = ee.getTokenContext();
    NodeSocket entrySocket = context.getCurrentSocket();
    VisualItem visual = (VisualItem) mo;

    NodeSocket nextSocket = null;

    // Check, whether we've a dynamic visual we should execute instead of this visual.
    VisualItem dynamicVisual = determineDynamicVisual(visual, context, entrySocket);

    if (dynamicVisual != this)
View Full Code Here

      socketList.add(((SingleSocketNode) node).getSocket());

    List modelObjects = new ArrayList();
    for (int i = 0; i < socketList.size(); i++)
    {
      NodeSocket socket = (NodeSocket) socketList.get(i);
      modelObjects.addAll(findInNodeSocket(socket, item));
    }

    return modelObjects;
  }
View Full Code Here

   * @throws OpenBPException On error
   */
  public void executeModelObject(ModelObject mo, EngineExecutor ee)
  {
    TokenContext context = ee.getTokenContext();
    NodeSocket entrySocket = context.getCurrentSocket();
    FinalNode node = (FinalNode) entrySocket.getNode();

    NodeSocket nextSocket = null;

    String jumpTarget = (String) TokenContextUtil.getParamValue(context, entrySocket, CoreConstants.DYNAMIC_JUMPTARGET_PARAM_NAME);
    if (jumpTarget == null)
      jumpTarget = node.getJumpTarget();

View Full Code Here

  private NodeSocket executeReturnFinalNode(Node node, NodeSocket entrySocket, TokenContext context)
  {
    // TODO Commented out due to showcase: Split final and return nodes!

    // A top-level final node will end the process
    NodeSocket nextSocket = null;

    // Check whether a return is possible.
    if (context.getCallStack().getCallDepth() != 0)
    {
      // Pop the reference to the calling sub proces node from the call stack
      CallStackItem stackItem = context.getCallStack().pop();

      // Get the payload socket of the call stack item
      NodeSocket callStackSocket = stackItem.getNodeSocket();
      if (callStackSocket != null)
      {
        // Regular call stack item (sub process).
        // Determine the exit socket of the sub process node we shall continue with
        // using the name of the final node of the sub process.
View Full Code Here

TOP

Related Classes of org.openbp.core.model.item.process.NodeSocket

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.