Package org.openbp.server.context

Examples of org.openbp.server.context.TokenContext


   */
  @Transactional(propagation = Propagation.REQUIRED)
  public String getProcessOutput(Object tokenId)
  {
    // Re-load the token from the database
    TokenContext token = getProcessFacade().getTokenById(tokenId);

    Map<String, Object> outputParam = new HashMap<String, Object>();
    getProcessFacade().retrieveOutputParameters(token, outputParam);

    // Since we cleared the 'delete process after completion' flag, we need to delete the process manually.
View Full Code Here


   */
  public boolean execute(HandlerContext hc)
    throws Exception
  {
    // {{*Handler implementation*
    TokenContext context = hc.getTokenContext();

    String signalId = (String) hc.getParam(PARAM_SIGNALID);
    Object signalValue = hc.getParam(PARAM_SIGNALVALUE);

    LogUtil.debug(getClass(), "Context $0 setting signal $1 to $2...", context.getId(), signalId, signalValue);

    TestCaseSyncMgr.getInstance().setSignal(signalId, signalValue);

    return true;
    // }}*Handler implementation*
 
View Full Code Here

    startValue = 99;
    inputParams.put("NumValue", new Integer(startValue));

    // Create the process context and start the process
    TokenContext token = createToken();
    token.createProcessVariable("externalValue", true);
    token.setProcessVariableValue("externalValue", new Integer(199));
    getProcessFacade().startToken(token, STARTREF, inputParams);

    Object tokenId = token.getId();

    // Note: This should be done by some worker thread; for the test case, we do it right here.
    getProcessFacade().executePendingContextsInThisThread();

    commit();
View Full Code Here

  protected void doWorkflowTask(final Object tokenId)
  {
    begin();

    TokenContext token = getProcessFacade().getTokenById(tokenId);

    // Check the process variables of the token context
    Object p = token.getProcessVariableValue("globalObject");
    assertTrue(p instanceof PersistedComplexParam);
    PersistedComplexParam rcp = (PersistedComplexParam) p;
    int nRet = rcp.getResult();
    assertEquals(startValue + 1, nRet);

    // Get the workflow task that is associated with our process.
    WorkflowTaskCriteria criteria = new WorkflowTaskCriteria();
    criteria.setTokenContext(token);
    Iterator it = getProcessFacade().getworkflowTasks(criteria);
    assertTrue(it.hasNext());
    WorkflowTask task = (WorkflowTask) it.next();

    TokenContext taskToken = task.getTokenContext();

    // Check the process variables of the token context
    Object p2 = taskToken.getProcessVariableValue("globalObject");
    assertTrue(p2 instanceof PersistedComplexParam);
    PersistedComplexParam rcp2 = (PersistedComplexParam) p2;
    int nRet2 = rcp2.getResult();
    assertEquals(startValue + 1, nRet2);
View Full Code Here

  protected void doFinish(final Object tokenId)
  {
    begin();

    TokenContext token = getProcessFacade().getTokenById(tokenId);

    // Note: This should be done by some worker thread; for the test case, we do it right here.
    getProcessFacade().executePendingContextsInThisThread();

    // Token should be at the end of the workflow
View Full Code Here

    getProcessFacade().rollback();
  }

  public TokenContext createToken()
  {
    TokenContext token = getProcessFacade().createToken();
    token.setDebuggerId("Deb1");
    return token;
  }
View Full Code Here

  {
    begin();
    int n = 0;
    for (Iterator it = CollectionUtil.iterator(getProcessFacade().getTokens(null, 0)); it.hasNext();)
    {
      TokenContext token = (TokenContext) it.next();
      if (token.getCurrentSocket() == null)
      {
        errOut("Test context check " + stepName + ": Socket of context " + token + " is null.");
      }
      ++n;
    }
View Full Code Here

  public TokenContext startSimpleSignalWaitProcess(String signalId, int priority)
  {
    HashMap initialParams = new HashMap();
    initialParams.put("SignalId", signalId);

    TokenContext tc = createToken();
    tc.setPriority(priority);
    getProcessFacade().startToken(tc, SIMPLE_SIGNAL_WAIT_PROCESS_STARTREF, initialParams);
    return tc;
  }
View Full Code Here

  {
    HashMap initialParams = new HashMap();
    initialParams.put("SignalId", signalId);
    initialParams.put("SignalValue", signalValue);

    TokenContext tc = createToken();
    tc.setPriority(priority);
    getProcessFacade().startToken(tc, SIMPLE_SIGNAL_SET_PROCESS_STARTREF, initialParams);
    return tc;
  }
View Full Code Here

   */
  public boolean execute(HandlerContext hc)
    throws Exception
  {
    // {{*Handler implementation*
    TokenContext context = hc.getTokenContext();
    String signalId = (String) hc.getParam(PARAM_SIGNALID);

    LogUtil.debug(getClass(), "Context $0 waiting for signal $1...", context.getId(), signalId);

    Object signalValue = TestCaseSyncMgr.getInstance().receiveSignal(null, signalId, 10);

    LogUtil.debug(getClass(), "Context $0 received signal $1, value $2.", context.getId(), signalId, signalValue);

    hc.setResult(PARAM_SIGNALVALUE, signalValue);

    return true;
    // }}*Handler implementation*
 
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.