static void checkArgsNotNull(final Object... args) { try { Misc.checkArgsNotNull(1, args); } catch (final IllegalArgumentException e) { throw new BonitaWrapperException(e); } }
static void checkArgsNotNull(Object... args) { try { Misc.checkArgsNotNull(1, args); } catch (IllegalArgumentException e) { throw new BonitaWrapperException(e); } }
private void checkAssignmentCompatibility(String variableId, Object variableValue, DataTypeDefinition dataType, ProcessDefinitionUUID processUUID, PackageDefinitionUUID packageUUID) { if (!isAssignmentCompatible(variableValue, dataType, processUUID, packageUUID)) { throw new BonitaWrapperException( new TypeMismatchException("Invalid value: '" + variableValue + "' for variable '" + variableId + "'") ); } }
public static boolean evaluate(final String value, final Execution internalExecution) { try { return evaluateGroovy(value, internalExecution); } catch (final Exception e) { throw new BonitaWrapperException(new ExpressionEvaluationException(e)); } }
public void handleUndeployedPackage(PackageFullDefinition packageDefinition) { final Archiver archiver = EnvTool.getArchiver(); final Recorder recorder = EnvTool.getRecorder(); try { Tool.atomicArchive(packageDefinition, recorder, archiver); } catch (AtomicArchiveException e) { throw new BonitaWrapperException(e); } }
@Override public User addUser(final String username, final String password) throws UserAlreadyExistsException { FacadeUtil.checkArgsNotNull(username, password); if ("".equals(username.trim())) { throw new BonitaWrapperException(new IllegalArgumentException("The user name cannot be empty")); } final IdentityService identityService = EnvTool.getIdentityService(); UserImpl user = identityService.findUserByUsername(username); if (user != null) { throw new UserAlreadyExistsException("bai_IAPII_4", username); } user = new UserImpl(username, password); identityService.addUser(user); return user; }
private static Set<String> executeRoleMapper(final TaskInstance task, final Performer performer) { final ProcessDefinitionUUID processUUID = task.getProcessDefinitionUUID(); final RoleMapperDefinition rolemapperDef = performer.getRoleMapperDefinition(); final ClassLoader baseClassLoader = Thread.currentThread().getContextClassLoader(); try { final ClassLoader processClassLoader = EnvTool.getClassDataLoader().getProcessClassLoader(processUUID); Thread.currentThread().setContextClassLoader(processClassLoader); if (rolemapperDef != null) { final RoleMapper roleMapper = EnvTool.getClassDataLoader().getInstance(RoleMapper.class, processUUID, rolemapperDef); try { return ConnectorExecutor.executeRoleMapper(roleMapper, task, performer.getName(), rolemapperDef.getParameters()); } catch (final Exception e) { throw new BonitaWrapperException(new RoleMapperInvocationException("be_TRT_2", rolemapperDef.toString(), e)); } } return null; } finally { Thread.currentThread().setContextClassLoader(baseClassLoader); } }
private static Set<String> executeFilter(final TaskInstance task, final Set<String> candidates, final Performer performer) { final ProcessDefinitionUUID processUUID = task.getProcessDefinitionUUID(); final ClassLoader baseClassLoader = Thread.currentThread().getContextClassLoader(); try { final ClassLoader processClassLoader = EnvTool.getClassDataLoader().getProcessClassLoader(processUUID); Thread.currentThread().setContextClassLoader(processClassLoader); final FilterDefinition filterDefinition = performer.getFilterDefinition(); if (filterDefinition != null) { final PerformerAssign performerAssign = getPerformerAssign(processUUID, filterDefinition); Filter filter = null; if (performerAssign == null) { filter = EnvTool.getClassDataLoader().getInstance(Filter.class, processUUID, filterDefinition); } else { filter = new PerformerAssignFilter(); } try { return ConnectorExecutor.executeFilter(filter, performerAssign, task, candidates, filterDefinition.getParameters()); } catch (final Exception e) { throw new BonitaWrapperException(e); } } return candidates; } finally { Thread.currentThread().setContextClassLoader(baseClassLoader); } }
throw wrapper; throw new BonitaWrapperException(originalCause); } catch (final BonitaInternalException e) { throw (RuntimeException) originalCause; throw new BonitaWrapperException(originalCause);
public void handleFinishedInstance(final InternalProcessInstance instance) { final Querier journal = EnvTool.getJournalQueriers(); if (instance.getChildrenInstanceUUID() != null) { for (final ProcessInstanceUUID child : instance.getChildrenInstanceUUID()) { handleFinishedInstance(journal.getProcessInstance(child)); } } try { ArchiveTool.atomicArchive(instance); } catch (final AtomicArchiveException e) { throw new BonitaWrapperException(e); } } }
FacadeUtil.checkArgsNotNull(username, password); if ("".equals(username.trim())) { throw new BonitaWrapperException(new IllegalArgumentException("The user name cannot be empty"));
throw new BonitaWrapperException( new HookInvocationException(javaHook.toString(), e) );
protected void mapRole(Performer performer) { ClassInfo rolemapperInfo = performer.getRoleMapper(); if (rolemapperInfo != null) { RoleMapper roleMapper = ClassDataLoader.getRoleMapperInstance(packageUUID, rolemapperInfo); try { this.candidates = roleMapper.searchMembers( AccessorUtil.getQueryAPIAccessor(), instanceUUID, performer.getParticipantId()); } catch (Exception e) { throw new BonitaWrapperException( new RoleMapperInvocationException(rolemapperInfo.toString(), e) ); } } }
performerAssign, activityInst, this.candidates); } catch (final Exception e) { throw new BonitaWrapperException( new PerformerAssignInvocationException(performerAssignInfo.toString(), e) );
protected void executeRoleMapper(final Performer performer) { final ClassInfo rolemapperInfo = performer.getRoleMapper(); if (rolemapperInfo != null) { final RoleMapper roleMapper = ClassDataLoader.getInstance(RoleMapper.class, this.packageUUID, rolemapperInfo); try { this.candidates = EngineEnvTool.getHookExecutor().executeRoleMapper( roleMapper, this.instanceUUID, performer.getParticipantId()); } catch (final Exception e) { throw new BonitaWrapperException( new RoleMapperInvocationException(rolemapperInfo.toString(), e) ); } } }
public void handleFinishedInstance(XpdlInstance instance) { final Querier journal = EnvTool.getJournalQueriers(); final Archiver archiver = EnvTool.getArchiver(); final Recorder recorder = EnvTool.getRecorder(); if (instance.getChildInstances() != null) { for (XpdlInstance child : instance.getChildInstances()) { handleFinishedInstance(child); } } ProcessFullInstance processInst = journal.getProcessInstance(instance.getUUID()); try { Tool.atomicArchive(processInst, recorder, archiver); } catch (AtomicArchiveException e) { throw new BonitaWrapperException(e); } } }
protected void assign(Performer performer) { ClassInfo performerAssignInfo = performer.getPerformerAssign(); if (performerAssignInfo != null) { PerformerAssign performerAssign = ClassDataLoader.getPerformerAssignInstance(packageUUID, performerAssignInfo); ActivityInstance<ActivityBody> activityInst = EnvTool.getJournalQueriers().getActivityInstance(instanceUUID, activityId, iterationId, activityInstanceId); try { this.userId = performerAssign.selectUser(AccessorUtil.getQueryAPIAccessor(), activityInst, this.candidates); } catch (Exception e) { throw new BonitaWrapperException( new PerformerAssignInvocationException(performerAssignInfo.toString(), e) ); } } }
private void startActivityInstance(final Execution internalExecution) { final InternalActivityDefinition activity = internalExecution.getNode(); final ActivityInstanceUUID activityUUID = internalExecution.getActivityInstanceUUID(); try { initializeEvents(internalExecution); } catch (final GroovyException e) { final String message = "Error while initializing events: "; throw new BonitaWrapperException(new BonitaRuntimeException(message, e)); } if (activity.isAsynchronous()) { final EventService eventService = EnvTool.getEventService(); String uuid = internalExecution.getEventUUID(); if (uuid == null) { uuid = UUID.randomUUID().toString(); } final String eventName = BonitaConstants.ASYNC_EVENT_PREFIX + activityUUID; internalExecution.setEventUUID(uuid); internalExecution.lock("async continuation " + eventName); final Job async = JobBuilder.asyncJob(eventName, internalExecution.getInstance().getRootInstanceUUID(), uuid, internalExecution.getInstance().getProcessInstanceUUID()); eventService.storeJob(async); } else { executeActivityInstance(internalExecution); } }
throw new BonitaWrapperException(new BonitaRuntimeException( "Error while evaluating dynamic execution summary: " + activity.getDynamicExecutionSummary(), e));
protected void skip(final Execution internalExecution) { final ActivityDefinition activity = internalExecution.getNode(); if (activity.getDynamicExecutionSummary() != null) { try { if (GroovyExpression.isGroovyExpression(activity.getDynamicExecutionSummary())) { final Object dynamicExecutionSummary = GroovyUtil.evaluate(activity.getDynamicExecutionSummary(), null, internalExecution.getActivityInstanceUUID(), false, false); if (dynamicExecutionSummary != null) { internalExecution.getActivityInstance().setDynamicExecutionSummary(dynamicExecutionSummary.toString()); } } else { internalExecution.getActivityInstance().setDynamicExecutionSummary(activity.getDynamicExecutionSummary()); } } catch (final Exception e) { throw new BonitaWrapperException(new BonitaRuntimeException("Error while ending execution: " + activity.getDynamicExecutionSummary(), e)); } } if (activity.getMultiInstantiationDefinition() != null || activity.getMultipleInstancesInstantiator() != null) { removeChildrenActivityInstances(internalExecution); terminateInstanceIfNoOutgoingTransitions(internalExecution); executeSplit(internalExecution, false); } else { terminateInstanceIfNoOutgoingTransitions(internalExecution); executeSplit(internalExecution, true); } }