Examples of TaskInstance


Examples of org.jbpm.taskmgmt.exe.TaskInstance

            }
            if (!(taskInstanceValue instanceof TaskInstance)) {
                context.setError("Error assigning task", "Attempted to assigning something other than a task instance");
                return;
            }
            final TaskInstance taskInstance = (TaskInstance) taskInstanceValue;
            if (actorIdExpression == null) {
                context.setError("Error assigning task", "Actor ID expression is null");
                return;
            }
            final Object actorIdValue = actorIdExpression.getValue(elContext);
            if (actorIdValue == null) {
                context.setError("Error assigning 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 assigning 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.setActorId(actorId, overwriteSwimlane.booleanValue());
            } else {
                taskInstance.setActorId(actorId);
            }
            context.addSuccessMessage("Task assigned");
            context.getJbpmContext().getSession().flush();
            context.selectOutcome("success");
        } catch (Exception ex) {
View Full Code Here

Examples of org.jbpm.taskmgmt.exe.TaskInstance

            }
            if (!(taskInstanceValue instanceof TaskInstance)) {
                context.setError("Error completing task", "Attempted to complete something other than a task instance");
                return;
            }
            final TaskInstance taskInstance = (TaskInstance) taskInstanceValue;
            if (transitionExpression != null) {
                final Object transitionValue = transitionExpression.getValue(elContext);
                if (transitionValue == null) {
                    taskInstance.end();
                } else if (transitionValue instanceof Transition) {
                    taskInstance.end((Transition)transitionValue);
                } else {
                    final String transitionName = transitionValue.toString();
                    taskInstance.end(transitionName);
                }
            } else {
                taskInstance.end();
            }
            context.addSuccessMessage("Task completed");
            context.getJbpmContext().getSession().flush();
            context.selectOutcome("success");
        } catch (Exception ex) {
View Full Code Here

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

Examples of org.jbpm.taskmgmt.exe.TaskInstance

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

Examples of org.jbpm.taskmgmt.exe.TaskInstance

            }
            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

Examples of org.jbpm.taskmgmt.exe.TaskInstance

  {
    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

Examples of org.jbpm.taskmgmt.exe.TaskInstance

  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

Examples of org.jbpm.taskmgmt.exe.TaskInstance

  }

  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

Examples of org.jbpm.taskmgmt.exe.TaskInstance

            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

Examples of org.jbpm.taskmgmt.exe.TaskInstance

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