KIE Remote Services :: Services 6.0.0.CR5

org.kie.services.remote.rest
Class RestProcessRequestBean

java.lang.Object
  extended by org.kie.services.remote.rest.RestProcessRequestBean

@RequestScoped
public class RestProcessRequestBean
extends Object

This class is used by both the RuntimeResource and TaskResource to do the core operations on the Deployment/Runtime's KieSession and TaskService.

It contains the necessary logic to do the following: The commit on the SeamTransaction is necessary in order to avoid race-conditions involving the application scoped EntityManager used in the KieSession.


Constructor Summary
RestProcessRequestBean()
           
 
Method Summary
 Object doKieSessionOperation(org.kie.api.command.Command<?> cmd, String deploymentId, Long processInstanceId, String errorMsg)
          A variant of the above method which always calls commit once the Command has completed.
 Object doKieSessionOperation(org.kie.api.command.Command<?> cmd, String deploymentId, Long processInstanceId, String errorMsg, boolean commit)
          A variant of the above method which commits but does not restart the SeamTransaction once the command has completed.
 Object doKieSessionOperation(org.kie.api.command.Command<?> cmd, String deploymentId, Long processInstanceId, String errorMsg, boolean commit, boolean restartTx)
          Executes a command on the KieSession from the proper RuntimeManager.
 Object doTaskOperation(org.jbpm.services.task.commands.TaskCommand<?> cmd, String errorMsg)
          Executes a command on the TaskService (without synchronizing around the KieSession)
 Object doTaskOperationOnDeployment(org.jbpm.services.task.commands.TaskCommand<?> cmd, String errorMsg, String deploymentId)
          Variant of the above method which does not restart the transaction.
 Object doTaskOperationOnDeployment(org.jbpm.services.task.commands.TaskCommand<?> cmd, String errorMsg, String deploymentId, boolean restartTx)
          Executes a command on the injected TaskService instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestProcessRequestBean

public RestProcessRequestBean()
Method Detail

doKieSessionOperation

public Object doKieSessionOperation(org.kie.api.command.Command<?> cmd,
                                    String deploymentId,
                                    Long processInstanceId,
                                    String errorMsg,
                                    boolean commit,
                                    boolean restartTx)
Executes a command on the KieSession from the proper RuntimeManager. This method ends up synchronizing around the retrieved KieSession in order to avoid race-conditions.

Parameters:
cmd - The command to be executed.
deploymentId - The id of the runtime.
processInstanceId - The process instance id, if available.
commit - Whether or not to commit (the SeamTransaction) at after the Command has been completed.
Returns:
The result of the Command.

doKieSessionOperation

public Object doKieSessionOperation(org.kie.api.command.Command<?> cmd,
                                    String deploymentId,
                                    Long processInstanceId,
                                    String errorMsg)
A variant of the above method which always calls commit once the Command has completed.

Parameters:
cmd - The command to be executed.
deploymentId - The id of the runtime.
processInstanceId - The process id, if available.
Returns:
The result of the executed command.

doKieSessionOperation

public Object doKieSessionOperation(org.kie.api.command.Command<?> cmd,
                                    String deploymentId,
                                    Long processInstanceId,
                                    String errorMsg,
                                    boolean commit)
A variant of the above method which commits but does not restart the SeamTransaction once the command has completed.

Parameters:
cmd - The command to be executed.
deploymentId - The id of the runtime.
processInstanceId - The process id, if available.
Returns:
The result of the executed command.

doTaskOperationOnDeployment

public Object doTaskOperationOnDeployment(org.jbpm.services.task.commands.TaskCommand<?> cmd,
                                          String errorMsg,
                                          String deploymentId,
                                          boolean restartTx)
Executes a command on the injected TaskService instance.

Should be used only for commands that end up affecting the associated KieSession. Since the CompleteTaskCommand ends up signalling the KieSession, we make sure to first retrieve the proper KieSession in order to synchronize around it.

Parameters:
cmd - The command to be executed.
errorMsg - The message to be added to any (non-runtime) exceptions thrown.
deploymentId - The deployment id of the runtime.
Returns:
The result of the completed command.

doTaskOperationOnDeployment

public Object doTaskOperationOnDeployment(org.jbpm.services.task.commands.TaskCommand<?> cmd,
                                          String errorMsg,
                                          String deploymentId)
Variant of the above method which does not restart the transaction.

Parameters:
cmd - The Command to be executed.
errorMsg - The error message for any exception thrown.
deploymentId - The deployment id.
Returns:
The result of the given Command.

doTaskOperation

public Object doTaskOperation(org.jbpm.services.task.commands.TaskCommand<?> cmd,
                              String errorMsg)
Executes a command on the TaskService (without synchronizing around the KieSession)

Parameters:
cmd - The command to be executed.
errorMsg - The error message to be attached to any exceptions thrown.
Returns:
The result of the completed command.

KIE Remote Services :: Services 6.0.0.CR5

Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.