1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.flow.impl; |
20 | |
|
21 | |
import java.util.Iterator; |
22 | |
import javax.faces.context.FacesContext; |
23 | |
import javax.faces.flow.Flow; |
24 | |
import org.apache.myfaces.config.FacesConfigurator; |
25 | |
import org.apache.myfaces.flow.FlowImpl; |
26 | |
import org.apache.myfaces.spi.FacesFlowProvider; |
27 | |
import org.apache.myfaces.spi.FacesFlowProviderFactory; |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | 0 | public class AnnotatedFlowConfigurator |
34 | |
{ |
35 | |
|
36 | |
public static void configureAnnotatedFlows(FacesContext facesContext) |
37 | |
{ |
38 | 0 | FacesFlowProviderFactory factory = |
39 | |
FacesFlowProviderFactory.getFacesFlowProviderFactory(facesContext.getExternalContext()); |
40 | 0 | FacesFlowProvider provider = factory.getFacesFlowProvider(facesContext.getExternalContext()); |
41 | |
|
42 | 0 | Iterator<Flow> it = provider.getAnnotatedFlows(facesContext); |
43 | |
|
44 | 0 | if (it != null) |
45 | |
{ |
46 | 0 | if (it.hasNext()) |
47 | |
{ |
48 | 0 | FacesConfigurator.enableDefaultWindowMode(facesContext); |
49 | |
} |
50 | 0 | while (it.hasNext()) |
51 | |
{ |
52 | 0 | Flow flow = it.next(); |
53 | |
|
54 | 0 | if (flow instanceof FlowImpl) |
55 | |
{ |
56 | 0 | ((FlowImpl)flow).freeze(); |
57 | |
} |
58 | |
|
59 | 0 | facesContext.getApplication().getFlowHandler().addFlow(facesContext, flow); |
60 | 0 | } |
61 | |
} |
62 | 0 | } |
63 | |
} |