@Test public void testDomainsFiltered() throws Exception { List<DocumentModel> result = domainFinder.getDomainsFiltered(); assertEquals(0, result.size()); DocumentModel domain1 = session.createDocumentModel("/", "dom1", "Domain"); domain1 = session.createDocument(domain1); DocumentModel domain2 = session.createDocumentModel("/", "dom1", "Domain"); domain2 = session.createDocument(domain2); DocumentModel socialdomain1 = session.createDocumentModel("/", "social", "SocialDomain"); socialdomain1 = session.createDocument(socialdomain1); session.save(); result = domainFinder.getDomainsFiltered(); assertEquals(2, result.size()); trashService.trashDocument(domain2); domain2 = session.getDocument(domain2.getRef()); assertTrue(domain2.isTrashed()); session.saveDocument(domain2); session.save(); result = domainFinder.getDomainsFiltered(); assertEquals(1, result.size()); }
@SuppressWarnings("unchecked") protected List<DocumentModel> getDomainsFiltered() { PageProviderService pps = Framework.getService(PageProviderService.class); Map<String, Serializable> props = new HashMap<>(); props.put(CoreQueryDocumentPageProvider.CORE_SESSION_PROPERTY, (Serializable) session); PageProvider<DocumentModel> pageProvider = (PageProvider<DocumentModel>) pps.getPageProvider( PUBLISHING_DOMAINS_PROVIDER, null, null, null, props, new Object[] { session.getRootDocument().getId() }); return pageProvider.getCurrentPage(); }
DomainsFinder extends UnrestrictedSessionRunner { @SuppressWarnings("unchecked") protected List<DocumentModel> getDomainsFiltered() { PageProviderService pps = Framework.getService(PageProviderService.class); Map<String, Serializable> props = new HashMap<>(); props.put(CoreQueryDocumentPageProvider.CORE_SESSION_PROPERTY, (Serializable) session); PageProvider<DocumentModel> pageProvider = (PageProvider<DocumentModel>) pps.getPageProvider( PUBLISHING_DOMAINS_PROVIDER, null, null, null, props, new Object[] { session.getRootDocument().getId() }); return pageProvider.getCurrentPage(); } }
DomainsFinder extends UnrestrictedSessionRunner { @SuppressWarnings("unchecked") protected List<DocumentModel> getDomainsFiltered() { PageProviderService pps = Framework.getService(PageProviderService.class); Map<String, Serializable> props = new HashMap<>(); props.put(CoreQueryDocumentPageProvider.CORE_SESSION_PROPERTY, (Serializable) session); PageProvider<DocumentModel> pageProvider = (PageProvider<DocumentModel>) pps.getPageProvider( PUBLISHING_DOMAINS_PROVIDER, null, null, null, props, new Object[] { session.getRootDocument().getId() }); return pageProvider.getCurrentPage(); } DomainsFinder(String repositoryName); }
DomainsFinder extends UnrestrictedSessionRunner { @SuppressWarnings("unchecked") protected List<DocumentModel> getDomainsFiltered() { PageProviderService pps = Framework.getService(PageProviderService.class); Map<String, Serializable> props = new HashMap<>(); props.put(CoreQueryDocumentPageProvider.CORE_SESSION_PROPERTY, (Serializable) session); PageProvider<DocumentModel> pageProvider = (PageProvider<DocumentModel>) pps.getPageProvider( PUBLISHING_DOMAINS_PROVIDER, null, null, null, props, new Object[] { session.getRootDocument().getId() }); return pageProvider.getCurrentPage(); } DomainsFinder(String repositoryName); @Override void run(); List<DocumentModel> getDomains(); }
DomainsFinder extends UnrestrictedSessionRunner { @SuppressWarnings("unchecked") protected List<DocumentModel> getDomainsFiltered() { PageProviderService pps = Framework.getService(PageProviderService.class); Map<String, Serializable> props = new HashMap<>(); props.put(CoreQueryDocumentPageProvider.CORE_SESSION_PROPERTY, (Serializable) session); PageProvider<DocumentModel> pageProvider = (PageProvider<DocumentModel>) pps.getPageProvider( PUBLISHING_DOMAINS_PROVIDER, null, null, null, props, new Object[] { session.getRootDocument().getId() }); return pageProvider.getCurrentPage(); } DomainsFinder(String repositoryName); @Override void run(); List<DocumentModel> getDomains(); static final String PUBLISHING_DOMAINS_PROVIDER; }