Revision 60:33da009cc01e

View differences:

src/com/ib/ibss/enterprise/services/ss112_user/IBSSRetailUserEnquiryDeleteServices.java
82 82
	{
83 83
		IBSSLogger.debug (c_oClass, "Entering userResetPassword");
84 84
		
85
		Long m_oLogStatus 						= AuditLogConstants.UNSUCCESSFUL;
86
		c_sPassword 							= getBeanMessage (IBSSUserConstants.PASS);
87
		c_sConfirmPassword 						= getBeanMessage (IBSSUserConstants.CONFIRM_PASS);
88
		c_sAdminName 							= getIBSSessionObjects().getSessionUser().getUserName ();
89
		c_oAdminID								= getIBSSessionObjects().getSessionUser().getUserId ();
90
		c_oDetailBean 							= (IBSSDynaBean) getIBSSDynaBean().get(IBSSUserConstants.IBSS_USER_DETAIL);
91
		c_oUserID								= (Long) c_oDetailBean.get (IBSSUserConstants.USER_ID);
92
		c_sUserAlias 							= (String) c_oDetailBean.get (IBSSUserConstants.USER_ALIAS);
93
		appId									= (String) c_oDetailBean.get (IBSSUserConstants.USER_APPLICATION_KEY);
85
		Long m_oLogStatus 	= AuditLogConstants.UNSUCCESSFUL;
86
		c_sPassword 		= getBeanMessage (IBSSUserConstants.PASS);
87
		c_sConfirmPassword 	= getBeanMessage (IBSSUserConstants.CONFIRM_PASS);
88
		c_sAdminName 		= getIBSSessionObjects().getSessionUser().getUserName ();
89
		c_oAdminID			= getIBSSessionObjects().getSessionUser().getUserId ();
90
		c_oDetailBean 		= (IBSSDynaBean) getIBSSDynaBean().get(IBSSUserConstants.IBSS_USER_DETAIL);
91
		c_oUserID			= (Long) c_oDetailBean.get (IBSSUserConstants.USER_ID);
92
		c_sUserAlias 		= (String) c_oDetailBean.get (IBSSUserConstants.USER_ALIAS);
93
		appId				= (String) c_oDetailBean.get (IBSSUserConstants.USER_APPLICATION_KEY);
94
		
95
		Session session = null;
94 96
		
95 97
		try
96 98
		{
......
102 104
			
103 105
			/* Delete User */
104 106
			UPassControllerV2 upass = new UPassControllerV2();
105
			Session session = HibernateUtils.currentSession();
107
			session = HibernateUtils.currentSession();
106 108
			session.beginTransaction();
107 109
			int response = upass.deleteUserWithTheProfile(upassAdmin, upassAdminPass, c_sUserAlias, Integer.valueOf(appId), session);
108 110
			
......
140 142
						getIBSSessionObjects ().getSessionUser ().getRoleId (),
141 143
						getIBSSessionObjects ().getSessionUser ().getGroupId (),
142 144
						getIBSSessionObjects ().getSessionUser ().getCurrentLoginIPAddress());
145
				
143 146
			}
144 147
			catch (Exception e)
145 148
			{
146 149
				IBSSErrorHandler.handleServiceError (e, c_oClass);
147 150
			}
151
			finally
152
			{
153
				if(session!=null)
154
				{
155
					session.clear();
156
					session.close();
157
				}
158
			}
148 159
		}
149 160
		IBSSLogger.debug (c_oClass, "Exiting userResetPassword");
150 161
	}
src/com/ib/ibss/enterprise/services/ss112_user/IBSSRetailUserEnquiryDetailsServices.java
91 91
		Map<String, IBSSDynaBean> userMap 	= new HashMap<String, IBSSDynaBean> ();
92 92
		LinkedHashMap<String, String> detailMap = new LinkedHashMap<String, String> ();
93 93
		
94
		Session session = null;
95
		
94 96
		try
95 97
		{
96 98
			
......
120 122
				
121 123
				MinimalUPassControllerV2 upass = new MinimalUPassControllerV2();
122 124
				
123
				Session session = HibernateUtils.currentSession();
125
				session = HibernateUtils.currentSession();
124 126
				session.beginTransaction();
125 127
				
126 128
				UserProfile userProfile = upass.findProfile(upassAdmin, upassAdminPass, (String)m_oUserBean.get(IBSSUserConstants.USER_ALIAS), userType, session);
......
175 177
		{
176 178
			IBSSErrorHandler.handleServiceError (e, c_oClass);
177 179
		}
180
		finally
181
		{
182
			if(session!=null)
183
			{
184
				session.clear();
185
				session.close();
186
			}
187
		}
178 188
		IBSSLogger.debug (c_oClass, "Exiting execute");
179 189
	}
