Examples of TaskInstance


Examples of org.jbpm.taskmgmt.exe.TaskInstance

   * 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

Examples of org.jbpm.taskmgmt.exe.TaskInstance

    // 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

Examples of org.jbpm.taskmgmt.exe.TaskInstance

  public String save() {
    log.debug("saving the task parameters " + taskFormParameters);

    // submit the parameters in the jbpm task controller
    TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(taskInstanceId);

    // collect the parameter values from the values that were updated in the
    // parameters by jsf.
    Iterator iter = taskFormParameters.iterator();
    while (iter.hasNext()) {
      TaskFormParameter taskFormParameter = (TaskFormParameter) iter.next();

      if ((taskFormParameter.isWritable()) && (taskFormParameter.getValue() != null)) {
        log.debug("submitting [" + taskFormParameter.getLabel() + "]=" + taskFormParameter.getValue());
        taskInstance.setVariable(taskFormParameter.getLabel(), taskFormParameter.getValue());
      } else {
        log.debug("ignoring unwritable [" + taskFormParameter.getLabel() + "]");
      }
    }
View Full Code Here

Examples of org.jbpm.taskmgmt.exe.TaskInstance

    save();

    // close the task instance
    String transitionButton = JsfHelper.getParameter("taskform:transitionButton");
    log.debug("Submitted button:" + transitionButton);
    TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(taskInstanceId);
    if ("Save and Close Task".equals(transitionButton)) {
      taskInstance.end();
    } else {
      taskInstance.end(transitionButton);
    }

    ProcessInstance processInstance = taskInstance.getTaskMgmtInstance().getProcessInstance();
    if (processInstance.hasEnded()) {
      JsfHelper.addMessage("The process has finished.");
    }

    LoggingInstance loggingInstance = processInstance.getLoggingInstance();
View Full Code Here

Examples of org.jbpm.taskmgmt.exe.TaskInstance

  public void execute(ExecutionContext executionContext) {
    if (isConversationEnd) {
      // get the outer business process task instance
      ContextInstance contextInstance = executionContext.getContextInstance();
      String variableName = "taskInstance";
      TaskInstance taskInstance = (TaskInstance) contextInstance.getVariable(variableName);
     
      // complete the task
      if (outcome==null) {
        taskInstance.end();
      } else {
        taskInstance.end(outcome);
      }
    }
  }
View Full Code Here

Examples of org.jbpm.taskmgmt.exe.TaskInstance

  }

  private void initialize() {
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    if (this.taskInstanceId > 0) {
      TaskInstance taskInstance = jbpmContext.getTaskMgmtSession().loadTaskInstance(taskInstanceId);
      currentToken = taskInstance.getToken();
    }
    else
    {
      if (this.tokenInstanceId > 0)
        currentToken = jbpmContext.getGraphSession().loadToken(this.tokenInstanceId);
View Full Code Here

Examples of org.jbpm.taskmgmt.exe.TaskInstance

    // Tasks list
    tasks = new ArrayList();
    if (processInstance.getTaskMgmtInstance().getTaskInstances().isEmpty() == false) {
      Iterator tasksIterator = processInstance.getTaskMgmtInstance().getTaskInstances().iterator();
      while (tasksIterator.hasNext()) {
        TaskInstance taskInstance = (TaskInstance) tasksIterator.next();
        tasks.add(new TaskBean(taskInstance.getId(), taskInstance.getName(), taskInstance.getActorId(), taskInstance.getEnd()));
      }
    }

  }
View Full Code Here

Examples of org.jbpm.taskmgmt.exe.TaskInstance

    ProcessInstance processInstance = null;

    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    if (this.taskInstanceId > 0) {
      TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
      TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(this.taskInstanceId);
      if (transitionName.equals("")) {
        taskInstance.end();
      } else {
        taskInstance.end(transitionName);
      }
      processInstance = taskInstance.getToken().getProcessInstance();
    } else if (this.tokenInstanceId > 0) {
      GraphSession graphSession = jbpmContext.getGraphSession();
      Token token = graphSession.loadToken(this.tokenInstanceId);
      if (transitionName.equals("")) {
        token.signal();
View Full Code Here

Examples of org.jbpm.taskmgmt.exe.TaskInstance

    selectTask();

    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();

    TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(this.taskInstanceId);

    if (taskInstance.getAvailableTransitions().size() > 1) {
      initializeAvailableTransitions(taskInstance);
      return "showTransitions";
    }

    taskInstance.end();

    ProcessInstance processInstance = taskInstance.getToken().getProcessInstance();
    jbpmContext.save(processInstance);

    this.initializeTasksList(processInstance);
    this.initializeTokensList(processInstance);
View Full Code Here

Examples of org.jbpm.taskmgmt.exe.TaskInstance

public class DefaultTaskInstanceFactoryImpl implements TaskInstanceFactory {

  private static final long serialVersionUID = 1L;

  public TaskInstance createTaskInstance(ExecutionContext executionContext) {
    return new TaskInstance();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.