Source:
<code>public @ResponseBody SearchResponse getDecertifiedCertifiedProducts ( @RequestParam("searchTerm") String searchTerm, @RequestParam(value = "pageNumber", required = false) Integer pageNumber, @RequestParam(value = "pageSize", required = false) Integer pageSize, @RequestParam(value = "orderBy", required = false) String orderBy, @RequestParam(value = "sortDescending", required = false) Boolean sortDescending) throws EntityRetrievalException { SearchResponse fullResp = new SearchResponse(); SearchResponse decertifiedCPs = new SearchResponse(); List<CertifiedProductSearchResult> cpResultList = new ArrayList<CertifiedProductSearchResult>(); if (pageNumber == null){ pageNumber = 0; } SearchRequest searchRequest = new SearchRequest(); <START> <END> searchRequest.setSearchTerm(searchTerm); searchRequest.setPageNumber(pageNumber); if (orderBy != null){ searchRequest.setOrderBy(orderBy); } if (sortDescending != null){ searchRequest.setSortDescending(sortDescending); } fullResp = certifiedProductSearchManager.search(searchRequest); for(CertifiedProductSearchResult cp : fullResp.getResults()){ logger.debug("CP " + cp.getChplProductNumber() + " has certificationStatus keys = " + cp.getCertificationStatus().keySet() + " and cp values = " + cp.getCertificationStatus().values()); if(cp.getCertificationStatus().containsValue(String.valueOf(CertificationStatusType.SuspendedByOnc)) || cp.getCertificationStatus().containsValue(String.valueOf(CertificationStatusType.WithdrawnByAcb)) || cp.getCertificationStatus().containsValue(String.valueOf(CertificationStatusType.WithdrawnByDeveloper)) || cp.getCertificationStatus().containsValue(String.valueOf(CertificationStatusType.TerminatedByOnc))) { logger.debug("Adding Decertified CP " + cp.getChplProductNumber() + " with status " + cp.getCertificationStatus()); cpResultList.add(cp); } } decertifiedCPs.setResults(cpResultList); decertifiedCPs.setPageSize(decertifiedCPs.getResults().size()); return decertifiedCPs; }</code><technical_language>set certificationstatuses filter of searchRequest here? DB filter results put logic in java</technical_language>

Target:
public @ResponseBody SearchResponse getDecertifiedCertifiedProducts ( @RequestParam("searchTerm") String searchTerm, @RequestParam(value = "pageNumber", required = false) Integer pageNumber, @RequestParam(value = "pageSize", required = false) Integer pageSize, @RequestParam(value = "orderBy", required = false) String orderBy, @RequestParam(value = "sortDescending", required = false) Boolean sortDescending) throws EntityRetrievalException { SearchResponse resp = new SearchResponse(); if (pageNumber == null){ pageNumber = 0; } SearchRequest searchRequest = new SearchRequest(); List<String> allowedCertificationStatuses = new ArrayList<String>(); allowedCertificationStatuses.add(String.valueOf(CertificationStatusType.SuspendedByOnc)); allowedCertificationStatuses.add(String.valueOf(CertificationStatusType.WithdrawnByAcb)); allowedCertificationStatuses.add(String.valueOf(CertificationStatusType.WithdrawnByDeveloper)); allowedCertificationStatuses.add(String.valueOf(CertificationStatusType.TerminatedByOnc)); searchRequest.setCertificationStatuses(allowedCertificationStatuses); searchRequest.setSearchTerm(searchTerm); searchRequest.setPageNumber(pageNumber); if(pageSize == null){ searchRequest.setPageSize(certifiedProductSearchResultDao.countMultiFilterSearchResults(searchRequest).intValue()); } if (orderBy != null){ searchRequest.setOrderBy(orderBy); } if (sortDescending != null){ searchRequest.setSortDescending(sortDescending); } resp = certifiedProductSearchManager.search(searchRequest); return resp; }