1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.orchestra.flow.components;
21
22 import javax.el.ELContext;
23 import javax.faces.webapp.UIComponentELTag;
24 import javax.servlet.jsp.JspException;
25 import javax.servlet.jsp.PageContext;
26 import javax.servlet.jsp.tagext.BodyTag;
27
28
29
30
31
32
33 public class FlowCallTag extends UIComponentELTag
34 {
35 private PageContext pageContext;
36
37 private String outcome;
38 private String viewId;
39 private String service;
40
41 @Override
42 public void setPageContext(PageContext pageContext)
43 {
44 super.setPageContext(pageContext);
45 this.pageContext = pageContext;
46 }
47
48 @Override
49 public String getComponentType()
50 {
51 return FlowCallComponent.COMPONENT_TYPE;
52 }
53
54 @Override
55 public String getRendererType()
56 {
57 return null;
58 }
59
60 public void setOutcome(String outcome)
61 {
62 this.outcome = outcome;
63 }
64
65 public void setViewId(String viewId)
66 {
67 this.viewId = viewId;
68 }
69
70 public void setService(String service)
71 {
72 this.service = service;
73 }
74
75 @Override
76 protected int getDoStartValue()
77 throws JspException
78 {
79
80
81
82 return BodyTag.EVAL_BODY_BUFFERED;
83 }
84
85 @Override
86 public int doAfterBody() throws JspException
87 {
88 FlowCallComponent component = (FlowCallComponent) getComponentInstance();
89 if (!component.isInitialized())
90 {
91 ELContext elContext = pageContext.getELContext();
92
93 component.setOutcome(outcome);
94 component.setViewId(viewId);
95 component.setService(service);
96
97 String bodyText = bodyContent.getString();
98
99 StringBuffer buf = new StringBuffer();
100 buf.append("<flowCall>\n");
101 buf.append(bodyText);
102 buf.append("</flowCall>");
103 String xml = buf.toString();
104 component.setBody(elContext, xml);
105 }
106
107 return 0;
108 }
109 }