@SuppressWarnings("rawtypes") public static void ensureNumberOfElements(String message, String variableName, Collection collection, int elements) { ensureNumberOfElements(ProcessEngineException.class, message, variableName, collection, elements); }
@SuppressWarnings("rawtypes") public static void ensureNumberOfElements(Class<? extends ProcessEngineException> exceptionClass, String variableName, Collection collection, int elements) { ensureNumberOfElements(exceptionClass, "", variableName, collection, elements); }
@SuppressWarnings("rawtypes") public static void ensureNumberOfElements(Class<? extends ProcessEngineException> exceptionClass, String variableName, Collection collection, int elements) { ensureNumberOfElements(exceptionClass, "", variableName, collection, elements); }
@SuppressWarnings("rawtypes") public static void ensureNumberOfElements(String variableName, Collection collection, int elements) { ensureNumberOfElements("", variableName, collection, elements); }
@SuppressWarnings("rawtypes") public static void ensureNumberOfElements(String variableName, Collection collection, int elements) { ensureNumberOfElements("", variableName, collection, elements); }
@SuppressWarnings("rawtypes") public static void ensureNumberOfElements(String message, String variableName, Collection collection, int elements) { ensureNumberOfElements(ProcessEngineException.class, message, variableName, collection, elements); }
ensureNumberOfElements(BadUserRequestException.class, "No historic process instances found with ids " + nonExistingIds, "nonExistingIds", nonExistingIds, 0);
ensureNumberOfElements(BadUserRequestException.class, "No historic process instances found with ids " + nonExistingIds, "nonExistingIds", nonExistingIds, 0);
@SuppressWarnings("rawtypes") public static void ensureNumberOfElements(String variableName, Collection collection, int elements) { ensureNumberOfElements("", variableName, collection, elements); }
@SuppressWarnings("rawtypes") public static void ensureNumberOfElements(String message, String variableName, Collection collection, int elements) { ensureNumberOfElements(ProcessEngineException.class, message, variableName, collection, elements); }
@SuppressWarnings("rawtypes") public static void ensureNumberOfElements(Class<? extends ProcessEngineException> exceptionClass, String variableName, Collection collection, int elements) { ensureNumberOfElements(exceptionClass, "", variableName, collection, elements); }
@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; }
ensureNotNull("taskId or processInstanceId has to be provided", this.processInstanceId); List<ExecutionEntity> executionsByProcessInstanceId = commandContext.getExecutionManager().findExecutionsByProcessInstanceId(processInstanceId); ensureNumberOfElements("processInstances",executionsByProcessInstanceId,1); processInstance = executionsByProcessInstanceId.get(0);
ensureNotNull("taskId or processInstanceId has to be provided", this.processInstanceId); List<ExecutionEntity> executionsByProcessInstanceId = commandContext.getExecutionManager().findExecutionsByProcessInstanceId(processInstanceId); ensureNumberOfElements("processInstances",executionsByProcessInstanceId,1); processInstance = executionsByProcessInstanceId.get(0);
ensureNumberOfElements(BadUserRequestException.class, "No historic process instances found with ids " + nonExistingIds, "nonExistingIds", nonExistingIds, 0);
@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; }
ensureNotNull("taskId or processInstanceId has to be provided", this.processInstanceId); List<ExecutionEntity> executionsByProcessInstanceId = commandContext.getExecutionManager().findExecutionsByProcessInstanceId(processInstanceId); ensureNumberOfElements("processInstances",executionsByProcessInstanceId,1); processInstance = executionsByProcessInstanceId.get(0);