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