protected void checkAuthorizationOfCatchSignals(final CommandContext commandContext, List<EventSubscriptionEntity> catchSignalEventSubscription) { // check authorization for each fetched signal event for (EventSubscriptionEntity event : catchSignalEventSubscription) { String processInstanceId = event.getProcessInstanceId(); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkUpdateProcessInstanceById(processInstanceId); } } }
protected void checkAuthorizationOfCatchSignals(final CommandContext commandContext, List<EventSubscriptionEntity> catchSignalEventSubscription) { // check authorization for each fetched signal event for (EventSubscriptionEntity event : catchSignalEventSubscription) { String processInstanceId = event.getProcessInstanceId(); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkUpdateProcessInstanceById(processInstanceId); } } }
@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; }
@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; }
protected MessageEntity newJobInstance(EventSubscriptionEntity eventSubscription) { MessageEntity message = new MessageEntity(); // initialize job message.setActivityId(eventSubscription.getActivityId()); message.setExecutionId(eventSubscription.getExecutionId()); message.setProcessInstanceId(eventSubscription.getProcessInstanceId()); ProcessDefinitionEntity processDefinition = eventSubscription.getProcessDefinition(); if (processDefinition != null) { message.setProcessDefinitionId(processDefinition.getId()); message.setProcessDefinitionKey(processDefinition.getKey()); } // TODO: support payload // if(payload != null) { // message.setEventPayload(payload); // } return message; }
protected MessageEntity newJobInstance(EventSubscriptionEntity eventSubscription) { MessageEntity message = new MessageEntity(); // initialize job message.setActivityId(eventSubscription.getActivityId()); message.setExecutionId(eventSubscription.getExecutionId()); message.setProcessInstanceId(eventSubscription.getProcessInstanceId()); ProcessDefinitionEntity processDefinition = eventSubscription.getProcessDefinition(); if (processDefinition != null) { message.setProcessDefinitionId(processDefinition.getId()); message.setProcessDefinitionKey(processDefinition.getKey()); } // TODO: support payload // if(payload != null) { // message.setEventPayload(payload); // } return message; }
@Test @Deployment(resources = SINGLE_CONDITIONAL_START_EVENT_XML) public void testDeploymentCreatesSubscriptions() { // given a deployed process String processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey(CONDITIONAL_EVENT_PROCESS).singleResult().getId(); // when List<EventSubscription> eventSubscriptions = runtimeService.createEventSubscriptionQuery().list(); // then assertEquals(1, eventSubscriptions.size()); EventSubscriptionEntity conditionalEventSubscription = (EventSubscriptionEntity) eventSubscriptions.get(0); assertEquals(EventType.CONDITONAL.name(), conditionalEventSubscription.getEventType()); assertEquals(processDefinitionId, conditionalEventSubscription.getConfiguration()); assertNull(conditionalEventSubscription.getEventName()); assertNull(conditionalEventSubscription.getExecutionId()); assertNull(conditionalEventSubscription.getProcessInstanceId()); }
protected void checkAuthorizationOfCatchSignals(final CommandContext commandContext, List<EventSubscriptionEntity> catchSignalEventSubscription) { // check authorization for each fetched signal event for (EventSubscriptionEntity event : catchSignalEventSubscription) { String processInstanceId = event.getProcessInstanceId(); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkUpdateProcessInstanceById(processInstanceId); } } }
@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; }
protected MessageEntity newJobInstance(EventSubscriptionEntity eventSubscription) { MessageEntity message = new MessageEntity(); // initialize job message.setActivityId(eventSubscription.getActivityId()); message.setExecutionId(eventSubscription.getExecutionId()); message.setProcessInstanceId(eventSubscription.getProcessInstanceId()); ProcessDefinitionEntity processDefinition = eventSubscription.getProcessDefinition(); if (processDefinition != null) { message.setProcessDefinitionId(processDefinition.getId()); message.setProcessDefinitionKey(processDefinition.getKey()); } // TODO: support payload // if(payload != null) { // message.setEventPayload(payload); // } return message; }
@Test @Deployment(resources = SINGLE_CONDITIONAL_START_EVENT_XML) public void testDeploymentCreatesSubscriptions() { // given a deployed process String processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey(CONDITIONAL_EVENT_PROCESS).singleResult().getId(); // when List<EventSubscription> eventSubscriptions = runtimeService.createEventSubscriptionQuery().list(); // then assertEquals(1, eventSubscriptions.size()); EventSubscriptionEntity conditionalEventSubscription = (EventSubscriptionEntity) eventSubscriptions.get(0); assertEquals(EventType.CONDITONAL.name(), conditionalEventSubscription.getEventType()); assertEquals(processDefinitionId, conditionalEventSubscription.getConfiguration()); assertNull(conditionalEventSubscription.getEventName()); assertNull(conditionalEventSubscription.getExecutionId()); assertNull(conditionalEventSubscription.getProcessInstanceId()); }