|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jbpm.pvm.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() .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.jbpm.pvm.impl
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 ProcessDefinitionImpl |
processDefinition
|
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,
ProcessDefinitionImpl 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. |
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,
ProcessDefinitionImpl 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. |
ProcessDefinition |
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 ProcessDefinitionImpl |
instantiateProcessDefinition()
to be overwritten by specific process language factories |
ProcessFactory |
listener(Activity activity)
adds an action to the current event. |
ProcessFactory |
listener(Descriptor descriptor)
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 |
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 |
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 ProcessDefinitionImpl 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 java.util.Stack<CompositeElementImpl> compositeElementStack
Constructor Detail |
---|
protected ProcessFactory()
protected ProcessFactory(java.lang.String processName)
protected ProcessFactory(java.lang.String processName, ProcessDefinitionImpl processDefinition)
Method Detail |
---|
public static ProcessFactory build()
public static ProcessFactory build(java.lang.String processName)
public static ProcessFactory build(java.lang.String processName, ProcessDefinitionImpl processDefinition)
protected ProcessDefinitionImpl instantiateProcessDefinition()
public ProcessFactory initial()
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 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(Activity activity)
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 ProcessDefinition done()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |