Subversion Repositories SmartDukaan

Rev

Rev 4272 | Rev 4892 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4272 Rev 4891
Line 8... Line 8...
8
import in.shop2020.thrift.clients.config.ConfigClient;
8
import in.shop2020.thrift.clients.config.ConfigClient;
9
 
9
 
10
import java.util.ArrayList;
10
import java.util.ArrayList;
11
import java.util.List;
11
import java.util.List;
12
 
12
 
-
 
13
import javax.mail.internet.AddressException;
-
 
14
import javax.mail.internet.InternetAddress;
-
 
15
 
13
import org.apache.commons.lang.StringUtils;
16
import org.apache.commons.lang.StringUtils;
14
import org.apache.log4j.Logger;
17
import org.apache.log4j.Logger;
15
 
18
 
16
public class Utils {
19
public class Utils {
17
    private static Logger logger = Logger.getLogger(Utils.class);
20
    private static Logger logger = Logger.getLogger(Utils.class);
18
    
21
    
19
	public static final String EXPORT_ENTITIES_PATH = getExportPath();
22
//	public static final String EXPORT_ENTITIES_PATH = getExportPath();
20
	public static final long ROOT_CATEGORY = 10000;
23
	public static final long ROOT_CATEGORY = 10000;
21
	public static final long MOBILE_PHONES_CATEGORY = 10001;
24
	public static final long MOBILE_PHONES_CATEGORY = 10001;
22
	public static final long MOBILE_ACCESSORIES_CATEGORY = 10011;
25
	public static final long MOBILE_ACCESSORIES_CATEGORY = 10011;
23
	public static final long TABLETS_CATEGORY = 10010;
26
	public static final long TABLETS_CATEGORY = 10010;
24
    public static final long LAPTOPS_CATEGORY = 10050;
27
    public static final long LAPTOPS_CATEGORY = 10050;
Line 53... Line 56...
53
		if (pin < 100000 || pin > 999999) {
56
		if (pin < 100000 || pin > 999999) {
54
			return false;
57
			return false;
55
		}
58
		}
56
		return true;
59
		return true;
57
	}
60
	}
-
 
61
	
-
 
62
	public static boolean isValidEmail(String emailAddress)	{
-
 
63
		
-
 
64
		if(emailAddress == null || emailAddress.isEmpty())	{
-
 
65
			return false;
-
 
66
		}
-
 
67
		try {
-
 
68
			InternetAddress address = new InternetAddress(emailAddress, true);
-
 
69
			address.validate();
-
 
70
			return true;
-
 
71
			
-
 
72
		} catch (AddressException e) {
-
 
73
			logger.error(emailAddress + " is not valid email address ", e);
-
 
74
			return false;
-
 
75
		}
-
 
76
	}
58
 
77
 
59
	public static boolean validatePhone(String phone) {
78
	public static boolean validatePhone(String phone) {
60
		long iPhone;
79
		long iPhone;
61
		try {
80
		try {
62
    		iPhone = Long.parseLong(phone);
81
    		iPhone = Long.parseLong(phone);
Line 88... Line 107...
88
                }
107
                }
89
            }
108
            }
90
        }
109
        }
91
        return StringUtils.join(itemIds, '_');
110
        return StringUtils.join(itemIds, '_');
92
    }
111
    }
93
 
-
 
94
	
-
 
95
}
112
}
96
	
-
 
97
113