@Test public void testGetAnnotationPage() { String query = "comment"; String motivation = null; String date = null; String user = null; String queryString = "http: String page = null; when(template.getClient()).thenReturn(client); long totalHits = 10; searchQueryUtils.setUpBuilder(totalHits, client); Parameters params = new Parameters(query, motivation, date, user); ServiceResponse<Map<String, Object>> response = impl.getAnnotationPage(params, queryString, page, null, null); assertNotEquals(ServiceResponse.Status.NOT_FOUND,response.getStatus()); }
@Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) @Cacheable(value="oaAnnotationSearchPagingCache", key="#queryString" ) public ServiceResponse<Map<String, Object>> getAnnotationPage(Parameters parameters, String queryString, String page, String within, String type) { String[] annoSearchArray = this.getAnnotationsPage(parameters, queryString, false, page, within, type); if(annoSearchArray.length == 0){ Map <String, Object> emptyMap = annotationUtils.returnEmptyResultSet(queryString,false, new PageParameters(),false); return new ServiceResponse<>(Status.OK,emptyMap); } PageParameters pagingParameters = this.getPageParameters(); List<W3CAnnotation> annotationList = annotationUtils.getW3CAnnotations(annoSearchArray); Map<String, Object> annoMap = annotationUtils.createAnnotationPage(queryString, annotationList, false, pagingParameters, (int)this.getTotalHits(), false); if(null != annoMap && !annoMap.isEmpty()){ return new ServiceResponse<>(Status.OK, annoMap); }else{ Map <String, Object> emptyMap = annotationUtils.returnEmptyResultSet(queryString,false, new PageParameters(),false); return new ServiceResponse<>(Status.OK,emptyMap); } }
OAAnnotationSearchServiceImpl extends AnnotationSearchServiceImpl implements OAAnnotationSearchService { @Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) @Cacheable(value="oaAnnotationSearchPagingCache", key="#queryString" ) public ServiceResponse<Map<String, Object>> getAnnotationPage(Parameters parameters, String queryString, String page, String within, String type) { String[] annoSearchArray = this.getAnnotationsPage(parameters, queryString, false, page, within, type); if(annoSearchArray.length == 0){ Map <String, Object> emptyMap = annotationUtils.returnEmptyResultSet(queryString,false, new PageParameters(),false); return new ServiceResponse<>(Status.OK,emptyMap); } PageParameters pagingParameters = this.getPageParameters(); List<W3CAnnotation> annotationList = annotationUtils.getW3CAnnotations(annoSearchArray); Map<String, Object> annoMap = annotationUtils.createAnnotationPage(queryString, annotationList, false, pagingParameters, (int)this.getTotalHits(), false); if(null != annoMap && !annoMap.isEmpty()){ return new ServiceResponse<>(Status.OK, annoMap); }else{ Map <String, Object> emptyMap = annotationUtils.returnEmptyResultSet(queryString,false, new PageParameters(),false); return new ServiceResponse<>(Status.OK,emptyMap); } } }
OAAnnotationSearchServiceImpl extends AnnotationSearchServiceImpl implements OAAnnotationSearchService { @Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) @Cacheable(value="oaAnnotationSearchPagingCache", key="#queryString" ) public ServiceResponse<Map<String, Object>> getAnnotationPage(Parameters parameters, String queryString, String page, String within, String type) { String[] annoSearchArray = this.getAnnotationsPage(parameters, queryString, false, page, within, type); if(annoSearchArray.length == 0){ Map <String, Object> emptyMap = annotationUtils.returnEmptyResultSet(queryString,false, new PageParameters(),false); return new ServiceResponse<>(Status.OK,emptyMap); } PageParameters pagingParameters = this.getPageParameters(); List<W3CAnnotation> annotationList = annotationUtils.getW3CAnnotations(annoSearchArray); Map<String, Object> annoMap = annotationUtils.createAnnotationPage(queryString, annotationList, false, pagingParameters, (int)this.getTotalHits(), false); if(null != annoMap && !annoMap.isEmpty()){ return new ServiceResponse<>(Status.OK, annoMap); }else{ Map <String, Object> emptyMap = annotationUtils.returnEmptyResultSet(queryString,false, new PageParameters(),false); return new ServiceResponse<>(Status.OK,emptyMap); } } @Autowired  OAAnnotationSearchServiceImpl(AnnotationUtils annotationUtils,ElasticsearchTemplate template,  TextSearchService textSearchService, CacheManager cacheManager); }
OAAnnotationSearchServiceImpl extends AnnotationSearchServiceImpl implements OAAnnotationSearchService { @Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) @Cacheable(value="oaAnnotationSearchPagingCache", key="#queryString" ) public ServiceResponse<Map<String, Object>> getAnnotationPage(Parameters parameters, String queryString, String page, String within, String type) { String[] annoSearchArray = this.getAnnotationsPage(parameters, queryString, false, page, within, type); if(annoSearchArray.length == 0){ Map <String, Object> emptyMap = annotationUtils.returnEmptyResultSet(queryString,false, new PageParameters(),false); return new ServiceResponse<>(Status.OK,emptyMap); } PageParameters pagingParameters = this.getPageParameters(); List<W3CAnnotation> annotationList = annotationUtils.getW3CAnnotations(annoSearchArray); Map<String, Object> annoMap = annotationUtils.createAnnotationPage(queryString, annotationList, false, pagingParameters, (int)this.getTotalHits(), false); if(null != annoMap && !annoMap.isEmpty()){ return new ServiceResponse<>(Status.OK, annoMap); }else{ Map <String, Object> emptyMap = annotationUtils.returnEmptyResultSet(queryString,false, new PageParameters(),false); return new ServiceResponse<>(Status.OK,emptyMap); } } @Autowired  OAAnnotationSearchServiceImpl(AnnotationUtils annotationUtils,ElasticsearchTemplate template,  TextSearchService textSearchService, CacheManager cacheManager); @Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) @Cacheable(value="oaAnnotationSearchPagingCache", key="#queryString" ) ServiceResponse<Map<String, Object>> getAnnotationPage(Parameters parameters, String queryString, String page, String within, String type); }
OAAnnotationSearchServiceImpl extends AnnotationSearchServiceImpl implements OAAnnotationSearchService { @Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) @Cacheable(value="oaAnnotationSearchPagingCache", key="#queryString" ) public ServiceResponse<Map<String, Object>> getAnnotationPage(Parameters parameters, String queryString, String page, String within, String type) { String[] annoSearchArray = this.getAnnotationsPage(parameters, queryString, false, page, within, type); if(annoSearchArray.length == 0){ Map <String, Object> emptyMap = annotationUtils.returnEmptyResultSet(queryString,false, new PageParameters(),false); return new ServiceResponse<>(Status.OK,emptyMap); } PageParameters pagingParameters = this.getPageParameters(); List<W3CAnnotation> annotationList = annotationUtils.getW3CAnnotations(annoSearchArray); Map<String, Object> annoMap = annotationUtils.createAnnotationPage(queryString, annotationList, false, pagingParameters, (int)this.getTotalHits(), false); if(null != annoMap && !annoMap.isEmpty()){ return new ServiceResponse<>(Status.OK, annoMap); }else{ Map <String, Object> emptyMap = annotationUtils.returnEmptyResultSet(queryString,false, new PageParameters(),false); return new ServiceResponse<>(Status.OK,emptyMap); } } @Autowired  OAAnnotationSearchServiceImpl(AnnotationUtils annotationUtils,ElasticsearchTemplate template,  TextSearchService textSearchService, CacheManager cacheManager); @Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) @Cacheable(value="oaAnnotationSearchPagingCache", key="#queryString" ) ServiceResponse<Map<String, Object>> getAnnotationPage(Parameters parameters, String queryString, String page, String within, String type); static final String OA_ANNOTATION_SERVICE_NAME; }