Package org.jbpm.taskmgmt.exe

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


    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

  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

  }

  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

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

    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

    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

public class DefaultTaskInstanceFactoryImpl implements TaskInstanceFactory {

  private static final long serialVersionUID = 1L;

  public TaskInstance createTaskInstance(ExecutionContext executionContext) {
    return new TaskInstance();
  }
View Full Code Here

  /**
   * get the task instance for a given task instance-id.
   */
  public TaskInstance loadTaskInstance(long taskInstanceId) {
    TaskInstance taskInstance = null;
    try {
      taskInstance = (TaskInstance) session.load(TaskInstance.class, new Long(taskInstanceId));
    } catch (Exception e) {
      log.error(e);
      jbpmSession.handleException();
View Full Code Here

      beginSessionTransaction();
    }

    List taskInstances = taskMgmtSession.findTaskInstances("victim");
    assertEquals(1, taskInstances.size());
    TaskInstance taskInstance = (TaskInstance) taskInstances.get(0);
    taskInstance.setVariable("a", "value a updated");
    taskInstance.setVariable("b", "value b updated");
    taskInstance.end();
   
    jbpmContext.save(taskInstance);
    long taskInstanceId = taskInstance.getId();
    long tokenId = taskInstance.getToken().getId();
    newTransaction();
   
    taskInstance = jbpmContext.loadTaskInstance(taskInstanceId);
    assertEquals("value a updated", taskInstance.getVariable("a"));
    assertEquals("value b updated", taskInstance.getVariable("b"));
   
    Token token = jbpmContext.loadToken(tokenId);
    ContextInstance subContextInstance = token.getProcessInstance().getContextInstance();
    assertEquals("value a", subContextInstance.getVariable("a"));
    assertEquals("value b updated", subContextInstance.getVariable("b"));
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.