Revision 106:187c15fe2d9c

View differences:

src/main/java/my/com/upass/maybank/MinimalMaybankFacadeImpl.java
275 275
			session.beginTransaction();
276 276

  
277 277
			final MinimalUserBean user = profile.getMinUser();
278
			final String username = user.getUsername();
279
			final Integer appId = AppAccessMgtService.getAppIdForProfile(profile);
280
			Character accessType = minUpcV2.getAppAccessType(username, appId, session);
278 281

  
279
			rc = (profile instanceof M2uUserContainer) ?
280
					MinimalConstants.ERR_SUCCESS
281
					: minUpcV2.addUser(
282
							appAccessId, hashedSecretKey, user, UserAppAccess.TYPE_USER, session);
282
			rc = (accessType != null) ?
283
					MinimalConstants.ERR_ALREADY_EXIST
284
					: (profile instanceof M2uUserContainer) ?
285
							MinimalConstants.ERR_SUCCESS
286
							: minUpcV2.addUser(
287
									appAccessId, hashedSecretKey, user, UserAppAccess.TYPE_USER, session);
283 288

  
284 289
			if (rc == MinimalConstants.ERR_SUCCESS) {
285
				final String username = user.getUsername();
286
				final Integer appId = AppAccessMgtService.getAppIdForProfile(profile);
287
				Character accessType = minUpcV2.getAppAccessType(username, appId, session);
288

  
289
				rc = accessType == null ?
290
						minUpcV2.updateProfileShallowly(appAccessId, hashedSecretKey, profile, session)
291
						: MinimalConstants.ERR_ALREADY_EXIST;
290
				rc = minUpcV2.updateProfileShallowly(appAccessId, hashedSecretKey, profile, session);
292 291

  
293 292
				if (rc == MinimalConstants.ERR_SUCCESS) {
294 293
					session.getTransaction().commit();

Also available in: Unified diff