Esempio n. 1
0
 /** {@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();
 }
Esempio n. 2
0
 @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();
 }