litesoft
Diff Revisions
947
vs
948
for /trunk/GWT_Sandbox/FormEngine/src/com/temp/shared/validators/PhoneValidator.java
|
@@ -1,13 +1,14 @@ |
1 |
1 |
|
package com.temp.shared.validators; |
2 |
2 |
|
|
3 |
|
- |
import com.temp.shared.ValueValidator; |
4 |
|
- |
import org.litesoft.core.util.externalization.E13nData; |
5 |
|
- |
import com.temp.shared.utils.StringUtils; |
|
3 |
+ |
import org.litesoft.core.util.externalization.*; |
|
4 |
+ |
|
|
5 |
+ |
import com.temp.shared.*; |
|
6 |
+ |
import com.temp.shared.utils.*; |
6 |
7 |
|
|
7 |
8 |
|
/** |
8 |
9 |
|
* Phone Number Validator, that requires at a minimum that a phone number not be |
9 |
10 |
|
* empty! |
10 |
|
- |
* |
|
11 |
+ |
* <p/> |
11 |
12 |
|
* This lame validation was copied from the Client utils.Util.java class. |
12 |
13 |
|
* |
13 |
14 |
|
* @author georgs |
|
@@ -24,19 +25,19 @@ |
24 |
25 |
|
protected PhoneValidator() { |
25 |
26 |
|
} |
26 |
27 |
|
|
27 |
|
- |
public boolean isValid(String phone) { |
28 |
|
- |
return (null == checkValue(phone)); |
|
28 |
+ |
public boolean isValid( String phone ) { |
|
29 |
+ |
return (null == checkValue( phone )); |
29 |
30 |
|
} |
30 |
31 |
|
|
31 |
32 |
|
@Override |
32 |
|
- |
public E13nData checkValue(String phone) { |
33 |
|
- |
phone = StringUtils.noEmpty(phone); |
34 |
|
- |
if (phone == null) { |
35 |
|
- |
return new E13nData(ErrorTemplateIdCode.PhoneEmpty); |
|
33 |
+ |
public E13nData checkValue( String phone ) { |
|
34 |
+ |
phone = StringUtils.noEmpty( phone ); |
|
35 |
+ |
if ( phone == null ) { |
|
36 |
+ |
return new E13nData( ErrorTemplateIdCode.PhoneEmpty ); |
36 |
37 |
|
} |
37 |
|
- |
int at = StringUtils.indexOfControlCharacter(phone); |
38 |
|
- |
if (at != -1) { |
39 |
|
- |
return new E13nData(ErrorTemplateIdCode.PhoneNoCtrlCharsAllowed); |
|
38 |
+ |
int at = StringUtils.indexOfControlCharacter( phone ); |
|
39 |
+ |
if ( at != -1 ) { |
|
40 |
+ |
return new E13nData( ErrorTemplateIdCode.PhoneNoCtrlCharsAllowed ); |
40 |
41 |
|
} |
41 |
42 |
|
return null; |
42 |
43 |
|
} |