UserMgr { public VXPortalUser mapXXPortalUserToVXPortalUser(XXPortalUser user, Collection<String> userRoleList) { if (user == null) { return null; } UserSessionBase sess = ContextUtil.getCurrentUserSession(); if (sess == null) { return null; } VXPortalUser userProfile = new VXPortalUser(); gjUserToUserProfile(user, userProfile); if (sess.isUserAdmin() || sess.isKeyAdmin() || sess.getXXPortalUser().getId().equals(user.getId())) { if (userRoleList == null) { userRoleList = new ArrayList<String>(); List<XXPortalUserRole> gjUserRoleList = daoManager .getXXPortalUserRole().findByParentId(user.getId()); for (XXPortalUserRole userRole : gjUserRoleList) { userRoleList.add(userRole.getUserRole()); } } userProfile.setUserRoleList(userRoleList); } userProfile.setUserSource(user.getUserSource()); return userProfile; } UserMgr(); XXPortalUser createUser(VXPortalUser userProfile, int userStatus,
			Collection<String> userRoleList); XXPortalUser createUser(XXPortalUser user, int userStatus,
			Collection<String> userRoleList); XXPortalUser createUser(VXPortalUser userProfile, int userStatus); XXPortalUser updateUser(VXPortalUser userProfile); boolean updateRoles(Long userId, Collection<String> rolesList); void setUserRoles(Long userId, List<VXString> vStringRolesList); VXResponse changePassword(VXPasswordChange pwdChange); VXPortalUser changeEmailAddress(XXPortalUser gjUser,
			VXPasswordChange changeEmail); VXPortalUser deactivateUser(XXPortalUser gjUser); VXPortalUser getUserProfile(Long id); VXPortalUser getUserProfileByLoginId(); VXPortalUser getUserProfileByLoginId(String loginId); XXPortalUser mapVXPortalUserToXXPortalUser(VXPortalUser userProfile); VXPortalUser mapXXPortalUserToVXPortalUser(XXPortalUser user,
			Collection<String> userRoleList); VXPortalUser mapXXPortalUserVXPortalUser(XXPortalUser user); XXPortalUser findByEmailAddress(String emailId); XXPortalUser findByLoginId(String loginId); @Transactional(readOnly = true, propagation = Propagation.REQUIRED) Collection<String> getRolesForUser(XXPortalUser user); VXPortalUserList searchUsers(SearchCriteria searchCriteria); boolean deleteUserRole(Long userId, String userRole); boolean deleteUserRole(Long userId, XXPortalUserRole gjUserRole); XXPortalUserRole addUserRole(Long userId, String userRole); void checkAccess(Long userId); void checkAccess(XXPortalUser gjUser); void checkAccessForUpdate(XXPortalUser gjUser); String encrypt(String loginId, String password); String encryptWithOlderAlgo(String loginId, String password); VXPortalUser createUser(VXPortalUser userProfile); VXPortalUser createDefaultAccountUser(VXPortalUser userProfile); boolean isUserInRole(Long userId, String role); XXPortalUser updateUserWithPass(VXPortalUser userProfile); @Transactional(readOnly = false, propagation = Propagation.REQUIRED) XXPortalUser updatePasswordInSHA256(String userName,String userPassword,boolean logAudits); void checkAdminAccess(); Collection<String> getRolesByLoginId(String loginId); @Transactional(readOnly = false, propagation = Propagation.REQUIRED) XXPortalUser updateOldUserName(String userLoginId,String newUserName, String currentPassword);  }
@Test public void test38mapVXPortalUserToXXPortalUser() { Collection<String> existingRoleList = new ArrayList<String>(); existingRoleList.add(RangerConstants.ROLE_USER); VXPortalUser dbVXPortalUser = userMgr.mapXXPortalUserToVXPortalUser(null,existingRoleList); XXPortalUser user = new XXPortalUser(); Assert.assertNull(dbVXPortalUser); dbVXPortalUser = userMgr.mapXXPortalUserToVXPortalUser(user,existingRoleList); Assert.assertNull(dbVXPortalUser); }