m2u-upass-core / src / my / com / upass / services / DisableTacService.java @ 18:78fbff99ec6c
History | View | Annotate | Download (1.98 KB)
1 | 0:02300db8682b | hadi | /**
|
---|---|---|---|
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 java.util.Map; |
||
15 | |||
16 | import my.com.upass.ConfigBean; |
||
17 | import my.com.upass.Constants; |
||
18 | import my.com.upass.UPassControllerV2; |
||
19 | import my.com.upass.dao.DAOFactoryProvider; |
||
20 | import my.com.upass.dao.UserTacDAO; |
||
21 | import my.com.upass.factory.UPassFactory; |
||
22 | import my.com.upass.pojo.TacBean; |
||
23 | import my.com.upass.tac.TacController; |
||
24 | |||
25 | /**
|
||
26 | * PROGRAMMER: Danniell
|
||
27 | * CHANGE-NO:
|
||
28 | * TASK-NO:
|
||
29 | * DATE CREATED: Dec 28, 2011
|
||
30 | * TAG AS:
|
||
31 | * REASON(S):
|
||
32 | * MODIFICATION:
|
||
33 | */
|
||
34 | |||
35 | /**
|
||
36 | * <Class description>
|
||
37 | */
|
||
38 | public class DisableTacService { |
||
39 | |||
40 | private UPassControllerV2 upc;
|
||
41 | |||
42 | public DisableTacService(UPassControllerV2 upc) {
|
||
43 | this.upc = upc;
|
||
44 | } |
||
45 | |||
46 | public int disableTAC(String userAlias) { |
||
47 | |||
48 | int rc = Constants.ERR_SYSTEM_NOT_READY;
|
||
49 | |||
50 | try {
|
||
51 | UserTacDAO tacDao = DAOFactoryProvider.getDAOFactory().getUserTacDAO(); |
||
52 | final Map<Integer, ConfigBean> configsMap = upc.getConfigurationsMap(); |
||
53 | for (Integer appId : configsMap.keySet()) { |
||
54 | |||
55 | TacBean tb = tacDao.getTacFromStore(userAlias, appId); |
||
56 | if (tb == null) { |
||
57 | 8:1982e43e6686 | mohd | continue;
|
58 | 0:02300db8682b | hadi | } |
59 | // reset TAC
|
||
60 | final ConfigBean config = configsMap.get(appId);
|
||
61 | TacController tc = UPassFactory.getTacController(tb, config); |
||
62 | tc.DisableTAC(); |
||
63 | tc.getUpdatedObject(); |
||
64 | |||
65 | if (tacDao.updateTacToStore(tb)) {
|
||
66 | 8:1982e43e6686 | mohd | return Constants.ERR_SUCCESS;
|
67 | 0:02300db8682b | hadi | |
68 | } else {
|
||
69 | 8:1982e43e6686 | mohd | return Constants.ERR_UNKNOWN;
|
70 | 0:02300db8682b | hadi | } |
71 | } |
||
72 | 8:1982e43e6686 | mohd | |
73 | rc = Constants.ERR_USERALIAS_NOT_FOUND; |
||
74 | |||
75 | 0:02300db8682b | hadi | } catch (Exception e) { |
76 | e.printStackTrace(); |
||
77 | } |
||
78 | return rc;
|
||
79 | } |
||
80 | } |