@Test public void findSites_NoResults() { List<Site> sites = portal.findSites(new SiteQuery.Builder().withAllSiteTypes().build()); assertNotNull(sites); assertEquals(0, sites.size()); }
@Override public List<Site> findSites(SiteQuery query) { Parameters.requireNonNull(query, "query"); Pagination pagination = query.getPagination(); if (pagination != null && query.getSiteTypes().size() > 1) { pagination = null; log.warn("Pagination is not supported internally for SiteQuery's with multiple site types. Therefore this query has the possibility to perform poorly."); } boolean includeAll = query.isIncludeEmptySites(); List<Site> sites = new ArrayList<Site>(); for (SiteType type : query.getSiteTypes()) { List<Site> sitesFound; switch (type) { case SITE: sitesFound = findSites(pagination, SITES, Comparators.site(query.getSorting()), includeAll); break; case SPACE: sitesFound = findSites(pagination, SPACES, Comparators.site(query.getSorting()), includeAll); break; case DASHBOARD: sitesFound = findSites(pagination, DASHBOARDS, Comparators.site(query.getSorting()), includeAll); break; default: throw new AssertionError(); } sites.addAll(sitesFound); if (pagination != null && sites.size() >= pagination.getLimit()) { break; } } filter(sites, query.getFilter()); if (query.getSiteTypes().size() > 1) { sites = paginate(sites, query.getPagination()); } return sites; }
PortalImpl implements Portal { @Override public List<Site> findSites(SiteQuery query) { Parameters.requireNonNull(query, "query"); Pagination pagination = query.getPagination(); if (pagination != null && query.getSiteTypes().size() > 1) { pagination = null; log.warn("Pagination is not supported internally for SiteQuery's with multiple site types. Therefore this query has the possibility to perform poorly."); } boolean includeAll = query.isIncludeEmptySites(); List<Site> sites = new ArrayList<Site>(); for (SiteType type : query.getSiteTypes()) { List<Site> sitesFound; switch (type) { case SITE: sitesFound = findSites(pagination, SITES, Comparators.site(query.getSorting()), includeAll); break; case SPACE: sitesFound = findSites(pagination, SPACES, Comparators.site(query.getSorting()), includeAll); break; case DASHBOARD: sitesFound = findSites(pagination, DASHBOARDS, Comparators.site(query.getSorting()), includeAll); break; default: throw new AssertionError(); } sites.addAll(sitesFound); if (pagination != null && sites.size() >= pagination.getLimit()) { break; } } filter(sites, query.getFilter()); if (query.getSiteTypes().size() > 1) { sites = paginate(sites, query.getPagination()); } return sites; } }
PortalImpl implements Portal { @Override public List<Site> findSites(SiteQuery query) { Parameters.requireNonNull(query, "query"); Pagination pagination = query.getPagination(); if (pagination != null && query.getSiteTypes().size() > 1) { pagination = null; log.warn("Pagination is not supported internally for SiteQuery's with multiple site types. Therefore this query has the possibility to perform poorly."); } boolean includeAll = query.isIncludeEmptySites(); List<Site> sites = new ArrayList<Site>(); for (SiteType type : query.getSiteTypes()) { List<Site> sitesFound; switch (type) { case SITE: sitesFound = findSites(pagination, SITES, Comparators.site(query.getSorting()), includeAll); break; case SPACE: sitesFound = findSites(pagination, SPACES, Comparators.site(query.getSorting()), includeAll); break; case DASHBOARD: sitesFound = findSites(pagination, DASHBOARDS, Comparators.site(query.getSorting()), includeAll); break; default: throw new AssertionError(); } sites.addAll(sitesFound); if (pagination != null && sites.size() >= pagination.getLimit()) { break; } } filter(sites, query.getFilter()); if (query.getSiteTypes().size() > 1) { sites = paginate(sites, query.getPagination()); } return sites; } PortalImpl(DataStorage dataStorage, PageService pageService, NavigationService navigationService,
                      DescriptionService descriptionService, ResourceBundleManager bundleManager, Authenticator authenticator,
                      IdentityRegistry identityRegistry, UserACL acl, UserPortalConfigService userPortalConfigService,
                      OAuthProviderAccessor oauthProviderAccessor); }
