public void setTask(Task task) { this.name = task.getName(); this.description = task.getDescription(); this.task = task; this.isBlocking = task.isBlocking(); this.priority = task.getPriority(); this.isSignalling = task.isSignalling(); }
public void addTask( Task task ) { if (tasks==null) tasks = new HashMap(); task.setTaskMgmtDefinition(this); tasks.put(task.getName(), task); }
public void readStartStateTask(Element startTaskElement, StartState startState) { TaskMgmtDefinition taskMgmtDefinition = processDefinition.getTaskMgmtDefinition(); Task startTask = readTask(startTaskElement, taskMgmtDefinition, null); startTask.setStartState(startState); if (startTask.getName() == null) startTask.setName(startState.getName()); taskMgmtDefinition.setStartTask(startTask); }
public Task readTask(Element taskElement, TaskMgmtDefinition taskMgmtDefinition, TaskNode taskNode) { Task task = new Task(); task.setProcessDefinition(processDefinition); task.setName(name); taskMgmtDefinition.addTask(task); task.setName(taskNode.getName()); taskMgmtDefinition.addTask(task); task.setDescription(description); task.setCondition(condition); task.setDueDate(duedateText); if (priorityText != null) task.setPriority(Task.parsePriority(priorityText)); task.setBlocking(readBoolean(blockingText, false)); task.setSignalling(readBoolean(signallingText, true)); task.setSwimlane(swimlane); if (assignmentElement.attribute("actor-id") != null || assignmentElement.attribute("pooled-actors") != null) { task.setActorIdExpression(assignmentElement.attributeValue("actor-id")); task.setPooledActorsExpression(assignmentElement.attributeValue("pooled-actors"));
public void assign(ExecutionContext executionContext) { TaskMgmtInstance taskMgmtInstance = executionContext.getTaskMgmtInstance(); Swimlane swimlane = task.getSwimlane(); // if this task is in a swimlane if (swimlane != null) { // if this is a task assignment for a start-state if (isStartTaskInstance()) { // initialize the swimlane swimlaneInstance = new SwimlaneInstance(swimlane); taskMgmtInstance.addSwimlaneInstance(swimlaneInstance); // with the current authenticated actor swimlaneInstance.setActorId(SecurityHelper.getAuthenticatedActorId()); } // lazily initialize the swimlane... else { // get the swimlane instance (if there is any) swimlaneInstance = taskMgmtInstance.getInitializedSwimlaneInstance(executionContext, swimlane); // copy the swimlaneInstance assignment into the taskInstance assignment copySwimlaneInstanceAssignment(swimlaneInstance); } } else { // this task is not in a swimlane taskMgmtInstance.performAssignment(task.getAssignmentDelegation(), task.getActorIdExpression(), task.getPooledActorsExpression(), this, executionContext); } updatePooledActorsReferences(swimlaneInstance); }
/** * @return the name of the replacement task, if one is given in the task name mapping, or the * old task name */ private String getReplacementTaskName(Task oldTask) { String oldName = oldTask.getName(); if (taskNameMapping != null && taskNameMapping.containsKey(oldName)) { return (String) taskNameMapping.get(oldName); } // return new node name = old node name as default return oldName; }
/** * marks this task as done and specifies the name of a transition leaving the task-node for * the case that the completion of this task instances triggers a signal on the token. If this * task leads to a signal on the token, the given transition name will be used in the signal. * If this task completion does not trigger execution to move on, the transitionName is * ignored. */ public void end(String transitionName) { if (task == null) { throw new JbpmException(this + " has no task definition"); } Node node = task.getTaskNode(); if (node == null) { GraphElement parent = task.getParent(); if (!(parent instanceof Node)) { throw new JbpmException(this + " has no enclosing node"); } node = (Node) parent; } Transition leavingTransition = node.getLeavingTransition(transitionName); if (leavingTransition == null) { throw new JbpmException(node + " has no leaving transition named " + transitionName); } end(leavingTransition); }
executionContext.setTask(task); executionContext.setTaskInstance(this); task.fireEvent(Event.EVENTTYPE_TASK_END, executionContext); isSignalling = false; TaskNode taskNode = task.getTaskNode(); if (isStartTaskInstance() // ending start task leads to signal || (taskNode != null && taskNode.completionTriggersSignal(this))) {
if (task != null && (dueDateText = task.getDueDate()) != null) { Date dueDate; String description = task.getDescription(); if (description != null) { String result = (String) JbpmExpressionEvaluator
public void create(ExecutionContext executionContext) { if (create != null) { throw new IllegalStateException(this + " was already created"); } create = Clock.getCurrentTime(); // if this task instance is associated with a task... if (task != null && executionContext != null) { // fire task create event // WARNING: The events create and assign are fired in the right order, // yet the logs are still not ordered properly executionContext.setTaskInstance(this); executionContext.setTask(task); task.fireEvent(Event.EVENTTYPE_TASK_CREATE, executionContext); } }
public boolean isStartTaskInstance() { if (taskMgmtInstance != null) { TaskMgmtDefinition taskMgmtDefinition = taskMgmtInstance.getTaskMgmtDefinition(); if (taskMgmtDefinition != null) { return task != null && task.equals(taskMgmtInstance.getTaskMgmtDefinition().getStartTask()); } } return false; }
public void execute(ExecutionContext executionContext) { TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance(); // if this tasknode should create instances if (createTasks && tasks != null) { for (Iterator iter = tasks.iterator(); iter.hasNext();) { Task task = (Task) iter.next(); executionContext.setTask(task); if (evaluateTaskCondition(task.getCondition(), executionContext)) { tmi.createTaskInstance(task, executionContext); } } } // check if we should continue execution boolean continueExecution; switch (signal) { case SIGNAL_UNSYNCHRONIZED: continueExecution = true; break; case SIGNAL_FIRST: case SIGNAL_LAST: continueExecution = tmi.getSignallingTasks(executionContext).isEmpty(); break; default: continueExecution = false; } if (continueExecution) leave(executionContext); }
public Task readTask(Element taskElement, TaskMgmtDefinition taskMgmtDefinition, TaskNode taskNode) { Task task = new Task(); task.setProcessDefinition(processDefinition); task.setName(name); taskMgmtDefinition.addTask(task); task.setName(taskNode.getName()); taskMgmtDefinition.addTask(task); task.setDescription(description); task.setCondition(condition); task.setDueDate(duedateText); if (priorityText != null) task.setPriority(Task.parsePriority(priorityText)); task.setBlocking(readBoolean(blockingText, false)); task.setSignalling(readBoolean(signallingText, true)); task.setSwimlane(swimlane); if (assignmentElement.attribute("actor-id") != null || assignmentElement.attribute("pooled-actors") != null) { task.setActorIdExpression(assignmentElement.attributeValue("actor-id")); task.setPooledActorsExpression(assignmentElement.attributeValue("pooled-actors"));
public void assign(ExecutionContext executionContext) { TaskMgmtInstance taskMgmtInstance = executionContext.getTaskMgmtInstance(); Swimlane swimlane = task.getSwimlane(); // if this task is in a swimlane if (swimlane != null) { // if this is a task assignment for a start-state if (isStartTaskInstance()) { // initialize the swimlane swimlaneInstance = new SwimlaneInstance(swimlane); taskMgmtInstance.addSwimlaneInstance(swimlaneInstance); // with the current authenticated actor swimlaneInstance.setActorId(SecurityHelper.getAuthenticatedActorId()); } // lazily initialize the swimlane... else { // get the swimlane instance (if there is any) swimlaneInstance = taskMgmtInstance.getInitializedSwimlaneInstance(executionContext, swimlane); // copy the swimlaneInstance assignment into the taskInstance assignment copySwimlaneInstanceAssignment(swimlaneInstance); } } else { // this task is not in a swimlane taskMgmtInstance.performAssignment(task.getAssignmentDelegation(), task.getActorIdExpression(), task.getPooledActorsExpression(), this, executionContext); } updatePooledActorsReferences(swimlaneInstance); }
public void readStartStateTask(Element startTaskElement, StartState startState) { TaskMgmtDefinition taskMgmtDefinition = processDefinition.getTaskMgmtDefinition(); Task startTask = readTask(startTaskElement, taskMgmtDefinition, null); startTask.setStartState(startState); if (startTask.getName() == null) startTask.setName(startState.getName()); taskMgmtDefinition.setStartTask(startTask); }
/** * @return the name of the replacement task, if one is given in the task name mapping, or the * old task name */ private String getReplacementTaskName(Task oldTask) { String oldName = oldTask.getName(); if (taskNameMapping != null && taskNameMapping.containsKey(oldName)) { return (String) taskNameMapping.get(oldName); } // return new node name = old node name as default return oldName; }
public void addTask( Task task ) { if (tasks==null) tasks = new HashMap(); task.setTaskMgmtDefinition(this); tasks.put(task.getName(), task); }
/** * marks this task as done and specifies the name of a transition leaving the task-node for * the case that the completion of this task instances triggers a signal on the token. If this * task leads to a signal on the token, the given transition name will be used in the signal. * If this task completion does not trigger execution to move on, the transitionName is * ignored. */ public void end(String transitionName) { if (task == null) { throw new JbpmException(this + " has no task definition"); } Node node = task.getTaskNode(); if (node == null) { GraphElement parent = task.getParent(); if (!(parent instanceof Node)) { throw new JbpmException(this + " has no enclosing node"); } node = (Node) parent; } Transition leavingTransition = node.getLeavingTransition(transitionName); if (leavingTransition == null) { throw new JbpmException(node + " has no leaving transition named " + transitionName); } end(leavingTransition); }
executionContext.setTask(task); executionContext.setTaskInstance(this); task.fireEvent(Event.EVENTTYPE_TASK_END, executionContext); isSignalling = false; TaskNode taskNode = task.getTaskNode(); if (isStartTaskInstance() // ending start task leads to signal || (taskNode != null && taskNode.completionTriggersSignal(this))) {
if (task != null && (dueDateText = task.getDueDate()) != null) { Date dueDate; String description = task.getDescription(); if (description != null) { String result = (String) JbpmExpressionEvaluator