Source:
<code>public long doCountRoles(String filter) throws UserStoreException { long usersCount = 0; String sqlStmt; if (filter.startsWith(UserCoreConstants.INTERNAL_DOMAIN)) { sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.COUNT_INTERNAL_ROLES); String names[] = filter.split(UserCoreConstants.DOMAIN_SEPARATOR); filter = names[1].trim(); } else if (filter.startsWith(UserCoreConstants.APPLICATION_DOMAIN)) { sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.COUNT_APPLICATION_ROLES); } else { sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.COUNT_ROLES); } if (StringUtils.isNotEmpty(filter)) { filter = filter.trim(); filter = filter.replace("*", "%"); filter = filter.replace("?", "_"); } else { filter = "%"; } try (Connection dbConnection = getDBConnection(); PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)) { prepStmt.setString(1, filter); if (sqlStmt.toUpperCase().contains(UserCoreConstants.SQL_ESCAPE_KEYWORD)) { prepStmt.setString(2, SQL_FILTER_CHAR_ESCAPE); if (sqlStmt.contains(UserCoreConstants.UM_TENANT_COLUMN)) { prepStmt.setInt(3, tenantId); } } else { if (sqlStmt.contains(UserCoreConstants.UM_TENANT_COLUMN)) { prepStmt.setInt(2, tenantId); } } ResultSet resultSets = prepStmt.executeQuery(); while (resultSets.next()) { return resultSets.getLong(1); } } catch (SQLException e) { <START> String msg = ERROR_OCCURRED_WHILE_RETRIEVING_USERS_FOR_FILTER + filter; <END> if (log.isDebugEnabled()) { log.debug(msg, e); } throw new UserStoreException(msg, ERROR_CODE_ERROR_WHILE_EXECUTING_THE_SQL.getCode(), e); } catch (UserStoreException ex) { handleGetUserCountFailure(UserCoreErrorConstants.ErrorMessages.ERROR_CODE_ERROR_WHILE_GETTING_ROLES_COUNT .getCode(), String.format(UserCoreErrorConstants.ErrorMessages.ERROR_CODE_ERROR_WHILE_GETTING_ROLES_COUNT .getMessage(), ex.getMessage()), null, null); throw ex; } return usersCount; }</code><technical_language>for this constant well</technical_language>

Target:
public long doCountRoles(String filter) throws UserStoreException { long usersCount = 0; String sqlStmt; if (filter.startsWith(UserCoreConstants.INTERNAL_DOMAIN)) { sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.COUNT_INTERNAL_ROLES); String names[] = filter.split(UserCoreConstants.DOMAIN_SEPARATOR); filter = names[1].trim(); } else if (filter.startsWith(UserCoreConstants.APPLICATION_DOMAIN)) { sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.COUNT_APPLICATION_ROLES); } else { sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.COUNT_ROLES); } if (StringUtils.isNotEmpty(filter)) { filter = filter.trim(); filter = filter.replace("*", "%"); filter = filter.replace("?", "_"); } else { filter = "%"; } try (Connection dbConnection = getDBConnection(); PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)) { prepStmt.setString(1, filter); if (sqlStmt.toUpperCase().contains(UserCoreConstants.SQL_ESCAPE_KEYWORD)) { prepStmt.setString(2, SQL_FILTER_CHAR_ESCAPE); if (sqlStmt.contains(UserCoreConstants.UM_TENANT_COLUMN)) { prepStmt.setInt(3, tenantId); } } else { if (sqlStmt.contains(UserCoreConstants.UM_TENANT_COLUMN)) { prepStmt.setInt(2, tenantId); } } ResultSet resultSets = prepStmt.executeQuery(); while (resultSets.next()) { return resultSets.getLong(1); } } catch (SQLException e) { if (log.isDebugEnabled()) { log.debug(ERROR_CODE_ERROR_WHILE_EXECUTING_THE_SQL.getMessage(), e); } throw new UserStoreException(ERROR_CODE_ERROR_WHILE_EXECUTING_THE_SQL.getMessage(), ERROR_CODE_ERROR_WHILE_EXECUTING_THE_SQL.getCode(), e); } catch (UserStoreException ex) { handleGetUserCountFailure(UserCoreErrorConstants.ErrorMessages.ERROR_CODE_ERROR_WHILE_GETTING_ROLES_COUNT .getCode(), String.format(UserCoreErrorConstants.ErrorMessages.ERROR_CODE_ERROR_WHILE_GETTING_ROLES_COUNT .getMessage(), ex.getMessage()), null, null); throw ex; } return usersCount; }