|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ow2.bonita.pvm.model.ProcessFactory
public class ProcessFactory
factory for process definitions.
Use this factory as a fluent
interface for building a process definition. To use it in this way, start
with instantiating a ProcessFactory object. Then a number of methods can be
invoked concatenated with dots cause all the methods return the same process
factory object. When done, end that sequence with done()
to get the
constructed ProcessDefinition.
The idea is that this results into a more compact and more readable code to build process definitions as opposed to including xml inline. For example :
ProcessDefinition processDefinition = ProcessFactory.build().node().initial() .behaviour(new WaitState()).transition("normal").to("a").transition( "shortcut").to("c").node("a").behaviour(new WaitState()).transition() .to("b").node("b").behaviour(new WaitState()).transition().to("c") .node("c").behaviour(new WaitState()).done();
If more control is needed over the creation of the process definition
objects, then consider using the concrete implementation classes from package
org.ow2.bonita.pvm.internal.model
directly. The implementation code
of this class might be a good guide to get you on your way.
Nested Class Summary | |
---|---|
class |
ProcessFactory.DestinationReference
|
Field Summary | |
---|---|
protected CompositeElementImpl |
compositeElement
|
protected java.util.Stack<CompositeElementImpl> |
compositeElementStack
|
protected java.util.List<ProcessFactory.DestinationReference> |
destinationReferences
|
protected EventImpl |
event
|
protected EventListenerReference |
eventListenerReference
|
protected ExceptionHandlerImpl |
exceptionHandler
|
protected NodeImpl |
node
|
protected ObservableElementImpl |
observableElement
|
protected PVMProcessDefinitionImpl |
processDefinition
|
protected CompositeElementImpl |
scope
|
protected TransitionImpl |
transition
|
Constructor Summary | |
---|---|
protected |
ProcessFactory()
start building a process definition without a name. |
protected |
ProcessFactory(java.lang.String processName)
start building a process definition with the given name. |
protected |
ProcessFactory(java.lang.String processName,
PVMProcessDefinitionImpl processDefinition)
start building a process definition with the given name. |
Method Summary | |
---|---|
ProcessFactory |
asyncExecute()
sets the asyncExecute property on the current node. |
ProcessFactory |
asyncLeave()
sets the asyncLeave property on the current node. |
ProcessFactory |
asyncSignal()
sets the asyncSignal property on the current node. |
ProcessFactory |
asyncTake()
sets the takeAsync property on the current transition This method requires a current transition. |
ProcessFactory |
behaviour(Activity activity)
sets the behaviour on the current node. |
ProcessFactory |
behaviour(java.lang.Class<? extends Activity> activityClass)
sets the behaviour on the current node. |
ProcessFactory |
behaviour(Descriptor descriptor)
sets the behaviour on the current node. |
ProcessFactory |
behaviour(java.lang.String expression)
sets the behaviour on the current node. |
static ProcessFactory |
build()
starts building a process definition |
static ProcessFactory |
build(java.lang.String processName)
starts building a process definition |
static ProcessFactory |
build(java.lang.String processName,
PVMProcessDefinitionImpl processDefinition)
starts populating a given process definition |
ProcessFactory |
compositeEnd()
ends a block in which nested nodes are created. |
ProcessFactory |
compositeNode()
starts a block in which nested nodes can be created. |
ProcessFactory |
compositeNode(java.lang.String nodeName)
starts a block in which nested nodes can be created. |
ClientProcessDefinition |
done()
extract the process definition from the factory. |
ProcessFactory |
event(java.lang.String eventName)
creates the given event on the current process element. |
ProcessFactory |
exceptionHandler(java.lang.Class<? extends java.lang.Exception> exceptionClass)
creates an exception handler for the given exception class on the current process element; until the exceptionHandlerEnd() . |
ProcessFactory |
exceptionHandlerEnd()
|
ProcessFactory |
guardCondition(Condition condition)
sets the guard condition on the current transition. |
ProcessFactory |
initial()
marks the last created node as the initial node in the process. |
protected PVMProcessDefinitionImpl |
instantiateProcessDefinition()
to be overwritten by specific process language factories |
ProcessFactory |
key(java.lang.String key)
sets the key of the process definition
explicitely |
ProcessFactory |
listener(Descriptor descriptor)
adds an action to the current event. |
ProcessFactory |
listener(EventListener eventListener)
adds an action to the current event. |
ProcessFactory |
listener(java.lang.String expression)
adds an action to the current event. |
ProcessFactory |
needsPrevious()
sets the property needsPrevious on the current node. |
ProcessFactory |
node()
creates a node in the current parent. |
ProcessFactory |
node(java.lang.String nodeName)
creates a named node. |
ProcessFactory |
propagationDisabled()
disables propagated events. |
ProcessFactory |
property(Descriptor descriptor)
adds a configuration to the current process element |
ProcessFactory |
property(java.lang.String name,
java.lang.String stringValue)
adds a string-valued configuration to the current process element |
ProcessFactory |
scope()
applies on a node and makes it create a local activity instance scope. |
ProcessFactory |
timer(java.util.Date dueDate,
java.lang.String signalName)
declares a timer on the current node or process. |
protected ProcessFactory |
timer(java.lang.String dueDateDescription,
java.util.Date dueDate,
java.lang.String signalName,
java.lang.String repeat)
|
ProcessFactory |
timer(java.lang.String dueDateDescription,
java.lang.String signalName)
declares a timer on the current node or process. |
ProcessFactory |
timer(java.lang.String dueDateDescription,
java.lang.String signalName,
java.lang.String repeat)
declares a timer on the current node or process. |
ProcessFactory |
to(java.lang.String destination)
sets the destination node on the current transition. |
ProcessFactory |
transactional()
|
ProcessFactory |
transition()
creates a transition on the current node. |
ProcessFactory |
transition(java.lang.String transitionName)
creates a named transition on the current node. |
ProcessFactory |
variable(Descriptor sourceDescriptor)
declares a local variable. |
ProcessFactory |
variable(java.lang.String key)
declares a local variable. |
ProcessFactory |
variable(java.lang.String key,
java.lang.String initialValue)
declares a local variable. |
ProcessFactory |
version(int version)
sets the version of the process
definition explicitely |
ProcessFactory |
waitCondition(Condition condition)
sets the wait condition on the current transition. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PVMProcessDefinitionImpl processDefinition
protected NodeImpl node
protected TransitionImpl transition
protected java.util.List<ProcessFactory.DestinationReference> destinationReferences
protected ObservableElementImpl observableElement
protected EventImpl event
protected EventListenerReference eventListenerReference
protected ExceptionHandlerImpl exceptionHandler
protected CompositeElementImpl compositeElement
protected CompositeElementImpl scope
protected java.util.Stack<CompositeElementImpl> compositeElementStack
Constructor Detail |
---|
protected ProcessFactory()
protected ProcessFactory(java.lang.String processName)
protected ProcessFactory(java.lang.String processName, PVMProcessDefinitionImpl processDefinition)
Method Detail |
---|
public static ProcessFactory build()
public static ProcessFactory build(java.lang.String processName)
public static ProcessFactory build(java.lang.String processName, PVMProcessDefinitionImpl processDefinition)
protected PVMProcessDefinitionImpl instantiateProcessDefinition()
public ProcessFactory initial()
public ProcessFactory scope()
adding a variable
or
adding a timer
public ProcessFactory variable(java.lang.String key)
scope()
is automatically implied.
public ProcessFactory variable(Descriptor sourceDescriptor)
scope()
is automatically implied.
public ProcessFactory variable(java.lang.String key, java.lang.String initialValue)
scope()
is automatically implied.
public ProcessFactory timer(java.lang.String dueDateDescription, java.lang.String signalName)
scope()
is
automatically implied.
public ProcessFactory timer(java.lang.String dueDateDescription, java.lang.String signalName, java.lang.String repeat)
scope()
is
automatically implied.
public ProcessFactory timer(java.util.Date dueDate, java.lang.String signalName)
scope()
is
automatically implied.
protected ProcessFactory timer(java.lang.String dueDateDescription, java.util.Date dueDate, java.lang.String signalName, java.lang.String repeat)
public ProcessFactory node()
compositeNode(String)
was called previously.
public ProcessFactory node(java.lang.String nodeName)
compositeNode(String)
was
called previously.
public ProcessFactory behaviour(Activity activity)
public ProcessFactory behaviour(Descriptor descriptor)
public ProcessFactory behaviour(java.lang.Class<? extends Activity> activityClass)
public ProcessFactory behaviour(java.lang.String expression)
public ProcessFactory asyncExecute()
public ProcessFactory asyncLeave()
public ProcessFactory asyncSignal()
public ProcessFactory needsPrevious()
public ProcessFactory compositeNode()
compositeEnd()
. A current node is required.
public ProcessFactory compositeNode(java.lang.String nodeName)
compositeEnd()
. A current node is required.
public ProcessFactory compositeEnd()
compositeNode(String)
public ProcessFactory transition()
public ProcessFactory transition(java.lang.String transitionName)
public ProcessFactory asyncTake()
public ProcessFactory to(java.lang.String destination)
public ProcessFactory waitCondition(Condition condition)
public ProcessFactory guardCondition(Condition condition)
public ProcessFactory event(java.lang.String eventName)
exceptionHandler(Class)
first.
public ProcessFactory exceptionHandler(java.lang.Class<? extends java.lang.Exception> exceptionClass)
exceptionHandlerEnd()
. Subsequent
invocations of listeners
or
transitions
will have the created exception handler as
a target.
DONT'T FORGET TO CLOSE THE EXCEPTION HANDLER WITH exceptionHandlerEnd.
public ProcessFactory exceptionHandlerEnd()
public ProcessFactory transactional()
public ProcessFactory listener(Descriptor descriptor)
event(String)
or by a transition()
. Subsequent
invocations of exceptionHandler(Class)
will be associated to this
event listener.
public ProcessFactory listener(EventListener eventListener)
event(String)
or by a transition()
. Subsequent
invocations of exceptionHandler(Class)
will be associated to this
event listener.
public ProcessFactory listener(java.lang.String expression)
event(String)
or by a transition()
. Subsequent
invocations of exceptionHandler(Class)
will be associated to this
event listener.
public ProcessFactory propagationDisabled()
public ProcessFactory property(java.lang.String name, java.lang.String stringValue)
public ProcessFactory property(Descriptor descriptor)
public ClientProcessDefinition done()
public ProcessFactory version(int version)
version
of the process
definition explicitely
public ProcessFactory key(java.lang.String key)
key
of the process definition
explicitely
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |