VoPriceServiceImpl implements VoPriceService { @Override public VoSearchResult<VoPriceList> getFilteredPrices(final VoSearchContext filter) throws Exception { final VoSearchResult<VoPriceList> result = new VoSearchResult<>(); final List<VoPriceList> results = new ArrayList<>(); result.setSearchContext(filter); result.setItems(results); final String shopCode = FilterSearchUtils.getStringFilter(filter.getParameters().get("shopCode")); final String currency = FilterSearchUtils.getStringFilter(filter.getParameters().get("currency")); if (federationFacade.isManageable(shopCode, ShopDTO.class) && StringUtils.isNotBlank(currency)) { final SearchContext searchContext = new SearchContext( filter.getParameters(), filter.getStart(), filter.getSize(), filter.getSortBy(), filter.isSortDesc(), "filter", "shopCode", "currency" ); final SearchResult<PriceListDTO> batch = dtoPriceListsService.findPrices(searchContext); if (!batch.getItems().isEmpty()) { results.addAll(voAssemblySupport.assembleVos(VoPriceList.class, PriceListDTO.class, batch.getItems())); } result.setTotal(batch.getTotal()); } return result; } VoPriceServiceImpl(final DtoPriceListsService dtoPriceListsService,
                              final FederationFacade federationFacade,
                              final VoAssemblySupport voAssemblySupport); @Override VoSearchResult<VoPriceList> getFilteredPrices(final VoSearchContext filter); @Override VoPriceList getPriceById(final long id); @Override VoPriceList updatePrice(final VoPriceList vo); @Override VoPriceList createPrice(final VoPriceList vo); @Override void removePrice(final long id);  }
@Test public void testGetPrices() throws Exception { VoSearchContext ctxNone = new VoSearchContext(); ctxNone.setParameters(createSearchContextParams( "filter", "XXXX", "shopCode", "SHOIP1", "currency", "EUR" )); ctxNone.setSize(10); final List<VoPriceList> pl = voPriceService.getFilteredPrices(ctxNone).getItems(); assertNotNull(pl); assertTrue(pl.isEmpty()); VoSearchContext ctxFind = new VoSearchContext(); ctxFind.setParameters(createSearchContextParams( "filter", "CC_TEST1", "shopCode", "SHOIP1", "currency", "EUR" )); ctxFind.setSize(10); final List<VoPriceList> pl2 = voPriceService.getFilteredPrices(ctxFind).getItems(); assertNotNull(pl2); assertFalse(pl2.isEmpty()); assertEquals("CC_TEST1", pl2.get(0).getSkuCode()); }