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.sys.document.validation.GenericValidation;
20 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
21 import org.kuali.rice.kns.datadictionary.validation.fieldlevel.EmailAddressValidationPattern;
22 import org.kuali.rice.kns.datadictionary.validation.fieldlevel.PhoneNumberValidationPattern;
23
24 public class PurchasingAccountsPayableProcessVendorValidation extends GenericValidation {
25
26 public boolean validate(AttributedDocumentEvent event) {
27 return true;
28 }
29
30
31
32
33
34
35
36 public boolean validatePhoneNumber(String PhoneNumber) {
37 boolean valid = true;
38
39
40 if (StringUtils.isNotBlank(PhoneNumber)) {
41 PhoneNumberValidationPattern phonePattern = new PhoneNumberValidationPattern();
42 if (!phonePattern.matches(PhoneNumber)) {
43 return false;
44 }
45 }
46
47 return valid;
48 }
49
50
51
52
53
54
55
56 public boolean validateEmailAddress(String emailAddress) {
57 boolean valid = true;
58
59
60 if (StringUtils.isNotBlank(emailAddress)) {
61 EmailAddressValidationPattern emailAddressPattern = new EmailAddressValidationPattern();
62 if (!emailAddressPattern.matches(emailAddress)) {
63 return false;
64 }
65 }
66
67 return valid;
68 }
69 }