use of org.camunda.bpm.engine.impl.bpmn.parser.EventSubscriptionDeclaration in project camunda-bpm-platform by camunda.
the class ExecutionEntity method initialize.
// scopes ///////////////////////////////////////////////////////////////////
@Override
@SuppressWarnings("unchecked")
public void initialize() {
LOG.initializeExecution(this);
ScopeImpl scope = getScopeActivity();
ensureParentInitialized();
List<VariableDeclaration> variableDeclarations = (List<VariableDeclaration>) scope.getProperty(BpmnParse.PROPERTYNAME_VARIABLE_DECLARATIONS);
if (variableDeclarations != null) {
for (VariableDeclaration variableDeclaration : variableDeclarations) {
variableDeclaration.initialize(this, parent);
}
}
if (isProcessInstanceExecution()) {
String initiatorVariableName = (String) processDefinition.getProperty(BpmnParse.PROPERTYNAME_INITIATOR_VARIABLE_NAME);
if (initiatorVariableName != null) {
String authenticatedUserId = Context.getCommandContext().getAuthenticatedUserId();
setVariable(initiatorVariableName, authenticatedUserId);
}
}
// create event subscriptions for the current scope
for (EventSubscriptionDeclaration declaration : EventSubscriptionDeclaration.getDeclarationsForScope(scope).values()) {
if (!declaration.isStartEvent()) {
declaration.createSubscriptionForExecution(this);
}
}
}
use of org.camunda.bpm.engine.impl.bpmn.parser.EventSubscriptionDeclaration in project camunda-bpm-platform by camunda.
the class EventSubscriptionInstanceHandler method handle.
@Override
public void handle(MigratingInstanceParseContext parseContext, MigratingActivityInstance owningInstance, List<EventSubscriptionEntity> elements) {
Map<String, EventSubscriptionDeclaration> targetDeclarations = getDeclarationsByTriggeringActivity(owningInstance.getTargetScope());
for (EventSubscriptionEntity eventSubscription : elements) {
if (!getSupportedEventTypes().contains(eventSubscription.getEventType())) {
// ignore unsupported event subscriptions
continue;
}
MigrationInstruction migrationInstruction = parseContext.findSingleMigrationInstruction(eventSubscription.getActivityId());
ActivityImpl targetActivity = parseContext.getTargetActivity(migrationInstruction);
if (targetActivity != null && owningInstance.migratesTo(targetActivity.getEventScope())) {
// the event subscription is migrated
EventSubscriptionDeclaration targetDeclaration = targetDeclarations.remove(targetActivity.getId());
owningInstance.addMigratingDependentInstance(new MigratingEventSubscriptionInstance(eventSubscription, targetActivity, migrationInstruction.isUpdateEventTrigger(), targetDeclaration));
} else {
// the event subscription will be removed
owningInstance.addRemovingDependentInstance(new MigratingEventSubscriptionInstance(eventSubscription));
}
parseContext.consume(eventSubscription);
}
if (owningInstance.migrates()) {
addEmergingEventSubscriptions(owningInstance, targetDeclarations);
}
}
Aggregations