1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.rule.web; |
18 | |
|
19 | |
import java.util.ArrayList; |
20 | |
import java.util.HashMap; |
21 | |
import java.util.List; |
22 | |
import java.util.Map; |
23 | |
import java.util.Properties; |
24 | |
|
25 | |
import javax.servlet.http.HttpServletRequest; |
26 | |
|
27 | |
import org.apache.commons.lang.StringUtils; |
28 | |
import org.apache.struts.action.ActionErrors; |
29 | |
import org.apache.struts.action.ActionForm; |
30 | |
import org.apache.struts.action.ActionMapping; |
31 | |
import org.apache.struts.action.ActionMessage; |
32 | |
import org.apache.struts.action.ActionMessages; |
33 | |
import org.kuali.rice.kew.doctype.bo.DocumentType; |
34 | |
import org.kuali.rice.kew.doctype.service.DocumentTypeService; |
35 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
36 | |
import org.kuali.rice.kew.util.KEWConstants; |
37 | |
import org.kuali.rice.kew.util.Utilities; |
38 | |
import org.kuali.rice.kew.web.KeyValue; |
39 | |
import org.kuali.rice.kns.util.KNSConstants; |
40 | |
import org.kuali.rice.kns.util.UrlFactory; |
41 | |
import org.kuali.rice.kns.web.struts.form.KualiForm; |
42 | |
import org.kuali.rice.kns.web.ui.Row; |
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
public class RoutingReportForm extends KualiForm { |
51 | |
|
52 | |
private static final long serialVersionUID = 509542372934250061L; |
53 | |
|
54 | |
private Long ruleTemplateId; |
55 | |
private String lookupableImplServiceName; |
56 | |
private String documentType; |
57 | |
private String reportType; |
58 | |
|
59 | |
|
60 | |
private String documentTypeParam; |
61 | |
private String initiatorPrincipalId; |
62 | |
private String documentContent; |
63 | |
private String backUrl; |
64 | |
private String showCloseButton; |
65 | |
|
66 | |
private String dateRef; |
67 | |
private String effectiveHour; |
68 | |
private String effectiveMinute; |
69 | |
private String amPm; |
70 | |
|
71 | |
private List ruleTemplates; |
72 | |
private List actionRequests; |
73 | |
private Map fields; |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
private List<Row> ruleTemplateAttributes; |
79 | |
private List attributes; |
80 | |
|
81 | |
private boolean showFields; |
82 | |
private boolean showViewResults; |
83 | |
|
84 | 0 | public RoutingReportForm() { |
85 | 0 | attributes = new ArrayList(); |
86 | 0 | ruleTemplates = new ArrayList(); |
87 | 0 | actionRequests = new ArrayList(); |
88 | 0 | fields = new HashMap(); |
89 | 0 | ruleTemplateAttributes = new ArrayList(); |
90 | 0 | } |
91 | |
|
92 | |
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { |
93 | |
|
94 | 0 | ActionErrors errors = new ActionErrors(); |
95 | 0 | if (getReportType() != null && getReportType().equals(RoutingReportAction.DOC_TYPE_REPORTING)) { |
96 | 0 | if (!Utilities.isEmpty(getDocumentType())) { |
97 | 0 | DocumentType docType = getDocumentTypeService().findByName(getDocumentType()); |
98 | 0 | if (docType == null) { |
99 | 0 | ActionMessage error = new ActionMessage("routereport.documenttype.invalid"); |
100 | 0 | errors.add(ActionMessages.GLOBAL_MESSAGE, error); |
101 | |
} |
102 | |
} |
103 | |
} |
104 | 0 | return errors; |
105 | |
} |
106 | |
|
107 | |
public String getLookupableImplServiceName() { |
108 | 0 | return lookupableImplServiceName; |
109 | |
} |
110 | |
|
111 | |
public void setLookupableImplServiceName(String lookupableImplServiceName) { |
112 | 0 | this.lookupableImplServiceName = lookupableImplServiceName; |
113 | 0 | } |
114 | |
|
115 | |
public List<Row> getRuleTemplateAttributes() { |
116 | 0 | return ruleTemplateAttributes; |
117 | |
} |
118 | |
|
119 | |
|
120 | |
public void setRuleTemplateAttributes(List<Row> ruleTemplateAttributes) { |
121 | 0 | this.ruleTemplateAttributes = ruleTemplateAttributes; |
122 | 0 | } |
123 | |
|
124 | |
public Map getFields() { |
125 | 0 | return fields; |
126 | |
} |
127 | |
|
128 | |
public void setFields(Map fields) { |
129 | 0 | this.fields = fields; |
130 | 0 | } |
131 | |
|
132 | |
public List getRuleTemplates() { |
133 | 0 | return ruleTemplates; |
134 | |
} |
135 | |
|
136 | |
public void setRuleTemplates(List ruleTemplates) { |
137 | 0 | this.ruleTemplates = ruleTemplates; |
138 | 0 | } |
139 | |
|
140 | |
public List getHours() { |
141 | 0 | List hours = new ArrayList(); |
142 | 0 | hours.add(new KeyValue("0", "12")); |
143 | 0 | for (int i = 1; i < 12; i++) { |
144 | 0 | hours.add(new KeyValue(i + "", i + "")); |
145 | |
} |
146 | 0 | return hours; |
147 | |
} |
148 | |
public List getMinutes() { |
149 | 0 | List mins = new ArrayList(); |
150 | 0 | for (int i = 0; i < 60; i++) { |
151 | 0 | mins.add(new KeyValue(i + "", ":" + (i < 10 ? "0" : "") + i + "")); |
152 | |
} |
153 | 0 | return mins; |
154 | |
} |
155 | |
|
156 | |
public Long getRuleTemplateId() { |
157 | 0 | return ruleTemplateId; |
158 | |
} |
159 | |
|
160 | |
public void setRuleTemplateId(Long ruleTemplateId) { |
161 | 0 | this.ruleTemplateId = ruleTemplateId; |
162 | 0 | } |
163 | |
|
164 | |
public List getActionRequests() { |
165 | 0 | return actionRequests; |
166 | |
} |
167 | |
|
168 | |
public void setActionRequests(List actionRequests) { |
169 | 0 | this.actionRequests = actionRequests; |
170 | 0 | } |
171 | |
|
172 | |
public void setDocTypeFullName(String documentType) { |
173 | 0 | this.documentType = documentType; |
174 | 0 | } |
175 | |
|
176 | |
public void setDocTypeGroupName(String docTypeGroupName) { |
177 | 0 | this.documentType = docTypeGroupName; |
178 | 0 | } |
179 | |
|
180 | |
public String getDocumentType() { |
181 | 0 | return documentType; |
182 | |
} |
183 | |
|
184 | |
public void setDocumentType(String documentType) { |
185 | 0 | this.documentType = documentType; |
186 | 0 | } |
187 | |
|
188 | |
public List getAttributes() { |
189 | 0 | return attributes; |
190 | |
} |
191 | |
|
192 | |
public void setAttributes(List attributes) { |
193 | 0 | this.attributes = attributes; |
194 | 0 | } |
195 | |
|
196 | |
public String getReportType() { |
197 | 0 | return reportType; |
198 | |
} |
199 | |
|
200 | |
public void setReportType(String reportType) { |
201 | 0 | this.reportType = reportType; |
202 | 0 | } |
203 | |
|
204 | |
public boolean isShowFields() { |
205 | 0 | return showFields; |
206 | |
} |
207 | |
|
208 | |
public void setShowFields(boolean showFields) { |
209 | 0 | this.showFields = showFields; |
210 | 0 | } |
211 | |
|
212 | |
public boolean isShowViewResults() { |
213 | 0 | return showViewResults; |
214 | |
} |
215 | |
|
216 | |
public void setShowViewResults(boolean showViewResults) { |
217 | 0 | this.showViewResults = showViewResults; |
218 | 0 | } |
219 | |
|
220 | |
private DocumentTypeService getDocumentTypeService() { |
221 | 0 | return (DocumentTypeService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE); |
222 | |
} |
223 | |
|
224 | |
public String getDateRef() { |
225 | 0 | return dateRef; |
226 | |
} |
227 | |
|
228 | |
public void setDateRef(String dateRef) { |
229 | 0 | this.dateRef = dateRef; |
230 | 0 | } |
231 | |
|
232 | |
public String getEffectiveHour() { |
233 | 0 | return effectiveHour; |
234 | |
} |
235 | |
|
236 | |
public void setEffectiveHour(String effectiveHour) { |
237 | 0 | this.effectiveHour = effectiveHour; |
238 | 0 | } |
239 | |
|
240 | |
public String getEffectiveMinute() { |
241 | 0 | return effectiveMinute; |
242 | |
} |
243 | |
|
244 | |
public void setEffectiveMinute(String effectiveMinute) { |
245 | 0 | this.effectiveMinute = effectiveMinute; |
246 | 0 | } |
247 | |
|
248 | |
public String getAmPm() { |
249 | 0 | return amPm; |
250 | |
} |
251 | |
|
252 | |
public void setAmPm(String amPm) { |
253 | 0 | this.amPm = amPm; |
254 | 0 | } |
255 | |
|
256 | |
public String getDocumentContent() { |
257 | 0 | return documentContent; |
258 | |
} |
259 | |
|
260 | |
public void setDocumentContent(String documentContent) { |
261 | 0 | this.documentContent = documentContent; |
262 | 0 | } |
263 | |
|
264 | |
public String getInitiatorPrincipalId() { |
265 | 0 | return initiatorPrincipalId; |
266 | |
} |
267 | |
|
268 | |
public void setInitiatorPrincipalId(String initiatorNetworkId) { |
269 | 0 | this.initiatorPrincipalId = initiatorNetworkId; |
270 | 0 | } |
271 | |
|
272 | |
public String getBackUrl() { |
273 | 0 | if (StringUtils.isBlank(backUrl)) { |
274 | 0 | return null; |
275 | |
} |
276 | 0 | return backUrl; |
277 | |
} |
278 | |
|
279 | |
public void setBackUrl(String backUrl) { |
280 | 0 | this.backUrl = backUrl; |
281 | 0 | } |
282 | |
|
283 | |
public boolean isDisplayCloseButton() { |
284 | 0 | return (KEWConstants.DISPLAY_CLOSE_BUTTON_TRUE_VALUE.equals(getShowCloseButton())); |
285 | |
} |
286 | |
|
287 | |
public String getShowCloseButton() { |
288 | 0 | return showCloseButton; |
289 | |
} |
290 | |
|
291 | |
public void setShowCloseButton(String showCloseButton) { |
292 | 0 | this.showCloseButton = showCloseButton; |
293 | 0 | } |
294 | |
|
295 | |
public String getDocumentTypeParam() { |
296 | 0 | return documentTypeParam; |
297 | |
} |
298 | |
|
299 | |
public void setDocumentTypeParam(String documentTypeParam) { |
300 | 0 | this.documentTypeParam = documentTypeParam; |
301 | 0 | this.documentType = documentTypeParam; |
302 | 0 | } |
303 | |
|
304 | |
} |