Source:
public void addHybridRole(String roleName, String[] userList) throws UserStoreException { Connection dbConnection = null; try { String primaryDomainName = getMyDomainName(); if (primaryDomainName!=null){ primaryDomainName = primaryDomainName.toUpperCase(); } dbConnection = getDBConnection(); if (!this.isExistingRole(roleName)) { DatabaseUtil.updateDatabase(dbConnection, HybridJDBCConstants.ADD_ROLE_SQL, roleName, tenantId); } else { throw new UserStoreException("Role name: " + roleName + " in the system. Please pick another role name."); } if (userList != null) { String sql = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL; String type = DatabaseCreator.getDatabaseType(dbConnection); if (UserCoreConstants.MSSQL_TYPE.equals(type)) { sql = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL_MSSQL; } if (UserCoreConstants.OPENEDGE_TYPE.equals(type)) { sql = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL_OPENEDGE; DatabaseUtil.udpateUserRoleMappingInBatchModeForInternalRoles(dbConnection, sql, primaryDomainName, userList, tenantId, roleName, tenantId); } else { DatabaseUtil.udpateUserRoleMappingInBatchModeForInternalRoles(dbConnection, sql, primaryDomainName, userList, roleName, tenantId, tenantId, tenantId); } } dbConnection.commit(); } catch (SQLException e) { throw new UserStoreException("Error occurred while adding Hybrid role :"+roleName, 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 addHybridRole(String roleName, String[] userList) throws UserStoreException { Connection dbConnection = null; try { String primaryDomainName = getMyDomainName(); if (primaryDomainName!=null){ primaryDomainName = primaryDomainName.toUpperCase(); } dbConnection = getDBConnection(); if (!this.isExistingRole(roleName)) { DatabaseUtil.updateDatabase(dbConnection, HybridJDBCConstants.ADD_ROLE_SQL, roleName, tenantId); } else { throw new UserStoreException("Role name: " + roleName + " in the system. Please pick another role name."); } if (userList != null) { String sql = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL; String type = DatabaseCreator.getDatabaseType(dbConnection); if (UserCoreConstants.MSSQL_TYPE.equals(type)) { sql = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL_MSSQL; } if (UserCoreConstants.OPENEDGE_TYPE.equals(type)) { sql = HybridJDBCConstants.ADD_USER_TO_ROLE_SQL_OPENEDGE; DatabaseUtil.udpateUserRoleMappingInBatchModeForInternalRoles(dbConnection, sql, primaryDomainName, userList, tenantId, roleName, tenantId); } else { DatabaseUtil.udpateUserRoleMappingInBatchModeForInternalRoles(dbConnection, sql, primaryDomainName, userList, roleName, tenantId, tenantId, tenantId); } } dbConnection.commit(); } catch (SQLException e) { String errorMessage = "Error occurred while adding Hybrid 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); } }