[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Mon Oct 16 07:36:38 EDT 2006
User: gavin
Date: 06/10/16 07:36:38
Modified: src/main/org/jboss/seam/core BusinessProcess.java
Dispatcher.java
Log:
javadoc, and method rename
Revision Changes Path
1.6 +70 -7 jboss-seam/src/main/org/jboss/seam/core/BusinessProcess.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BusinessProcess.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/BusinessProcess.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- BusinessProcess.java 10 Oct 2006 19:37:37 -0000 1.5
+++ BusinessProcess.java 16 Oct 2006 11:36:38 -0000 1.6
@@ -18,7 +18,8 @@
import org.jbpm.taskmgmt.exe.TaskInstance;
/**
- * Holds the task and process ids for the current conversation
+ * Holds the task and process ids for the current conversation,
+ * and provides programmatic control over the business process.
*
* @author Gavin King
*
@@ -40,34 +41,64 @@
return (BusinessProcess) Component.getInstance(BusinessProcess.class, ScopeType.CONVERSATION, true);
}
+ /**
+ * Is there a process instance associated with
+ * the current conversation?
+ */
public boolean hasCurrentProcess()
{
return processId!=null;
}
+ /**
+ * Is there a task instance associated with
+ * the current conversation?
+ */
public boolean hasCurrentTask()
{
return taskId!=null;
}
+ /**
+ * The jBPM process instance id associated with
+ * the current conversation.
+ */
public Long getProcessId() {
return processId;
}
+ /**
+ * Set the process instance id, without validating
+ * that the process instance actually exists.
+ */
public void setProcessId(Long processId) {
setDirty(this.processId, processId);
this.processId = processId;
}
+ /**
+ * The jBPM task instance id associated with
+ * the current conversation.
+ */
public Long getTaskId() {
return taskId;
}
+ /**
+ * Set the task instance id, without validating
+ * that the task instance actually exists.
+ */
public void setTaskId(Long taskId) {
setDirty(this.taskId, taskId);
this.taskId = taskId;
}
+ /**
+ * Create a process instance and associate it with the
+ * current conversation.
+ *
+ * @param processDefinitionName the jBPM process definition name
+ */
public void createProcess(String processDefinitionName)
{
JbpmContext jbpmContext = ManagedJbpmContext.instance();
@@ -104,20 +135,27 @@
Events.instance().raiseEvent("org.jboss.seam.startTask." + task.getTask().getName());
}
+ /**
+ * End a task, via the given transition. If no transition name is given,
+ * check the Transition component for a transition, or use the default
+ * transition.
+ *
+ * @param transitionName the jBPM transition name, or null
+ */
public void endTask(String transitionName)
{
TaskInstance task = org.jboss.seam.core.TaskInstance.instance();
- if ( task == null )
+ if (task==null)
{
throw new IllegalStateException( "no task instance associated with context" );
}
- if ( "".equals(transitionName) )
+ if ( transitionName==null || "".equals(transitionName) )
{
transitionName = Transition.instance().getName();
}
- if ( transitionName == null )
+ if (transitionName==null)
{
task.end();
}
@@ -137,6 +175,11 @@
}
}
+ /**
+ * Signal the given transition for the current process instance.
+ *
+ * @param transitionName the jBPM transition name
+ */
public void transition(String transitionName)
{
ProcessInstance process = org.jboss.seam.core.ProcessInstance.instance();
@@ -147,7 +190,14 @@
}
}
- public boolean initTask(Long taskId)
+ /**
+ * Associate the task instance with the given id with the current
+ * conversation.
+ *
+ * @param taskId the jBPM task instance id
+ * @return true if the task was found and was not ended
+ */
+ public boolean resumeTask(Long taskId)
{
setTaskId(taskId);
TaskInstance task = org.jboss.seam.core.TaskInstance.instance();
@@ -170,7 +220,14 @@
}
- public boolean initProcess(Long processId)
+ /**
+ * Associate the process instance with the given id with the
+ * current conversation.
+ *
+ * @param processId the jBPM process instance id
+ * @return true if the process was found and was not ended
+ */
+ public boolean resumeProcess(Long processId)
{
setProcessId(processId);
ProcessInstance process = org.jboss.seam.core.ProcessInstance.instance();
@@ -191,7 +248,13 @@
}
}
- public boolean checkTask()
+ /**
+ * Check that the task currently associated with the conversation
+ * exists and has not ended.
+ *
+ * @return true if the task exists and was not ended
+ */
+ public boolean validateTask()
{
if ( !hasCurrentTask() )
{
1.6 +2 -2 jboss-seam/src/main/org/jboss/seam/core/Dispatcher.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Dispatcher.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Dispatcher.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- Dispatcher.java 11 Oct 2006 01:22:15 -0000 1.5
+++ Dispatcher.java 16 Oct 2006 11:36:38 -0000 1.6
@@ -67,11 +67,11 @@
{
if (taskId!=null)
{
- BusinessProcess.instance().initTask(taskId);
+ BusinessProcess.instance().resumeTask(taskId);
}
else if (processId!=null)
{
- BusinessProcess.instance().initProcess(processId);
+ BusinessProcess.instance().resumeProcess(processId);
}
Contexts.getEventContext().set("timer", timer);
More information about the jboss-cvs-commits
mailing list