public abstract class FlowBuilder
extends java.lang.Object
A Java language API for building Flow
s. This API is semantically identical to the
<flow-definition>
element in the Application
Configuration Resources XML Schema Definition.
Usage example:
public class FlowA implements Serializable {
@Produces FlowDefinition
public Flow
buildMyFlow(@FlowBuilderParameter
FlowBuilder
flowBuilder) {
String flowId = "flow-a";
flowBuilder.id("unique", flowId);
flowBuilder.returnNode("taskFlowReturn1").
fromOutcome("#{flow_a_Bean.returnValue}");
flowBuilder.inboundParameter("param1FromFlowB", "#{flowScope.param1Value}");
flowBuilder.inboundParameter("param2FromFlowB", "#{flowScope.param2Value}");
flowBuilder.flowCallNode("callB").flowReference("", "flow-b").
outboundParameter("param1FromFlowA", "param1Value").
outboundParameter("param2FromFlowA", "param2Value");
return flowBuilder.getFlow();
}
}
The runtime must discover all such methods at startup time and ensure that
the returned flows are added to the FlowHandler
using
the FlowHandler.addFlow(javax.faces.context.FacesContext, javax.faces.flow.Flow)
method.
Constructor and Description |
---|
FlowBuilder() |
Modifier and Type | Method and Description |
---|---|
abstract FlowBuilder |
finalizer(MethodExpression methodExpression)
A MethodExpression that will be invoked when the flow is exited. |
abstract FlowBuilder |
finalizer(java.lang.String methodExpression)
A MethodExpression that will be invoked when the flow is exited. |
abstract FlowCallBuilder |
flowCallNode(java.lang.String flowCallNodeId)
Define a flow call node. |
abstract Flow |
getFlow()
Called as the last step in flow definition,
this method must perform any implementation specific initialization
and return the built |
abstract FlowBuilder |
id(java.lang.String definingDocumentId,
java.lang.String id)
Set the defining document id and flow id of this flow. |
abstract FlowBuilder |
inboundParameter(java.lang.String name,
java.lang.String expression)
A parameter that will be populated with the value from a correspondingly named outbound parameter from another flow when this flow is entered from that flow. |
abstract FlowBuilder |
inboundParameter(java.lang.String name,
ValueExpression expression)
A parameter that will be populated with the value from a correspondingly named outbound parameter from another flow when this flow is entered from that flow. |
abstract FlowBuilder |
initializer(MethodExpression methodExpression)
A MethodExpression that will be invoked when the flow is entered. |
abstract FlowBuilder |
initializer(java.lang.String methodExpression)
A MethodExpression that will be invoked when the flow is entered. |
abstract MethodCallBuilder |
methodCallNode(java.lang.String methodCallNodeId)
Define a method call node. |
abstract NavigationCaseBuilder |
navigationCase()
Define a particular combination of conditions that must match for this case to be executed, and the view id of the component tree that should be selected next. |
abstract ReturnBuilder |
returnNode(java.lang.String returnNodeId)
Define a return node. |
abstract SwitchBuilder |
switchNode(java.lang.String switchNodeId)
Define a particular list of cases that will be inspected in the order they are defined to determine where to go next in the flow graph. |
abstract ViewBuilder |
viewNode(java.lang.String viewNodeId,
java.lang.String vdlDocumentId)
Define a view node in a flow graph. |
public abstract FlowBuilder id(java.lang.String definingDocumentId, java.lang.String id)
Set the defining document id and flow id of this flow.
definingDocumentId
- The defining document id of this flow, or the
empty string if this flow does not need a defining document id.id
- the id of the flowjava.lang.NullPointerException
- if any of the parameters are null
public abstract ViewBuilder viewNode(java.lang.String viewNodeId, java.lang.String vdlDocumentId)
Define a view node in a flow graph.
viewNodeId
- Within the flow graph, the id of this view node. Must
be unique among all nodes in this flow graph.vdlDocumentId
- The fully qualified path to the view node within this flow.java.lang.NullPointerException
- if any of the parameters are null
public abstract NavigationCaseBuilder navigationCase()
Define a particular combination of conditions that must match for this case to be executed, and the view id of the component tree that should be selected next.
public abstract SwitchBuilder switchNode(java.lang.String switchNodeId)
Define a particular list of cases that will be inspected in the order they are defined to determine where to go next in the flow graph. If none of the cases match, the outcome from the default case is chosen.
switchNodeId
- Within the flow graph, the id of this switch node. Must
be unique among all nodes in this flow graph.java.lang.NullPointerException
- if any of the parameters are null
public abstract ReturnBuilder returnNode(java.lang.String returnNodeId)
Define a return node. This node will cause the specified outcome to be returned to the calling flow.
returnNodeId
- Within the flow graph, the id of this return node. Must
be unique among all nodes in this flow graph.java.lang.NullPointerException
- if any of the parameters are null
public abstract MethodCallBuilder methodCallNode(java.lang.String methodCallNodeId)
Define a method call node. This node will cause the specified method to be invoked, passing parameters if necessary. The return from the method is used as the outcome for where to go next in the flow. If the method is a void method, the default outcome is used.
methodCallNodeId
- Within the flow graph, the id of this method call node. Must
be unique among all nodes in this flow graph.java.lang.NullPointerException
- if any of the parameters are null
public abstract FlowCallBuilder flowCallNode(java.lang.String flowCallNodeId)
Define a flow call node. This node will cause the specified flow to be called, passing parameters if necessary.
flowCallNodeId
- Within the flow graph, the id of this return node. Must
be unique among all nodes in this flow graph.java.lang.NullPointerException
- if any of the parameters are null
public abstract FlowBuilder initializer(MethodExpression methodExpression)
A MethodExpression that will be invoked when the flow is entered.
methodExpression
- the expression to invoke, must reference a zero-argument method.java.lang.NullPointerException
- if any of the parameters are null
public abstract FlowBuilder initializer(java.lang.String methodExpression)
A MethodExpression that will be invoked when the flow is entered.
methodExpression
- the expression to invoke, must reference a zero-argument method.java.lang.NullPointerException
- if any of the parameters are null
public abstract FlowBuilder finalizer(MethodExpression methodExpression)
A MethodExpression that will be invoked when the flow is exited.
methodExpression
- the expression to invoke, must reference a zero-argument method.java.lang.NullPointerException
- if any of the parameters are null
public abstract FlowBuilder finalizer(java.lang.String methodExpression)
A MethodExpression that will be invoked when the flow is exited.
methodExpression
- the expression to invoke, must reference a zero-argument method.java.lang.NullPointerException
- if any of the parameters are null
public abstract FlowBuilder inboundParameter(java.lang.String name, ValueExpression expression)
A parameter that will be populated with the value from a correspondingly named outbound parameter from another flow when this flow is entered from that flow.
name
- the parameter nameexpression
- the ValueExpression
to populate with the inbound
value when the flow is called.java.lang.NullPointerException
- if any of the parameters are null
public abstract FlowBuilder inboundParameter(java.lang.String name, java.lang.String expression)
A parameter that will be populated with the value from a correspondingly named outbound parameter from another flow when this flow is entered from that flow.
name
- the parameter nameexpression
- the ValueExpression
String to populate with the inbound
value when the flow is called.java.lang.NullPointerException
- if any of the parameters are null
public abstract Flow getFlow()
Called as the last step in flow definition,
this method must perform any implementation specific initialization
and return the built Flow
. If called more than one time during a
given flow building process, the second and subsequent invocations must
take no action and return the built flow.
Flow
java.lang.IllegalStateException
- if the id(java.lang.String, java.lang.String)
method had not been
called prior to this method being called.