1 17 18 package org.apache.lenya.cms.publication; 19 20 import java.util.List ; 21 22 25 public final class PublicationHelper { 26 27 private Publication publication; 28 29 public PublicationHelper(Publication publication) { 30 this.publication = publication; 31 } 32 33 40 public Document[] getAllDocuments(String area, String language) throws DocumentException { 41 try { 42 List allNodes = getPublication().getTree(area).getNode("/").preOrder(); 43 Document[] documents = new Document[allNodes.size()-1]; 44 45 for(int i=1; i<allNodes.size(); i++) { 46 documents[i-1] = DefaultDocumentBuilder.getInstance().createDocument(getPublication(), area, 47 ((SiteTreeNode)allNodes.get(i)).getAbsoluteId(), language); 48 } 49 return documents; 50 } catch(SiteTreeException e) { 51 throw new DocumentException("Can not access sitetree to get document ids.", e); 52 } catch(DocumentBuildException e) { 53 throw new DocumentException("Can not build document from id obtained from sitetree.", e); 54 } 55 } 56 57 60 public Publication getPublication() { 61 return publication; 62 } 63 } 64 | Popular Tags |