예제 #1
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);
  }
예제 #2
0
  public void onClick$save(Event e) {
    log.info("onClick: save");

    if (this.selectedObject == null) this.selectedObject = new User();

    this.selectedObject.setFirstName(firstName.getValue());
    this.selectedObject.setLastName(lastName.getValue());
    this.selectedObject.setPassword(password.getValue());
    this.selectedObject.setUsername(username.getValue());
    this.selectedObject.setEmail(email.getValue());

    // u.setRoles(roles);

    try {
      userService.merge(this.selectedObject);
    } catch (EntityNotFoundException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
    userDetailsWin.onClose();
    e.stopPropagation();
  }
예제 #3
0
 public void onChange$username(Event e) {
   log.info("onChange: username");
   User user = userService.findByUserName(username.getValue());
   if (user != null) throw new WrongValueException(username, "username already exists");
 }