1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kns.web.struts.form; |
18 | |
|
19 | |
import java.util.ArrayList; |
20 | |
|
21 | |
import javax.servlet.http.HttpServletRequest; |
22 | |
|
23 | |
import org.kuali.rice.kns.question.Question; |
24 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
25 | |
import org.kuali.rice.kns.service.KNSServiceLocatorWeb; |
26 | |
import org.kuali.rice.kns.util.KNSConstants; |
27 | |
import org.kuali.rice.kns.util.WebUtils; |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | 0 | public class QuestionPromptForm extends KualiForm { |
35 | |
private static final long serialVersionUID = 1L; |
36 | |
private ArrayList buttons; |
37 | |
private String caller; |
38 | |
|
39 | |
private String formKey; |
40 | |
private String questionIndex; |
41 | |
private String questionText; |
42 | |
private String questionType; |
43 | |
private String title; |
44 | |
private String context; |
45 | |
private String reason; |
46 | |
private String showReasonField; |
47 | |
private String questionAnchor; |
48 | |
private String methodToCallPath; |
49 | |
private String docNum; |
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
public String getDocNum() { |
55 | 0 | return this.docNum; |
56 | |
} |
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
public void setDocNum(String docNum) { |
62 | 0 | this.docNum = docNum; |
63 | 0 | } |
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
public String getShowReasonField() { |
69 | 0 | return showReasonField; |
70 | |
} |
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
public void setShowReasonField(String showReasonField) { |
76 | 0 | this.showReasonField = showReasonField; |
77 | 0 | } |
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
public ArrayList getButtons() { |
83 | 0 | return buttons; |
84 | |
} |
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
public String getCaller() { |
90 | 0 | return caller; |
91 | |
} |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
public String getFormKey() { |
97 | 0 | return formKey; |
98 | |
} |
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
public String getQuestionIndex() { |
104 | 0 | return questionIndex; |
105 | |
} |
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
public String getQuestionText() { |
111 | 0 | return questionText != null ? WebUtils.filterHtmlAndReplaceRiceMarkup(questionText) : questionText; |
112 | |
} |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
public String getQuestionType() { |
118 | 0 | return questionType; |
119 | |
} |
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
public String getTitle() { |
125 | 0 | return title; |
126 | |
} |
127 | |
|
128 | |
|
129 | |
|
130 | |
|
131 | |
public void populate(HttpServletRequest request) { |
132 | 0 | super.populate(request); |
133 | |
|
134 | |
|
135 | 0 | title = KNSConstants.QUESTION_PAGE_TITLE; |
136 | |
|
137 | 0 | if (request.getAttribute(KNSConstants.DOC_FORM_KEY) != null) { |
138 | 0 | this.setFormKey((String) request.getAttribute(KNSConstants.DOC_FORM_KEY)); |
139 | |
} |
140 | 0 | else if (request.getParameter(KNSConstants.DOC_FORM_KEY) != null) { |
141 | 0 | this.setFormKey(request.getParameter(KNSConstants.DOC_FORM_KEY)); |
142 | |
} |
143 | |
|
144 | 0 | if (request.getAttribute(KNSConstants.DOC_NUM) != null) { |
145 | 0 | this.setFormKey((String) request.getAttribute(KNSConstants.DOC_NUM)); |
146 | |
} |
147 | |
|
148 | |
|
149 | 0 | if (request.getParameter(KNSConstants.RETURN_LOCATION_PARAMETER) != null) { |
150 | 0 | this.setBackLocation(request.getParameter(KNSConstants.RETURN_LOCATION_PARAMETER)); |
151 | |
} |
152 | |
|
153 | 0 | if (getMethodToCall().equals(KNSConstants.START_METHOD)) { |
154 | 0 | Question kualiQuestion = KNSServiceLocatorWeb.getQuestion(questionType); |
155 | 0 | if (kualiQuestion == null) { |
156 | 0 | throw new RuntimeException("question implementation not found: " + request.getParameter(KNSConstants.QUESTION_IMPL_ATTRIBUTE_NAME)); |
157 | |
} |
158 | |
|
159 | |
|
160 | |
|
161 | |
|
162 | 0 | if (questionText == null) { |
163 | 0 | questionText = kualiQuestion.getQuestion(); |
164 | |
} |
165 | |
|
166 | 0 | if (buttons == null) { |
167 | 0 | buttons = kualiQuestion.getButtons(); |
168 | |
} |
169 | |
} |
170 | 0 | } |
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
public void setButtons(ArrayList buttons) { |
176 | 0 | this.buttons = buttons; |
177 | 0 | } |
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
public void setCaller(String caller) { |
183 | 0 | this.caller = caller; |
184 | 0 | } |
185 | |
|
186 | |
|
187 | |
|
188 | |
|
189 | |
public void setFormKey(String formKey) { |
190 | 0 | this.formKey = formKey; |
191 | 0 | } |
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | |
public void setQuestionIndex(String questionIndex) { |
197 | 0 | this.questionIndex = questionIndex; |
198 | 0 | } |
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
public void setQuestionText(String questionText) { |
204 | 0 | this.questionText = questionText; |
205 | 0 | } |
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | |
public void setQuestionType(String questionName) { |
211 | 0 | this.questionType = questionName; |
212 | 0 | } |
213 | |
|
214 | |
|
215 | |
|
216 | |
|
217 | |
public void setTitle(String title) { |
218 | 0 | this.title = title; |
219 | 0 | } |
220 | |
|
221 | |
public String getContext() { |
222 | 0 | return context; |
223 | |
} |
224 | |
|
225 | |
public void setContext(String context) { |
226 | 0 | this.context = context; |
227 | 0 | } |
228 | |
|
229 | |
|
230 | |
|
231 | |
|
232 | |
public String getReason() { |
233 | 0 | return reason; |
234 | |
} |
235 | |
|
236 | |
|
237 | |
|
238 | |
|
239 | |
public void setReason(String reason) { |
240 | 0 | this.reason = reason; |
241 | 0 | } |
242 | |
|
243 | |
public String getQuestionAnchor() { |
244 | 0 | return questionAnchor; |
245 | |
} |
246 | |
|
247 | |
public void setQuestionAnchor(String questionAnchor) { |
248 | 0 | this.questionAnchor = questionAnchor; |
249 | 0 | } |
250 | |
|
251 | |
public String getMethodToCallPath() { |
252 | 0 | return methodToCallPath; |
253 | |
} |
254 | |
public void setMethodToCallPath(String methodToCallPath) { |
255 | 0 | this.methodToCallPath = methodToCallPath; |
256 | 0 | } |
257 | |
|
258 | |
} |