m2u-upass-core / src / my / com / upass / services / ResetTokenService.java @ 38:3d22253b0fbc
History | View | Annotate | Download (1.67 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.dao.DAOFactoryProvider; |
16 |
import my.com.upass.dao.UserTokenDAO; |
17 |
import my.com.upass.factory.UPassFactory; |
18 |
import my.com.upass.pojo.UserTokenBean; |
19 |
import my.com.upass.vasco.TokenController; |
20 |
|
21 |
/**
|
22 |
* PROGRAMMER: Danniell
|
23 |
* CHANGE-NO:
|
24 |
* TASK-NO:
|
25 |
* DATE CREATED: Dec 28, 2011
|
26 |
* TAG AS:
|
27 |
* REASON(S):
|
28 |
* MODIFICATION:
|
29 |
*/
|
30 |
|
31 |
/**
|
32 |
* <Class description>
|
33 |
*/
|
34 |
public class ResetTokenService |
35 |
{ |
36 |
public int resetToken (String userAlias) |
37 |
{ |
38 |
int rc = Constants.ERR_SYSTEM_NOT_READY;
|
39 |
|
40 |
try
|
41 |
{ |
42 |
UserTokenDAO tokenDao = DAOFactoryProvider.getDAOFactory () |
43 |
.getUserTokenDAO (UPassFactory.getTokenMode ()); |
44 |
UserTokenBean tb = tokenDao.getTokenFromStoreByUserAlias (userAlias); |
45 |
|
46 |
if (tb == null) |
47 |
{ |
48 |
return Constants.ERR_USERALIAS_NOT_FOUND;
|
49 |
} |
50 |
|
51 |
TokenController tc = UPassFactory.getTokenController (tb); |
52 |
rc = tc.resetToken (); |
53 |
tb = (UserTokenBean) tc.getUpdatedObject (); |
54 |
|
55 |
// update database
|
56 |
boolean lrc = tokenDao.updateTokenToStore (tb);
|
57 |
|
58 |
if (!lrc)
|
59 |
{ |
60 |
return Constants.ERR_UNKNOWN;
|
61 |
} |
62 |
} |
63 |
catch (Exception e) |
64 |
{ |
65 |
e.printStackTrace (); |
66 |
} |
67 |
return rc;
|
68 |
} |
69 |
} |