本文整理汇总了Java中org.camunda.bpm.engine.delegate.DelegateExecution.getCurrentActivityId方法的典型用法代码示例。如果您正苦于以下问题:Java DelegateExecution.getCurrentActivityId方法的具体用法?Java DelegateExecution.getCurrentActivityId怎么用?Java DelegateExecution.getCurrentActivityId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.delegate.DelegateExecution
的用法示例。
在下文中一共展示了DelegateExecution.getCurrentActivityId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Override
public void execute(DelegateExecution context) throws Exception {
String traceId = context.getProcessBusinessKey();
String eventNameString = null;
if (eventName!=null && eventName.getValue(context)!=null) {
eventNameString = (String) eventName.getValue(context);
} else {
// if not configured we use the element id from the flow definition as default
eventNameString = context.getCurrentActivityId();
}
messageSender.send(new Message<String>( //
eventNameString, //
traceId, //
null)); // no payload at the moment
}
示例2: notify
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Override
public void notify(DelegateExecution execution) throws Exception {
LOGGER.info("Timer fired at " + new Date() + " in Scope " + execution.getId());
// fetch the BPMN model ID of the timer event
String timerEventId = execution.getCurrentActivityId();
// get the task this timer event is attached to
Job timerJob = execution.getProcessEngineServices().getManagementService().createJobQuery()
.activityId(timerEventId).singleResult();
Task task = execution.getProcessEngineServices().getTaskService().createTaskQuery()
.executionId(timerJob.getExecutionId()).singleResult();
if (task.getFollowUpDate() != null && task.getFollowUpDate().before(new Date())) {
LOGGER.info("the follow up date (" + task.getFollowUpDate()
+ ") of the User Task was reached");
execution.getProcessEngineServices().getRuntimeService().setVariableLocal(
task.getExecutionId(), "demoTaskBoundaryEvent.followUpDateReached", true);
}
// set a trigger marker variable on the local task scope
execution.getProcessEngineServices().getRuntimeService()
.setVariableLocal(task.getExecutionId(), "demoTaskBoundaryEvent.fired", true);
}
示例3: createEvent
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
protected BusinessProcessEvent createEvent(DelegateExecution execution) {
ProcessDefinition processDefinition = Context.getExecutionContext().getProcessDefinition();
// map type
String eventName = execution.getEventName();
BusinessProcessEventType type = null;
if(ExecutionListener.EVENTNAME_START.equals(eventName)) {
type = BusinessProcessEventType.START_ACTIVITY;
} else if(ExecutionListener.EVENTNAME_END.equals(eventName)) {
type = BusinessProcessEventType.END_ACTIVITY;
} else if(ExecutionListener.EVENTNAME_TAKE.equals(eventName)) {
type = BusinessProcessEventType.TAKE;
}
return new CdiBusinessProcessEvent(execution.getCurrentActivityId(), execution.getCurrentTransitionId(), processDefinition, execution, type, ClockUtil.getCurrentTime());
}
示例4: fromExecution
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public static DelegateEvent fromExecution(DelegateExecution delegateExecution) {
DelegateEvent event = new DelegateEvent();
event.activityInstanceId = delegateExecution.getActivityInstanceId();
event.businessKey = delegateExecution.getBusinessKey();
event.currentActivityId = delegateExecution.getCurrentActivityId();
event.currentActivityName = delegateExecution.getCurrentActivityName();
event.currentTransitionId = delegateExecution.getCurrentTransitionId();
event.eventName = delegateExecution.getEventName();
event.id = delegateExecution.getId();
event.parentActivityInstanceId = delegateExecution.getParentActivityInstanceId();
event.parentId = delegateExecution.getParentId();
event.processBusinessKey = delegateExecution.getProcessBusinessKey();
event.processDefinitionId = delegateExecution.getProcessDefinitionId();
event.processInstanceId = delegateExecution.getProcessInstanceId();
event.tenantId = delegateExecution.getTenantId();
event.variableScopeKey = delegateExecution.getVariableScopeKey();
return event;
}
示例5: handleProcessLog
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
/**
* Checks if the current execution matches the configuration. If {@code yes} performs desired
* operation; here just prints a message that was specified in the DMN model.
*
* @param execution the current execution
*/
private void handleProcessLog(final DelegateExecution execution) {
if (execution.getCurrentActivityId() != null && execution.getEventName() != null) {
VariableMap variables =
Variables.putValue("activityId", execution.getCurrentActivityId())
.putValue("eventName", execution.getEventName());
DmnDecisionTableResult result =
dmnEngine.evaluateDecisionTable(eventLogDecision, variables);
if (!result.isEmpty()) {
// the configuration matched the event
System.out.println(">>> " + result.getSingleEntry().toString());
}
}
}
示例6: selector
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public static SelectorBuilder selector(final DelegateExecution delegateExecution) {
String typeName = extractTypeName(delegateExecution);
String element = ("sequenceFlow".equals(typeName))
? delegateExecution.getCurrentTransitionId()
: delegateExecution.getCurrentActivityId();
return selector()
.context(Context.bpmn)
.type(typeName)
.process(GetProcessDefinitionKey.from(delegateExecution))
.element(element)
.event(delegateExecution.getEventName());
}
示例7: testIntermediateTimerEvent
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Deployment
public void testIntermediateTimerEvent() {
// given
final List<String> timerEvents = new ArrayList<String>();
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication() {
public ExecutionListener getExecutionListener() {
return new ExecutionListener() {
public void notify(DelegateExecution delegateExecution) {
String currentActivityId = delegateExecution.getCurrentActivityId();
String eventName = delegateExecution.getEventName();
if ("timer".equals(currentActivityId) &&
(ExecutionListener.EVENTNAME_START.equals(eventName) || ExecutionListener.EVENTNAME_END.equals(eventName))) {
timerEvents.add(delegateExecution.getEventName());
}
}
};
}
};
// register app so that it is notified about events
managementService.registerProcessApplication(deploymentId, processApplication.getReference());
// when
runtimeService.startProcessInstanceByKey("process");
String jobId = managementService.createJobQuery().singleResult().getId();
managementService.executeJob(jobId);
// then
assertEquals(2, timerEvents.size());
// "start" event listener
assertEquals(ExecutionListener.EVENTNAME_START, timerEvents.get(0));
// "end" event listener
assertEquals(ExecutionListener.EVENTNAME_END, timerEvents.get(1));
}
示例8: testIntermediateSignalEvent
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Deployment
public void testIntermediateSignalEvent() {
// given
final List<String> timerEvents = new ArrayList<String>();
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication() {
public ExecutionListener getExecutionListener() {
return new ExecutionListener() {
public void notify(DelegateExecution delegateExecution) {
String currentActivityId = delegateExecution.getCurrentActivityId();
String eventName = delegateExecution.getEventName();
if ("signal".equals(currentActivityId) &&
(ExecutionListener.EVENTNAME_START.equals(eventName) || ExecutionListener.EVENTNAME_END.equals(eventName))) {
timerEvents.add(delegateExecution.getEventName());
}
}
};
}
};
// register app so that it is notified about events
managementService.registerProcessApplication(deploymentId, processApplication.getReference());
// when
runtimeService.startProcessInstanceByKey("process");
runtimeService.signalEventReceived("abort");
// then
assertEquals(2, timerEvents.size());
// "start" event listener
assertEquals(ExecutionListener.EVENTNAME_START, timerEvents.get(0));
// "end" event listener
assertEquals(ExecutionListener.EVENTNAME_END, timerEvents.get(1));
}
示例9: notify
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void notify(DelegateExecution execution) throws Exception {
String counterKey = execution.getCurrentActivityId() + "-" +execution.getEventName();
collectedEvents.add(counterKey);
}
示例10: createCoveredFlowNode
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
private CoveredFlowNode createCoveredFlowNode(DelegateExecution execution) {
// Get the process definition in order to obtain the key
final RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService();
final ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(
execution.getProcessDefinitionId()).singleResult();
final String currentActivityId = execution.getCurrentActivityId();
final CoveredFlowNode coveredFlowNode = new CoveredFlowNode(processDefinition.getKey(), currentActivityId);
return coveredFlowNode;
}
开发者ID:camunda,项目名称:camunda-bpm-process-test-coverage,代码行数:14,代码来源:IntermediateEventExecutionListener.java