PortalImpl implements Portal { @Override public List<Site> findSites(SiteQuery query) { Parameters.requireNonNull(query, "query"); Pagination pagination = query.getPagination(); if (pagination != null && query.getSiteTypes().size() > 1) { pagination = null; log.warn("Pagination is not supported internally for SiteQuery's with multiple site types. Therefore this query has the possibility to perform poorly."); } boolean includeAll = query.isIncludeEmptySites(); List<Site> sites = new ArrayList<Site>(); for (SiteType type : query.getSiteTypes()) { List<Site> sitesFound; switch (type) { case SITE: sitesFound = findSites(pagination, SITES, Comparators.site(query.getSorting()), includeAll); break; case SPACE: sitesFound = findSites(pagination, SPACES, Comparators.site(query.getSorting()), includeAll); break; case DASHBOARD: sitesFound = findSites(pagination, DASHBOARDS, Comparators.site(query.getSorting()), includeAll); break; default: throw new AssertionError(); } sites.addAll(sitesFound); if (pagination != null && sites.size() >= pagination.getLimit()) { break; } } filter(sites, query.getFilter()); if (query.getSiteTypes().size() > 1) { sites = paginate(sites, query.getPagination()); } return sites; } PortalImpl(DataStorage dataStorage, PageService pageService, NavigationService navigationService,
                      DescriptionService descriptionService, ResourceBundleManager bundleManager, Authenticator authenticator,
                      IdentityRegistry identityRegistry, UserACL acl, UserPortalConfigService userPortalConfigService,
                      OAuthProviderAccessor oauthProviderAccessor); @Override Site getSite(SiteId siteId); @Override Site createSite(SiteId siteId); @Override Site createSite(SiteId siteId, String templateName); @Override List<Site> findSites(SiteQuery query); @Override void saveSite(Site site); @Override boolean removeSite(SiteId siteId); @Override Navigation getNavigation(SiteId siteId); @Override PageBuilder newPageBuilder(); @Override ApplicationRegistry getApplicationRegistry(); @Override Page getPage(PageId pageId); List<ContainerItem> getPageRootContainer(PageContext pageContext); @Override Page createPage(PageId pageId); @Override List<Page> findPages(PageQuery query); @Override void savePage(Page page); @Override boolean removePage(PageId pageId); @Override boolean hasPermission(User user, Permission permission); @Override OAuthProvider getOAuthProvider(String oauthProviderKey); }
PortalImpl implements Portal { @Override public List<Site> findSites(SiteQuery query) { Parameters.requireNonNull(query, "query"); Pagination pagination = query.getPagination(); if (pagination != null && query.getSiteTypes().size() > 1) { pagination = null; log.warn("Pagination is not supported internally for SiteQuery's with multiple site types. Therefore this query has the possibility to perform poorly."); } boolean includeAll = query.isIncludeEmptySites(); List<Site> sites = new ArrayList<Site>(); for (SiteType type : query.getSiteTypes()) { List<Site> sitesFound; switch (type) { case SITE: sitesFound = findSites(pagination, SITES, Comparators.site(query.getSorting()), includeAll); break; case SPACE: sitesFound = findSites(pagination, SPACES, Comparators.site(query.getSorting()), includeAll); break; case DASHBOARD: sitesFound = findSites(pagination, DASHBOARDS, Comparators.site(query.getSorting()), includeAll); break; default: throw new AssertionError(); } sites.addAll(sitesFound); if (pagination != null && sites.size() >= pagination.getLimit()) { break; } } filter(sites, query.getFilter()); if (query.getSiteTypes().size() > 1) { sites = paginate(sites, query.getPagination()); } return sites; } PortalImpl(DataStorage dataStorage, PageService pageService, NavigationService navigationService,
                      DescriptionService descriptionService, ResourceBundleManager bundleManager, Authenticator authenticator,
                      IdentityRegistry identityRegistry, UserACL acl, UserPortalConfigService userPortalConfigService,
                      OAuthProviderAccessor oauthProviderAccessor); @Override Site getSite(SiteId siteId); @Override Site createSite(SiteId siteId); @Override Site createSite(SiteId siteId, String templateName); @Override List<Site> findSites(SiteQuery query); @Override void saveSite(Site site); @Override boolean removeSite(SiteId siteId); @Override Navigation getNavigation(SiteId siteId); @Override PageBuilder newPageBuilder(); @Override ApplicationRegistry getApplicationRegistry(); @Override Page getPage(PageId pageId); List<ContainerItem> getPageRootContainer(PageContext pageContext); @Override Page createPage(PageId pageId); @Override List<Page> findPages(PageQuery query); @Override void savePage(Page page); @Override boolean removePage(PageId pageId); @Override boolean hasPermission(User user, Permission permission); @Override OAuthProvider getOAuthProvider(String oauthProviderKey);  }