VoManagementServiceImpl implements VoManagementService { @Override public VoSearchResult<VoManagerInfo> getFilteredManagers(final VoSearchContext filter) throws Exception { final VoSearchResult<VoManagerInfo> result = new VoSearchResult<>(); final List<VoManagerInfo> results = new ArrayList<>(); result.setSearchContext(filter); result.setItems(results); final Map<String, List> params = new HashMap<>(); if (filter.getParameters() != null) { params.putAll(filter.getParameters()); } final Map<String, List> all = filter.getParameters() != null ? new HashMap<>(filter.getParameters()) : new HashMap<>(); if (!federationFacade.isCurrentUserSystemAdmin()) { final Set<Long> shopIds = federationFacade.getAccessibleShopIdsByCurrentManager(); if (CollectionUtils.isEmpty(shopIds)) { return result; } all.put("shopIds", new ArrayList(shopIds)); } final SearchContext searchContext = new SearchContext( params, filter.getStart(), filter.getSize(), filter.getSortBy(), filter.isSortDesc(), "filter", "shopIds" ); final SearchResult<ManagerDTO> batch = managementService.findManagers(searchContext); results.addAll(voAssemblySupport.assembleVos(VoManagerInfo.class, ManagerDTO.class, batch.getItems())); result.setTotal(batch.getTotal()); return result; } VoManagementServiceImpl(final ManagementService managementService,
                                   final DtoShopService shopService,
                                   final DtoCategoryService dtoCategoryService,
                                   final FederationFacade federationFacade,
                                   final VoAssemblySupport voAssemblySupport); @Override VoManager getMyself(); @Override VoLicenseAgreement getMyAgreement(); @Override VoLicenseAgreement acceptMyAgreement(); @Override VoSearchResult<VoManagerInfo> getFilteredManagers(final VoSearchContext filter); @Override VoManager getManagerById(final long id); @Override VoManager createManager(VoManager voManager); @Override VoManager updateManager(VoManager voManager); @Override void deleteManager(long id); @Override void updateDashboard(final long id, final String dashboardWidgets); @Override void resetPassword(long id); @Override void updateDisabledFlag(long id, boolean disabled); void setLicenseTextResource(final Resource licenseTextResource);  }
@Test public void testGetManagers() throws Exception { VoSearchContext ctxNoFilter = new VoSearchContext(); ctxNoFilter.setSize(10); List<VoManagerInfo> managers = voManagementService.getFilteredManagers(ctxNoFilter).getItems(); assertNotNull(managers); assertFalse(managers.isEmpty()); VoSearchContext ctxFind = new VoSearchContext(); ctxFind.setParameters(createSearchContextParams("filter", "test@test.com")); ctxFind.setSize(10); managers = voManagementService.getFilteredManagers(ctxFind).getItems(); assertNotNull(managers); assertFalse(managers.isEmpty()); assertEquals("test@test.com", managers.get(0).getEmail()); }