/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public List<String> getUsernames(String pattern, int count) { pattern = SqlLikeEscaper.escapeControlCharacters(pattern); return session() .getNamedQuery("getEnabledUsersNames") .setParameter("pattern", "%" + pattern.toLowerCase() + "%") .setMaxResults(count) .list(); }
@SuppressWarnings("unchecked") @Override public List<JCUser> findByUsernameOrEmail(String pattern, int count) { pattern = SqlLikeEscaper.escapeControlCharacters(pattern); return session() .getNamedQuery("searchByEmailOrUsername") .setParameter("pattern", "%" + pattern.toLowerCase() + "%") .setParameter("primaryPattern", pattern.toLowerCase() + "%") .setParameter("secondaryPattern", "%" + pattern.toLowerCase() + "%") .setParameter("thirdaryPattern", "%" + pattern.toLowerCase()) .setMaxResults(count) .list(); }