Package org.jbpm.taskmgmt.exe

Examples of org.jbpm.taskmgmt.exe.TaskInstance


         @Override
         protected void renderResponse() throws Exception
         {
            List<TaskInstance> tasks = (List<TaskInstance>) getInstance(TaskInstanceList.class);
            assert tasks.size()==1;
            TaskInstance taskInstance = tasks.get(0);
            assert taskInstance.getDescription().equals("Kick Roy out of my office");
            taskId = taskInstance.getId();
         }
        
      }.run();

  
View Full Code Here


    //     Load it again, individually
    ProcessDefinition pd2 = graphSession.loadProcessDefinition(pd.getId());

    //     Create an instance of the Process Def with Task
    ProcessInstance processInstance = new ProcessInstance(pd2);
    TaskInstance jbpmTaskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();

    //     Persist these changes
    graphSession.saveProcessInstance(processInstance);

    //     Be polite, like the template is.
View Full Code Here

                updatesMap = new UpdatesHashMap(processInstance.getContextInstance().getVariables());
            } else if (value instanceof Token) {
                final Token token = (Token) value;
                updatesMap = new UpdatesHashMap(token.getProcessInstance().getContextInstance().getVariables(token));
            } else if (value instanceof TaskInstance) {
                final TaskInstance task = (TaskInstance) value;
                updatesMap = new UpdatesHashMap(task.getVariables());
            } else if (value == null) {
                context.setError("Error getting variable map", "The value was given as null");
                return;
            } else {
                context.setError("Error getting variable map", "The value is not a recognized type");
View Full Code Here

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

            // 3. If the start state has a default leaving transition, then
            // signal the token along the default transition.
            context.addSuccessMessage("Started process");

            final TaskMgmtInstance taskMgmtInstance = instance.getTaskMgmtInstance();
            final TaskInstance startTaskInstance = taskMgmtInstance.createStartTaskInstance();

            /* next piece causes NPE.
             * and i don't think it is needed to signal a new process automatically.  that can
             * be done in the console itself as well. 
             * TODO it would be nice if the console automatically navigated to the screen where
View Full Code Here

                for (String name : updates) {
                    contextInstance.setVariable(name, updatesHashMap.get(name), token);
                    updated = true;
                }
            } else if (targetValue instanceof TaskInstance) {
                final TaskInstance task = (TaskInstance) targetValue;
                for (String name : deletes) {
                    task.deleteVariable(name);
                    updated = true;
                }
                for (String name : updates) {
                    task.setVariable(name, updatesHashMap.get(name));
                    updated = true;
                }
            } else if (targetValue == null) {
                context.setError("Error updating variable map", "The target value was given as null");
                return;
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) {
      handle(e);
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) {
      handle(e);
View Full Code Here

            }
            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

            }
            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

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.