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 int
FETCH_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 void
create(SCommand command)
Create command by given commandvoid
delete(long commandId)
Delete command by given command idvoid
delete(java.lang.String commandName)
Delete command by given command nameprotected void
delete(SCommand command, SCommandLogBuilder logBuilder)
void
deleteAll()
Delete all commandsSCommand
get(long commandId)
Get command by given idSCommand
get(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 paginatedlong
getNumberOfCommands(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 falsevoid
pause()
Temporary halt the execution of this service.void
resume()
resume the execution the servicejava.util.List<SCommand>
searchCommands(QueryOptions options)
Get a list of commands according to the specific criteriavoid
start()
Start the servicevoid
stop()
void
update(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:CommandService
Create command by given command- Specified by:
create
in 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, SCommandDeletionException
Description copied from interface:CommandService
Delete command by given command id- Specified by:
delete
in 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, SCommandDeletionException
Description copied from interface:CommandService
Delete command by given command name- Specified by:
delete
in 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 SCommandDeletionException
Description copied from interface:CommandService
Delete all commands- Specified by:
deleteAll
in 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:CommandService
Get command by given name- Specified by:
get
in 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:CommandService
Retrieves a paginated list of commands, The returned list is paginated- Specified by:
getAllCommands
in 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:CommandService
Update the command by its id- Specified by:
update
in 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:CommandService
Retrieves a paginated list of commands with System is false- Specified by:
getUserCommands
in 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:CommandService
Get command by given id- Specified by:
get
in 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:CommandService
Get total number of commands according to the specific criteria- Specified by:
getNumberOfCommands
in 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:CommandService
Get a list of commands according to the specific criteria- Specified by:
searchCommands
in interfaceCommandService
- Parameters:
options
- search criteria- Returns:
- a list of command objects
- Throws:
SBonitaReadException
-
start
public void start() throws SBonitaException
Description copied from interface:LifecycleService
Start the service- Specified by:
start
in interfaceLifecycleService
- Throws:
SBonitaException
-
stop
public void stop() throws SBonitaException
- Specified by:
stop
in interfaceLifecycleService
- Throws:
SBonitaException
-
pause
public void pause() throws SBonitaException
Description copied from interface:LifecycleService
Temporary halt the execution of this service.- Specified by:
pause
in interfaceLifecycleService
- Throws:
SBonitaException
-
resume
public void resume() throws SBonitaException
Description copied from interface:LifecycleService
resume the execution the service- Specified by:
resume
in interfaceLifecycleService
- Throws:
SBonitaException
-
-