Package org.jbpm.taskmgmt.exe

Examples of org.jbpm.taskmgmt.exe.TaskInstance


   * @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 #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

            }
            if (!(taskInstanceValue instanceof TaskInstance)) {
                context.setError("Error starting task", "Attempted to start something other than a task instance");
                return;
            }
            final TaskInstance taskInstance = (TaskInstance) taskInstanceValue;
            if (actorIdExpression != null) {
                final Object actorIdValue = actorIdExpression.getValue(elContext);
                if (actorIdValue == null) {
                    context.setError("Error starting task", "Actor ID expression resolved to null");
                    return;
                }
                final String actorId = actorIdValue.toString();
                if (overwriteSwimlaneExpression != null) {
                    final Object overwriteSwimlaneValue = overwriteSwimlaneExpression.getValue(elContext);
                    if (overwriteSwimlaneValue == null) {
                        context.setError("Error starting task", "Overwrite swimlane expression resolved to null");
                        return;
                    }
                    final Boolean overwriteSwimlane;
                    if (overwriteSwimlaneValue instanceof Boolean) {
                        overwriteSwimlane = (Boolean) overwriteSwimlaneValue;
                    } else {
                        overwriteSwimlane = Boolean.valueOf(overwriteSwimlaneValue.toString());
                    }
                    taskInstance.start(actorId, overwriteSwimlane.booleanValue());
                } else {
                    taskInstance.start(actorId);
                }
            } else {
                taskInstance.start();
            }
            context.addSuccessMessage("Task started");
            context.getJbpmContext().getSession().flush();
            context.selectOutcome("success");
        } catch (Exception ex) {
View Full Code Here

  {
    ProcessDefinition newDef = getNewProcessDefinition(token);
    Iterator<TaskInstance> iter = getTasksForToken(token).iterator();
    while (iter.hasNext())
    {
      TaskInstance ti = iter.next();

      // find new task
      Task oldTask = ti.getTask();
      Node oldNode = oldTask.getTaskNode();
     
      Task newTask = findReplacementTask(newDef, oldNode, oldTask);
      ti.setTask(newTask);
      log.debug("change dependent task-instance with id " + oldTask.getId());
    }
  }
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

  }

  public Object execute(JbpmContext jbpmContext) throws Exception
  {
    String actor = this.actorId == null ? jbpmContext.getActorId() : this.actorId;
    TaskInstance taskInstance = jbpmContext.getTaskInstance(taskInstanceId);

    if (taskInstance.getStart() != null)
    {
      log.warn("Force stop on task " + taskInstance.getId() + ". Will be restarted.");
      taskInstance.setStart(null); // strange, but means isNotStarted()
    }

    taskInstance.start(actor, overwriteSwimlane);

    return null;
  }
View Full Code Here

            final String name = nameValue.toString();
            final Object value = valueExpression.getValue(elContext);
            final Object entity = entityExpression.getValue(elContext);
            final Object oldValue;
            if (entity instanceof TaskInstance) {
                final TaskInstance task = (TaskInstance) entity;
                oldValue = task.getVariable(name);
                task.setVariable(name, value);
            } else if (entity instanceof Token) {
                final Token token = (Token) entity;
                final ContextInstance contextInstance = token.getProcessInstance().getContextInstance();
                oldValue = contextInstance.getVariable(name, token);
                contextInstance.setVariable(name, value, token);
View Full Code Here

    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

            }
            if (!(taskInstanceValue instanceof TaskInstance)) {
                context.setError("Error updating task", "Attempted to resume something other than a task instance");
                return;
            }
            final TaskInstance taskInstance = (TaskInstance) taskInstanceValue;
            final Date start;
            if (startDateExpression != null) {
                final Object startDateValue = startDateExpression.getValue(elContext);
                if (startDateValue == null) {
                    context.setError("Error updating task", "Start date value is null");
                    return;
                }
                if (startDateValue instanceof Date) {
                    start = (Date) startDateValue;
                } else if (startDateValue instanceof Long) {
                    start = new Date(((Long)startDateValue).longValue());
                } else {
                    context.setError("Error updating task", "Start date value is not a recognized type");
                    return;
                }
            } else {
                start = new Date();
            }
            taskInstance.setStart(start);
            context.getJbpmContext().getSession().flush();
        } catch (Exception ex) {
            context.setError("Error updating task", ex);
            return;
        }
View Full Code Here

    if (tasks != null && tasks.size() > 0)
    {
      log.info("cancel " + tasks.size() + " tasks");
      for (Iterator it = tasks.iterator(); it.hasNext();)
      {
        TaskInstance ti = (TaskInstance)it.next();

        // if the process def doesn't set signal="never", we have to
        // manually turn off signaling for all tasks;
        // otherwise, the token will be triggered instead of being
        // ended.
        // Do this until http://jira.jboss.com/jira/browse/JBPM-392 is
        // resolved

        log.info("cancel task " + ti.getId());
        ti.setSignalling(false);
        ti.cancel();
      }
    }
  }
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.