Esempio n. 1
0
 public void updateUser(UserVO user) throws InvalidInputDataException, Exception {
   logger.debug("inside updateUser: in UserDAOImpl");
   logger.debug("Updating user with id = " + user.getId() + " userName="******"Updated user user = " + user.getAttributesAsString());
 }
Esempio n. 2
0
 @SuppressWarnings("unchecked")
 public UserCollectionVO searchUsers(UserVO user) throws Exception {
   logger.debug("inside searchUsers: in UserDAOImpl");
   UserCollectionVO searchedUsers = new UserCollectionVO();
   List<UserVO> userList = null;
   Session session = null;
   try {
     session = getSession();
     Criteria criteria = session.createCriteria(UserVO.class, "user");
     if (StringUtils.isNotEmpty(user.getUserName())) {
       logger.debug("userName search");
       criteria.add(Restrictions.eq("userName", user.getUserName()));
     }
     if (StringUtils.isNotEmpty(user.getLastName())) {
       logger.debug("Last Name search");
       criteria.add(Restrictions.eq("lastName", user.getLastName()));
     }
     if (StringUtils.isNotEmpty(user.getFirstName())) {
       logger.debug("First Name search");
       criteria.add(Restrictions.eq("firstName", user.getFirstName()));
     }
     if (user.getUserType() != null) {
       logger.debug("User Type search");
       criteria.add(Restrictions.eq("userType", user.getUserType()));
     }
     if (user.getUserStatus() != null) {
       logger.debug("User Status search");
       criteria.add(Restrictions.eq("userStatus", user.getUserStatus()));
     }
     criteria.addOrder(Order.desc("lastUpdatedDate"));
     userList = criteria.list();
   } catch (Exception e) {
     logger.error(e.getMessage());
     // System.out.println(e.getMessage());
   } finally {
     session.flush();
     session.close();
   }
   if (userList != null) {
     logger.debug("userList.size()=" + userList.size());
     searchedUsers.addAll(userList);
   }
   return searchedUsers;
 }