@Override
 protected User getSearchExample(String query) {
   User example = new User();
   example.setFirstName("%" + query + "%");
   example.setUsername("%" + query + "%");
   return example;
 }
Пример #2
0
 protected String getUserRolesString(User user) {
   Iterator<Role> iter = user.getRoles().iterator();
   String userRolesString = "";
   while (iter.hasNext()) {
     userRolesString += iter.next().getName();
     if (iter.hasNext()) userRolesString += ", ";
   }
   return userRolesString;
 }
 @Override
 public void render(Listitem listItem, Object data) throws Exception {
   User user = (User) data;
   new Listcell(user.getFirstName()).setParent(listItem);
   new Listcell(user.getLastName()).setParent(listItem);
 }
Пример #4
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);
  }