Class CommandFactory
The CommandFactory returns Commands that can be used by classes that implement CommandExecutor. Typically more than one Command will want to be executed, where is where the BatchExecution comes in, which takes a List of commands, think of it as CompositeCommand.
Out of the box marshalling to XML is support for the Commands, specifically the BatchExecution command and ExecutionResults, using the Drools Pipeline. If the drools-pipeline module is added then the PipelineFactory can be used in conjunction with the BatchExecutionHelper to marshall to and from XML. BatchExecutionHelper also provides additional documentation on the supported XML format.
`This api is experimental and thus the classes and the interfaces returned are subject to change.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Command<FactHandle>fromExternalFactHandleCommand(String factHandleExternalForm) static Command<FactHandle>fromExternalFactHandleCommand(String factHandleExternalForm, boolean disconnected) static CommandnewAbortWorkItem(long workItemId) static BatchExecutionCommandnewBatchExecution(List<? extends Command> commands) This is a special composite command and will execute all the supplied commands in turn.static BatchExecutionCommandnewBatchExecution(List<? extends Command> commands, String lookup) static CommandnewCompleteWorkItem(long workItemId, Map<String, Object> results) static CommandnewDelete(FactHandle factHandle) static CommandnewDeleteObject(Object object, String entryPoint) static Commandstatic CommandnewEnableAuditLog(String filename) static CommandnewEnableAuditLog(String directory, String filename) static Commandstatic CommandnewFireAllRules(int max) static CommandnewFireAllRules(String outidentifier) static CommandnewGetFactHandle(Object object) static CommandnewGetFactHandleInEntryPoint(Object object, String entryPoint) static CommandnewGetGlobal(String identifier) Gets the global and adds it to the ExecutionResultsstatic CommandnewGetGlobal(String identifier, String outIdentifier) Gets the global and adds it ot the BatchExecutionresults using the alternative outIdentifier.static CommandnewGetObject(FactHandle factHandle) static CommandnewGetObject(FactHandle factHandle, String outIdentifier) static Commandstatic CommandnewGetObjects(String outIdentifier) static CommandnewGetObjects(ObjectFilter filter) static CommandnewGetObjects(ObjectFilter filter, String outIdentifier) static CommandInserts a new instancestatic CommandInserts a new instance but references via the outIdentifier, which is returned as part of the ExecutionResultsstatic CommandInserts a new instance but references via the outIdentifier, which is returned as part of the ExecutionResults The outIdentifier can be null.static CommandnewInsertElements(Collection objects) Iterate and insert each of the elements of the Collection.static CommandnewInsertElements(Collection objects, String outIdentifier, boolean returnObject, String entryPoint) Iterate and insert each of the elements of the Collection.static CommandnewModify(FactHandle factHandle, List<Setter> setters) static CommandExecutes a query.static CommandExecutes a query using the given parameters.static CommandnewRegisterWorkItemHandlerCommand(WorkItemHandler handler, String workItemName) static CommandnewSetGlobal(String identifier, Object object) Sets the global.static CommandnewSetGlobal(String identifier, Object object, boolean out) Sets the global but also when the out parameter is true specifies that the global is added to the ExecutionResults.static CommandnewSetGlobal(String identifier, Object object, String outIdentifier) Sets the global but also specifies that the global is added to the ExecutionResults.static Setterstatic CommandnewSignalEvent(String type, Object event) static CommandnewSignalEvent(String processInstanceId, String type, Object event) static CommandnewStartProcess(String processId) Start a processstatic CommandnewStartProcess(String processId, Map<String, Object> parameters) Start a process using the given parameters.
-
Constructor Details
-
CommandFactory
public CommandFactory()
-
-
Method Details
-
newInsert
Inserts a new instance- Parameters:
object-- Returns:
-
newDispose
-
newInsert
Inserts a new instance but references via the outIdentifier, which is returned as part of the ExecutionResults- Parameters:
object-outIdentifier-- Returns:
-
newInsert
public static Command newInsert(Object object, String outIdentifier, boolean returnObject, String entryPoint) Inserts a new instance but references via the outIdentifier, which is returned as part of the ExecutionResults The outIdentifier can be null. The entryPoint, which can also be null, specifies the entrypoint the object is inserted into.- Parameters:
object-outIdentifier-entryPoint-- Returns:
-
newInsertElements
Iterate and insert each of the elements of the Collection.- Parameters:
objects- The objects to insert- Returns:
-
newInsertElements
public static Command newInsertElements(Collection objects, String outIdentifier, boolean returnObject, String entryPoint) Iterate and insert each of the elements of the Collection.- Parameters:
objects- The objects to insertoutIdentifier- Identifier to lookup the returned objectsreturnObject- boolean to specify whether the inserted Collection is part of the ExecutionResultsentryPoint- Optional EntryPoint for the insertions- Returns:
-
newDelete
-
newDeleteObject
-
newGetFactHandle
-
newGetFactHandleInEntryPoint
-
newSetter
-
newModify
-
newGetObject
-
newGetObject
-
newGetObjects
-
newGetObjects
-
newGetObjects
-
newGetObjects
-
newSetGlobal
Sets the global. Does not add the global to the ExecutionResults.- Parameters:
identifier- The identifier of the globalobject- The instance to be set as the global.- Returns:
-
newSetGlobal
Sets the global but also when the out parameter is true specifies that the global is added to the ExecutionResults.- Parameters:
identifier- The identifier of the globalobject- The instance to be set as the global.out- When true the global will be added to the ExecutionResults using the global's identifier.- Returns:
-
newSetGlobal
Sets the global but also specifies that the global is added to the ExecutionResults. Instead of using the global's identifier it uses the outIdentifier when being added to the ExecutionResults.- Parameters:
identifier- The identifier of the globalobject- The instance to be set as the global.outIdentifier- The identifier used to store the global in the ExecutionResults- Returns:
-
newGetGlobal
Gets the global and adds it to the ExecutionResults- Parameters:
identifier-- Returns:
-
newGetGlobal
Gets the global and adds it ot the BatchExecutionresults using the alternative outIdentifier.- Parameters:
identifier- The identifier of the globaloutIdentifier- The identifier used in the ExecutionResults to store the global.- Returns:
-
newFireAllRules
-
newFireAllRules
-
newFireAllRules
-
newStartProcess
Start a process- Parameters:
processId-- Returns:
-
newStartProcess
Start a process using the given parameters.- Parameters:
processId-parameters-- Returns:
-
newSignalEvent
-
newSignalEvent
-
newRegisterWorkItemHandlerCommand
public static Command newRegisterWorkItemHandlerCommand(WorkItemHandler handler, String workItemName) -
newCompleteWorkItem
-
newAbortWorkItem
-
newQuery
Executes a query. The query results will be added to the ExecutionResults using the given identifier.- Parameters:
identifier- The identifier to be used for the results when added to the ExecutionResultsname- The name of the query to execute- Returns:
-
newQuery
Executes a query using the given parameters. The query results will be added to the ExecutionResults using the given identifier.- Parameters:
identifier- The identifier to be used for the results when added to the ExecutionResultsname- The name of the query to executearguments- The arguments to be used for the query parameters- Returns:
-
newBatchExecution
This is a special composite command and will execute all the supplied commands in turn.- Parameters:
commands-- Returns:
-
newBatchExecution
public static BatchExecutionCommand newBatchExecution(List<? extends Command> commands, String lookup) - Returns:
-
fromExternalFactHandleCommand
-
fromExternalFactHandleCommand
public static Command<FactHandle> fromExternalFactHandleCommand(String factHandleExternalForm, boolean disconnected) -
newEnableAuditLog
-
newEnableAuditLog
-