jpl.mipl.pgs.jbpm.services
Class ProcessService

java.lang.Object
  extended by jpl.mipl.pgs.jbpm.services.ProcessService

public class ProcessService
extends Object

Provides methods for controlling process execution and inquiry about process instance. This class provides a thread safe mechanism for controlling process execution. Controlling means stopping, pausing, resuming, etc. of process instance. Inquiry means inquiring about the status of a process instance.


       Copyright 2004-Present, California Institute of Technology.
       ALL RIGHTS RESERVED.
       U.S. Government Sponsorship acknowledge.
 

Author:
Raj Patel {Rajesh.R.Patel@jpl.nasa.gov}

Nested Class Summary
static class ProcessService.PI_STATUS
           
 
Field Summary
static String ABORT_MESSAGE
           
static String COMPLETED_MESSAGE
           
static String PAUSE_AT_NODE_MESSAGE
           
static String PAUSE_MESSAGE
           
static String STOP_MESSAGE
           
 
Constructor Summary
ProcessService()
           
 
Method Summary
static ProcessService.PI_STATUS abort(org.jbpm.graph.exe.ProcessInstance pi, String reason)
          Sends an abort signal to the given process instance.
static boolean aborted(org.jbpm.graph.exe.ProcessInstance pi)
          Returns true if an abort signal is received for this PI
static boolean hasAsyncActionHandler(org.jbpm.graph.def.GraphElement element)
          Check to see if the given graph element has a task of type AsyncTaskRunner
static boolean isJoin(org.jbpm.graph.def.Node node)
          Returns true if the given node is a PGS join node.
static boolean isMJoin(org.jbpm.graph.def.Node node)
          Returns true if the given node is a PGS join node where more then one parent (multiple splits) merges.
static boolean isMSplit(org.jbpm.graph.def.Node node)
          Returns true if the given node is a PGS split node that meets at a join where more then one parent token merges.
static boolean isSplit(org.jbpm.graph.def.Node node)
          Returns true if the given node is a PGS split node.
static ProcessService.PI_STATUS pause(org.jbpm.graph.exe.ProcessInstance pi, String reason)
          Pauses the pi's execution by pausing only the TokenRunner.
static ProcessService.PI_STATUS pause(org.jbpm.graph.exe.ProcessInstance pi, String nodeName, String reason)
          Pauses the pi's execution by pausing only the TokenRunner.
static boolean paused(org.jbpm.graph.exe.ProcessInstance pi)
          Returns true if an abort signal is received for this PI
static boolean paused(org.jbpm.graph.exe.ProcessInstance pi, String nodeName)
          Returns true if the given process instance is paused at specified node.
static boolean pausedAtNode(org.jbpm.graph.exe.ProcessInstance pi)
          Returns true if the given pi is paused at any node.
static String reason(org.jbpm.graph.exe.ProcessInstance pi)
          Returns the reason for abort or stop or pause or null if pi is neither aborted nor stopped nor paused.
static ProcessService.PI_STATUS resume(org.jbpm.graph.exe.ProcessInstance pi)
          Resume process execution and notifies pi.
static void resume(org.jbpm.graph.exe.ProcessInstance pi, String nodeName)
          Resume process execution and notifies pi.
static boolean resumed(org.jbpm.graph.exe.ProcessInstance pi)
          Returns true if the process was resumed or if it was never paused.
static boolean resumed(org.jbpm.graph.exe.ProcessInstance pi, String nodeName)
          Returns true if the process was resumed or if it was never paused.
static ProcessService.PI_STATUS status(org.jbpm.graph.exe.ProcessInstance pi)
          Returns the status of the given processinstance.
static ProcessService.PI_STATUS stop(org.jbpm.graph.exe.ProcessInstance pi, String reason)
          Signals the process to stop.
static boolean stopped(org.jbpm.graph.exe.ProcessInstance pi)
          Returns true if an stop signal is received for this PI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPLETED_MESSAGE

public static final String COMPLETED_MESSAGE
See Also:
Constant Field Values

ABORT_MESSAGE

public static final String ABORT_MESSAGE
See Also:
Constant Field Values

PAUSE_MESSAGE

public static final String PAUSE_MESSAGE
See Also:
Constant Field Values

PAUSE_AT_NODE_MESSAGE

public static final String PAUSE_AT_NODE_MESSAGE
See Also:
Constant Field Values

STOP_MESSAGE

