public static void ensureAtLeastOneNotNull(String message, Object... values) { ensureAtLeastOneNotNull(NullValueException.class, message, values); }
public static void ensureAtLeastOneNotNull(String message, Object... values) { ensureAtLeastOneNotNull(NullValueException.class, message, values); }
protected void validate(String userId, List<String> groupIds, Permission permission, Resource resource) { ensureAtLeastOneNotNull("Authorization must have a 'userId' or/and a 'groupId'.", userId, groupIds); ensureNotNull("Invalid permission for an authorization", "authorization.getResource()", permission); ensureNotNull("Invalid resource for an authorization", "authorization.getResource()", resource); }
protected void validate(String userId, List<String> groupIds, Permission permission, Resource resource) { ensureAtLeastOneNotNull("Authorization must have a 'userId' or/and a 'groupId'.", userId, groupIds); ensureNotNull("Invalid permission for an authorization", "authorization.getResource()", permission); ensureNotNull("Invalid resource for an authorization", "authorization.getResource()", resource); }
/** * Creates a new {@link ExecutableScript} from a source or resource. It excepts static and * dynamic sources and resources. Dynamic means that the source or resource is an expression * which will be evaluated during execution. * * @param language the language of the script * @param source the source code of the script or an expression which evaluates to the source code * @param resource the resource path of the script code or an expression which evaluates to the resource path * @param expressionManager the expression manager to use to generate the expressions of dynamic scripts * @param scriptFactory the script factory used to create the script * @return the newly created script * @throws NotValidException if language is null or empty or both of source and resource are invalid */ public static ExecutableScript getScript(String language, String source, String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory) { ensureNotEmpty(NotValidException.class, "Script language", language); ensureAtLeastOneNotNull(NotValidException.class, "No script source or resource was given", source, resource); if (resource != null && !resource.isEmpty()) { return getScriptFromResource(language, resource, expressionManager, scriptFactory); } else { return getScriptFormSource(language, source, expressionManager, scriptFactory); } }
/** * Creates a new {@link ExecutableScript} from a source or resource. It excepts static and * dynamic sources and resources. Dynamic means that the source or resource is an expression * which will be evaluated during execution. * * @param language the language of the script * @param source the source code of the script or an expression which evaluates to the source code * @param resource the resource path of the script code or an expression which evaluates to the resource path * @param expressionManager the expression manager to use to generate the expressions of dynamic scripts * @param scriptFactory the script factory used to create the script * @return the newly created script * @throws NotValidException if language is null or empty or both of source and resource are invalid */ public static ExecutableScript getScript(String language, String source, String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory) { ensureNotEmpty(NotValidException.class, "Script language", language); ensureAtLeastOneNotNull(NotValidException.class, "No script source or resource was given", source, resource); if (resource != null && !resource.isEmpty()) { return getScriptFromResource(language, resource, expressionManager, scriptFactory); } else { return getScriptFormSource(language, source, expressionManager, scriptFactory); } }
public CaseInstance execute(CommandContext commandContext) { ensureAtLeastOneNotNull("caseDefinitionId and caseDefinitionKey are null", caseDefinitionId, caseDefinitionKey); CaseDefinitionEntity caseDefinition = find(commandContext); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkCreateCaseInstance(caseDefinition); } // Start the case instance CaseExecutionEntity caseInstance = (CaseExecutionEntity) caseDefinition.createCaseInstance(businessKey); caseInstance.create(variables); return caseInstance; }
public CaseInstance execute(CommandContext commandContext) { ensureAtLeastOneNotNull("caseDefinitionId and caseDefinitionKey are null", caseDefinitionId, caseDefinitionKey); CaseDefinitionEntity caseDefinition = find(commandContext); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkCreateCaseInstance(caseDefinition); } // Start the case instance CaseExecutionEntity caseInstance = (CaseExecutionEntity) caseDefinition.createCaseInstance(businessKey); caseInstance.create(variables); return caseInstance; }
public List<MessageCorrelationResult> execute(final CommandContext commandContext) { ensureAtLeastOneNotNull( "At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", messageName, builder.getBusinessKey(), builder.getCorrelationProcessInstanceVariables(), builder.getProcessInstanceId()); final CorrelationHandler correlationHandler = Context.getProcessEngineConfiguration().getCorrelationHandler(); final CorrelationSet correlationSet = new CorrelationSet(builder); List<CorrelationHandlerResult> correlationResults = commandContext.runWithoutAuthorization(new Callable<List<CorrelationHandlerResult>>() { public List<CorrelationHandlerResult> call() throws Exception { return correlationHandler.correlateMessages(commandContext, messageName, correlationSet); } }); // check authorization for (CorrelationHandlerResult correlationResult : correlationResults) { checkAuthorization(correlationResult); } List<MessageCorrelationResult> results = new ArrayList<MessageCorrelationResult>(); for (CorrelationHandlerResult correlationResult : correlationResults) { results.add(createMessageCorrelationResult(commandContext, correlationResult)); } return results; } }
public List<MessageCorrelationResult> execute(final CommandContext commandContext) { ensureAtLeastOneNotNull( "At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", messageName, builder.getBusinessKey(), builder.getCorrelationProcessInstanceVariables(), builder.getProcessInstanceId()); final CorrelationHandler correlationHandler = Context.getProcessEngineConfiguration().getCorrelationHandler(); final CorrelationSet correlationSet = new CorrelationSet(builder); List<CorrelationHandlerResult> correlationResults = commandContext.runWithoutAuthorization(new Callable<List<CorrelationHandlerResult>>() { public List<CorrelationHandlerResult> call() throws Exception { return correlationHandler.correlateMessages(commandContext, messageName, correlationSet); } }); // check authorization for (CorrelationHandlerResult correlationResult : correlationResults) { checkAuthorization(correlationResult); } List<MessageCorrelationResult> results = new ArrayList<MessageCorrelationResult>(); for (CorrelationHandlerResult correlationResult : correlationResults) { results.add(createMessageCorrelationResult(commandContext, correlationResult)); } return results; } }
public static void ensureAtLeastOneNotNull(String message, Object... values) { ensureAtLeastOneNotNull(NullValueException.class, message, values); }
public MessageCorrelationResult execute(final CommandContext commandContext) { ensureAtLeastOneNotNull( "At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", messageName, builder.getBusinessKey(), builder.getCorrelationProcessInstanceVariables(), builder.getProcessInstanceId()); final CorrelationHandler correlationHandler = Context.getProcessEngineConfiguration().getCorrelationHandler(); final CorrelationSet correlationSet = new CorrelationSet(builder); CorrelationHandlerResult correlationResult = commandContext.runWithoutAuthorization(new Callable<CorrelationHandlerResult>() { public CorrelationHandlerResult call() throws Exception { return correlationHandler.correlateMessage(commandContext, messageName, correlationSet); } }); if (correlationResult == null) { throw new MismatchingMessageCorrelationException(messageName, "No process definition or execution matches the parameters"); } // check authorization checkAuthorization(correlationResult); return createMessageCorrelationResult(commandContext, correlationResult); } }
public MessageCorrelationResult execute(final CommandContext commandContext) { ensureAtLeastOneNotNull( "At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", messageName, builder.getBusinessKey(), builder.getCorrelationProcessInstanceVariables(), builder.getProcessInstanceId()); final CorrelationHandler correlationHandler = Context.getProcessEngineConfiguration().getCorrelationHandler(); final CorrelationSet correlationSet = new CorrelationSet(builder); CorrelationHandlerResult correlationResult = commandContext.runWithoutAuthorization(new Callable<CorrelationHandlerResult>() { public CorrelationHandlerResult call() throws Exception { return correlationHandler.correlateMessage(commandContext, messageName, correlationSet); } }); if (correlationResult == null) { throw new MismatchingMessageCorrelationException(messageName, "No process definition or execution matches the parameters"); } // check authorization checkAuthorization(correlationResult); return createMessageCorrelationResult(commandContext, correlationResult); } }
/** * Creates a new {@link ExecutableScript} from a source or resource. It excepts static and * dynamic sources and resources. Dynamic means that the source or resource is an expression * which will be evaluated during execution. * * @param language the language of the script * @param source the source code of the script or an expression which evaluates to the source code * @param resource the resource path of the script code or an expression which evaluates to the resource path * @param expressionManager the expression manager to use to generate the expressions of dynamic scripts * @param scriptFactory the script factory used to create the script * @return the newly created script * @throws NotValidException if language is null or empty or both of source and resource are invalid */ public static ExecutableScript getScript(String language, String source, String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory) { ensureNotEmpty(NotValidException.class, "Script language", language); ensureAtLeastOneNotNull(NotValidException.class, "No script source or resource was given", source, resource); if (resource != null && !resource.isEmpty()) { return getScriptFromResource(language, resource, expressionManager, scriptFactory); } else { return getScriptFormSource(language, source, expressionManager, scriptFactory); } }
public CaseInstance execute(CommandContext commandContext) { ensureAtLeastOneNotNull("caseDefinitionId and caseDefinitionKey are null", caseDefinitionId, caseDefinitionKey); CaseDefinitionEntity caseDefinition = find(commandContext); for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkCreateCaseInstance(caseDefinition); } // Start the case instance CaseExecutionEntity caseInstance = (CaseExecutionEntity) caseDefinition.createCaseInstance(businessKey); caseInstance.create(variables); return caseInstance; }
public List<MessageCorrelationResult> execute(final CommandContext commandContext) { ensureAtLeastOneNotNull( "At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", messageName, builder.getBusinessKey(), builder.getCorrelationProcessInstanceVariables(), builder.getProcessInstanceId()); final CorrelationHandler correlationHandler = Context.getProcessEngineConfiguration().getCorrelationHandler(); final CorrelationSet correlationSet = new CorrelationSet(builder); List<CorrelationHandlerResult> correlationResults = commandContext.runWithoutAuthorization(new Callable<List<CorrelationHandlerResult>>() { public List<CorrelationHandlerResult> call() throws Exception { return correlationHandler.correlateMessages(commandContext, messageName, correlationSet); } }); // check authorization for (CorrelationHandlerResult correlationResult : correlationResults) { checkAuthorization(correlationResult); } List<MessageCorrelationResult> results = new ArrayList<MessageCorrelationResult>(); for (CorrelationHandlerResult correlationResult : correlationResults) { results.add(createMessageCorrelationResult(commandContext, correlationResult)); } return results; } }
public MessageCorrelationResult execute(final CommandContext commandContext) { ensureAtLeastOneNotNull( "At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", messageName, builder.getBusinessKey(), builder.getCorrelationProcessInstanceVariables(), builder.getProcessInstanceId()); final CorrelationHandler correlationHandler = Context.getProcessEngineConfiguration().getCorrelationHandler(); final CorrelationSet correlationSet = new CorrelationSet(builder); CorrelationHandlerResult correlationResult = commandContext.runWithoutAuthorization(new Callable<CorrelationHandlerResult>() { public CorrelationHandlerResult call() throws Exception { return correlationHandler.correlateMessage(commandContext, messageName, correlationSet); } }); if (correlationResult == null) { throw new MismatchingMessageCorrelationException(messageName, "No process definition or execution matches the parameters"); } // check authorization checkAuthorization(correlationResult); return createMessageCorrelationResult(commandContext, correlationResult); } }