Package org.jbpm.taskmgmt.exe

Examples of org.jbpm.taskmgmt.exe.TaskInstance


      Actor actor = Actor.instance();
      if ( actor.getId()==null )
      {
         throw new IllegalStateException("no current actor id defined");
      }
      TaskInstance taskInstance = getTaskInstance();
      if (taskInstance!=null)
      {
         taskInstance.setActorId( actor.getId() );
         return "taskAssignedToActor";
      }
      else
      {
         return null;
View Full Code Here


    * @return a null outcome only if the task was not found
    */
   @Transactional
   public String assign(String actorId)
   {
      TaskInstance taskInstance = getTaskInstance();
      if (taskInstance!=null)
      {
         taskInstance.setActorId(actorId);
         return "taskAssigned";
      }
      else
      {
         return null;
View Full Code Here

    * @return a null outcome only if the task was not found
    */
   @Transactional
   public String unassign()
   {
      TaskInstance taskInstance = getTaskInstance();
      if (taskInstance!=null)
      {
         taskInstance.setActorId(null);
         return "taskUnassigned";
      }
      else
      {
         return null;
View Full Code Here

   * @see #loadTaskInstance(long)
   * @see #getTaskInstance(long)
   * @see #getTaskInstanceForUpdate(long)
   */
  public TaskInstance loadTaskInstanceForUpdate(long taskInstanceId) {
    TaskInstance taskInstance = getTaskMgmtSession().loadTaskInstance(taskInstanceId);
    addAutoSaveTaskInstance(taskInstance);
    return taskInstance;
  }
View Full Code Here

   * @see #loadTaskInstance(long)
   * @see #getTaskInstance(long)
   * @see #loadTaskInstanceForUpdate(long)
   */
  public TaskInstance getTaskInstanceForUpdate(long taskInstanceId) {
    TaskInstance taskInstance = getTaskMgmtSession().getTaskInstance(taskInstanceId);
    if (taskInstance!=null) {
      addAutoSaveTaskInstance(taskInstance);
    }
    return 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

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

  // TODO: Change timers too!

  // change tasks
  Iterator iter = getTasksForToken(token).iterator();
  while (iter.hasNext()) {
      TaskInstance ti = (TaskInstance) iter.next();

      Task oldTask = ti.getTask();
      // find new task
      Query q = jbpmContext.getSession().getNamedQuery(
        "TaskMgmtSession.findTaskForNode");
      q.setString("taskName", oldTask.getName());
      q.setLong("taskNodeId", newNode.getId());
      // TODO: q.setLong("processDefinitionId", newDef.getId());

      Task newTask = (Task) q.uniqueResult();

      if (newTask == null) {
    throw new JbpmException(
      "node '"
        + newNode.getName()
        + "' has no Task configured! Check the new process definition");
      }

      ti.setTask(newTask);
      log.debug("change dependent task-instance with id "
        + oldTask.getId());
  }

  // change childs recursive
View Full Code Here

    }

    public Object execute(JbpmContext jbpmContext) throws Exception {

  if (taskInstanceId > 0) {
      TaskInstance taskInstance = jbpmContext
        .getTaskInstance(taskInstanceId);
      if (taskInstance != null) {
    retrieveTaskInstanceDetails(taskInstance);
      }

      return taskInstance;
  }
  else if (tokenId > 0) {
      List result = jbpmContext.getTaskMgmtSession()
        .findTaskInstancesByToken(tokenId);
      for (Iterator iter = result.iterator(); iter.hasNext();) {
    TaskInstance ti = (TaskInstance) iter.next();
    retrieveTaskInstanceDetails(ti);
      }
      return result;
  }
  else if (processInstanceId > 0) {
      List result = jbpmContext.getTaskMgmtSession()
        .findTaskInstancesByProcessInstance(
          jbpmContext.getProcessInstance(processInstanceId));
      for (Iterator iter = result.iterator(); iter.hasNext();) {
    TaskInstance ti = (TaskInstance) iter.next();
    retrieveTaskInstanceDetails(ti);
      }
      return result;
  }
  else
View Full Code Here

    this.transitionName = transitionName;
    this.variables = variables;
  }

  public Object execute(JbpmContext jbpmContext) {
    TaskInstance taskInstance = getTaskInstance(jbpmContext);

    if (variables != null && variables.size() > 0) {
      taskInstance.getContextInstance().addVariables(variables);
    }

    if (transitionName == null) {
      taskInstance.end();
    } else {
      taskInstance.end(transitionName);
    }
    return taskInstance;
  }
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.