Class CommandServiceImpl
- java.lang.Object
-
- org.bonitasoft.engine.command.api.impl.CommandServiceImpl
-
- All Implemented Interfaces:
CommandService,LifecycleService,TenantLifecycleService
public class CommandServiceImpl extends java.lang.Object implements CommandService
- Author:
- Zhang Bole, Matthieu Chaffotte, Hongwen Zang, Celine Souchet
-
-
Field Summary
Fields Modifier and Type Field Description static intFETCH_SIZE-
Fields inherited from interface org.bonitasoft.engine.command.CommandService
COMMAND
-
-
Constructor Summary
Constructors Constructor Description CommandServiceImpl(ReadPersistenceService persistenceService, Recorder recorder, EventService eventService, TechnicalLoggerService logger, QueriableLoggerService queriableLoggerService, CommandProvider defaultCommandProvider)CommandServiceImpl(ReadPersistenceService persistenceService, Recorder recorder, EventService eventService, TechnicalLoggerService logger, QueriableLoggerService queriableLoggerService, CommandProvider defaultCommandProvider, int fetchSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreate(SCommand command)Create command by given commandvoiddelete(long commandId)Delete command by given command idvoiddelete(java.lang.String commandName)Delete command by given command nameprotected voiddelete(SCommand command, SCommandLogBuilder logBuilder)voiddeleteAll()Delete all commandsSCommandget(long commandId)Get command by given idSCommandget(java.lang.String commandName)Get command by given namejava.util.List<SCommand>getAllCommands(int startIndex, int maxResults, SCommandCriterion sCommandCriterion)Retrieves a paginated list of commands, The returned list is paginatedlonggetNumberOfCommands(QueryOptions options)Get total number of commands according to the specific criteriajava.util.List<SCommand>getUserCommands(int startIndex, int maxResults, SCommandCriterion sCommandCriterion)Retrieves a paginated list of commands with System is falsevoidpause()Temporary halt the execution of this service.voidresume()resume the execution the servicejava.util.List<SCommand>searchCommands(QueryOptions options)Get a list of commands according to the specific criteriavoidstart()Start the servicevoidstop()voidupdate(SCommand command, EntityUpdateDescriptor updateDescriptor)Update the command by its id-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bonitasoft.engine.commons.TenantLifecycleService
init
-
-
-
-
Field Detail
-
FETCH_SIZE
public static final int FETCH_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CommandServiceImpl
public CommandServiceImpl(ReadPersistenceService persistenceService, Recorder recorder, EventService eventService, TechnicalLoggerService logger, QueriableLoggerService queriableLoggerService, CommandProvider defaultCommandProvider)
-
CommandServiceImpl
public CommandServiceImpl(ReadPersistenceService persistenceService, Recorder recorder, EventService eventService, TechnicalLoggerService logger, QueriableLoggerService queriableLoggerService, CommandProvider defaultCommandProvider, int fetchSize)
-
-
Method Detail
-
create
public void create(SCommand command) throws SCommandAlreadyExistsException, SCommandCreationException
Description copied from interface:CommandServiceCreate command by given command- Specified by:
createin interfaceCommandService- Parameters:
command- command without Id- Throws:
SCommandAlreadyExistsException- Error thrown when relative command already existsSCommandCreationException- Error thrown if has exceptions during the creating command.
-
delete
public void delete(long commandId) throws SCommandNotFoundException, SCommandDeletionExceptionDescription copied from interface:CommandServiceDelete command by given command id- Specified by:
deletein interfaceCommandService- Parameters:
commandId- identifier of command which will be deleted- Throws:
SCommandNotFoundException- Error thrown if no command have name corresponding to the parameter.SCommandDeletionException- Error thrown if has exception during the deleting command.
-
delete
protected void delete(SCommand command, SCommandLogBuilder logBuilder) throws SCommandDeletionException
- Throws:
SCommandDeletionException
-
delete
public void delete(java.lang.String commandName) throws SCommandNotFoundException, SCommandDeletionExceptionDescription copied from interface:CommandServiceDelete command by given command name- Specified by:
deletein interfaceCommandService- Parameters:
commandName- Name of command which will be deleted- Throws:
SCommandNotFoundException- Error thrown if no command have name corresponding to the parameter.SCommandDeletionException- Error thrown if has exception during the deleting command.
-
deleteAll
public void deleteAll() throws SCommandDeletionExceptionDescription copied from interface:CommandServiceDelete all commands- Specified by:
deleteAllin interfaceCommandService- Throws:
SCommandDeletionException- Error thrown if has exception during the deleting command.
-
get
public SCommand get(java.lang.String commandName) throws SCommandNotFoundException
Description copied from interface:CommandServiceGet command by given name- Specified by:
getin interfaceCommandService- Parameters:
commandName- Name of command- Returns:
- a command object
- Throws:
SCommandNotFoundException- Error thrown if no command have name corresponding to the parameter.
-
getAllCommands
public java.util.List<SCommand> getAllCommands(int startIndex, int maxResults, SCommandCriterion sCommandCriterion) throws SCommandGettingException
Description copied from interface:CommandServiceRetrieves a paginated list of commands, The returned list is paginated- Specified by:
getAllCommandsin interfaceCommandService- Parameters:
startIndex- Start index of command recordmaxResults- Number of commands we want to get. Maximum number of commands returned.sCommandCriterion- The criterion used to sort the retried commands- Returns:
- a list of command objects
- Throws:
SCommandGettingException- Error thrown if has exception during the command getting.
-
update
public void update(SCommand command, EntityUpdateDescriptor updateDescriptor) throws SCommandUpdateException
Description copied from interface:CommandServiceUpdate the command by its id- Specified by:
updatein interfaceCommandService- Parameters:
command- The command will be updatedupdateDescriptor- The description for update command- Throws:
SCommandUpdateException- Error thrown if has exception during the command updating.
-
getUserCommands
public java.util.List<SCommand> getUserCommands(int startIndex, int maxResults, SCommandCriterion sCommandCriterion) throws SCommandGettingException
Description copied from interface:CommandServiceRetrieves a paginated list of commands with System is false- Specified by:
getUserCommandsin interfaceCommandService- Parameters:
startIndex- Start index of command recordmaxResults- Number of commands we want to get. Maximum number of commands returned.sCommandCriterion- The criterion used to sort the retried commands- Returns:
- A list of command objects
- Throws:
SCommandGettingException- Error thrown if has exception during the command getting.
-
get
public SCommand get(long commandId) throws SCommandNotFoundException
Description copied from interface:CommandServiceGet command by given id- Specified by:
getin interfaceCommandService- Parameters:
commandId- identifier of command- Returns:
- a command object
- Throws:
SCommandNotFoundException- Error thrown if no command have name corresponding to the parameter.
-
getNumberOfCommands
public long getNumberOfCommands(QueryOptions options) throws SBonitaReadException
Description copied from interface:CommandServiceGet total number of commands according to the specific criteria- Specified by:
getNumberOfCommandsin interfaceCommandService- Parameters:
options- search criteria- Returns:
- total number of commands corresponding to the specific criteria
- Throws:
SBonitaReadException
-
searchCommands
public java.util.List<SCommand> searchCommands(QueryOptions options) throws SBonitaReadException
Description copied from interface:CommandServiceGet a list of commands according to the specific criteria- Specified by:
searchCommandsin interfaceCommandService- Parameters:
options- search criteria- Returns:
- a list of command objects
- Throws:
SBonitaReadException
-
start
public void start() throws SBonitaExceptionDescription copied from interface:LifecycleServiceStart the service- Specified by:
startin interfaceLifecycleService- Throws:
SBonitaException
-
stop
public void stop() throws SBonitaException- Specified by:
stopin interfaceLifecycleService- Throws:
SBonitaException
-
pause
public void pause() throws SBonitaExceptionDescription copied from interface:LifecycleServiceTemporary halt the execution of this service.- Specified by:
pausein interfaceLifecycleService- Throws:
SBonitaException
-
resume
public void resume() throws SBonitaExceptionDescription copied from interface:LifecycleServiceresume the execution the service- Specified by:
resumein interfaceLifecycleService- Throws:
SBonitaException
-
-