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.PurapConstants;
20 import org.kuali.ole.module.purap.PurapKeyConstants;
21 import org.kuali.ole.module.purap.PurapPropertyConstants;
22 import org.kuali.ole.module.purap.document.PurchasingDocument;
23 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
24 import org.kuali.rice.krad.util.GlobalVariables;
25 import org.kuali.rice.krad.util.MessageMap;
26
27
28
29
30 public class PurchasingProcessRequestorPhoneAndEmailAddressValidation extends PurchasingAccountsPayableProcessVendorValidation {
31
32 @Override
33 public boolean validate(AttributedDocumentEvent event) {
34 boolean valid = true;
35 PurchasingDocument purDocument = (PurchasingDocument) event.getDocument();
36 MessageMap errorMap = GlobalVariables.getMessageMap();
37 errorMap.clearErrorPath();
38 errorMap.addToErrorPath(PurapConstants.ADDITIONAL_TAB_ERRORS);
39
40 valid &= super.validate(event);
41
42
43
44
45
46
47
48
49
50
51 if (StringUtils.isNotBlank(purDocument.getRequestorPersonEmailAddress())) {
52 if (!validateEmailAddress(purDocument.getRequestorPersonEmailAddress())) {
53 valid &= false;
54 errorMap.putError(PurapPropertyConstants.REQUESTOR_PERSON_EMAIL_ADDRESS, PurapKeyConstants.ERROR_INVALID_EMAIL_ADDRESS);
55 }
56 }
57
58 errorMap.clearErrorPath();
59
60 return valid;
61 }
62 }