1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.cdi;
20
21 import java.lang.reflect.Type;
22 import java.util.Map;
23 import javax.enterprise.inject.spi.BeanManager;
24 import javax.enterprise.util.AnnotationLiteral;
25 import javax.faces.annotation.FlowMap;
26 import javax.faces.context.FacesContext;
27 import javax.faces.flow.FlowScoped;
28 import org.apache.myfaces.cdi.util.AbstractDynamicProducer;
29 import org.apache.myfaces.cdi.util.ParameterizedTypeImpl;
30
31 public class JsfArtifactFlowMapProducer extends AbstractDynamicProducer
32 {
33 class FlowMapAnnotationLiteral extends AnnotationLiteral<FlowMap> implements FlowMap
34 {
35 private static final long serialVersionUID = -8623640277155878657L;
36 }
37
38 public JsfArtifactFlowMapProducer(BeanManager beanManager)
39 {
40 super(beanManager);
41
42 super.name("flowScope")
43 .scope(FlowScoped.class)
44 .qualifiers(new FlowMapAnnotationLiteral())
45 .types(new ParameterizedTypeImpl(Map.class, new Type[] { Object.class, Object.class }),
46 Map.class,
47 Object.class)
48 .beanClass(Map.class)
49 .create(e -> FacesContext.getCurrentInstance().getApplication().getFlowHandler().getCurrentFlowScope());
50 }
51 }