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