Package org.jbpm.taskmgmt.exe

Examples of org.jbpm.taskmgmt.exe.TaskInstance


    assertEquals("result of myMethod", result);
    assertEquals(1, myMethodInvocationCount);
  }
 
  public void testTaskInstanceName() throws Exception {
    TaskInstance taskInstance = new TaskInstance("hallo");
    executionContext.setTaskInstance(taskInstance);

    String expression = "#{taskInstance.name}";
    Object result = JbpmExpressionEvaluator.evaluate(expression, executionContext);
    assertEquals("hallo", result);
View Full Code Here


    Object result = JbpmExpressionEvaluator.evaluate(expression, executionContext);
    assertEquals("hallo", result);
  }

  public void testTaskInstanceVariable() throws Exception {
    TaskInstance taskInstance = new TaskInstance("hallo");
    taskInstance.setVariableLocally("expectedNbrOfHours", new Float(5.5));
    executionContext.setTaskInstance(taskInstance);
   
    String expression = "#{taskInstance.variables['expectedNbrOfHours']}";
    Object result = JbpmExpressionEvaluator.evaluate(expression, executionContext);
    assertEquals(new Float(5.5), result);
View Full Code Here

    Object result = JbpmExpressionEvaluator.evaluate(expression, executionContext);
    assertEquals(new Float(5.5), result);
  }

  public void testPieceOfText() throws Exception {
    TaskInstance taskInstance = new TaskInstance("hallo");
    taskInstance.setVariableLocally("expectedNbrOfHours", new Float(5.5));

    String expression = "a, b, cdefg";
    Object result = JbpmExpressionEvaluator.evaluate(expression, executionContext);
    assertEquals("a, b, cdefg", result);
  }
View Full Code Here

      "    <property name='actorId'><string>theotherguy</string></property>" +
      "  </bean>" +
      "</beans>"
    );

    TaskInstance taskInstance = (TaskInstance) objectFactory.createObject("task");
    assertEquals("do dishes", taskInstance.getName());
    assertEquals("theotherguy", taskInstance.getActorId());
  }
View Full Code Here

      "    </constructor>" +
      "  </bean>" +
      "</beans>"
    );

    TaskInstance taskInstance = (TaskInstance) objectFactory.createObject("task");
    assertEquals("do dishes", taskInstance.getName());
    assertEquals("theotherguy", taskInstance.getActorId());
  }
View Full Code Here

    assertSame(c, token.getNode());
  }

  public static void endOneTask(Token token) {
    TaskMgmtInstance tmi = (TaskMgmtInstance)token.getProcessInstance().getInstance(TaskMgmtInstance.class);
    TaskInstance taskInstance = (TaskInstance) tmi.getUnfinishedTasks(token).iterator().next();
    taskInstance.end();
  }
View Full Code Here

   * selects a task.
   */
  public String selectTaskInstance() {
    // Get the task instance id from request parameter
    long taskInstanceId = JsfHelper.getId("taskInstanceId");
    TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(taskInstanceId);
    taskBean.initialize(taskInstance);
    return "task";
  }
View Full Code Here

    // create a new process instance to run
    ProcessInstance processInstance = new ProcessInstance(processDefinition);

    // create a new taskinstance for the start task
    TaskInstance taskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();

    // Save the process instance along with the task instance
    jbpmContext.save(processInstance);
   
    // Fill the task backing bean with useful information
View Full Code Here

   * The loaded task instance will be save automatically at the {@link #close()}.
   * This is a convenience method in case you plan to do update operations on
   * this task instance.
   */
  public TaskInstance loadTaskInstanceForUpdate(long taskInstanceId) {
    TaskInstance taskInstance = getTaskMgmtSession().loadTaskInstance(taskInstanceId);
    addAutoSaveTaskInstance(taskInstance);
    return taskInstance;
  }
View Full Code Here

    // there should be 1 task instance created in the business process
    Collection allTaskInstances = businessProcessInstance.getTaskMgmtInstance().getTaskInstances();
    assertNotNull(allTaskInstances);
    assertEquals(1, allTaskInstances.size());
    TaskInstance taskInstance = (TaskInstance) allTaskInstances.iterator().next();
    document = (Document) taskInstance.getVariable("document");
    assertEquals("blablabla", document.getText());

   
    // Now SEAM will handle the page flow that is specified here:
    ProcessDefinition pageFlowDefinition = ProcessDefinition.parseXmlString(
      "<process-definition name='approve document task'>" +
      "  <start-state name='start page flow'>" +
      "    <transition to='review' />" +
      "  </start-state>" +
      "  <page name='review' url='review.jsp'>" +
      "    <transition name='approve' to='approved' />" +
      "    <transition name='reject' to='rejected' />" +
      "  </page>" +
      "  <page name='approved' url='approved.jsp'>" +
      "    <conversation-end outcome='approveDocument' />" +
      "  </page>" +
      "  <page name='rejected' url='rejected.jsp'>" +
      "    <conversation-end outcome='rejectDocument' />" +
      "  </page>" +
      "</process-definition>"
    );
   
    // A new page flow process is started
    ProcessInstance pageFlowInstance = new ProcessInstance(pageFlowDefinition);
    Token pageFlowToken = pageFlowInstance.getRootToken();

    // This page flow is in the context of a specific user that
    // clicked an entry in his task list.  The task instance is
    // injected as a process context variable
    contextInstance = pageFlowInstance.getContextInstance();
    contextInstance.setVariable("taskInstance", taskInstance);

    // With the task instance information, the page flow process is started
    // and can now decide which is the first page to show the user
    pageFlowInstance.signal();

    // SEAM can expect that when a wait state is entered, the main
    // path of execution is positioned in a page.  That page
    // contains the url that SEAM should render.
    // In this simple page flow process, we always start with the
    // review page.
    Page page = (Page) pageFlowToken.getNode();
    assertNotNull(page);
    assertEquals("review", page.getName());
    assertEquals("review.jsp", page.getUrl());
   
    // so now, the SEAM page flow renders the review page.
    // in review.jsp, the EL expression "taskInstance[document].text" should resolve
    // to 'blablabla'
    taskInstance = (TaskInstance) contextInstance.getVariable("taskInstance");
    document = (Document) taskInstance.getVariable("document");
    assertEquals("blablabla", document.getText());
    assertEquals("business process review task", taskInstance.getName());

    // suppose the user presses the approve button
    pageFlowToken.signal("approve");

    // now the page flow process should have moved to the
    // approved page with the approved.jsp
    page = (Page) pageFlowToken.getNode();
    assertNotNull(page);
    assertEquals("approved", page.getName());
    assertEquals("approved.jsp", page.getUrl());

    // ...and, the business process task instance should have ended.
    assertTrue(taskInstance.hasEnded());
    // causing the business process to move to the next state
    assertEquals("file horizontally", businessToken.getNode().getName());
  }
View Full Code Here

TOP

Related Classes of org.jbpm.taskmgmt.exe.TaskInstance

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.