public DocumentList getAllContent(String docType) { return getAllContent(docType, false); }
@Override public DocumentList get(ContentStore db, Map model, String key) { // document types are pluralized in model, so unpluralize try { String type = DocumentTypeUtils.unpluralize(key); return db.getAllContent(type); } catch (UnsupportedOperationException e) { return new DocumentList(); } }
@Override public DocumentList get(ContentStore db, Map model, String key) { DocumentList allContent = new DocumentList(); String[] documentTypes = DocumentTypes.getDocumentTypes(); for (String docType : documentTypes) { DocumentList query = db.getAllContent(docType); allContent.addAll(query); } return allContent; }
public DocumentList getAllContent(String docType) { return getAllContent(docType, false); }
@Test public void crawl() { Crawler crawler = new Crawler(db, config); crawler.crawl(); Assert.assertEquals(4, db.getDocumentCount("post")); Assert.assertEquals(3, db.getDocumentCount("page")); DocumentList results = db.getPublishedPosts(); assertThat(results.size()).isEqualTo(3); for (Map<String, Object> content : results) { assertThat(content) .containsKey(Crawler.Attributes.ROOTPATH) .containsValue("../../../"); } DocumentList allPosts = db.getAllContent("post"); assertThat(allPosts.size()).isEqualTo(4); for (Map<String, Object> content : allPosts) { if (content.get(Crawler.Attributes.TITLE).equals("Draft Post")) { assertThat(content).containsKey(Crawler.Attributes.DATE); } } // covers bug #213 DocumentList publishedPostsByTag = db.getPublishedPostsByTag("blog"); Assert.assertEquals(3, publishedPostsByTag.size()); }
@Override public DocumentList get(ContentStore db, Map model, String key) { // document types are pluralized in model, so unpluralize try { String type = DocumentTypeUtils.unpluralize(key); return db.getAllContent(type); } catch (UnsupportedOperationException e) { return new DocumentList(); } }
@Override public DocumentList get(ContentStore db, Map model, String key) { DocumentList allContent = new DocumentList(); String[] documentTypes = DocumentTypes.getDocumentTypes(); for (String docType : documentTypes) { DocumentList query = db.getAllContent(docType); allContent.addAll(query); } return allContent; }