m2u-upass-core / src / my / com / upass / services / VerifySecurityCodeService.java @ 62:9571b0589c96
History | View | Annotate | Download (1.96 KB)
1 |
/**
|
---|---|
2 |
* Copyright (c) 2010 Penril Datability (M) Sdn Bhd All rights reserved.
|
3 |
*
|
4 |
* This software is copyrighted. Under the copyright laws, this software
|
5 |
* may not be copied, in whole or in part, without prior written consent
|
6 |
* of Penril Datability (M) Sdn Bhd or its assignees. This software is
|
7 |
* provided under the terms of a license between Penril Datability (M)
|
8 |
* Sdn Bhd and the recipient, and its use is subject to the terms of that
|
9 |
* license.
|
10 |
*/
|
11 |
|
12 |
package my.com.upass.services; |
13 |
|
14 |
import my.com.upass.Constants; |
15 |
import my.com.upass.UPassControllerV2; |
16 |
import my.com.upass.dao.DAOFactoryProvider; |
17 |
import my.com.upass.dao.UserSecurityCodeDAO; |
18 |
import my.com.upass.factory.UPassFactory; |
19 |
import my.com.upass.pojo.SecurityCodeBean; |
20 |
import my.com.upass.security.code.SecurityCodeController; |
21 |
|
22 |
/**
|
23 |
* PROGRAMMER: Danniell
|
24 |
* CHANGE-NO:
|
25 |
* TASK-NO:
|
26 |
* DATE CREATED: Dec 28, 2011
|
27 |
* TAG AS:
|
28 |
* REASON(S):
|
29 |
* MODIFICATION:
|
30 |
*/
|
31 |
|
32 |
/**
|
33 |
* <Class description>
|
34 |
*/
|
35 |
public class VerifySecurityCodeService |
36 |
{ |
37 |
private UPassControllerV2 upc;
|
38 |
|
39 |
public VerifySecurityCodeService(UPassControllerV2 upc)
|
40 |
{ |
41 |
this.upc = upc;
|
42 |
} |
43 |
|
44 |
public int verifySecurityCode (String referenceId, String securityCode) |
45 |
{ |
46 |
int rc = Constants.ERR_SYSTEM_NOT_READY;
|
47 |
|
48 |
try
|
49 |
{ |
50 |
UserSecurityCodeDAO dao = DAOFactoryProvider.getDAOFactory () |
51 |
.getUserSecurityCodeDAO (); |
52 |
SecurityCodeBean bean = dao.getSecurityCodeFromStore (referenceId); |
53 |
|
54 |
if (bean == null) |
55 |
{ |
56 |
return Constants.ERR_USERALIAS_NOT_FOUND;
|
57 |
} |
58 |
|
59 |
SecurityCodeController sc = UPassFactory.getSecurityCodeController ( |
60 |
bean, upc.getConfigurationsMap ()); |
61 |
rc = sc.VerifySecurityCode (securityCode); |
62 |
|
63 |
bean = (SecurityCodeBean) sc.getUpdatedObject (); |
64 |
|
65 |
// update database
|
66 |
boolean lrc = dao.updateSecurityCodeToStore (bean);
|
67 |
|
68 |
if (!lrc)
|
69 |
{ |
70 |
return Constants.ERR_UNKNOWN;
|
71 |
} |
72 |
} |
73 |
catch (Exception e) |
74 |
{ |
75 |
e.printStackTrace (); |
76 |
return rc;
|
77 |
} |
78 |
return rc;
|
79 |
} |
80 |
} |