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