public void setUserId(String userId) { if (this.groupId != null && userId != null) { throw new ActivitiException("Cannot assign a userId to a task assignment that already has a groupId"); } this.userId = userId; }
public void setUserId(String userId) { if (this.groupId != null && userId != null) { throw new ActivitiException("Cannot assign a userId to a task assignment that already has a groupId"); } this.userId = userId; }
public HistoricProcessInstanceQuery endOr() { if (!inOrStatement) { throw new ActivitiException("endOr() can only be called after calling or()"); } inOrStatement = false; currentOrQueryObject = null; return this; }
public boolean evaluate(String sequenceFlowId, DelegateExecution execution) { Object result = expression.getValue(execution); if (result == null) { throw new ActivitiException("condition expression returns null (sequenceFlowId: " + sequenceFlowId + " execution: " + execution + ")"); } if (!(result instanceof Boolean)) { throw new ActivitiException("condition expression returns non-Boolean (sequenceFlowId: " + sequenceFlowId + " execution: " + execution + "): " + result + " (" + result.getClass().getName() + ")"); } return (Boolean) result; }
public HistoricTaskInstanceQuery or() { if (inOrStatement) { throw new ActivitiException("the query is already in an or statement"); } inOrStatement = true; currentOrQueryObject = new HistoricTaskInstanceQueryImpl(); orQueryObjects.add(currentOrQueryObject); return this; }
/** * {@inheritDoc} */ public Object transform(Object anObject) { try { return this.primTransform(anObject); } catch (Exception e) { throw new ActivitiException("Error while executing transformation from object: " + anObject + " using transformer " + this); } }
public ProcessInstanceQuery or() { if (inOrStatement) { throw new ActivitiException("the query is already in an or statement"); } inOrStatement = true; currentOrQueryObject = new ProcessInstanceQueryImpl(); orQueryObjects.add(currentOrQueryObject); return this; }
@Override public CommandInterceptor createTransactionInterceptor() { if (transactionManager == null) { throw new ActivitiException("transactionManager is required property for JtaProcessEngineConfiguration, use " + StandaloneProcessEngineConfiguration.class.getName() + " otherwise"); } return new JtaTransactionInterceptor(transactionManager); }
public boolean evaluate(String sequenceFlowId, DelegateExecution execution) { ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines(); Object result = scriptingEngines.evaluate(expression, language, execution); if (result == null) { throw new ActivitiException("condition script returns null: " + expression); } if (!(result instanceof Boolean)) { throw new ActivitiException("condition script returns non-Boolean: " + result + " (" + result.getClass().getName() + ")"); } return (Boolean) result; }
public static ProcessEngine buildProcessEngine(URL resource) { log.debug("==== BUILDING SPRING APPLICATION CONTEXT AND PROCESS ENGINE ========================================="); ApplicationContext applicationContext = new GenericXmlApplicationContext(new UrlResource(resource)); Map<String, ProcessEngine> beansOfType = applicationContext.getBeansOfType(ProcessEngine.class); if ((beansOfType == null) || (beansOfType.isEmpty())) { throw new ActivitiException("no " + ProcessEngine.class.getName() + " defined in the application context " + resource.toString()); } ProcessEngine processEngine = beansOfType.values().iterator().next(); log.debug("==== SPRING PROCESS ENGINE CREATED =================================================================="); return processEngine; }
public U executeSingleResult(CommandContext commandContext) { List<U> results = executeList(commandContext, getParameterMap(), 0, Integer.MAX_VALUE); if (results.size() == 1) { return results.get(0); } else if (results.size() > 1) { throw new ActivitiException("Query return " + results.size() + " results instead of max 1"); } return null; }
protected Object evaluate(String script, String language, Bindings bindings) { ScriptEngine scriptEngine = getEngineByName(language); try { return scriptEngine.eval(script, bindings); } catch (ScriptException e) { throw new ActivitiException("problem evaluating script: " + e.getMessage(), e); } }
@Override public void completed(DelegateExecution execution) throws Exception { if (activityBehaviorInstance == null) { activityBehaviorInstance = getActivityBehaviorInstance(); } if (activityBehaviorInstance instanceof SubProcessActivityBehavior) { ((SubProcessActivityBehavior) activityBehaviorInstance).completed(execution); } else { throw new ActivitiException("completed() can only be called on a " + SubProcessActivityBehavior.class.getName() + " instance"); } }
public Object deserialize(byte[] bytes, ValueFields valueFields) { ByteArrayInputStream bais = new ByteArrayInputStream(bytes); try { ObjectInputStream ois = createObjectInputStream(bais); Object deserializedObject = ois.readObject(); return deserializedObject; } catch (Exception e) { throw new ActivitiException("Couldn't deserialize object in variable '"+valueFields.getName()+"'", e); } finally { IoUtil.closeSilently(bais); } }
/** * Returns the {@link BpmnModel} matching the process definition bpmn model * for the process definition of the passed {@link DelegateExecution}. */ public static BpmnModel getBpmnModel(DelegateExecution execution) { if (execution == null) { throw new ActivitiException("Null execution passed"); } return ProcessDefinitionUtil.getBpmnModel(execution.getProcessDefinitionId()); }
@Override protected VariableInstanceEntity getSpecificVariable(String variableName) { CommandContext commandContext = Context.getCommandContext(); if (commandContext == null) { throw new ActivitiException("lazy loading outside command context"); } VariableInstanceEntity variableInstance = commandContext.getVariableInstanceEntityManager().findVariableInstanceByTaskAndName(id, variableName); return variableInstance; }
public static void setSuspensionState(ProcessDefinitionEntity processDefinitionEntity, SuspensionState state) { if (processDefinitionEntity.getSuspensionState() == state.getStateCode()) { throw new ActivitiException("Cannot set suspension state '" + state + "' for " + processDefinitionEntity + "': already in state '" + state + "'."); } processDefinitionEntity.setSuspensionState(state.getStateCode()); dispatchStateChangeEvent(processDefinitionEntity, state); }
public static void setSuspensionState(TaskEntity taskEntity, SuspensionState state) { if (taskEntity.getSuspensionState() == state.getStateCode()) { throw new ActivitiException("Cannot set suspension state '" + state + "' for " + taskEntity + "': already in state '" + state + "'."); } taskEntity.setSuspensionState(state.getStateCode()); dispatchStateChangeEvent(taskEntity, state); }
@Override public Void execute(CommandContext commandContext) { if (event == null) { throw new ActivitiIllegalArgumentException("event is null"); } if (commandContext.getEventDispatcher().isEnabled()) { commandContext.getEventDispatcher().dispatchEvent(event); } else { throw new ActivitiException("Message dispatcher is disabled, cannot dispatch event"); } return null; }
public void trigger(DelegateExecution execution, String signalName, Object signalData) { CommandContext commandContext = Context.getCommandContext(); TaskEntityManager taskEntityManager = commandContext.getTaskEntityManager(); List<TaskEntity> taskEntities = taskEntityManager.findTasksByExecutionId(execution.getId()); // Should be only one for (TaskEntity taskEntity : taskEntities) { if (!taskEntity.isDeleted()) { throw new ActivitiException("UserTask should not be signalled before complete"); } } leave(execution); }