本文整理汇总了Java中org.activiti.engine.delegate.event.ActivitiEvent类的典型用法代码示例。如果您正苦于以下问题:Java ActivitiEvent类的具体用法?Java ActivitiEvent怎么用?Java ActivitiEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActivitiEvent类属于org.activiti.engine.delegate.event包,在下文中一共展示了ActivitiEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEvent
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
switch (event.getType()) {
case ACTIVITY_STARTED:
this.onActivityStart((ActivitiActivityEvent) event);
break;
case ACTIVITY_COMPLETED:
this.onActivityEnd((ActivitiActivityEvent) event);
break;
default:
logger.debug("Event received: {}", event.getType());
}
}
示例2: onEvent
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public void onEvent(ActivitiEvent event) {
if (!(event instanceof ActivitiSequenceFlowTakenEvent)) {
return;
}
ActivitiSequenceFlowTakenEvent activitiSequenceFlowTakenEvent = (ActivitiSequenceFlowTakenEvent) event;
String code = activitiSequenceFlowTakenEvent.getId();
String sourceCode = activitiSequenceFlowTakenEvent
.getSourceActivityId();
String targetCode = activitiSequenceFlowTakenEvent
.getTargetActivityId();
String processInstanceId = activitiSequenceFlowTakenEvent
.getProcessInstanceId();
BpmSequence bpmSequence = new BpmSequence();
bpmSequence.setCode(code);
bpmSequence.setSourceCode(sourceCode);
bpmSequence.setTargetCode(targetCode);
bpmSequence.setProcessInstanceId(processInstanceId);
bpmSequence.setCreateTime(new Date());
bpmSequenceManager.save(bpmSequence);
}
示例3: onEvent
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public void onEvent(ActivitiEvent event) {
if (!(event instanceof ActivitiEntityEventImpl)) {
return;
}
ActivitiEntityEventImpl activitiEntityEventImpl = (ActivitiEntityEventImpl) event;
Object entity = activitiEntityEventImpl.getEntity();
if (!(entity instanceof TaskEntity)) {
return;
}
TaskEntity taskEntity = (TaskEntity) entity;
try {
switch (event.getType()) {
case TASK_CREATED:
logger.debug("create : {}", taskEntity.getId());
this.onCreate(taskEntity);
break;
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
示例4: handle
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void handle(ActivitiEvent event) {
/*ActivitiEntityEventImpl activitiEvent = (ActivitiEntityEventImpl) event;
TaskEntity taskEntity = (TaskEntity) activitiEvent.getEntity();
System.out.println("---------------指定委托人:-----------------"+taskEntity.getId());
//------------------------获取委托人-----------------------------
if(!StrUtil.isEmpty(taskEntity.getAssignee())) {
String attorney=delegateService.getAttorneyByAssignee(taskEntity.getAssignee());
if(!StrUtil.isEmpty(attorney)) {
System.out.println("------任务委托------任务ID:"+taskEntity.getId()+"委托人:"+taskEntity.getAssignee()+";被委托人ID:"+attorney);
taskEntity.delegate(attorney);
}
//taskEntity.setAssignee(attorney);
}*/
}
示例5: onEvent
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
ActivitiEntityEvent entityEvent = (ActivitiEntityEvent) event;
Object entity = entityEvent.getEntity();
if (entity instanceof TaskEntity) {
TaskEntity task = (TaskEntity) entity;
String originUserId = task.getAssignee();
String newUserId = userMap.get(originUserId);
if (StringUtils.isNotBlank(newUserId)) {
task.setAssignee(newUserId);
TaskService taskService = event.getEngineServices().getTaskService();
String message = getClass().getName() + "-> 任务[" + task.getName() + "]的办理人[" +
originUserId + "]自动转办给了用户[" + newUserId + "]";
taskService.addComment(task.getId(), task.getProcessInstanceId(), "redirect", message);
}
}
}
示例6: onEvent
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
if (!isEventValid(event)) {
return;
}
String processInstanceId = event.getProcessInstanceId();
String correlationId = getCorrelationId(event);
new SafeExecutor().executeSafely(() -> {
new ProcessConflictPreventer(getOperationDao()).attemptToReleaseLock(correlationId);
});
new SafeExecutor().executeSafely(() -> {
setOperationInAbortedState(correlationId);
});
HistoryService historyService = event.getEngineServices().getHistoryService();
new SafeExecutor().executeSafely(() -> {
deleteAllocatedRoutes(historyService, processInstanceId);
});
new SafeExecutor().executeSafely(() -> {
deleteDeploymentFiles(historyService, processInstanceId);
});
new SafeExecutor().executeSafely(() -> {
new ClientReleaser(event, getClientProvider()).releaseClient();
});
new SafeExecutor().executeSafely(() -> {
if (configuration.shouldGatherUsageStatistics()) {
sendStatistics(event);
}
});
}
示例7: getCorrelationId
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
private String getCorrelationId(ActivitiEvent event) {
HistoricVariableInstance correlationId = getHistoricVarInstanceValue(event.getEngineServices().getHistoryService(),
event.getProcessInstanceId(), Constants.VAR_CORRELATION_ID);
if (correlationId != null) {
return (String) correlationId.getValue();
}
// The process was started before we introduced subprocesses in our BPMN
// diagrams. Therefore, the correlation ID is the ID of the
// process instance.
return event.getProcessInstanceId();
}
示例8: onEvent
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
String eventType=event.getType().name();
//根据事件的类型ID,找到对应的事件处理器
String eventHandlerBeanId=handlers.get(eventType);
if(eventHandlerBeanId!=null){
EventHandler handler=(EventHandler) SpringContextUtil.getBean(eventHandlerBeanId);
handler.handle(event);
}
}
示例9: onEvent
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public void onEvent(ActivitiEvent event) {
switch (event.getType()) {
case VARIABLE_CREATED:
ActivitiVariableEvent variableEvent = (ActivitiVariableEvent) event;
System.out.println("创建了变量: " + variableEvent.getVariableName() + ", 值:" + variableEvent.getVariableValue());
break;
default:
System.out.println("Event received: " + event.getType());
}
}
示例10: onEvent
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
switch (event.getType()) {
case ACTIVITY_STARTED: {
broadcastEvent((ActivitiActivityEvent)event);
break;
}
case ACTIVITY_COMPLETED: {
broadcastEvent((ActivitiActivityEvent)event);
break;
}
}
}
示例11: onEvent
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public void onEvent(ActivitiEvent event) {
if (!(event instanceof ActivitiEntityEventImpl)) {
return;
}
ActivitiEntityEventImpl activitiEntityEventImpl = (ActivitiEntityEventImpl) event;
Object entity = activitiEntityEventImpl.getEntity();
if (!(entity instanceof TaskEntity)) {
return;
}
TaskEntity taskEntity = (TaskEntity) entity;
try {
switch (event.getType()) {
case TASK_CREATED:
logger.debug("create : {}", taskEntity.getId());
this.onCreate(taskEntity);
break;
case TASK_ASSIGNED:
logger.debug("assign : {}", taskEntity.getId());
this.onAssign(taskEntity);
break;
case TASK_COMPLETED:
logger.debug("complete : {}", taskEntity.getId());
this.onComplete(taskEntity);
break;
case ENTITY_DELETED:
logger.debug("delete : {}", taskEntity.getId());
this.onDelete(taskEntity);
break;
default:
logger.debug("{} : {}", event.getType(), taskEntity.getId());
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
示例12: onInitialized
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
protected void onInitialized(ActivitiEvent event) {
if (!(event instanceof ActivitiEntityEventImpl)) {
return;
}
ActivitiEntityEventImpl activitiEntityEventImpl = (ActivitiEntityEventImpl) event;
Object entity = activitiEntityEventImpl.getEntity();
if (!(entity instanceof ExecutionEntity)) {
return;
}
ExecutionEntity executionEntity = (ExecutionEntity) entity;
if (!executionEntity.isProcessInstanceType()) {
return;
}
String processInstanceId = executionEntity.getId();
String processDefinitionId = executionEntity.getProcessDefinitionId();
CommandContext commandContext = Context.getCommandContext();
ProcessDefinitionEntity processDefinition = new GetDeploymentProcessDefinitionCmd(
processDefinitionId).execute(commandContext);
// {流程标题:title}-{发起人:startUser}-{发起时间:startTime}
String processDefinitionName = processDefinition.getName();
if (processDefinitionName == null) {
processDefinitionName = processDefinition.getKey();
}
String userId = Authentication.getAuthenticatedUserId();
String displayName = userConnector.findById(userId).getDisplayName();
String processInstanceName = processDefinitionName + "-" + displayName
+ "-"
+ new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
// runtime
executionEntity.setName(processInstanceName);
// history
HistoricProcessInstanceEntity historicProcessInstanceEntity = commandContext
.getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(processInstanceId);
historicProcessInstanceEntity.setName(processInstanceName);
}
示例13: ActivitiEventToDelegateExecutionAdapter
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public ActivitiEventToDelegateExecutionAdapter(ActivitiEvent event) {
this.event = event;
}
示例14: ClientReleaser
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public ClientReleaser(ActivitiEvent event, CloudFoundryClientProvider clientProvider) {
this.event = event;
this.clientProvider = clientProvider;
}
示例15: sendStatistics
import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
protected void sendStatistics(ActivitiEvent event) {
DelegateExecution context = new ActivitiEventToDelegateExecutionAdapter(event);
RestTemplate restTemplate = new RestTemplate();
AnalyticsData collectedData = dataSender.collectAnalyticsData(context, State.ABORTED);
dataSender.sendCollectedData(restTemplate, dataSender.convertCollectedAnalyticsDataToXml(context, collectedData));
}