@Test public void testGetUserByName() { try { UsersDTO result = userResourceFacadeImp.getUserByName(user .getName()); assertEquals(user.getUserID(), result.getUserID()); } catch (PropertyNotSetException ex) { logger.error("PropertyNotSetException while fetching user by name "+ex.getMessage()); fail("testGetUserByName failed"); } }
@Override public UsersDTO getUserByName(String name) throws PropertyNotSetException { List<Users> usersList = (List<Users>) getAllByCriteria(Restrictions.eq("userName", name)); if(usersList != null && !usersList.isEmpty()){ return new UsersDTO(usersList.get(0)); } return null; }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public UsersDTO getUserByName(String name) throws PropertyNotSetException { List<Users> usersList = (List<Users>) getAllByCriteria(Restrictions.eq("userName", name)); if(usersList != null && !usersList.isEmpty()){ return new UsersDTO(usersList.get(0)); } return null; } }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public UsersDTO getUserByName(String name) throws PropertyNotSetException { List<Users> usersList = (List<Users>) getAllByCriteria(Restrictions.eq("userName", name)); if(usersList != null && !usersList.isEmpty()){ return new UsersDTO(usersList.get(0)); } return null; } protected  UsersResourceFacadeImp(); }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public UsersDTO getUserByName(String name) throws PropertyNotSetException { List<Users> usersList = (List<Users>) getAllByCriteria(Restrictions.eq("userName", name)); if(usersList != null && !usersList.isEmpty()){ return new UsersDTO(usersList.get(0)); } return null; } protected  UsersResourceFacadeImp(); @Override UsersDTO getUserByName(String name); @Override UsersDTO getUserById(Long id); @Override List<UsersDTO> getAllUsersByName(String name); @Override List<CollectionDTO> findAllCrisisByUserID(Long id); @Override UsersDTO addUser(UsersDTO user); @Override Integer deleteUser(Long id); @Override List<UsersDTO> findByCriteria(String columnName, Object value); @Override List<UsersDTO> getAllUsers(); }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public UsersDTO getUserByName(String name) throws PropertyNotSetException { List<Users> usersList = (List<Users>) getAllByCriteria(Restrictions.eq("userName", name)); if(usersList != null && !usersList.isEmpty()){ return new UsersDTO(usersList.get(0)); } return null; } protected  UsersResourceFacadeImp(); @Override UsersDTO getUserByName(String name); @Override UsersDTO getUserById(Long id); @Override List<UsersDTO> getAllUsersByName(String name); @Override List<CollectionDTO> findAllCrisisByUserID(Long id); @Override UsersDTO addUser(UsersDTO user); @Override Integer deleteUser(Long id); @Override List<UsersDTO> findByCriteria(String columnName, Object value); @Override List<UsersDTO> getAllUsers();  }