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