@Override public Pair<List<? extends GuestOS>, Integer> listGuestOSByCriteria(final ListGuestOsCmd cmd) { final Filter searchFilter = new Filter(GuestOSVO.class, "displayName", true, cmd.getStartIndex(), cmd.getPageSizeVal()); final Long id = cmd.getId(); final Long osCategoryId = cmd.getOsCategoryId(); final String description = cmd.getDescription(); final String keyword = cmd.getKeyword(); final SearchCriteria<GuestOSVO> sc = _guestOSDao.createSearchCriteria(); if (id != null) { sc.addAnd("id", SearchCriteria.Op.EQ, id); } if (osCategoryId != null) { sc.addAnd("categoryId", SearchCriteria.Op.EQ, osCategoryId); } if (description != null) { sc.addAnd("displayName", SearchCriteria.Op.LIKE, "%" + description + "%"); } if (keyword != null) { sc.addAnd("displayName", SearchCriteria.Op.LIKE, "%" + keyword + "%"); } final Pair<List<GuestOSVO>, Integer> result = _guestOSDao.searchAndCount(sc, searchFilter); return new Pair<List<? extends GuestOS>, Integer>(result.first(), result.second()); }