static void checkArgsNotNull(final Object... args) { try { Misc.checkArgsNotNull(1, args); } catch (final IllegalArgumentException e) { throw new BonitaWrapperException(e); } }
@Override public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { if (Environment.getCurrent() != null) { return new RESTServerAPIInterceptorCommand(method, args, api) .execute(Environment.getCurrent()); } // If no environment: use directly the command Service with interceptors final EnvironmentFactory envFactory = GlobalEnvironmentFactory .getEnvironmentFactory(DomainOwner.getDomain()); try { return envFactory.get(CommandService.class).execute( new RESTServerAPIInterceptorCommand(method, args, api)); } catch (final BonitaWrapperException e) { throw e.getCause(); } catch (final BonitaRuntimeException e) { if (DefaultCommandService.class.getName().equals(e.getWrappedBy()) || UnRollbackableException.class.getName().equals(e.getWrappedBy())) { throw e.getCause(); } else { throw e; } } }
public Object invoke(final Object proxy, final Method method, final Object[] args) throws BonitaException { try { // If already in environment: use the same environment to execute the // command directly if (Environment.getCurrent() != null) { return new APIInterceptorCommand(method, args, true).execute(Environment.getCurrent()); } // If no environment: use directly the command Service with interceptors final EnvironmentFactory envFactory = GlobalEnvironmentFactory.getEnvironmentFactory(); return envFactory.get(CommandService.class).execute(new APIInterceptorCommand(method, args, false)); } catch (final PvmException e) { final Throwable cause = e.getCause(); if (cause instanceof BonitaException) { throw (BonitaException) cause; } throw e; } catch (final BonitaException e) { throw e; } catch (final InvalidEnvironmentException e) { // Don't throw BonitaInternalException if Environment parsing failed. // This is a configuration problem, not an engine bug. throw e; } catch (final BonitaWrapperException e) { throw (RuntimeException) e.getCause(); } catch (final RuntimeException e) { throw BonitaInternalException.build(e); } catch (final Exception t) { throw new BonitaInternalException("Ouch! Unexpected error: " + t, t); } }
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); } }
return bool; throw new BonitaWrapperException( new ExpressionEvaluationException("Evaluation of the condition by the interpreter is null!")); } catch (final EvalError e) { throw new BonitaWrapperException(new ExpressionEvaluationException(errorMsg));
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); } }
return bool; throw new BonitaWrapperException( new ExpressionEvaluationException("Evaluation of the condition by the interpreter is null!")); } catch (final EvalError e) { throw new BonitaWrapperException(new ExpressionEvaluationException(errorMsg));
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) ); } } }
throw new BonitaWrapperException(new MultiInstantiatorInvocationException("be_AA_4", activity .getMultiInstantiationDefinition().getClassName(), e));