1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.module.purap.document.validation.impl;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.ole.module.purap.PurapKeyConstants;
20 import org.kuali.ole.module.purap.PurapPropertyConstants;
21 import org.kuali.ole.module.purap.businessobject.PurchaseOrderVendorStipulation;
22 import org.kuali.ole.module.purap.document.PurchaseOrderDocument;
23 import org.kuali.ole.sys.OLEConstants;
24 import org.kuali.ole.sys.document.validation.GenericValidation;
25 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
26 import org.kuali.rice.krad.util.GlobalVariables;
27
28 import java.util.List;
29
30 public class PurchaseOrderProcessVendorStipulationValidation extends GenericValidation {
31
32
33
34
35
36
37
38 public boolean validate(AttributedDocumentEvent event) {
39 boolean valid = true;
40 List<PurchaseOrderVendorStipulation> stipulations = ((PurchaseOrderDocument) event.getDocument()).getPurchaseOrderVendorStipulations();
41 for (int i = 0; i < stipulations.size(); i++) {
42 PurchaseOrderVendorStipulation stipulation = stipulations.get(i);
43 if (StringUtils.isBlank(stipulation.getVendorStipulationDescription())) {
44 GlobalVariables.getMessageMap().putError(OLEConstants.DOCUMENT_PROPERTY_NAME + "." + PurapPropertyConstants.VENDOR_STIPULATION + "[" + i + "]." + PurapPropertyConstants.VENDOR_STIPULATION_DESCRIPTION, PurapKeyConstants.ERROR_STIPULATION_DESCRIPTION);
45 valid = false;
46 }
47 }
48
49 return valid;
50 }
51
52 }