public static final String STOP_MESSAGE
See Also:
Constant Field Values
Constructor Detail

ProcessService

public ProcessService()
Method Detail

hasAsyncActionHandler

public static boolean hasAsyncActionHandler(org.jbpm.graph.def.GraphElement element)
Check to see if the given graph element has a task of type AsyncTaskRunner

Parameters:
element - The element to check
Returns:
true if the node has an action with the action handler of type AsyncTaskRunner.

status

public static ProcessService.PI_STATUS status(org.jbpm.graph.exe.ProcessInstance pi)
Returns the status of the given processinstance.


reason

public static String reason(org.jbpm.graph.exe.ProcessInstance pi)
Returns the reason for abort or stop or pause or null if pi is neither aborted nor stopped nor paused. In case of paused at node, returns the first reason that is found from the context of the given pi.


stop

public static ProcessService.PI_STATUS stop(org.jbpm.graph.exe.ProcessInstance pi,
                                            String reason)
Signals the process to stop. A stop is an exit with a possibility of rerun.

Returns:
jpl.mipl.pgs.jbpm.services.ProcessService.STOPPED if process instance is stopped else returns the current status of process instance.

stopped

public static boolean stopped(org.jbpm.graph.exe.ProcessInstance pi)
Returns true if an stop signal is received for this PI.


abort

public static ProcessService.PI_STATUS abort(org.jbpm.graph.exe.ProcessInstance pi,
                                             String reason)
Sends an abort signal to the given process instance. An abort is hint to stop execution immediately. It is a HINT because the final decision is made by the executing Task.

Returns:
jpl.mipl.pgs.jbpm.services.ProcessService.ABORTED if process instance is aborted else returns the current status of process instance.

aborted

public static boolean aborted(org.jbpm.graph.exe.ProcessInstance pi)
Returns true if an abort signal is received for this PI


pause

public static ProcessService.PI_STATUS pause(org.jbpm.graph.exe.ProcessInstance pi,
                                             String nodeName,
                                             String reason)
Pauses the pi's execution by pausing only the TokenRunner. It is assumed that a resume will follow the pause, eventually, in same execution.

Returns:
The status. A status of other than jpl.mipl.pgs.jbpm.services.ProcessService.PAUSED_AT_NODE will mean the pause was not performed because the process instance is in a state where the pause is inappropriate.

paused

public static boolean paused(org.jbpm.graph.exe.ProcessInstance pi,
                             String nodeName)
Returns true if the given process instance is paused at specified node.


resume

public static void resume(org.jbpm.graph.exe.ProcessInstance pi,
                          String nodeName)
Resume process execution and notifies pi. This method returns silently if the given process instance is not paused at the specified node.


resumed

public static boolean resumed(org.jbpm.graph.exe.ProcessInstance pi,
                              String nodeName)
Returns true if the process was resumed or if it was never paused.


pause

public static ProcessService.PI_STATUS pause(org.jbpm.graph.exe.ProcessInstance pi,
                                             String reason)
Pauses the pi's execution by pausing only the TokenRunner. It is assumed that a resume will follow the pause, eventually, in same execution.

Returns:
jpl.mipl.pgs.jbpm.services.ProcessService.PAUSE if the PAUSE was successful otherwise the current status of the process instance.

paused

public static boolean paused(org.jbpm.graph.exe.ProcessInstance pi)
Returns true if an abort signal is received for this PI


pausedAtNode

public static boolean pausedAtNode(org.jbpm.graph.exe.ProcessInstance pi)
Returns true if the given pi is paused at any node.


resume

public static ProcessService.PI_STATUS resume(org.jbpm.graph.exe.ProcessInstance pi)
Resume process execution and notifies pi.


resumed

public static boolean resumed(org.jbpm.graph.exe.ProcessInstance pi)
Returns true if the process was resumed or if it was never paused. Use this method both for pause and pauseAtNode


isSplit

public static boolean isSplit(org.jbpm.graph.def.Node node)
Returns true if the given node is a PGS split node.


isJoin

public static boolean isJoin(org.jbpm.graph.def.Node node)
Returns true if the given node is a PGS join node.


isMSplit

public static boolean isMSplit(org.jbpm.graph.def.Node node)
Returns true if the given node is a PGS split node that meets at a join where more then one parent token merges.


isMJoin

public static boolean isMJoin(org.jbpm.graph.def.Node node)
Returns true if the given node is a PGS join node where more then one parent (multiple splits) merges.