@Test public void testFindByCriteria() { try { String columnName = "role"; String value = userRole; List<UsersDTO> result = userResourceFacadeImp.findByCriteria( columnName, value); assertNotNull(result); assertEquals(userRole, result.get(0).getRole()); } catch (PropertyNotSetException ex) { logger.error("PropertyNotSetException while fetching users by criteria "+ex.getMessage()); fail("testFindByCriteria failed"); } }
@Override public List<UsersDTO> findByCriteria(String columnName, Object value) throws PropertyNotSetException { List<Users> list = getAllByCriteria(Restrictions.eq(columnName,value)); List<UsersDTO> dtoList = new ArrayList<UsersDTO>(); if (list != null && !list.isEmpty()) { for (Users c: list) { dtoList.add(new UsersDTO(c)); } } return dtoList; }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public List<UsersDTO> findByCriteria(String columnName, Object value) throws PropertyNotSetException { List<Users> list = getAllByCriteria(Restrictions.eq(columnName,value)); List<UsersDTO> dtoList = new ArrayList<UsersDTO>(); if (list != null && !list.isEmpty()) { for (Users c: list) { dtoList.add(new UsersDTO(c)); } } return dtoList; } }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public List<UsersDTO> findByCriteria(String columnName, Object value) throws PropertyNotSetException { List<Users> list = getAllByCriteria(Restrictions.eq(columnName,value)); List<UsersDTO> dtoList = new ArrayList<UsersDTO>(); if (list != null && !list.isEmpty()) { for (Users c: list) { dtoList.add(new UsersDTO(c)); } } return dtoList; } protected  UsersResourceFacadeImp(); }
UsersResourceFacadeImp extends CoreDBServiceFacadeImp<Users, Long> implements UsersResourceFacade { @Override public List<UsersDTO> findByCriteria(String columnName, Object value) throws PropertyNotSetException { List<Users> list = getAllByCriteria(Restrictions.eq(columnName,value)); List<UsersDTO> dtoList = new ArrayList<UsersDTO>(); if (list != null && !list.isEmpty()) { for (Users c: list) { dtoList.add(new UsersDTO(c)); } } return dtoList; } 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 List<UsersDTO> findByCriteria(String columnName, Object value) throws PropertyNotSetException { List<Users> list = getAllByCriteria(Restrictions.eq(columnName,value)); List<UsersDTO> dtoList = new ArrayList<UsersDTO>(); if (list != null && !list.isEmpty()) { for (Users c: list) { dtoList.add(new UsersDTO(c)); } } return dtoList; } 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();  }