@Override public void unregister(final long commandId) throws CommandNotFoundException, DeletionException { final CommandService commandService = getTenantAccessor().getCommandService(); final DeleteSCommand deleteCommand = new DeleteSCommand(commandService, commandId); unregister(deleteCommand); }
@Override public void unregisterAll() throws DeletionException { final CommandService commandService = getTenantAccessor().getCommandService(); try { commandService.deleteAll(); } catch (final SCommandDeletionException sde) { throw new DeletionException(sde); } }
@Override public void unregisterAll() throws DeletionException { final CommandService commandService = getTenantAccessor().getCommandService(); try { commandService.deleteAll(); } catch (final SCommandDeletionException sde) { throw new DeletionException(sde); } }
@Override public void unregister(final long commandId) throws CommandNotFoundException, DeletionException { final CommandService commandService = getTenantAccessor().getCommandService(); final DeleteSCommand deleteCommand = new DeleteSCommand(commandService, commandId); unregister(deleteCommand); }
private CommandDescriptor getCommand(final SCommandFetcher commandFetcher) throws CommandNotFoundException { final CommandService commandService = getTenantAccessor().getCommandService(); try { final SCommand sCommand = commandFetcher.fetch(commandService); return ModelConvertor.toCommandDescriptor(sCommand); } catch (final SBonitaException e) { throw new CommandNotFoundException(e); } }
private CommandDescriptor getCommand(final SCommandFetcher commandFetcher) throws CommandNotFoundException { final CommandService commandService = getTenantAccessor().getCommandService(); try { final SCommand sCommand = commandFetcher.fetch(commandService); return ModelConvertor.toCommandDescriptor(sCommand); } catch (final SBonitaException e) { throw new CommandNotFoundException(e); } }
@Override public void unregister(final String name) throws CommandNotFoundException, DeletionException { if (name == null) { // FIXME: throw IllegalArgumentException instead, and make bonita interceptor catch all exceptions and wrap it into BonitaRuntimeException: throw new DeletionException("Command name can not be null!"); } final CommandService commandService = getTenantAccessor().getCommandService(); final DeleteSCommand deleteCommand = new DeleteSCommand(commandService, name); unregister(deleteCommand); }
@Override public void unregister(final String name) throws CommandNotFoundException, DeletionException { if (name == null) { // FIXME: throw IllegalArgumentException instead, and make bonita interceptor catch all exceptions and wrap it into BonitaRuntimeException: throw new DeletionException("Command name can not be null!"); } final CommandService commandService = getTenantAccessor().getCommandService(); final DeleteSCommand deleteCommand = new DeleteSCommand(commandService, name); unregister(deleteCommand); }
private Serializable executeCommand(final SCommandFetcher commandFetcher, final Map<String, Serializable> parameters, final boolean transactionManagedManually) throws CommandNotFoundException, CommandParameterizationException, CommandExecutionException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); try { final TenantCommand tenantCommand = fetchTenantCommand(commandFetcher, transactionManagedManually); return tenantCommand.execute(parameters, tenantAccessor); } catch (final SCommandExecutionException scee) { throw new CommandExecutionException(scee); } catch (final SCommandParameterizationException scpe) { throw new CommandParameterizationException(scpe); } catch (final SCommandNotFoundException e) { throw new CommandNotFoundException(e); } }
private Serializable executeCommand(final SCommandFetcher commandFetcher, final Map<String, Serializable> parameters, final boolean transactionManagedManually) throws CommandNotFoundException, CommandParameterizationException, CommandExecutionException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); try { final TenantCommand tenantCommand = fetchTenantCommand(commandFetcher, transactionManagedManually); return tenantCommand.execute(parameters, tenantAccessor); } catch (final SCommandExecutionException scee) { throw new CommandExecutionException(scee); } catch (final SCommandParameterizationException scpe) { throw new CommandParameterizationException(scpe); } catch (final SCommandNotFoundException e) { throw new CommandNotFoundException(e); } }
@Override public List<CommandDescriptor> getUserCommands(final int startIndex, final int maxResults, final CommandCriterion sort) { final CommandService commandService = getTenantAccessor().getCommandService(); try { final GetCommands getCommands = new GetCommands(commandService, startIndex, maxResults, sort); getCommands.execute(); return ModelConvertor.toCommandDescriptors(getCommands.getResult()); } catch (final SBonitaException e) { throw new RetrieveException(e); } }
@Override public void removeDependency(final String name) throws DependencyNotFoundException, DeletionException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final DependencyService dependencyService = tenantAccessor.getDependencyService(); try { dependencyService.deleteDependency(name); dependencyService.refreshClassLoaderAfterUpdate(ScopeType.TENANT, tenantAccessor.getTenantId()); } catch (final SDependencyNotFoundException e) { throw new DependencyNotFoundException(e); } catch (final SBonitaException e) { throw new DeletionException(e); } }
@Override public List<CommandDescriptor> getUserCommands(final int startIndex, final int maxResults, final CommandCriterion sort) { final CommandService commandService = getTenantAccessor().getCommandService(); try { final GetCommands getCommands = new GetCommands(commandService, startIndex, maxResults, sort); getCommands.execute(); return ModelConvertor.toCommandDescriptors(getCommands.getResult()); } catch (final SBonitaException e) { throw new RetrieveException(e); } }
@Override public void removeDependency(final String name) throws DependencyNotFoundException, DeletionException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final DependencyService dependencyService = tenantAccessor.getDependencyService(); try { dependencyService.deleteDependency(name); dependencyService.refreshClassLoaderAfterUpdate(ScopeType.TENANT, tenantAccessor.getTenantId()); } catch (final SDependencyNotFoundException e) { throw new DependencyNotFoundException(e); } catch (final SBonitaException e) { throw new DeletionException(e); } }
private void update(final SCommandFetcher commandFetcher, final CommandUpdater updateDescriptor) throws UpdateException { if (updateDescriptor == null || updateDescriptor.getFields().isEmpty()) { throw new UpdateException("The update descriptor does not contain field updates"); } final SCommandUpdateBuilderFactory fact = BuilderFactory.get(SCommandUpdateBuilderFactory.class); final SCommandUpdateBuilder commandUpdateBuilder = fact.createNewInstance(); final CommandService commandService = getTenantAccessor().getCommandService(); try { final EntityUpdateDescriptor changeDescriptor = getCommandUpdateDescriptor(updateDescriptor, commandUpdateBuilder); final SCommand sCommand = commandFetcher.fetch(commandService); commandService.update(sCommand, changeDescriptor); } catch (final SCommandNotFoundException | SCommandUpdateException e) { throw new UpdateException(e); } }
private void update(final SCommandFetcher commandFetcher, final CommandUpdater updateDescriptor) throws UpdateException { if (updateDescriptor == null || updateDescriptor.getFields().isEmpty()) { throw new UpdateException("The update descriptor does not contain field updates"); } final SCommandUpdateBuilderFactory fact = BuilderFactory.get(SCommandUpdateBuilderFactory.class); final SCommandUpdateBuilder commandUpdateBuilder = fact.createNewInstance(); final CommandService commandService = getTenantAccessor().getCommandService(); try { final EntityUpdateDescriptor changeDescriptor = getCommandUpdateDescriptor(updateDescriptor, commandUpdateBuilder); final SCommand sCommand = commandFetcher.fetch(commandService); commandService.update(sCommand, changeDescriptor); } catch (final SCommandNotFoundException | SCommandUpdateException e) { throw new UpdateException(e); } }
@Override public void addDependency(final String name, final byte[] jar) throws AlreadyExistsException, CreationException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final DependencyService dependencyService = tenantAccessor.getDependencyService(); try { dependencyService.createMappedDependency(name, jar, name + ".jar", tenantAccessor.getTenantId(), ScopeType.TENANT); dependencyService.refreshClassLoaderAfterUpdate(ScopeType.TENANT, tenantAccessor.getTenantId()); } catch (final SDependencyAlreadyExistsException e) { throw new AlreadyExistsException(e); } catch (final SDependencyException sbe) { throw new CreationException(sbe); } }
@Override public SearchResult<CommandDescriptor> searchCommands(final SearchOptions searchOptions) throws SearchException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final CommandService commandService = tenantAccessor.getCommandService(); final SearchEntitiesDescriptor searchEntitiesDescriptor = tenantAccessor.getSearchEntitiesDescriptor(); final SearchCommands searchCommands = new SearchCommands(commandService, searchEntitiesDescriptor.getSearchCommandDescriptor(), searchOptions); try { searchCommands.execute(); return searchCommands.getResult(); } catch (final SBonitaException sbe) { throw new SearchException(sbe); } }
@Override public void addDependency(final String name, final byte[] jar) throws AlreadyExistsException, CreationException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final DependencyService dependencyService = tenantAccessor.getDependencyService(); try { dependencyService.createMappedDependency(name, jar, name + ".jar", tenantAccessor.getTenantId(), ScopeType.TENANT); dependencyService.refreshClassLoaderAfterUpdate(ScopeType.TENANT, tenantAccessor.getTenantId()); } catch (final SDependencyAlreadyExistsException e) { throw new AlreadyExistsException(e); } catch (final SDependencyException sbe) { throw new CreationException(sbe); } }
@Override public SearchResult<CommandDescriptor> searchCommands(final SearchOptions searchOptions) throws SearchException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final CommandService commandService = tenantAccessor.getCommandService(); final SearchEntitiesDescriptor searchEntitiesDescriptor = tenantAccessor.getSearchEntitiesDescriptor(); final SearchCommands searchCommands = new SearchCommands(commandService, searchEntitiesDescriptor.getSearchCommandDescriptor(), searchOptions); try { searchCommands.execute(); return searchCommands.getResult(); } catch (final SBonitaException sbe) { throw new SearchException(sbe); } }