Class FlowBuilder

java.lang.Object
jakarta.faces.flow.builder.FlowBuilder
Direct Known Subclasses:
FlowBuilderImpl

public abstract class FlowBuilder extends Object

A Java language API for building Flows. 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(jakarta.faces.context.FacesContext, jakarta.faces.flow.Flow) method.

Since:
2.2