@Override public CommandDescriptor get(final long commandId) throws CommandNotFoundException { return getCommand(new SCommandFetcherById(commandId)); }
@Override public CommandDescriptor get(final long commandId) throws CommandNotFoundException { return getCommand(new SCommandFetcherById(commandId)); }
@Override public CommandDescriptor getCommand(final String commandName) throws CommandNotFoundException { return getCommand(new SCommandFetcherByName(commandName)); }
@Override public CommandDescriptor getCommand(final String commandName) throws CommandNotFoundException { return getCommand(new SCommandFetcherByName(commandName)); }
@Override public CommandDescriptor register(final String name, final String description, final String implementation) throws AlreadyExistsException, CreationException { CommandDescriptor existingCommandDescriptor = null; try { existingCommandDescriptor = getCommand(name); } catch (final CommandNotFoundException notFoundE) { // Nothing to do : no command with that name exists. } if (existingCommandDescriptor != null) { throw new AlreadyExistsException("A command with name \"" + name + "\" already exists"); } final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final CommandService commandService = tenantAccessor.getCommandService(); final SCommandBuilderFactory fact = BuilderFactory.get(SCommandBuilderFactory.class); final SCommand sCommand = fact.createNewInstance(name, description, implementation).setSystem(false).done(); try { commandService.create(sCommand); return ModelConvertor.toCommandDescriptor(sCommand); } catch (final SBonitaException sbe) { throw new CreationException(sbe); } }
@Override public CommandDescriptor register(final String name, final String description, final String implementation) throws AlreadyExistsException, CreationException { CommandDescriptor existingCommandDescriptor = null; try { existingCommandDescriptor = getCommand(name); } catch (final CommandNotFoundException notFoundE) { // Nothing to do : no command with that name exists. } if (existingCommandDescriptor != null) { throw new AlreadyExistsException("A command with name \"" + name + "\" already exists"); } final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final CommandService commandService = tenantAccessor.getCommandService(); final SCommandBuilderFactory fact = BuilderFactory.get(SCommandBuilderFactory.class); final SCommand sCommand = fact.createNewInstance(name, description, implementation).setSystem(false).done(); try { commandService.create(sCommand); return ModelConvertor.toCommandDescriptor(sCommand); } catch (final SBonitaException sbe) { throw new CreationException(sbe); } }