180 190
}
src/com/ib/ibss/enterprise/services/ss112_user/IBSSRetailUserEnquiryMainServices.java
114 114
		Map<String, String> authModeMap 				= new HashMap<String, String> ();
115 115
		Map<Long, String> m_mGroupMap					= null;
116 116
		
117
		Session session	= null;
118
		
117 119
		SimpleDateFormat m_oDateFormat = new SimpleDateFormat(IBSSCommonConstants.STANDARD_DATE_FORMAT_SHORT_DDMMYYYY);
118 120
		
119 121
		try
......
181 183
			}
182 184
			
183 185
			MinimalUPassControllerV2 upass = new MinimalUPassControllerV2();
184
			Session session = HibernateUtils.currentSession();
186
			session = HibernateUtils.currentSession();
185 187
			session.beginTransaction();
186 188
			
187 189
			if (!DataValidator.isEmptyString(m_sCreateFr)){
......
283 285
			e.printStackTrace ();
284 286
			IBSSErrorHandler.handleServiceError (e, c_oClass);
285 287
		}
288
		finally
289
		{
290
			if(session!=null)
291
			{
292
				session.clear();
293
				session.close();
294
			}
295
		}
286 296
		IBSSLogger.debug (c_oClass, "Exiting createEnquiryScreen");
287 297
	}
288 298
	
src/com/ib/ibss/enterprise/services/ss112_user/IBSSRetailUserEnquiryResetPassServices.java
16 16
import org.hibernate.Session;
17 17

  
18 18
import my.com.upass.MinimalUPassControllerV2;
19
import my.com.upass.UPassControllerV2;
20 19
import net.penril.generic.hibernate.HibernateUtils;
21 20
import net.penril.ibss.audit.log.AuditLogConstants;
22 21
import net.penril.ibss.audit.log.USER_ACTIVITY_TYTPE;
23
import net.penril.ibss.core.hibernate.IbCustProfile;
24

  
25
import com.ib.common.utils.constant.UPassConstants;
26 22
import com.ib.ibss.common.constant.AdminPermissionModeType.RIBPermission;
27 23
import com.ib.ibss.common.constant.ExceptionErrors;
28 24
import com.ib.ibss.common.utils.IBSSLogger;
......
82 78
	{
83 79
		IBSSLogger.debug (c_oClass, "Entering userResetPassword");
84 80
		
85
		Long m_oLogStatus 						= AuditLogConstants.UNSUCCESSFUL;
86
		c_sPassword 							= getBeanMessage (IBSSUserConstants.PASS);
87
		c_sConfirmPassword 						= getBeanMessage (IBSSUserConstants.CONFIRM_PASS);
88
		c_sAdminName 							= getIBSSessionObjects().getSessionUser().getUserName ();
89
		c_oAdminID								= getIBSSessionObjects().getSessionUser().getUserId ();
90
		c_oDetailBean 							= (IBSSDynaBean) getIBSSDynaBean().get(IBSSUserConstants.IBSS_USER_DETAIL);
91
		c_oUserID								= (Long) c_oDetailBean.get (IBSSUserConstants.USER_ID);
92
		c_sUserAlias 							= (String) c_oDetailBean.get (IBSSUserConstants.USER_ALIAS);
81
		Long m_oLogStatus 	= AuditLogConstants.UNSUCCESSFUL;
82
		c_sPassword 		= getBeanMessage (IBSSUserConstants.PASS);
83
		c_sConfirmPassword 	= getBeanMessage (IBSSUserConstants.CONFIRM_PASS);
84
		c_sAdminName 		= getIBSSessionObjects().getSessionUser().getUserName ();
85
		c_oAdminID			= getIBSSessionObjects().getSessionUser().getUserId ();
86
		c_oDetailBean 		= (IBSSDynaBean) getIBSSDynaBean().get(IBSSUserConstants.IBSS_USER_DETAIL);
87
		c_oUserID			= (Long) c_oDetailBean.get (IBSSUserConstants.USER_ID);
88
		c_sUserAlias 		= (String) c_oDetailBean.get (IBSSUserConstants.USER_ALIAS);
89
		
90
		Session session 	= null;
93 91
		
94 92
		try
95 93
		{
......
102 100
			boolean isMakerChecker = m_oSharedServices.determineMakerChecker (actionId, getAdminActionDAO(), getIBSSessionObjects());	
103 101
			
104 102
			/* Reset password */
105
				resetPassword();
106
				/* Log successful */
107
				m_oLogStatus = AuditLogConstants.SUCCESSFUL;
103
			MinimalUPassControllerV2 upass = new MinimalUPassControllerV2();
104
			session = HibernateUtils.currentSession();
105
			session.beginTransaction();
106
			int m_iRC = upass.resetPassword_withAppChecked(upassAdmin, upassAdminPass, c_sUserAlias, c_sPassword);
107
			System.out.println("m_iRC:"+m_iRC);
108
			switch(m_iRC)
109
			{
110
				case StatusConstants.ERR_SUCCESS:
111
					setBeanMessage (IBSSUserConstants.PASS, "");
112
					setBeanMessage (IBSSUserConstants.CONFIRM_PASS, "");
113
					setBeanMessage (IBSSUserConstants.USER_ID, String.valueOf (c_oUserID));
114
					c_sLogReason = "Update Successful";
115
					break;
116
				default:
117
					c_sLogReason = "Unhandled response: " + m_iRC;
118
					throw IBSSErrorHandler.createBusinessException (IBSSBusinessException.LOGIN, ExceptionErrors.ERR_SYSTEM_NOT_READY);
119
			}
120

  
121
			/* Log successful */
122
			m_oLogStatus = AuditLogConstants.SUCCESSFUL;
108 123
				
109
				setBeanMessage (IBSSUserConstants.JSP_TITLE, 
110
						ResourcesUtils.getApplicationResourceMessage ("user.user") + ": " + c_sUserAlias + " " +
111
						ResourcesUtils.getApplicationResourceMessage ("user.has.been.successfully") + " " +
112
						ResourcesUtils.getApplicationResourceMessage ("user.reset.desc"));
124
			setBeanMessage (IBSSUserConstants.JSP_TITLE, 
125
				ResourcesUtils.getApplicationResourceMessage ("user.user") + ": " + c_sUserAlias + " " +
126
				ResourcesUtils.getApplicationResourceMessage ("user.has.been.successfully") + " " +
127
				ResourcesUtils.getApplicationResourceMessage ("user.reset.desc"));
113 128
		}
114 129
		catch (Exception e)
115 130
		{
......
132 147
			{
133 148
				IBSSErrorHandler.handleServiceError (e, c_oClass);
134 149
			}
150
			finally
151
			{
152
				if(session!=null)
153
				{
154
					session.clear();
155
					session.close();
156
				}
157
			}
135 158
		}
136 159
		IBSSLogger.debug (c_oClass, "Exiting userResetPassword");
137 160
	}
