Package org.openbp.server.context

Examples of org.openbp.server.context.TokenContext


    for (int i = 0; i < historicContextData.length; ++i)
    {
      try
      {
        tokenId = startToken();
        TokenContext token = getProcessFacade().getTokenById(tokenId);

        String base64ContextData = historicContextData[i].getBase64ContextData();
        byte[] contextData = Base64.decode(base64ContextData);
        token.setContextData(contextData);

        ((PersistentTokenContextService) getProcessServer().getTokenContextService()).postProcessContextAfterLoad(token);

        resumeToken(tokenId);
      }
View Full Code Here


    }
  }

  private Object startToken()
  {
    TokenContext token = createToken();

    getProcessFacade().startToken(token, "/TestCase/SubProcessTest.Start", null);
    Object tokenId = token.getId();

    getProcessFacade().executePendingContextsInThisThread();

    return tokenId;
  }
View Full Code Here

    return tokenId;
  }

  private void resumeToken(Object tokenId)
  {
    TokenContext token = getProcessFacade().getTokenById(tokenId);
    getProcessFacade().resumeToken(token, "Resumption", null);

    getProcessFacade().executePendingContextsInThisThread();
  }
View Full Code Here

    getProcessFacade().executePendingContextsInThisThread();
  }

  private void printToken(Object tokenId)
  {
    TokenContext token = getProcessFacade().getTokenById(tokenId);

    byte[] data = token.getContextData();

        String base64Data = Base64.encodeBytes(data, Base64.DONT_BREAK_LINES);

        byte[] encodedData = Base64.decode(base64Data);
View Full Code Here

  /**
   * Destroys context, i\.\e. removes it from its parent context.
   */
  public void destroy()
  {
    TokenContext parent = getParentContext();
    if (parent != null)
    {
      parent.removeChildContext(this);
      parentContext = null;
    }
  }
View Full Code Here

   */
  public boolean hasProcessVariableValue(final String variableName)
  {
    if (hasParamValue(CoreConstants.PROCESS_VARIABLE_INDICATOR + variableName))
      return true;
    TokenContext parentContext = getParentContext();
    if (parentContext != null)
      return parentContext.hasProcessVariableValue(variableName);
    return false;
  }
View Full Code Here

  @Test
  public void testStandardRollbackProcessor()
    throws Exception
  {
    // Create the process context and start the process
    TokenContext token = createToken();
    token.registerObserver(this, new String[] { EngineExceptionHandlerEvent.HANDLE_EXCEPTION });

    getProcessFacade().startToken(token, "/TestCase/RollbackLocalErrorHandlerTest.Start", null);

    Engine engine = this.getProcessServer().getEngine();
    engine.executeContext(token);
View Full Code Here

    throws Exception
  {
    scheduler = (QuartzProcessScheduler) getProcessServer().getProcessScheduler();

    getProcessServer().getProcessFacade().begin();
    TokenContext tc = createToken();
    getProcessServer().getProcessFacade().prepareTokenForScheduler(tc);
    getProcessServer().getProcessFacade().commit();

    ProcessJobDescriptor job1 = new ProcessJobDescriptor();
    job1.setJobName("job1");
View Full Code Here

   */
  @Transactional(propagation = Propagation.REQUIRED)
  public Object startProcess(VacationData data)
  {
    // Create the process context and start the process
    TokenContext token = getProcessFacade().createToken();
    // We need to retrieve the process' output parameters, so do not delete the process after it has completed.
    token.setDeleteAfterCompletion(false);
    token.setDebuggerId("Deb1");

    // Start the process
    Map<String, Object> inputParam = new HashMap<String, Object>();
    inputParam.put("Data", data);
    getProcessFacade().startToken(token, "/VacationRequest/HandleVacationRequest.Start", inputParam);

    // Note: We do not have asynchronous processing in the workflow, so we use blocking execution
    // (i. e. execute the process right here in this thread).
    // Otherweise, the execution would have to be done by some worker thread (blocking execution).
    getProcessFacade().executePendingContextsInThisThread();

    return token.getId();
  }
View Full Code Here

   * @param ee Engine executor that called this method
   * @throws OpenBPException On error
   */
  public void executeModelObject(ModelObject mo, EngineExecutor ee)
  {
    TokenContext context = ee.getTokenContext();
    NodeSocket entrySocket = context.getCurrentSocket();
    PlaceholderNode node = (PlaceholderNode) entrySocket.getNode();

    NodeSocket nextSocket = node.getDefaultExitSocket();
    if (nextSocket == null)
    {
      String msg = LogUtil.error(getClass(), "No default exit socket present for placeholder node $0. [{1}]", node.getQualifier(), context);
      throw new EngineException("NoDefaultExitSocket", msg);
    }
    context.setCurrentSocket(nextSocket);
  }
View Full Code Here

TOP

Related Classes of org.openbp.server.context.TokenContext

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.