Java Code Examples for org.flowable.engine.impl.persistence.entity.ExecutionEntity#getEventSubscriptions()
The following examples show how to use
org.flowable.engine.impl.persistence.entity.ExecutionEntity#getEventSubscriptions() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BoundarySignalEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void trigger(DelegateExecution execution, String triggerName, Object triggerData) { ExecutionEntity executionEntity = (ExecutionEntity) execution; BoundaryEvent boundaryEvent = (BoundaryEvent) execution.getCurrentFlowElement(); if (boundaryEvent.isCancelActivity()) { String eventName = EventDefinitionExpressionUtil.determineSignalName(Context.getCommandContext(), signalEventDefinition, ProcessDefinitionUtil.getBpmnModel(execution.getProcessDefinitionId()), execution); EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (eventSubscription instanceof SignalEventSubscriptionEntity && eventSubscription.getEventName().equals(eventName)) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } } super.trigger(executionEntity, triggerName, triggerData); }
Example 2
Source File: BoundaryCompensateEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void trigger(DelegateExecution execution, String triggerName, Object triggerData) { ExecutionEntity executionEntity = (ExecutionEntity) execution; BoundaryEvent boundaryEvent = (BoundaryEvent) execution.getCurrentFlowElement(); if (boundaryEvent.isCancelActivity()) { EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (eventSubscription instanceof CompensateEventSubscriptionEntity && eventSubscription.getActivityId().equals(compensateEventDefinition.getActivityRef())) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } } super.trigger(executionEntity, triggerName, triggerData); }
Example 3
Source File: BoundaryMessageEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void trigger(DelegateExecution execution, String triggerName, Object triggerData) { ExecutionEntity executionEntity = (ExecutionEntity) execution; BoundaryEvent boundaryEvent = (BoundaryEvent) execution.getCurrentFlowElement(); if (boundaryEvent.isCancelActivity()) { String messageName = EventDefinitionExpressionUtil.determineMessageName(Context.getCommandContext(), messageEventDefinition, execution); EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (eventSubscription instanceof MessageEventSubscriptionEntity && eventSubscription.getEventName().equals(messageName)) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } } super.trigger(executionEntity, triggerName, triggerData); }
Example 4
Source File: ReceiveEventTaskActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void trigger(DelegateExecution execution, String signalName, Object signalData) { ExecutionEntity executionEntity = (ExecutionEntity) execution; Object eventInstance = execution.getTransientVariables().get(EventConstants.EVENT_INSTANCE); if (eventInstance instanceof EventInstance) { EventInstanceBpmnUtil.handleEventInstanceOutParameters(execution, execution.getCurrentFlowElement(), (EventInstance) eventInstance); } EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); CommandContext commandContext = Context.getCommandContext(); String eventDefinitionKey = getEventDefinitionKey(commandContext, executionEntity); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (Objects.equals(eventDefinitionKey, eventSubscription.getEventType())) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } super.leave(execution); }
Example 5
Source File: IntermediateCatchEventRegistryEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
protected ExecutionEntity deleteEventSubscription(DelegateExecution execution) { ExecutionEntity executionEntity = (ExecutionEntity) execution; Object eventInstance = execution.getTransientVariables().get(EventConstants.EVENT_INSTANCE); if (eventInstance instanceof EventInstance) { EventInstanceBpmnUtil.handleEventInstanceOutParameters(execution, execution.getCurrentFlowElement(), (EventInstance) eventInstance); } EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); CommandContext commandContext = Context.getCommandContext(); String eventDefinitionKey = getEventDefinitionKey(commandContext, executionEntity); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (Objects.equals(eventDefinitionKey, eventSubscription.getEventType())) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } return executionEntity; }
Example 6
Source File: IntermediateCatchMessageEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
protected ExecutionEntity deleteMessageEventSubScription(DelegateExecution execution) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntity executionEntity = (ExecutionEntity) execution; EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(commandContext); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); String messageName = EventDefinitionExpressionUtil.determineMessageName(commandContext, messageEventDefinition, execution); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (eventSubscription instanceof MessageEventSubscriptionEntity && eventSubscription.getEventName().equals(messageName)) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } return executionEntity; }
Example 7
Source File: BoundaryEventRegistryEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void trigger(DelegateExecution execution, String triggerName, Object triggerData) { ExecutionEntity executionEntity = (ExecutionEntity) execution; BoundaryEvent boundaryEvent = (BoundaryEvent) execution.getCurrentFlowElement(); Object eventInstance = execution.getTransientVariables().get(EventConstants.EVENT_INSTANCE); if (eventInstance instanceof EventInstance) { EventInstanceBpmnUtil.handleEventInstanceOutParameters(execution, boundaryEvent, (EventInstance) eventInstance); } if (boundaryEvent.isCancelActivity()) { EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); CommandContext commandContext = Context.getCommandContext(); String eventDefinitionKey = getEventDefinitionKey(commandContext, executionEntity); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (Objects.equals(eventDefinitionKey, eventSubscription.getEventType())) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } } super.trigger(executionEntity, triggerName, triggerData); }
Example 8
Source File: IntermediateCatchSignalEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
protected ExecutionEntity deleteSignalEventSubscription(DelegateExecution execution) { ExecutionEntity executionEntity = (ExecutionEntity) execution; String eventName = EventDefinitionExpressionUtil.determineSignalName(Context.getCommandContext(), signalEventDefinition, ProcessDefinitionUtil.getBpmnModel(execution.getProcessDefinitionId()), execution); EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (eventSubscription instanceof SignalEventSubscriptionEntity && eventSubscription.getEventName().equals(eventName)) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } return executionEntity; }
Example 9
Source File: SendEventTaskActivityBehavior.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public void trigger(DelegateExecution execution, String signalName, Object signalData) { if (sendEventServiceTask.isTriggerable()) { Object eventInstance = execution.getTransientVariables().get(EventConstants.EVENT_INSTANCE); if (eventInstance instanceof EventInstance) { EventInstanceBpmnUtil.handleEventInstanceOutParameters(execution, sendEventServiceTask, (EventInstance) eventInstance); } CommandContext commandContext = CommandContextUtil.getCommandContext(); EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(commandContext); ExecutionEntity executionEntity = (ExecutionEntity) execution; List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); String eventType = null; if (StringUtils.isNotEmpty(sendEventServiceTask.getTriggerEventType())) { eventType = sendEventServiceTask.getTriggerEventType(); } else { eventType = sendEventServiceTask.getEventType(); } EventModel eventModel = null; if (Objects.equals(ProcessEngineConfiguration.NO_TENANT_ID, execution.getTenantId())) { eventModel = CommandContextUtil.getEventRepositoryService(commandContext).getEventModelByKey(eventType); } else { eventModel = CommandContextUtil.getEventRepositoryService(commandContext).getEventModelByKey(eventType, execution.getTenantId()); } for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (Objects.equals(eventModel.getKey(), eventSubscription.getEventType())) { eventSubscriptionService.deleteEventSubscription(eventSubscription); } } leave(execution); } }
Example 10
Source File: EventSubProcessSignalStartEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public void trigger(DelegateExecution execution, String triggerName, Object triggerData) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext); ExecutionEntity executionEntity = (ExecutionEntity) execution; String eventName = EventDefinitionExpressionUtil.determineSignalName(commandContext, signalEventDefinition, ProcessDefinitionUtil.getBpmnModel(execution.getProcessDefinitionId()), execution); StartEvent startEvent = (StartEvent) execution.getCurrentFlowElement(); if (startEvent.isInterrupting()) { List<ExecutionEntity> childExecutions = executionEntityManager.collectChildren(executionEntity.getParent()); for (int i = childExecutions.size() - 1; i >= 0; i--) { ExecutionEntity childExecutionEntity = childExecutions.get(i); if (!childExecutionEntity.isEnded() && !childExecutionEntity.getId().equals(executionEntity.getId())) { executionEntityManager.deleteExecutionAndRelatedData(childExecutionEntity, DeleteReason.EVENT_SUBPROCESS_INTERRUPTING + "(" + startEvent.getId() + ")", false); } } EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(commandContext); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (eventSubscription instanceof SignalEventSubscriptionEntity && eventSubscription.getEventName().equals(eventName)) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } } ExecutionEntity newSubProcessExecution = executionEntityManager.createChildExecution(executionEntity.getParent()); newSubProcessExecution.setCurrentFlowElement((SubProcess) executionEntity.getCurrentFlowElement().getParentContainer()); newSubProcessExecution.setEventScope(false); newSubProcessExecution.setScope(true); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(newSubProcessExecution); ExecutionEntity outgoingFlowExecution = executionEntityManager.createChildExecution(newSubProcessExecution); outgoingFlowExecution.setCurrentFlowElement(startEvent); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(outgoingFlowExecution); leave(outgoingFlowExecution); }
Example 11
Source File: EventSubProcessMessageStartEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public void trigger(DelegateExecution execution, String triggerName, Object triggerData) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext); ExecutionEntity executionEntity = (ExecutionEntity) execution; StartEvent startEvent = (StartEvent) execution.getCurrentFlowElement(); if (startEvent.isInterrupting()) { List<ExecutionEntity> childExecutions = executionEntityManager.collectChildren(executionEntity.getParent()); for (int i = childExecutions.size() - 1; i >= 0; i--) { ExecutionEntity childExecutionEntity = childExecutions.get(i); if (!childExecutionEntity.isEnded() && !childExecutionEntity.getId().equals(executionEntity.getId())) { executionEntityManager.deleteExecutionAndRelatedData(childExecutionEntity, DeleteReason.EVENT_SUBPROCESS_INTERRUPTING + "(" + startEvent.getId() + ")", false); } } EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(commandContext); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); String messageName = EventDefinitionExpressionUtil.determineMessageName(commandContext, messageEventDefinition, execution); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (eventSubscription instanceof MessageEventSubscriptionEntity && eventSubscription.getEventName().equals(messageName)) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } } ExecutionEntity newSubProcessExecution = executionEntityManager.createChildExecution(executionEntity.getParent()); newSubProcessExecution.setCurrentFlowElement((SubProcess) executionEntity.getCurrentFlowElement().getParentContainer()); newSubProcessExecution.setEventScope(false); newSubProcessExecution.setScope(true); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(newSubProcessExecution); ExecutionEntity outgoingFlowExecution = executionEntityManager.createChildExecution(newSubProcessExecution); outgoingFlowExecution.setCurrentFlowElement(startEvent); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(outgoingFlowExecution); leave(outgoingFlowExecution); }
Example 12
Source File: EventSubProcessEventRegistryStartEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public void trigger(DelegateExecution execution, String triggerName, Object triggerData) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext); ExecutionEntity executionEntity = (ExecutionEntity) execution; StartEvent startEvent = (StartEvent) execution.getCurrentFlowElement(); if (startEvent.isInterrupting()) { List<ExecutionEntity> childExecutions = executionEntityManager.collectChildren(executionEntity.getParent()); for (int i = childExecutions.size() - 1; i >= 0; i--) { ExecutionEntity childExecutionEntity = childExecutions.get(i); if (!childExecutionEntity.isEnded() && !childExecutionEntity.getId().equals(executionEntity.getId())) { executionEntityManager.deleteExecutionAndRelatedData(childExecutionEntity, DeleteReason.EVENT_SUBPROCESS_INTERRUPTING + "(" + startEvent.getId() + ")", false); } } EventSubscriptionService eventSubscriptionService = CommandContextUtil.getEventSubscriptionService(commandContext); List<EventSubscriptionEntity> eventSubscriptions = executionEntity.getEventSubscriptions(); for (EventSubscriptionEntity eventSubscription : eventSubscriptions) { if (Objects.equals(eventDefinitionKey, eventSubscription.getEventType())) { eventSubscriptionService.deleteEventSubscription(eventSubscription); CountingEntityUtil.handleDeleteEventSubscriptionEntityCount(eventSubscription); } } } ExecutionEntity newSubProcessExecution = executionEntityManager.createChildExecution(executionEntity.getParent()); newSubProcessExecution.setCurrentFlowElement((SubProcess) executionEntity.getCurrentFlowElement().getParentContainer()); newSubProcessExecution.setEventScope(false); newSubProcessExecution.setScope(true); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(newSubProcessExecution); ExecutionEntity outgoingFlowExecution = executionEntityManager.createChildExecution(newSubProcessExecution); outgoingFlowExecution.setCurrentFlowElement(startEvent); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(outgoingFlowExecution); leave(outgoingFlowExecution); }