/** * Return a tablet based on the given product number * * @param productNumber the productNumber * @return Tablet instance based on the given productNumber * @throws EntityNotFoundException if the tablet is not found with given product number */ public ServiceResult<Tablet> getTablet(String productNumber) throws EntityNotFoundException { Tablet tablet = tabletDAO.findById(productNumber); if (tablet == null) { throw new EntityNotFoundException("Tablet not found with the given product number"); } return new ServiceResult<Tablet>(tablet); }
/** * Search the tablets based on the search criteria * * @param criteria the search criteria * @return Generic ServiceResult with embedded search results and search result cursor */ public ServiceResult<Tablet> getTablets(SearchCriteria criteria) { // set default limit if (criteria.getLimit() == null) { criteria.setLimit(apiConfiguration.getDefaultLimit()); } return tabletDAO.search(criteria); }