Source:
public void updateUserListOfHybridRole(String roleName, String[] deletedUsers, String[] newUsers) throws UserStoreException { String sqlStmt1 = HybridJDBCConstants.REMOVE_USER_FROM_ROLE_SQL; String sqlStmt2 = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL; Connection dbConnection = null; try { String primaryDomainName = getMyDomainName(); if (primaryDomainName != null){ primaryDomainName = primaryDomainName.toUpperCase(); } dbConnection = getDBConnection(); String type = DatabaseCreator.getDatabaseType(dbConnection); if (UserCoreConstants.MSSQL_TYPE.equals(type)) { sqlStmt2 = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL_MSSQL; } if (deletedUsers != null && deletedUsers.length > 0) { DatabaseUtil.udpateUserRoleMappingInBatchModeForInternalRoles( dbConnection, sqlStmt1, primaryDomainName, deletedUsers, roleName, tenantId, tenantId, tenantId); for (String deletedUser : deletedUsers) { userRealm.getAuthorizationManager().clearUserAuthorization(deletedUser); } } if (newUsers != null && newUsers.length > 0) { if (UserCoreConstants.OPENEDGE_TYPE.equals(type)) { sqlStmt2 = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL_OPENEDGE; DatabaseUtil.udpateUserRoleMappingInBatchModeForInternalRoles(dbConnection, sqlStmt2, primaryDomainName, newUsers, tenantId, roleName, tenantId); } else { DatabaseUtil.udpateUserRoleMappingInBatchModeForInternalRoles(dbConnection, sqlStmt2, primaryDomainName, newUsers, roleName, tenantId, tenantId, tenantId); } } dbConnection.commit(); } catch (SQLException e) { String errorMessage = "Error occurred while updating user list of role :"+roleName; throw new UserStoreException(errorMessage, e); } catch (Exception e) { String errorMessage = "Error occurred while getting database type from db connection"; throw new UserStoreException(errorMessage, e); } finally { DatabaseUtil.closeAllConnections(dbConnection); } }

Target:
public void updateUserListOfHybridRole(String roleName, String[] deletedUsers, String[] newUsers) throws UserStoreException { String sqlStmt1 = HybridJDBCConstants.REMOVE_USER_FROM_ROLE_SQL; String sqlStmt2 = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL; Connection dbConnection = null; try { String primaryDomainName = getMyDomainName(); if (primaryDomainName != null){ primaryDomainName = primaryDomainName.toUpperCase(); } dbConnection = getDBConnection(); String type = DatabaseCreator.getDatabaseType(dbConnection); if (UserCoreConstants.MSSQL_TYPE.equals(type)) { sqlStmt2 = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL_MSSQL; } if (deletedUsers != null && deletedUsers.length > 0) { DatabaseUtil.udpateUserRoleMappingInBatchModeForInternalRoles( dbConnection, sqlStmt1, primaryDomainName, deletedUsers, roleName, tenantId, tenantId, tenantId); for (String deletedUser : deletedUsers) { userRealm.getAuthorizationManager().clearUserAuthorization(deletedUser); } } if (newUsers != null && newUsers.length > 0) { if (UserCoreConstants.OPENEDGE_TYPE.equals(type)) { sqlStmt2 = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL_OPENEDGE; DatabaseUtil.udpateUserRoleMappingInBatchModeForInternalRoles(dbConnection, sqlStmt2, primaryDomainName, newUsers, tenantId, roleName, tenantId); } else { DatabaseUtil.udpateUserRoleMappingInBatchModeForInternalRoles(dbConnection, sqlStmt2, primaryDomainName, newUsers, roleName, tenantId, tenantId, tenantId); } } dbConnection.commit(); } catch (SQLException e) { String errorMessage = "Error occurred while updating user list of role : " + roleName; if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } catch (Exception e) { String errorMessage = "Error occurred while getting database type from DB connection"; if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } finally { DatabaseUtil.closeAllConnections(dbConnection); } }