Java Code Examples for org.camunda.bpm.engine.impl.interceptor.CommandContext#getEventSubscriptionManager()
The following examples show how to use
org.camunda.bpm.engine.impl.interceptor.CommandContext#getEventSubscriptionManager() .
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: DefaultCorrelationHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected List<EventSubscriptionEntity> findMessageStartEventSubscriptions(CommandContext commandContext, String messageName, CorrelationSet correlationSet) { EventSubscriptionManager eventSubscriptionManager = commandContext.getEventSubscriptionManager(); if (correlationSet.isTenantIdSet) { EventSubscriptionEntity eventSubscription = eventSubscriptionManager.findMessageStartEventSubscriptionByNameAndTenantId(messageName, correlationSet.getTenantId()); if (eventSubscription != null) { return Collections.singletonList(eventSubscription); } else { return Collections.emptyList(); } } else { return eventSubscriptionManager.findMessageStartEventSubscriptionByName(messageName); } }
Example 2
Source File: DefaultConditionHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected List<EventSubscriptionEntity> findConditionalStartEventSubscriptions(CommandContext commandContext, ConditionSet conditionSet) { EventSubscriptionManager eventSubscriptionManager = commandContext.getEventSubscriptionManager(); if (conditionSet.isTenantIdSet) { return eventSubscriptionManager.findConditionalStartEventSubscriptionByTenantId(conditionSet.getTenantId()); } else { return eventSubscriptionManager.findConditionalStartEventSubscription(); } }
Example 3
Source File: MessageEventReceivedCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public Void execute(CommandContext commandContext) { ensureNotNull("executionId", executionId); EventSubscriptionManager eventSubscriptionManager = commandContext.getEventSubscriptionManager(); List<EventSubscriptionEntity> eventSubscriptions = null; if (messageName != null) { eventSubscriptions = eventSubscriptionManager.findEventSubscriptionsByNameAndExecution( EventType.MESSAGE.name(), messageName, executionId, exclusive); } else { eventSubscriptions = eventSubscriptionManager.findEventSubscriptionsByExecutionAndType( executionId, EventType.MESSAGE.name(), exclusive); } ensureNotEmpty("Execution with id '" + executionId + "' does not have a subscription to a message event with name '" + messageName + "'", "eventSubscriptions", eventSubscriptions); ensureNumberOfElements("More than one matching message subscription found for execution " + executionId, "eventSubscriptions", eventSubscriptions, 1); // there can be only one: EventSubscriptionEntity eventSubscriptionEntity = eventSubscriptions.get(0); // check authorization String processInstanceId = eventSubscriptionEntity.getProcessInstanceId(); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkUpdateProcessInstanceById(processInstanceId); } eventSubscriptionEntity.eventReceived(processVariables, processVariablesLocal, null, false); return null; }
Example 4
Source File: SignalEventReceivedCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected List<EventSubscriptionEntity> findSignalEventSubscriptions(CommandContext commandContext, String signalName) { EventSubscriptionManager eventSubscriptionManager = commandContext.getEventSubscriptionManager(); if (builder.isTenantIdSet()) { return eventSubscriptionManager.findSignalEventSubscriptionsByEventNameAndTenantId(signalName, builder.getTenantId()); } else { return eventSubscriptionManager.findSignalEventSubscriptionsByEventName(signalName); } }
Example 5
Source File: SignalEventReceivedCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void sendSignalToExecution(CommandContext commandContext, String signalName, String executionId) { ExecutionManager executionManager = commandContext.getExecutionManager(); ExecutionEntity execution = executionManager.findExecutionById(executionId); ensureNotNull("Cannot find execution with id '" + executionId + "'", "execution", execution); EventSubscriptionManager eventSubscriptionManager = commandContext.getEventSubscriptionManager(); List<EventSubscriptionEntity> signalEvents = eventSubscriptionManager.findSignalEventSubscriptionsByNameAndExecution(signalName, executionId); ensureNotEmpty("Execution '" + executionId + "' has not subscribed to a signal event with name '" + signalName + "'.", signalEvents); checkAuthorizationOfCatchSignals(commandContext, signalEvents); notifyExecutions(signalEvents); }