org.jboss.seam.bpm
Class BusinessProcess

java.lang.Object
  extended by org.jboss.seam.core.AbstractMutable
      extended by org.jboss.seam.bpm.BusinessProcess
All Implemented Interfaces:
Serializable, Mutable

@Scope(value=CONVERSATION)
@Name(value="org.jboss.seam.bpm.businessProcess")
@BypassInterceptors
@Install(dependencies="org.jboss.seam.bpm.jbpm",
         precedence=0)
public class BusinessProcess
extends AbstractMutable
implements Serializable

Holds the task and process ids for the current conversation, and provides programmatic control over the business process.

Author:
Gavin King
See Also:
Serialized Form

Constructor Summary
BusinessProcess()
           
 
Method Summary
 void createProcess(String processDefinitionName)
          Create a process instance and associate it with the current conversation.
 void createProcess(String processDefinitionName, boolean shouldSignalProcess)
          Create a process instance and associate it with the current conversation.
 void createProcess(String processDefinitionName, String businessKey)
          Create a process instance and associate it with the current conversation.
 void endTask(String transitionName)
          End the current task, via the given transition.
 Long getProcessId()
          The jBPM process instance id associated with the current conversation.
 Long getTaskId()
          The jBPM task instance id associated with the current conversation.
 boolean hasActiveProcess()
          Is there a process instance that has not ended associated with the current conversation?
 boolean hasCurrentProcess()
          Is there a process instance associated with the current conversation?
 boolean hasCurrentTask()
          Is there a task instance associated with the current conversation?
static BusinessProcess instance()
           
protected  void processEnded(Long processId)
           
protected  void processEnded(String key)
           
protected  void processNotFound(Long processId)
           
protected  void processNotFound(String key)
           
 boolean resumeProcess(Long processId)
          Associate the process instance with the given id with the current conversation.
 boolean resumeProcess(String processDefinition, String key)
          Associate the process instance with the given business key with the current conversation.
 boolean resumeTask(Long taskId)
          Associate the task instance with the given id with the current conversation.
 void setProcessId(Long processId)
          Set the process instance id, without validating that the process instance actually exists.
 void setTaskId(Long taskId)
          Set the task instance id, without validating that the task instance actually exists.
 void startTask()
          Start the current task, using the current actor id
protected  void taskEnded(Long taskId)
           
protected  void taskNotFound(Long taskId)
           
 String toString()
           
 void transition(String transitionName)
          Signal the given transition for the current process instance.
 boolean validateTask()
          Check that the task currently associated with the conversation exists and has not ended.
 
Methods inherited from class org.jboss.seam.core.AbstractMutable
clearDirty, setDirty, setDirty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BusinessProcess

public BusinessProcess()
Method Detail

instance

public static BusinessProcess instance()

hasCurrentProcess

public boolean hasCurrentProcess()
Is there a process instance associated with the current conversation?


hasActiveProcess

public boolean hasActiveProcess()
Is there a process instance that has not ended associated with the current conversation?


hasCurrentTask

public boolean hasCurrentTask()
Is there a task instance associated with the current conversation?


getProcessId

public Long getProcessId()
The jBPM process instance id associated with the current conversation.


setProcessId

public void setProcessId(Long processId)
Set the process instance id, without validating that the process instance actually exists.


getTaskId

public Long getTaskId()
The jBPM task instance id associated with the current conversation.


setTaskId

public void setTaskId(Long taskId)
Set the task instance id, without validating that the task instance actually exists.


createProcess

public void createProcess(String processDefinitionName)
Create a process instance and associate it with the current conversation.

Parameters:
processDefinitionName - the jBPM process definition name

createProcess

public void createProcess(String processDefinitionName,
                          boolean shouldSignalProcess)
Create a process instance and associate it with the current conversation.

Parameters:
processDefinitionName - the jBPM process definition name

createProcess

public void createProcess(String processDefinitionName,
                          String businessKey)
Create a process instance and associate it with the current conversation.

Parameters:
processDefinitionName - the jBPM process definition name
businessKey - the business key of the new process definition

startTask

public void startTask()
Start the current task, using the current actor id

See Also:
Actor

endTask

public void endTask(String transitionName)
End the current task, via the given transition. If no transition name is given, check the Transition component for a transition, or use the default transition.

Parameters:
transitionName - the jBPM transition name, or null

transition

public void transition(String transitionName)
Signal the given transition for the current process instance.

Parameters:
transitionName - the jBPM transition name

resumeTask

public boolean resumeTask(Long taskId)
Associate the task instance with the given id with the current conversation.

Parameters:
taskId - the jBPM task instance id
Returns:
true if the task was found and was not ended

resumeProcess

public boolean resumeProcess(Long processId)
Associate the process instance with the given id with the current conversation.

Parameters:
processId - the jBPM process instance id
Returns:
true if the process was found and was not ended

resumeProcess

public boolean resumeProcess(String processDefinition,
                             String key)
Associate the process instance with the given business key with the current conversation.

Parameters:
processDefinition - the jBPM process definition name
key - the jBPM process instance key
Returns:
true if the process was found and was not ended

validateTask

public boolean validateTask()
Check that the task currently associated with the conversation exists and has not ended.

Returns:
true if the task exists and was not ended

taskNotFound

protected void taskNotFound(Long taskId)

taskEnded

protected void taskEnded(Long taskId)

processEnded

protected void processEnded(Long processId)

processNotFound

protected void processNotFound(Long processId)

processEnded

protected void processEnded(String key)

processNotFound

protected void processNotFound(String key)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Seam Framework. All Rights Reserved.