@Produces @FlowDefinition seems to be the right way to define a flow
definition.
But I still expect @Named @FlowScoped to annotate the corresponding
backing bean. This will define the bean to be in flow scope and make it
EL injectable as well. Just like @Model CDI stereotype, these two
together can be defined as a new stereotype.
What do you think ?
Arun
On 2/1/13 1:09 AM, Edward Burns wrote:
>>>>>> On Thu, 31 Jan 2013 17:05:57 +0100, Arun Gupta <arun.p.gupta_at_oracle.com> said:
> AG> Building applications that use Faces Flow, I expect
> AG> @Named
> AG> @FlowScoped
>
> AG> to be used commonly on flow-scoped beans.
>
> AG> Can a new stereotype be defined to accommodate this design pattern ?
>
> Hello Arun,
>
> After consultation with the CDI spec lead, it seems a better way is to
> use a producer method. With this approach, you simply have to have a
> method that is tagged with
>
> @Produces @FlowDefinition which has a FlowBuilder parameter that is
> tagged with @FlowBuilderParameter. For example
>
> public class FlowA implements Serializable {
>
> private static final long serialVersionUID = -7623501087369765218L;
>
> public FlowA() {
> }
>
> @Produces @FlowDefinition
> public Flow buildMyFlow(@FlowBuilderParameter FlowBuilder flowBuilder) {
> String flowId = "flow-a";
> flowBuilder.id("", flowId);
> flowBuilder.viewNode(flowId, "/" + flowId + "/" + flowId + ".xhtml").markAsStartNode();
> 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();
> }
> }
>
> I don't know if a stereotype can do this. I don't think it can.
>
> Ed
>
--
http://twitter.com/arungupta
http://blogs.oracle.com/arungupta