Class CommandFactory
- java.lang.Object
-
- org.kie.internal.command.CommandFactory
-
public class CommandFactory extends java.lang.Object
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 Constructor Description CommandFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.kie.api.command.Command<org.kie.api.runtime.rule.FactHandle>
fromExternalFactHandleCommand(java.lang.String factHandleExternalForm)
static org.kie.api.command.Command<org.kie.api.runtime.rule.FactHandle>
fromExternalFactHandleCommand(java.lang.String factHandleExternalForm, boolean disconnected)
static org.kie.api.command.Command
newAbortWorkItem(long workItemId)
static org.kie.api.command.BatchExecutionCommand
newBatchExecution(java.util.List<? extends org.kie.api.command.Command> commands)
This is a special composite command and will execute all the supplied commands in turn.static org.kie.api.command.BatchExecutionCommand
newBatchExecution(java.util.List<? extends org.kie.api.command.Command> commands, java.lang.String lookup)
static org.kie.api.command.Command
newCompleteWorkItem(long workItemId, java.util.Map<java.lang.String,java.lang.Object> results)
static org.kie.api.command.Command
newDelete(org.kie.api.runtime.rule.FactHandle factHandle)
static org.kie.api.command.Command
newDeleteObject(java.lang.Object object, java.lang.String entryPoint)
static org.kie.api.command.Command
newDispose()
static org.kie.api.command.Command
newEnableAuditLog(java.lang.String filename)
static org.kie.api.command.Command
newEnableAuditLog(java.lang.String directory, java.lang.String filename)
static org.kie.api.command.Command
newFireAllRules()
static org.kie.api.command.Command
newFireAllRules(int max)
static org.kie.api.command.Command
newFireAllRules(java.lang.String outidentifier)
static org.kie.api.command.Command
newGetFactHandle(java.lang.Object object)
static org.kie.api.command.Command
newGetFactHandleInEntryPoint(java.lang.Object object, java.lang.String entryPoint)
static org.kie.api.command.Command
newGetGlobal(java.lang.String identifier)
Gets the global and adds it to the ExecutionResultsstatic org.kie.api.command.Command
newGetGlobal(java.lang.String identifier, java.lang.String outIdentifier)
Gets the global and adds it ot the BatchExecutionresults using the alternative outIdentifier.static org.kie.api.command.Command
newGetObject(org.kie.api.runtime.rule.FactHandle factHandle)
static org.kie.api.command.Command
newGetObject(org.kie.api.runtime.rule.FactHandle factHandle, java.lang.String outIdentifier)
static org.kie.api.command.Command
newGetObjects()
static org.kie.api.command.Command
newGetObjects(java.lang.String outIdentifier)
static org.kie.api.command.Command
newGetObjects(org.kie.api.runtime.ObjectFilter filter)
static org.kie.api.command.Command
newGetObjects(org.kie.api.runtime.ObjectFilter filter, java.lang.String outIdentifier)
static org.kie.api.command.Command
newInsert(java.lang.Object object)
Inserts a new instancestatic org.kie.api.command.Command
newInsert(java.lang.Object object, java.lang.String outIdentifier)
Inserts a new instance but references via the outIdentifier, which is returned as part of the ExecutionResultsstatic org.kie.api.command.Command
newInsert(java.lang.Object object, java.lang.String outIdentifier, boolean returnObject, java.lang.String entryPoint)
Inserts a new instance but references via the outIdentifier, which is returned as part of the ExecutionResults The outIdentifier can be null.static org.kie.api.command.Command
newInsertElements(java.util.Collection objects)
Iterate and insert each of the elements of the Collection.static org.kie.api.command.Command
newInsertElements(java.util.Collection objects, java.lang.String outIdentifier, boolean returnObject, java.lang.String entryPoint)
Iterate and insert each of the elements of the Collection.static org.kie.api.command.Command
newModify(org.kie.api.runtime.rule.FactHandle factHandle, java.util.List<org.kie.api.command.Setter> setters)
static org.kie.api.command.Command
newQuery(java.lang.String identifier, java.lang.String name)
Executes a query.static org.kie.api.command.Command
newQuery(java.lang.String identifier, java.lang.String name, java.lang.Object[] arguments)
Executes a query using the given parameters.static org.kie.api.command.Command
newRegisterWorkItemHandlerCommand(org.kie.api.runtime.process.WorkItemHandler handler, java.lang.String workItemName)
static org.kie.api.command.Command
newSetGlobal(java.lang.String identifier, java.lang.Object object)
Sets the global.static org.kie.api.command.Command
newSetGlobal(java.lang.String identifier, java.lang.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 org.kie.api.command.Command
newSetGlobal(java.lang.String identifier, java.lang.Object object, java.lang.String outIdentifier)
Sets the global but also specifies that the global is added to the ExecutionResults.static org.kie.api.command.Setter
newSetter(java.lang.String accessor, java.lang.String value)
static org.kie.api.command.Command
newSignalEvent(java.lang.String type, java.lang.Object event)
static org.kie.api.command.Command
newSignalEvent(java.lang.String processInstanceId, java.lang.String type, java.lang.Object event)
static org.kie.api.command.Command
newStartProcess(java.lang.String processId)
Start a processstatic org.kie.api.command.Command
newStartProcess(java.lang.String processId, java.util.Map<java.lang.String,java.lang.Object> parameters)
Start a process using the given parameters.
-
-
-
Method Detail
-
newInsert
public static org.kie.api.command.Command newInsert(java.lang.Object object)
Inserts a new instance- Parameters:
object
-- Returns:
-
newDispose
public static org.kie.api.command.Command newDispose()
-
newInsert
public static org.kie.api.command.Command newInsert(java.lang.Object object, java.lang.String outIdentifier)
Inserts a new instance but references via the outIdentifier, which is returned as part of the ExecutionResults- Parameters:
object
-outIdentifier
-- Returns:
-
newInsert
public static org.kie.api.command.Command newInsert(java.lang.Object object, java.lang.String outIdentifier, boolean returnObject, java.lang.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
public static org.kie.api.command.Command newInsertElements(java.util.Collection objects)
Iterate and insert each of the elements of the Collection.- Parameters:
objects
- The objects to insert- Returns:
-
newInsertElements
public static org.kie.api.command.Command newInsertElements(java.util.Collection objects, java.lang.String outIdentifier, boolean returnObject, java.lang.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
public static org.kie.api.command.Command newDelete(org.kie.api.runtime.rule.FactHandle factHandle)
-
newDeleteObject
public static org.kie.api.command.Command newDeleteObject(java.lang.Object object, java.lang.String entryPoint)
-
newGetFactHandle
public static org.kie.api.command.Command newGetFactHandle(java.lang.Object object)
-
newGetFactHandleInEntryPoint
public static org.kie.api.command.Command newGetFactHandleInEntryPoint(java.lang.Object object, java.lang.String entryPoint)
-
newSetter
public static org.kie.api.command.Setter newSetter(java.lang.String accessor, java.lang.String value)
-
newModify
public static org.kie.api.command.Command newModify(org.kie.api.runtime.rule.FactHandle factHandle, java.util.List<org.kie.api.command.Setter> setters)
-
newGetObject
public static org.kie.api.command.Command newGetObject(org.kie.api.runtime.rule.FactHandle factHandle)
-
newGetObject
public static org.kie.api.command.Command newGetObject(org.kie.api.runtime.rule.FactHandle factHandle, java.lang.String outIdentifier)
-
newGetObjects
public static org.kie.api.command.Command newGetObjects()
-
newGetObjects
public static org.kie.api.command.Command newGetObjects(java.lang.String outIdentifier)
-
newGetObjects
public static org.kie.api.command.Command newGetObjects(org.kie.api.runtime.ObjectFilter filter)
-
newGetObjects
public static org.kie.api.command.Command newGetObjects(org.kie.api.runtime.ObjectFilter filter, java.lang.String outIdentifier)
-
newSetGlobal
public static org.kie.api.command.Command newSetGlobal(java.lang.String identifier, java.lang.Object object)
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
public static org.kie.api.command.Command newSetGlobal(java.lang.String identifier, java.lang.Object object, boolean out)
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
public static org.kie.api.command.Command newSetGlobal(java.lang.String identifier, java.lang.Object object, java.lang.String outIdentifier)
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
public static org.kie.api.command.Command newGetGlobal(java.lang.String identifier)
Gets the global and adds it to the ExecutionResults- Parameters:
identifier
-- Returns:
-
newGetGlobal
public static org.kie.api.command.Command newGetGlobal(java.lang.String identifier, java.lang.String outIdentifier)
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
public static org.kie.api.command.Command newFireAllRules()
-
newFireAllRules
public static org.kie.api.command.Command newFireAllRules(int max)
-
newFireAllRules
public static org.kie.api.command.Command newFireAllRules(java.lang.String outidentifier)
-
newStartProcess
public static org.kie.api.command.Command newStartProcess(java.lang.String processId)
Start a process- Parameters:
processId
-- Returns:
-
newStartProcess
public static org.kie.api.command.Command newStartProcess(java.lang.String processId, java.util.Map<java.lang.String,java.lang.Object> parameters)
Start a process using the given parameters.- Parameters:
processId
-parameters
-- Returns:
-
newSignalEvent
public static org.kie.api.command.Command newSignalEvent(java.lang.String type, java.lang.Object event)
-
newSignalEvent
public static org.kie.api.command.Command newSignalEvent(java.lang.String processInstanceId, java.lang.String type, java.lang.Object event)
-
newRegisterWorkItemHandlerCommand
public static org.kie.api.command.Command newRegisterWorkItemHandlerCommand(org.kie.api.runtime.process.WorkItemHandler handler, java.lang.String workItemName)
-
newCompleteWorkItem
public static org.kie.api.command.Command newCompleteWorkItem(long workItemId, java.util.Map<java.lang.String,java.lang.Object> results)
-
newAbortWorkItem
public static org.kie.api.command.Command newAbortWorkItem(long workItemId)
-
newQuery
public static org.kie.api.command.Command newQuery(java.lang.String identifier, java.lang.String name)
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
public static org.kie.api.command.Command newQuery(java.lang.String identifier, java.lang.String name, java.lang.Object[] arguments)
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
public static org.kie.api.command.BatchExecutionCommand newBatchExecution(java.util.List<? extends org.kie.api.command.Command> commands)
This is a special composite command and will execute all the supplied commands in turn.- Parameters:
commands
-- Returns:
-
newBatchExecution
public static org.kie.api.command.BatchExecutionCommand newBatchExecution(java.util.List<? extends org.kie.api.command.Command> commands, java.lang.String lookup)
- Returns:
-
fromExternalFactHandleCommand
public static org.kie.api.command.Command<org.kie.api.runtime.rule.FactHandle> fromExternalFactHandleCommand(java.lang.String factHandleExternalForm)
-
fromExternalFactHandleCommand
public static org.kie.api.command.Command<org.kie.api.runtime.rule.FactHandle> fromExternalFactHandleCommand(java.lang.String factHandleExternalForm, boolean disconnected)
-
newEnableAuditLog
public static org.kie.api.command.Command newEnableAuditLog(java.lang.String directory, java.lang.String filename)
-
newEnableAuditLog
public static org.kie.api.command.Command newEnableAuditLog(java.lang.String filename)
-
-