org.kie.services.remote.cdi
Class TransactionalExecutor
java.lang.Object
org.kie.services.remote.cdi.TransactionalExecutor
public class TransactionalExecutor
- extends Object
|
Method Summary |
Object |
execute(org.kie.internal.task.api.InternalTaskService taskService,
org.jbpm.services.task.commands.TaskCommand<?> cmd)
Executes a TaskService operation within a transaction. |
Object |
execute(org.kie.api.runtime.KieSession kieSession,
org.kie.api.command.Command<?> cmd)
Executes a KieSession operation within a transaction. |
Object |
executeAndSerialize(org.kie.internal.task.api.InternalTaskService taskService,
org.jbpm.services.task.commands.TaskCommand<?> cmd)
Executes a TaskService operation within a transaction. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TransactionalExecutor
public TransactionalExecutor()
execute
public Object execute(org.kie.api.runtime.KieSession kieSession,
org.kie.api.command.Command<?> cmd)
- Executes a
KieSession operation within a transaction.
- Parameters:
kieSession - The KieSession that the operation is being executed on.cmd - The Command to be executed.
- Returns:
- The result of the
Command, possibly null.
execute
public Object execute(org.kie.internal.task.api.InternalTaskService taskService,
org.jbpm.services.task.commands.TaskCommand<?> cmd)
- Executes a
TaskService operation within a transaction.
This method should only be used for TaskCommand classes that return objects that are not
(persistence) entity instances. If the TaskCommand returns a persistence entity, such as the TaskImpl
or ContentImpl, then use the executeAndSerialize(InternalTaskService, TaskCommand)
method.
- Parameters:
taskService - The TaskService to execute the operation on.cmd - The TaskCommand to be executed.
- Returns:
- The result of the
TaskCommand, possibly null.
executeAndSerialize
public Object executeAndSerialize(org.kie.internal.task.api.InternalTaskService taskService,
org.jbpm.services.task.commands.TaskCommand<?> cmd)
- Executes a
TaskService operation within a transaction. This method also tries to make sure the object returned
by the TaskCommand executed is also serialized within the transaction.
This is done in order to avoid problems with proxy collection objects inserted into the entity instances (such as
TaskImpl): if these collection objects are accessed outside of a transaction, errors will occur.
In essence, we're tightly coupling to the TaskService here, because of problems with the TaskService.
If those problems are ever fixed, this method should no longer be necessary.
- Parameters:
taskService - The TaskService on which the operation is being executed.cmd - The TaskCommand to be executed.
- Returns:
- The serialized result of the
TaskCommand
Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.