138 161

  
139
	private void resetPassword () throws Exception
140
	{
141
		IBSSLogger.debug (c_oClass, "Entering resetPassword");
142
		
143
		MinimalUPassControllerV2 upass = new MinimalUPassControllerV2();
144
		Session session = HibernateUtils.currentSession();
145
		session.beginTransaction();
146
		int m_iRC = upass.resetPassword_withAppChecked(upassAdmin, upassAdminPass, c_sUserAlias, c_sPassword);
147
		System.out.println("m_iRC:"+m_iRC);
148
		switch(m_iRC)
149
		{
150
			case StatusConstants.ERR_SUCCESS:
151
				setBeanMessage (IBSSUserConstants.PASS, "");
152
				setBeanMessage (IBSSUserConstants.CONFIRM_PASS, "");
153
				setBeanMessage (IBSSUserConstants.USER_ID, String.valueOf (c_oUserID));
154
				c_sLogReason = "Update Successful";
155
				break;
156
			default:
157
				c_sLogReason = "Unhandled response: " + m_iRC;
158
				throw IBSSErrorHandler.createBusinessException (IBSSBusinessException.LOGIN, ExceptionErrors.ERR_SYSTEM_NOT_READY);
159
		}
160
		
161
		IBSSLogger.debug (c_oClass, "Exiting resetPassword");
162
	}
163

  
164 162
	private void checkPasswordMatching () throws IBSSGenericException
165 163
	{
166 164
		IBSSLogger.debug (c_oClass, "Entering checkPasswordMatching");
src/com/ib/ibss/enterprise/services/ss223_application/IBSSApplicationUserCreateDetailsServices.java
41 41
	@SuppressWarnings("unchecked")
42 42
	public void execute () throws IBSSGenericException
43 43
	{
44
		Session session = null;
44 45
		try
45 46
		{
46 47
			MinimalUPassControllerV2 upass = new MinimalUPassControllerV2();
47
			Session session = HibernateUtils.currentSession();
48
			session = HibernateUtils.currentSession();
48 49
			session.beginTransaction();
49 50
			
50 51
			//get client application list for display
......
56 57
		{
57 58
			IBSSErrorHandler.handleServiceError (e, c_oClass);
58 59
		}
60
		finally
61
		{
62
			if(session!=null)
63
			{
64
				session.clear();
65
				session.close();
66
			}
67
		}
59 68
	}
60 69
}
src/com/ib/ibss/enterprise/services/ss223_application/IBSSApplicationUserCreateResultServices.java
124 124
						getIBSSessionObjects ().getSessionUser ().getGroupId (),
125 125
						getIBSSessionObjects ().getSessionUser ().getCurrentLoginIPAddress());
