|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.lenya.modules.collection.CollectionWrapper
public class CollectionWrapper
Document wrapper for collection functionality.
| Field Summary | |
|---|---|
protected static java.lang.String[] |
TYPES
|
| Fields inherited from interface org.apache.lenya.modules.collection.Collection |
|---|
ATTRIBUTE_HREF, ATTRIBUTE_TYPE, ATTRIBUTE_UUID, DEFAULT_PREFIX, ELEMENT_COLLECTION, ELEMENT_DOCUMENT, NAMESPACE, TYPE_CHILDREN, TYPE_LINK, TYPE_MANUAL |
| Constructor Summary | |
|---|---|
CollectionWrapper(org.apache.lenya.cms.publication.Document doc,
org.apache.avalon.framework.logger.Logger logger)
Ctor. |
|
| Method Summary | |
|---|---|
void |
add(org.apache.lenya.cms.publication.Document document)
Adds a document to the collection. |
void |
add(int position,
org.apache.lenya.cms.publication.Document document)
Inserts a document into the collection at a specific position. |
void |
clear()
Removes all documents from this collection. |
boolean |
contains(org.apache.lenya.cms.publication.Document document)
Checks if this collection contains a specific document. |
protected org.w3c.dom.Element |
createDocumentElement(org.apache.lenya.cms.publication.Document document,
org.apache.lenya.xml.NamespaceHelper helper)
Creates an element to store a document. |
protected java.util.List |
documents()
Returns the list that holds the documents. |
org.apache.lenya.cms.publication.Document |
getDelegate()
|
org.apache.lenya.cms.publication.Document[] |
getDocuments()
Returns the documents in this collection. |
int |
getFirstPosition(org.apache.lenya.cms.publication.Document document)
Returns the first position of this document in the collection. |
java.lang.String |
getHref()
|
protected org.apache.lenya.xml.NamespaceHelper |
getNamespaceHelper()
Returns the namespace helper for the XML source. |
java.lang.String |
getType()
|
protected org.apache.lenya.xml.NamespaceHelper |
initializeNamespaceHelper()
|
protected void |
load()
Loads the collection from its XML source. |
protected org.apache.lenya.cms.publication.Document |
loadDocument(org.w3c.dom.Element documentElement)
Loads a document from an XML element. |
protected void |
loadXml(org.apache.lenya.xml.NamespaceHelper helper)
|
void |
remove(org.apache.lenya.cms.publication.Document document)
Removes a document from the collection. |
void |
save()
Saves the collection. |
protected void |
saveXml(org.apache.lenya.xml.NamespaceHelper helper)
|
void |
setHref(java.lang.String href)
|
void |
setType(java.lang.String type)
|
int |
size()
Returns the number of documents in this collection. |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
|---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String[] TYPES
| Constructor Detail |
|---|
public CollectionWrapper(org.apache.lenya.cms.publication.Document doc,
org.apache.avalon.framework.logger.Logger logger)
doc - The document.logger - The logger.| Method Detail |
|---|
public org.apache.lenya.cms.publication.Document getDelegate()
getDelegate in interface Collection
protected java.util.List documents()
throws org.apache.lenya.cms.publication.DocumentException
org.apache.lenya.cms.publication.DocumentException - when something went wrong.
public org.apache.lenya.cms.publication.Document[] getDocuments()
throws org.apache.lenya.cms.publication.DocumentException
Collection
getDocuments in interface Collectionorg.apache.lenya.cms.publication.DocumentException - when something went wrong.Collection.getDocuments()
public void add(org.apache.lenya.cms.publication.Document document)
throws org.apache.lenya.cms.publication.DocumentException
Collection
add in interface Collectiondocument - A document.
org.apache.lenya.cms.publication.DocumentException - when an error occurs.Collection.add(org.apache.lenya.cms.publication.Document)
public void add(int position,
org.apache.lenya.cms.publication.Document document)
throws org.apache.lenya.cms.publication.DocumentException
Collection
add in interface Collectionposition - The position of the document after insertion,
starting with 0.document - A document.
org.apache.lenya.cms.publication.DocumentException - when something went wrong.Collection.add(int,
org.apache.lenya.cms.publication.Document)
public void remove(org.apache.lenya.cms.publication.Document document)
throws org.apache.lenya.cms.publication.DocumentException
Collection
remove in interface Collectiondocument - A document.
org.apache.lenya.cms.publication.DocumentException - when the document is not contained
or another error occurs.Collection.remove(org.apache.lenya.cms.publication.Document)protected final void load()
protected void loadXml(org.apache.lenya.xml.NamespaceHelper helper)
protected org.apache.lenya.cms.publication.Document loadDocument(org.w3c.dom.Element documentElement)
throws org.apache.lenya.cms.publication.DocumentBuildException
documentElement - The XML element.
org.apache.lenya.cms.publication.DocumentBuildException - when something went wrong.public final void save()
protected void saveXml(org.apache.lenya.xml.NamespaceHelper helper)
throws javax.xml.transform.TransformerException,
org.apache.lenya.cms.publication.DocumentException
helper - Save the XML to the provided namespace helper.
javax.xml.transform.TransformerException - if an error occurs.
org.apache.lenya.cms.publication.DocumentException - if an error occurs.public java.lang.String getType()
getType in interface CollectionCollection.TYPE_CHILDREN, Collection.TYPE_MANUAL, Collection.TYPE_LINK.
protected org.w3c.dom.Element createDocumentElement(org.apache.lenya.cms.publication.Document document,
org.apache.lenya.xml.NamespaceHelper helper)
throws org.apache.lenya.cms.publication.DocumentException
helper - The namespace helper of the document.document - The document.
org.apache.lenya.cms.publication.DocumentException - when something went wrong.
protected org.apache.lenya.xml.NamespaceHelper getNamespaceHelper()
throws org.apache.lenya.cms.publication.DocumentException,
javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException,
org.apache.avalon.framework.service.ServiceException
org.apache.lenya.cms.publication.DocumentException - when something went wrong.
javax.xml.parsers.ParserConfigurationException - when something went wrong.
org.xml.sax.SAXException - when something went wrong.
java.io.IOException - when something went wrong.
org.apache.avalon.framework.service.ServiceExceptionprotected org.apache.lenya.xml.NamespaceHelper initializeNamespaceHelper()
public boolean contains(org.apache.lenya.cms.publication.Document document)
throws org.apache.lenya.cms.publication.DocumentException
Collection
contains in interface Collectiondocument - The document to check.
org.apache.lenya.cms.publication.DocumentException - when something went wrong.Collection.contains(org.apache.lenya.cms.publication.Document)
public void clear()
throws org.apache.lenya.cms.publication.DocumentException
Collection
clear in interface Collectionorg.apache.lenya.cms.publication.DocumentException - when something went wrong.Collection.clear()
public int getFirstPosition(org.apache.lenya.cms.publication.Document document)
throws org.apache.lenya.cms.publication.DocumentException
Collection
getFirstPosition in interface Collectiondocument - The document.
org.apache.lenya.cms.publication.DocumentException - when the document is not contained.Collection.getFirstPosition(org.apache.lenya.cms.publication.Document)
public int size()
throws org.apache.lenya.cms.publication.DocumentException
Collection
size in interface Collectionorg.apache.lenya.cms.publication.DocumentException - when something went wrong.Collection.size()public void setType(java.lang.String type)
setType in interface Collectiontype - One of Collection.TYPE_CHILDREN, Collection.TYPE_MANUAL, Collection.TYPE_LINK.public java.lang.String getHref()
getHref in interface Collectionpublic void setHref(java.lang.String href)
setHref in interface Collectionhref - The link target. If the type is not Collection.TYPE_LINK, calling
this method has no effect.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||