Package com.gtp.domain

Examples of com.gtp.domain.User


public class UserServiceImp implements UserService {
  UserDao userDao;
  public User addUser(User u) throws ExistedException {
    if(u==null)
      throw new NullPointerException("user should not be null");
    User user=userDao.findByEmailName(u.getEmail());
    if(user!=null)
      throw new ExistedException();
    return userDao.addUser(u);
  }
View Full Code Here


  @Override
  public User removeUser(User user) throws NotFoundException {
    if(user==null)
      throw new NullPointerException("user should not be null");
    User ua=userDao.findByEmailName(user.getEmail());
    if(ua==null)
      throw new NotFoundException();
    return userDao.removeUser(user);
  }
View Full Code Here

  @Override
  public User updateUser(User user) throws NotFoundException, ExistedException {
    if(user==null)
      throw new NullPointerException("user should not be null");
    User us=userDao.findByEmailName(user.getEmail());
    if( us!=null && user.getId()!=us.getId())
      throw new ExistedException();
    return   userDao.updateUser(user);
  }
View Full Code Here

    this.userDao=userDao;
  }

  @Override
  public User findUser(String email) throws NotFoundException {
    User user=userDao.findByEmailName(email);
    if(user==null)
      throw new NotFoundException();
    return user;
  }
View Full Code Here

    return (User)getJpaTemplate().execute(new JpaCallback<User>() {
      public User doInJpa(EntityManager em) {
        CriteriaBuilder criteriaBuilder =em.getCriteriaBuilder();
        CriteriaQuery<User> query= criteriaBuilder.createQuery(User.class);
        Root<User> auth = query.from(User.class);
        User user=null;
        query.select(auth).where(criteriaBuilder.equal(auth.get("email"),name));
        List<User> result = em.createQuery(query).getResultList();
        if(result.isEmpty())
          return null;
        user=(User) result.get(0);
View Full Code Here

  private DualListModel<Authority> dualListModel = new DualListModel<Authority>(
      new ArrayList<Authority>(), new ArrayList<Authority>());

  public String addUser() {

    user = new User(name, surname, password, email, secretQuestion,
        secretAnswer, UmsUtil.toSetFromAuthorities(selectedAuthorities));
    try {
      userService.addUser(user);
    } catch (ExistedException e) {
      FacesContext.getCurrentInstance().addMessage(
View Full Code Here

public class ReminderController {
  String email,secretQuestion,secretAnswer;
  ReminderService reminderService;
  public String remind(){
    User user=new User();
    user.setEmail(email);
    user.setSecretQuestion(secretQuestion);
    user.setSecretAnswer(secretAnswer);
    try {
      try {
        reminderService.remindPassword(user);
      } catch (MessagingException e) {
        FacesContext.getCurrentInstance().addMessage(null,
View Full Code Here

  private UserDao userDao;

  public UserDetails loadUserByUsername(String eposta)
      throws UsernameNotFoundException, DataAccessException {
    User user = userDao.findByEmailName(eposta);

    if (user != null) {
      String password = user.getPassword();
      ArrayList<GrantedAuthority> ga = new ArrayList<GrantedAuthority>();
      Set<Authority> userAuthorities = user.getAuthorities();
      for (Authority authority : userAuthorities) {
        ga.add(new GrantedAuthorityImpl(authority.getName()));
      }
      GrantedAuthority[] grantedAuthorities = new GrantedAuthority[ga
          .size()];
View Full Code Here

TOP

Related Classes of com.gtp.domain.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.