126 126
				
127
				session.close();
128 127
			}
129 128
			catch (Exception e)
130 129
			{
131 130
				IBSSErrorHandler.handleServiceError (e, c_oClass);
132 131
			}
132
			finally
133
			{
134
				if(session!=null)
135
				{
136
					session.clear();
137
					session.close();
138
				}
139
			}
133 140
		}
134 141
	}
135 142
}
src/com/ib/ibss/enterprise/services/ss223_application/IBSSApplicationUserDeleteResultServices.java
118 118
						getIBSSessionObjects ().getSessionUser ().getGroupId (),
119 119
						getIBSSessionObjects ().getSessionUser ().getCurrentLoginIPAddress());
120 120
				
121
				session.close();
122 121
			}
123 122
			catch (Exception e)
124 123
			{
125 124
				IBSSLogger.error (c_oClass, IBSSErrorHandler.generateErrorMessage (e));
126 125
				IBSSErrorHandler.handleServiceError (e, c_oClass);
127 126
			}
127
			finally
128
			{
129
				if(session!=null)
130
				{
131
					session.clear();
132
					session.close();
133
				}
134
			}
128 135
		}
129 136
		IBSSLogger.debug (c_oClass, "Exiting deleteAppUser");
130 137
	}
src/com/ib/ibss/enterprise/services/ss223_application/IBSSApplicationUserEditResultServices.java
135 135
						getIBSSessionObjects ().getSessionUser ().getCurrentLoginIPAddress(),
136 136
						BeanToBeanTransferUtils.convertBeanToStringForDiffValue(user1, user2));
137 137
				
138
				session.close();
139 138
			}
140 139
			catch (Exception e)
141 140
			{
142 141
				IBSSErrorHandler.handleServiceError (e, c_oClass);
143 142
			}
143
			finally
144
			{
145
				if(session!=null)
146
				{
147
					session.clear();
148
					session.close();
149
				}
150
			}
144 151
		}
145 152
	}
146 153

  
src/com/ib/ibss/enterprise/services/ss223_application/IBSSApplicationUserMainServices.java
130 130
				startIndex 		= totalFixRow - userEnquiryRowPerPage;
131 131
				endIndex 		= Math.min(totalFixRow-1, appUserListSize-1);
132 132
				
133
//				session = HibernateUtils.currentSession();
134
//				session.beginTransaction();
135 133
				List <ClientApp> clientAppList = upass.listRecognizedClientApps(session);
136 134
				
137 135
				for(int i = startIndex; i <= endIndex; i++)
......
144 142
					appUserBean.set (IBSSApplicationUserConstants.USER_DESCRIPTION, user.getDescription());
145 143
					appUserBean.set (IBSSApplicationUserConstants.USER_ALIAS, user.getUserAlias());
146 144
					
147
//					session = HibernateUtils.currentSession();
148
//					session.beginTransaction();
149 145
					AccessCheckResult result = upass.checkAppAccess(user.getUserAlias(), user.getDoubleHashedPassword(), session);
150 146
					
151 147
					for(ClientApp app : clientAppList)
......
217 213
		}
218 214
		finally
219 215
		{
220
			session.close();
216
			if(session!=null)
217
			{
218
				session.clear();
219
				session.close();
220
			}
221 221
		}
222 222
		IBSSLogger.debug (c_oClass, "Exiting execute");
223 223
	}
src/com/ib/ibss/enterprise/services/ss223_application/IBSSApplicationUserResetPassResultServices.java
12 12
package com.ib.ibss.enterprise.services.ss223_application;
13 13

  
14 14
import my.com.upass.MinimalUPassControllerV2;
15
import net.penril.generic.hibernate.HibernateUtils;
16 15
import net.penril.ibss.audit.log.AuditLogConstants;
17 16
import net.penril.ibss.audit.log.USER_ACTIVITY_TYTPE;
18 17

  
19
import org.hibernate.Session;
20

  
21 18
import com.ib.ibss.common.constant.ExceptionErrors;
22 19
import com.ib.ibss.common.utils.IBSSLogger;
23 20
import com.ib.ibss.common.utils.ResourcesUtils;
......
69 66
			
70 67
			/* Reset password */
71 68
			MinimalUPassControllerV2 upass = new MinimalUPassControllerV2();
72
			Session session = HibernateUtils.currentSession();
73
			session.beginTransaction();
74 69
			int rc = upass.resetPassword_withAppChecked(upassAdmin, upassAdminPass, userAlias, password);
75 70
			System.out.println("rc:"+rc);
76 71
			

Also available in: Unified diff