Exemplo n.º 1
0
 /** {@inheritDoc} */
 @Override
 public boolean delete(String id) {
   boolean deleted = false;
   IUser user = userRepository.findById(id);
   if (user != null) {
     IContact contact = user.getContact();
     if (contact != null && contact.getId() != null) {
       contactService.delete(contact.getId());
     }
     userRepository.delete(user);
     deleted = true;
   }
   return deleted;
 }
Exemplo n.º 2
0
 /** {@inheritDoc} */
 @Override
 public IUser getByNameAndPassword(String name, String password) {
   IUser user = null;
   if (StringUtils.isNotEmpty(name) && StringUtils.isNotEmpty(password)) {
     user = userRepository.findByNameAndPassword(name, password);
   }
   return user;
 }
Exemplo n.º 3
0
 @Override
 public IUser login(String name, String password) {
   IUser user = userRepository.findByNameAndPassword(name, password);
   if (user != null) {
     if (user.getContact() != null && user.getContact().getId() != null) {
       user.getContact().setOnline(true);
       IConnection connection = connectionService.createConnection();
       user.getContact().setConnection(connection);
       contactService.update(user.getContact());
     }
   } else {
     user = createInstance();
     user.getContact().setOnline(false);
   }
   return user;
 }