示例#1
0
文件: UserDAOImpl.java 项目: kvdy/lib
 @SuppressWarnings("unchecked")
 public UserCollectionVO getAllUsers() throws Exception {
   logger.debug("inside getAllUsers: in UserDAOImpl");
   UserCollectionVO allUsers = new UserCollectionVO();
   List<UserVO> usersList = null;
   usersList = getHibernateTemplate().find("from UserVO u  order by lastUpdatedDate desc");
   if (usersList != null) {
     allUsers.addAll(usersList);
   }
   return allUsers;
 }
示例#2
0
文件: UserDAOImpl.java 项目: kvdy/lib
 @SuppressWarnings("unchecked")
 public UserCollectionVO getUsersByPartialUserName(String partialUserName) throws Exception {
   logger.debug("inside getUsersByPartialUserName: in UserDAOImpl");
   UserCollectionVO users = new UserCollectionVO();
   List<UserVO> usersList =
       getHibernateTemplate()
           .find("from UserVO u where u.userName like '%" + partialUserName + "%'");
   if (usersList != null) {
     users.addAll(usersList);
   }
   return users;
 }
示例#3
0
文件: UserDAOImpl.java 项目: kvdy/lib
 @SuppressWarnings("unchecked")
 public UserCollectionVO getUsersByUserType(UserType type) throws Exception {
   logger.debug("inside getUsersByType: in UserDAOImpl");
   UserCollectionVO users = new UserCollectionVO();
   List<UserVO> usersList = null;
   usersList =
       getHibernateTemplate()
           .find(
               "from UserVO u where u.userType ="
                   + Integer.parseInt(type.ordinal() + "")
                   + " order by lastUpdatedDate");
   if (usersList != null) {
     users.addAll(usersList);
   }
   return users;
 }
示例#4
0
文件: UserDAOImpl.java 项目: kvdy/lib
 @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;
 }