Exemple #1
0
  @Override
  public User getUserById(String userId) {
    final User prototype = new User();
    prototype.setId(userId);

    return getUser(prototype);
  }
Exemple #2
0
  @Override
  public User getUserByLoginPwd(String login, char[] password) {
    final User prototype = new User();
    prototype.setLogin(login);
    prototype.setPassword(new String(password));

    return getUser(prototype);
  }
Exemple #3
0
  @Override
  public List<Mailbox> getMailboxes(User user) {
    final String userId = user.getId();
    final Predicate<Mailbox> predicate =
        new Predicate<Mailbox>() {
          static final long serialVersionUID = 1l;

          @Override
          public boolean match(Mailbox mailbox) {
            return mailbox.getOwner().getId().equals(userId);
          }
        };
    return new ArrayList<Mailbox>(this.objectContainer.query(predicate));
  }
Exemple #4
0
  @Override
  public void initAdmin() {
    final User prototype = new User();
    prototype.setAdministrator(true);
    final ObjectSet<User> result = this.objectContainer.queryByExample(prototype);

    if (result.isEmpty()) {
      prototype.setId("admin");
      prototype.setFirstName("admin");
      prototype.setLastName("admin");
      prototype.setLogin("admin");
      prototype.setPassword("admin");
      prototype.setAdministrator(true);

      createUser(prototype);
    }
  }