Package org.jbpm.taskmgmt.exe

Examples of org.jbpm.taskmgmt.exe.TaskInstance


    }

    public long getProcessInstanceIdForTaskInstance(final long taskInstanceId) {
        return (Long) getJbpmTemplate().execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                TaskInstance ti = getTaskInstance(taskInstanceId);
                ProcessInstance pi = ti.getToken().getProcessInstance();
                return pi.getId();
            }
        });
    }
View Full Code Here


        if (taskInstanceId <= 0) {
            return;
        }
        getJbpmTemplate().execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                TaskInstance taskInstance = getTaskInstance(taskInstanceId);
                if (taskInstance != null) {
                    if (taskInstance.getStart() == null && !taskInstance.isCancelled() && !taskInstance.hasEnded()) {
                        taskInstance.start(actor);
                        //   loggingUtils.log("started " + taskInstanceId + " with actor " + actor);
                    }
                } else {
                    //  loggingUtils.log("task instance " + taskInstanceId + "is null! ");
                }
View Full Code Here

            }
        });
    }

    private TaskInstance _taskInstance(Session session, JbpmContext ctx, long taskInstanceId) throws Throwable {
        TaskInstance taskInstance = null;
        try {
            taskInstance = (TaskInstance) session.load(TaskInstance.class, taskInstanceId, LockMode.UPGRADE);
        } catch (Throwable e) {
            //  getLoggingUtils().log(e);
            throw new JbpmException("couldn't get task instance '" + taskInstanceId + "'", e);
View Full Code Here

    public void unlockTaskInstance(final long taskInstanceId) {
        if (taskInstanceId != 0) {
            getJbpmTemplate().execute(new JbpmCallback() {
                public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                    TaskInstance ti = getTaskInstance(taskInstanceId);
                    ti.suspend();
                    jbpmContext.save(ti);
                    return null;
                }
            });
        }
View Full Code Here

        if (taskInstanceId == 0) {
            return;
        }
        getJbpmTemplate().execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                TaskInstance taskInstance = getTaskInstance(taskInstanceId);
                if (taskInstance.getEnd() == null && !taskInstance.hasEnded()) {
                    taskInstance.end();
                    jbpmContext.save(taskInstance);
                }
                return null;
            }
        });
View Full Code Here

   @Override
   public Object getValue()
   {
      ValueExpression valueExpression = getValueExpression("taskInstance");
      if (valueExpression==null) valueExpression = getFacesContext().getApplication().getExpressionFactory().createValueExpression(getFacesContext().getELContext(), "#{task}", TaskInstance.class);
      TaskInstance taskInstance = (TaskInstance) valueExpression.getValue( getFacesContext().getELContext() );
      return taskInstance==null ? null : taskInstance.getId();
   }
View Full Code Here

    * @see Actor
    */
   public void startTask()
   {
      String actorId = Actor.instance().getId();
      TaskInstance task = org.jboss.seam.bpm.TaskInstance.instance();
      if ( actorId != null )
      {
         task.start(actorId);
      }
      else
      {
         task.start();
      }
     
      Events.instance().raiseEvent("org.jboss.seam.startTask." + task.getTask().getName());
   }
View Full Code Here

    *
    * @param transitionName the jBPM transition name, or null
    */
   public void endTask(String transitionName)
   {
      TaskInstance task = org.jboss.seam.bpm.TaskInstance.instance();
      if (task==null)
      {
         throw new IllegalStateException( "no task instance associated with context" );
      }
     
      if ( transitionName==null || "".equals(transitionName) )
      {
         transitionName = Transition.instance().getName();
      }
     
      if (transitionName==null)
      {
         task.end();
      }
      else
      {
         task.end(transitionName);
      }
     
      setTaskId(null); //TODO: do I really need this???!
     
      Events.instance().raiseEvent("org.jboss.seam.endTask." + task.getTask().getName());
      ProcessInstance process = org.jboss.seam.bpm.ProcessInstance.instance();
      if ( process.hasEnded() )
      {
         Events.instance().raiseEvent("org.jboss.seam.endProcess." + process.getProcessDefinition().getName());
      }
View Full Code Here

    * @return true if the task was found and was not ended
    */
   public boolean resumeTask(Long taskId)
   {
      setTaskId(taskId);
      TaskInstance task = org.jboss.seam.bpm.TaskInstance.instance();
      if (task==null)
      {
         taskNotFound(taskId);
         return false;
      }
      else if ( task.hasEnded() )
      {
         taskEnded(taskId);
         return false;
      }
      else
      {
         setProcessId( task.getTaskMgmtInstance().getProcessInstance().getId() );
         Events.instance().raiseEvent("org.jboss.seam.initTask." + task.getTask().getName());
         return true;
      }
   }
View Full Code Here

   private static void initProcessAndTask(ExecutionContext context)
   {
      BusinessProcess businessProcess = BusinessProcess.instance();
      businessProcess.setProcessId( context.getProcessInstance().getId() );
      TaskInstance taskInstance = context.getTaskInstance();
      if (taskInstance!=null)
      {
         businessProcess.setTaskId( taskInstance.getId() );
      }
   }
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.