本文整理汇总了Java中org.camunda.bpm.engine.delegate.TaskListener类的典型用法代码示例。如果您正苦于以下问题:Java TaskListener类的具体用法?Java TaskListener怎么用?Java TaskListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskListener类属于org.camunda.bpm.engine.delegate包,在下文中一共展示了TaskListener类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCommand
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Override
protected CreateTaskCommand createCommand(DelegateTask task) {
return CreateTaskCommand.builder()
.taskId(task.getId())
.taskDefinitionKey(task.getTaskDefinitionKey())
.name(task.getName())
.description(task.getDescription())
.priority(task.getPriority())
.assignee(task.getAssignee())
.owner(task.getOwner())
.processInstanceId(task.getProcessInstanceId())
.caseDefinitionId(task.getCaseDefinitionId())
.caseExecutionId(task.getCaseExecutionId())
.createTime(task.getCreateTime())
.dueDate(task.getDueDate())
.formKey(getFormKey(task))
.engineId(appName)
.eventType(TaskListener.EVENTNAME_CREATE)
.tenantId(task.getTenantId())
.build();
}
开发者ID:holisticon,项目名称:camunda-bpm-cloud,代码行数:22,代码来源:TaskCreateListener.java
示例2: createCommand
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Override
protected DeleteTaskCommand createCommand(DelegateTask task) {
return DeleteTaskCommand.builder()
.taskId(task.getId())
.taskDefinitionKey(task.getTaskDefinitionKey())
.name(task.getName())
.description(task.getDescription())
.priority(task.getPriority())
.assignee(task.getAssignee())
.owner(task.getOwner())
.processInstanceId(task.getProcessInstanceId())
.caseDefinitionId(task.getCaseDefinitionId())
.caseExecutionId(task.getCaseExecutionId())
.createTime(task.getCreateTime())
.dueDate(task.getDueDate())
.formKey(getFormKey(task))
.engineId(appName)
.eventType(TaskListener.EVENTNAME_CREATE)
.tenantId(task.getTenantId())
.build();
}
开发者ID:holisticon,项目名称:camunda-bpm-cloud,代码行数:22,代码来源:TaskDeleteListener.java
示例3: createCommand
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Override
protected CompleteTaskCommand createCommand(DelegateTask task) {
return CompleteTaskCommand.builder()
.taskId(task.getId())
.taskDefinitionKey(task.getTaskDefinitionKey())
.name(task.getName())
.description(task.getDescription())
.priority(task.getPriority())
.assignee(task.getAssignee())
.owner(task.getOwner())
.processInstanceId(task.getProcessInstanceId())
.caseDefinitionId(task.getCaseDefinitionId())
.caseExecutionId(task.getCaseExecutionId())
.createTime(task.getCreateTime())
.dueDate(task.getDueDate())
.formKey(getFormKey(task))
.engineId(appName)
.eventType(TaskListener.EVENTNAME_CREATE)
.tenantId(task.getTenantId())
.build();
}
开发者ID:holisticon,项目名称:camunda-bpm-cloud,代码行数:22,代码来源:TaskCompleteListener.java
示例4: taskListenerSetsCandidateGroup
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Test
public void taskListenerSetsCandidateGroup() throws Exception {
DelegateTask delegateTask = new DelegateTaskFake()
.withTaskDefinitionKey("the_task")
.withEventName(EVENTNAME_CREATE)
.withVariableLocal("nextGroup", "foo");
TaskListener taskListener = task -> {
if (EVENTNAME_CREATE.equals(task.getEventName()) && "the_task".equals(task.getTaskDefinitionKey())) {
task.addCandidateGroup((String) task.getVariableLocal("nextGroup"));
}
};
taskListener.notify(delegateTask);
assertThat(DelegateTaskFake.candidateGroupIds(delegateTask)).containsOnly("foo");
}
开发者ID:camunda,项目名称:camunda-bpm-mockito,代码行数:20,代码来源:DelegateTaskFakeTest.java
示例5: createEvent
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
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());
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:CdiEventListener.java
示例6: notifyTaskListener
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
protected void notifyTaskListener(DelegateTask task) throws Exception {
ProcessApplicationReference processApp = Context.getCurrentProcessApplication();
try {
ProcessApplicationInterface processApplication = processApp.getProcessApplication();
TaskListener taskListener = processApplication.getTaskListener();
if(taskListener != null) {
taskListener.notify(task);
} else {
LOG.paDoesNotProvideTaskListener(processApp.getName());
}
} catch (ProcessApplicationUnavailableException e) {
// Process Application unavailable => ignore silently
LOG.cannotInvokeListenerPaUnavailable(processApp.getName(), e);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:ProcessApplicationEventListenerDelegate.java
示例7: initializeTaskListeners
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
protected void initializeTaskListeners(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, TaskDefinition taskDefinition) {
HumanTask humanTask = getDefinition(element);
List<CamundaTaskListener> listeners = queryExtensionElementsByClass(humanTask, CamundaTaskListener.class);
for (CamundaTaskListener listener : listeners) {
TaskListener taskListener = initializeTaskListener(element, activity, context, listener);
String eventName = listener.getCamundaEvent();
if (eventName != null) {
taskDefinition.addTaskListener(eventName, taskListener);
} else {
taskDefinition.addTaskListener(TaskListener.EVENTNAME_CREATE, taskListener);
taskDefinition.addTaskListener(TaskListener.EVENTNAME_ASSIGNMENT, taskListener);
taskDefinition.addTaskListener(TaskListener.EVENTNAME_COMPLETE, taskListener);
taskDefinition.addTaskListener(TaskListener.EVENTNAME_DELETE, taskListener);
}
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:HumanTaskItemHandler.java
示例8: setAssignee
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Override
public void setAssignee(String assignee) {
ensureTaskActive();
registerCommandContextCloseListener();
String oldAssignee = this.assignee;
if (assignee==null && oldAssignee==null) {
return;
}
addIdentityLinkChanges(IdentityLinkType.ASSIGNEE, oldAssignee, assignee);
propertyChanged(ASSIGNEE, oldAssignee, assignee);
this.assignee = assignee;
CommandContext commandContext = Context.getCommandContext();
// if there is no command context, then it means that the user is calling the
// setAssignee outside a service method. E.g. while creating a new task.
if (commandContext != null) {
fireEvent(TaskListener.EVENTNAME_ASSIGNMENT);
if (commandContext.getDbEntityManager().contains(this)) {
fireAssigneeAuthorizationProvider(oldAssignee, assignee);
fireHistoricIdentityLinks();
}
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:TaskEntity.java
示例9: fireEvent
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
public void fireEvent(String taskEventName) {
List<TaskListener> taskEventListeners = getListenersForEvent(taskEventName);
if (taskEventListeners != null) {
for (TaskListener taskListener : taskEventListeners) {
CoreExecution execution = getExecution();
if (execution == null) {
execution = getCaseExecution();
}
if (execution != null) {
setEventName(taskEventName);
}
try {
TaskListenerInvocation listenerInvocation = new TaskListenerInvocation(taskListener, this, execution);
Context.getProcessEngineConfiguration()
.getDelegateInterceptor()
.handleInvocation(listenerInvocation);
} catch (Exception e) {
throw LOG.invokeTaskListenerException(e);
}
}
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:TaskEntity.java
示例10: notify
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
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 );
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:DelegateExpressionTaskListener.java
示例11: parseTaskListeners
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
protected void parseTaskListeners(Element userTaskElement, TaskDefinition taskDefinition) {
Element extentionsElement = userTaskElement.element("extensionElements");
if (extentionsElement != null) {
List<Element> taskListenerElements = extentionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, "taskListener");
for (Element taskListenerElement : taskListenerElements) {
String eventName = taskListenerElement.attribute("event");
if (eventName != null) {
if (TaskListener.EVENTNAME_CREATE.equals(eventName) || TaskListener.EVENTNAME_ASSIGNMENT.equals(eventName)
|| TaskListener.EVENTNAME_COMPLETE.equals(eventName) || TaskListener.EVENTNAME_DELETE.equals(eventName)) {
TaskListener taskListener = parseTaskListener(taskListenerElement);
taskDefinition.addTaskListener(eventName, taskListener);
} else {
addError("Attribute 'event' must be one of {create|assignment|complete|delete}", userTaskElement);
}
} else {
addError("Attribute 'event' is mandatory on taskListener", userTaskElement);
}
}
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:BpmnParse.java
示例12: testDeleteProcessInstanceSkipCustomTaskListeners
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Deployment
@Test
public void testDeleteProcessInstanceSkipCustomTaskListeners() {
// given a process instance
ProcessInstance instance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
// and an empty task listener invocation storage
RecorderTaskListener.clear();
// if we do not skip the custom listeners
runtimeService.deleteProcessInstance(instance.getId(), null, false);
// then the the custom listener is invoked
assertEquals(1, RecorderTaskListener.getRecordedEvents().size());
assertEquals(TaskListener.EVENTNAME_DELETE, RecorderTaskListener.getRecordedEvents().get(0).getEvent());
// if we do skip the custom listeners
instance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
RecorderTaskListener.clear();
runtimeService.deleteProcessInstance(instance.getId(), null, true);
// then the the custom listener is not invoked
assertTrue(RecorderTaskListener.getRecordedEvents().isEmpty());
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:27,代码来源:RuntimeServiceTest.java
示例13: testDoesNotImplementTaskListenerInterfaceByClass
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Deployment(resources = {"org/camunda/bpm/engine/test/cmmn/tasklistener/TaskListenerTest.testDoesNotImplementTaskListenerInterfaceByClass.cmmn"})
public void testDoesNotImplementTaskListenerInterfaceByClass() {
try {
caseService
.withCaseDefinitionByKey("case")
.create()
.getId();
fail("exception expected");
} catch (Exception e) {
// then
Throwable cause = e.getCause();
String message = cause.getMessage();
assertTextPresent("NotTaskListener doesn't implement "+TaskListener.class, message);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:TaskListenerTest.java
示例14: testDoesNotImplementTaskListenerInterfaceByDelegateExpression
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Deployment(resources = {"org/camunda/bpm/engine/test/cmmn/tasklistener/TaskListenerTest.testDoesNotImplementTaskListenerInterfaceByDelegateExpression.cmmn"})
public void testDoesNotImplementTaskListenerInterfaceByDelegateExpression() {
try {
caseService
.withCaseDefinitionByKey("case")
.setVariable("myTaskListener", new NotTaskListener())
.create()
.getId();
fail("exception expected");
} catch (Exception e) {
// then
Throwable cause = e.getCause();
String message = cause.getMessage();
assertTextPresent("Delegate expression ${myTaskListener} did not resolve to an implementation of interface "+TaskListener.class.getName(), message);
}
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:TaskListenerTest.java
示例15: testGetBpmnModelElementInstanceOnAssignment
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
public void testGetBpmnModelElementInstanceOnAssignment() {
String eventName = TaskListener.EVENTNAME_ASSIGNMENT;
deployProcess(eventName);
runtimeService.startProcessInstanceByKey(PROCESS_ID);
assertNull(ModelExecutionContextTaskListener.modelInstance);
assertNull(ModelExecutionContextTaskListener.userTask);
String taskId = taskService.createTaskQuery().singleResult().getId();
taskService.setAssignee(taskId, "demo");
assertModelInstance();
assertUserTask(eventName);
taskService.complete(taskId);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:UserTaskBpmnModelExecutionContextTest.java
示例16: testGetBpmnModelElementInstanceOnComplete
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
public void testGetBpmnModelElementInstanceOnComplete() {
String eventName = TaskListener.EVENTNAME_COMPLETE;
deployProcess(eventName);
runtimeService.startProcessInstanceByKey(PROCESS_ID);
assertNull(ModelExecutionContextTaskListener.modelInstance);
assertNull(ModelExecutionContextTaskListener.userTask);
String taskId = taskService.createTaskQuery().singleResult().getId();
taskService.setAssignee(taskId, "demo");
assertNull(ModelExecutionContextTaskListener.modelInstance);
assertNull(ModelExecutionContextTaskListener.userTask);
taskService.complete(taskId);
assertModelInstance();
assertUserTask(eventName);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:UserTaskBpmnModelExecutionContextTest.java
示例17: testCompleteTaskInCreateTaskListener
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Test
public void testCompleteTaskInCreateTaskListener() {
// given process with user task and task create listener
BpmnModelInstance modelInstance =
Bpmn.createExecutableProcess("startToEnd")
.startEvent()
.userTask()
.camundaTaskListenerClass(TaskListener.EVENTNAME_CREATE, TaskCreateListener.class.getName())
.name("userTask")
.endEvent().done();
testRule.deploy(modelInstance);
// when process is started and user task completed in task create listener
runtimeService.startProcessInstanceByKey("startToEnd");
// then task is successfully completed without an exception
assertNull(taskService.createTaskQuery().singleResult());
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:TaskListenerTest.java
示例18: testCompleteTaskInCreateTaskListenerWithIdentityLinks
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Test
public void testCompleteTaskInCreateTaskListenerWithIdentityLinks() {
// given process with user task, identity links and task create listener
BpmnModelInstance modelInstance =
Bpmn.createExecutableProcess("startToEnd")
.startEvent()
.userTask()
.camundaTaskListenerClass(TaskListener.EVENTNAME_CREATE, TaskCreateListener.class.getName())
.name("userTask")
.camundaCandidateUsers(Arrays.asList(new String[]{"users1", "user2"}))
.camundaCandidateGroups(Arrays.asList(new String[]{"group1", "group2"}))
.endEvent().done();
testRule.deploy(modelInstance);
// when process is started and user task completed in task create listener
runtimeService.startProcessInstanceByKey("startToEnd");
// then task is successfully completed without an exception
assertNull(taskService.createTaskQuery().singleResult());
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:TaskListenerTest.java
示例19: testCompleteTaskOnCreateListenerWithFollowingCallActivity
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
@Test
public void testCompleteTaskOnCreateListenerWithFollowingCallActivity() {
final BpmnModelInstance subProcess = Bpmn.createExecutableProcess("subProc")
.startEvent()
.userTask("calledTask")
.endEvent()
.done();
final BpmnModelInstance instance = Bpmn.createExecutableProcess("mainProc")
.startEvent()
.userTask("mainTask")
.camundaTaskListenerClass(TaskListener.EVENTNAME_CREATE, CreateTaskListener.class.getName())
.callActivity().calledElement("subProc")
.endEvent()
.done();
testRule.deploy(subProcess);
testRule.deploy(instance);
engineRule.getRuntimeService().startProcessInstanceByKey("mainProc");
Task task = engineRule.getTaskService().createTaskQuery().singleResult();
Assert.assertEquals(task.getTaskDefinitionKey(), "calledTask");
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:TaskListenerTest.java
示例20: registerOnTaskCreate
import org.camunda.bpm.engine.delegate.TaskListener; //导入依赖的package包/类
/**
* Registers the {@link #apply(TaskAssignmentCommand)} method to run on each
* task creation.
*
* @param camundaEventBus the camundaEventBus to register on
*/
@Autowired
void registerOnTaskCreate(CamundaEventBus camundaEventBus) {
camundaEventBus.register(SelectorBuilder.selector().bpmn().task().event(EVENTNAME_CREATE),
(TaskListener) delegateTask -> {
final TaskAssignmentCommand command = TaskAssignmentCommand.from(delegateTask);
CandidateGroup candidateGroup = this.apply(command);
delegateTask.addCandidateGroup(candidateGroup.getName());
});
}
开发者ID:holisticon,项目名称:holunda,代码行数:16,代码来源:TaskAssignmentProcess.java
注:本文中的org.camunda.bpm.engine.delegate.TaskListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论