public void notify(DelegateTask task) { DelegateExecution execution = task.getExecution(); recordedEvents.add(new RecordedTaskEvent(task.getId(), task.getExecutionId(), task.getEventName(), execution.getActivityInstanceId())); }
@SuppressWarnings("unchecked") public void notify(DelegateTask delegateTask) { // get mapping table from variable DelegateExecution execution = delegateTask.getExecution(); Map<String, String> assigneeMappingTable = (Map<String, String>) execution.getVariable("assigneeMappingTable"); // get assignee from process String assigneeFromProcessDefinition = delegateTask.getAssignee(); // overwrite assignee if there is an entry in the mapping table if (assigneeMappingTable.containsKey(assigneeFromProcessDefinition)) { String assigneeFromMappingTable = assigneeMappingTable.get(assigneeFromProcessDefinition); delegateTask.setAssignee(assigneeFromMappingTable); } }
public void notify(DelegateTask delegateTask) { TaskDeleteListener.eventCounter++; TaskDeleteListener.lastTaskDefinitionKey = delegateTask.getTaskDefinitionKey(); TaskDeleteListener.lastDeleteReason = delegateTask.getDeleteReason(); }
public CdiBusinessProcessEvent(DelegateTask task, ProcessDefinitionEntity processDefinition, BusinessProcessEventType type, Date timeStamp) { this.activityId = null; this.transitionName = null; this.processInstanceId = task.getProcessInstanceId(); this.executionId = task.getExecutionId(); this.type = type; this.timeStamp = timeStamp; this.processDefinition = processDefinition; this.delegateTask = task; }
public void notify(DelegateTask delegateTask) { String assignee = (String) delegateTask.getVariable("assignee"); delegateTask.setAssignee(assignee); }
public void notify(final DelegateTask delegateTask){ if(delegateTask.getExecution() == null) { LOG.taskNotRelatedToExecution(delegateTask); } else { final DelegateExecution execution = delegateTask.getExecution(); Callable<Void> notification = new Callable<Void>() { public Void call() throws Exception { notifyTaskListener(delegateTask); return null; } }; try { performNotification(execution, notification); } catch(Exception e) { throw LOG.exceptionWhileNotifyingPaTaskListener(e); } } }
@Override public HistoryEvent createActivityInstanceUpdateEvt(DelegateExecution execution, DelegateTask task) { final ExecutionEntity executionEntity = (ExecutionEntity) execution; // create event instance HistoricActivityInstanceEventEntity evt = loadActivityInstanceEventEntity(executionEntity); // initialize event initActivityInstanceEvent(evt, executionEntity, HistoryEventTypes.ACTIVITY_INSTANCE_UPDATE); // update task assignment if(task != null) { evt.setTaskId(task.getId()); evt.setTaskAssignee(task.getAssignee()); } return evt; }
protected BusinessProcessEvent createEvent(DelegateTask task) { ExecutionContext executionContext = Context.getExecutionContext(); ProcessDefinitionEntity processDefinition = null; if (executionContext != null) { processDefinition = executionContext.getProcessDefinition(); } // map type String eventName = task.getEventName(); BusinessProcessEventType type = null; if (TaskListener.EVENTNAME_CREATE.equals(eventName)) { type = BusinessProcessEventType.CREATE_TASK; } else if (TaskListener.EVENTNAME_ASSIGNMENT.equals(eventName)) { type = BusinessProcessEventType.ASSIGN_TASK; } else if (TaskListener.EVENTNAME_COMPLETE.equals(eventName)) { type = BusinessProcessEventType.COMPLETE_TASK; } else if (TaskListener.EVENTNAME_DELETE.equals(eventName)) { type = BusinessProcessEventType.DELETE_TASK; } return new CdiBusinessProcessEvent(task, processDefinition, type, ClockUtil.getCurrentTime()); }
@Override public String getTaskId() { if (delegateTask != null) { return delegateTask.getId(); } return null; }
public void notify(DelegateTask delegateTask) { // Note: we can't cache the result of the expression, because the // execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}' VariableScope variableScope = delegateTask.getExecution(); if (variableScope == null) { variableScope = delegateTask.getCaseExecution(); } Object delegate = expression.getValue(variableScope); applyFieldDeclaration(fieldDeclarations, delegate); if (delegate instanceof TaskListener) { try { Context.getProcessEngineConfiguration() .getDelegateInterceptor() .handleInvocation(new TaskListenerInvocation((TaskListener)delegate, delegateTask)); }catch (Exception e) { throw new ProcessEngineException("Exception while invoking TaskListener: "+e.getMessage(), e); } } else { throw new ProcessEngineException("Delegate expression " + expression + " did not resolve to an implementation of " + TaskListener.class ); } }
/** * Implementation of the event dispatching. * * @param delegateExecution * process execution */ public final void notify(DelegateTask delegateTask) { Guards.dispatch(this, delegateTask.getEventName(), delegateTask.getExecution()); } }
public void notify(DelegateTask delegateTask) { delegateTask.setVariable(delegateTask.getEventName(), true); } };
public void notify(DelegateTask delegateTask) { delegateTask.setAssignee("demo"); }
public static SelectorBuilder selector(final DelegateTask delegateTask) { return selector() .context(Context.task) .type(null) .process(GetProcessDefinitionKey.from(delegateTask)) .element(delegateTask.getTaskDefinitionKey()) .event(delegateTask.getEventName()); }
public void notify(DelegateTask delegateTask) { delegateTask.getProcessEngineServices().getTaskService().complete(delegateTask.getId()); } }
public void notify(DelegateTask delegateTask) { delegateTask.getExecution().setVariable("greeting", "Hello from " + greeter.getValue(delegateTask.getExecution())); delegateTask.getExecution().setVariable("shortName", shortName.getValue(delegateTask.getExecution())); delegateTask.setVariableLocal("myTaskVariable", "test"); }
public void notify(DelegateTask delegateTask) { ProcessEngineServices services = delegateTask.getProcessEngineServices(); RuntimeService runtimeService = services.getRuntimeService(); runtimeService.setVariable(delegateTask.getExecutionId(), "taskListenerCalled", true); }
@Override public String getTaskDefinitionKey() { if (delegateTask != null) { return delegateTask.getTaskDefinitionKey(); } return null; }
public void notify(DelegateTask delegateTask) { Set<IdentityLink> candidates = delegateTask.getCandidates(); Set<String> candidateUsers = new HashSet<String>(); Set<String> candidateGroups = new HashSet<String>(); for (IdentityLink candidate : candidates) { if (candidate.getUserId() != null) { candidateUsers.add(candidate.getUserId()); } else if (candidate.getGroupId() != null) { candidateGroups.add(candidate.getGroupId()); } } delegateTask.setVariable(VARNAME_CANDIDATE_USERS, candidateUsers); delegateTask.setVariable(VARNAME_CANDIDATE_GROUPS, candidateGroups); }
@Override public void notify(DelegateTask delegateTask) { delegateTask.setDueDate(Process.DUE_DATE); delegateTask.addCandidateGroup(Process.GROUP_1); delegateTask.addCandidateGroups(Arrays.asList(Process.GROUP_2,Process.GROUP_3)); } }