@Override
 protected User getSearchExample(String query) {
   User example = new User();
   example.setFirstName("%" + query + "%");
   example.setUsername("%" + query + "%");
   return example;
 }
Exemplo n.º 2
0
  public void createDemoAccount(String name, Set<Role> roles) {
    log.debug("Creating demo account for user " + name);
    User u = new User();
    u.setFirstName(name);
    u.setLastName("name");
    u.setPassword(name);
    u.setUsername(name);
    u.setEmail(name + "@zkbase.org");
    u.setAccountExpired(false);
    u.setAccountLocked(false);
    u.setCredentialsExpired(false);
    u.setEnabled(true);

    u.setRoles(roles);

    userService.persist(u);
  }