org.apache.lenya.cms.site.simple
Class DocumentStore

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.modules.collection.CollectionWrapper
          extended by org.apache.lenya.cms.site.simple.DocumentStore
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled, org.apache.lenya.cms.repository.RepositoryItem, org.apache.lenya.cms.site.SiteStructure, org.apache.lenya.modules.collection.Collection

public class DocumentStore
extends org.apache.lenya.modules.collection.CollectionWrapper
implements org.apache.lenya.cms.site.SiteStructure

Site structure object which stores a list of documents.

Version:
$Id: DocumentStore.java 565766 2007-08-14 14:09:21Z andreas $

Field Summary
protected static java.lang.String ATTRIBUTE_LANGUAGE
           
protected static java.lang.String ATTRIBUTE_PATH
           
static java.lang.String IDENTIFIABLE_TYPE
          The identifiable type.
protected static java.lang.String NAMESPACE
           
protected static java.lang.Object SITE_PATH
           
 
Fields inherited from class org.apache.lenya.modules.collection.CollectionWrapper
TYPES
 
Fields inherited from interface org.apache.lenya.modules.collection.Collection
ATTRIBUTE_HREF, ATTRIBUTE_TYPE, ATTRIBUTE_UUID, DEFAULT_PREFIX, ELEMENT_COLLECTION, ELEMENT_DOCUMENT, TYPE_CHILDREN, TYPE_LINK, TYPE_MANUAL
 
Constructor Summary
DocumentStore(org.apache.lenya.cms.publication.Document doc, org.apache.avalon.framework.logger.Logger logger)
           
 
Method Summary
 org.apache.lenya.cms.site.SiteNode add(java.lang.String path)
           
 org.apache.lenya.cms.site.Link add(java.lang.String path, org.apache.lenya.cms.publication.Document document)
           
 org.apache.lenya.cms.site.SiteNode add(java.lang.String path, java.lang.String followingSiblingPath)
           
 boolean contains(java.lang.String path)
           
 boolean contains(java.lang.String path, java.lang.String language)
           
 boolean containsByUuid(java.lang.String uuid, java.lang.String language)
           
 boolean containsInAnyLanguage(java.lang.String uuid)
           
protected  org.w3c.dom.Element createDocumentElement(org.apache.lenya.cms.publication.Document document, org.apache.lenya.xml.NamespaceHelper helper)
           
protected  java.util.Map doc2path()
           
 boolean exists()
           
 java.lang.String getArea()
           
 org.apache.lenya.cms.site.Link getByUuid(java.lang.String uuid, java.lang.String language)
           
protected  org.apache.lenya.cms.publication.Document getDocument(java.lang.String uuid)
           
protected  java.lang.String getKey(java.lang.String uuid, java.lang.String language)
           
protected  java.lang.String getLanguage(java.lang.String key)
           
 org.apache.lenya.cms.site.SiteNode getNode(java.lang.String path)
           
 org.apache.lenya.cms.site.SiteNode[] getNodes()
           
protected  java.lang.String getPath(java.lang.String uuid, java.lang.String language)
           
 org.apache.lenya.cms.publication.Publication getPublication()
           
 org.apache.lenya.cms.repository.Node getRepositoryNode()
           
 org.apache.lenya.cms.repository.Session getSession()
           
 org.apache.lenya.cms.site.SiteNode[] getTopLevelNodes()
           
protected  java.lang.String getUuid(java.lang.String key)
           
protected  org.apache.lenya.cms.publication.Document loadDocument(org.w3c.dom.Element documentElement)
           
 void remove(org.apache.lenya.cms.publication.Document document)
           
 void setPath(org.apache.lenya.cms.publication.Document document, java.lang.String path)
          Sets the path for a document.
 java.lang.String toString()
           
 
Methods inherited from class org.apache.lenya.modules.collection.CollectionWrapper
add, add, clear, contains, documents, getDelegate, getDocuments, getFirstPosition, getHref, getNamespaceHelper, getType, initializeNamespaceHelper, load, loadXml, save, saveXml, setHref, setType, size
 
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, wait, wait, wait
 

Field Detail

IDENTIFIABLE_TYPE

public static final java.lang.String IDENTIFIABLE_TYPE
The identifiable type.

See Also:
Constant Field Values

SITE_PATH

protected static final java.lang.Object SITE_PATH

NAMESPACE

protected static final java.lang.String NAMESPACE
See Also:
Constant Field Values

ATTRIBUTE_LANGUAGE

protected static final java.lang.String ATTRIBUTE_LANGUAGE
See Also:
Constant Field Values

ATTRIBUTE_PATH

protected static final java.lang.String ATTRIBUTE_PATH
See Also:
Constant Field Values
Constructor Detail

DocumentStore

public DocumentStore(org.apache.lenya.cms.publication.Document doc,
                     org.apache.avalon.framework.logger.Logger logger)
              throws org.apache.lenya.cms.publication.DocumentException
Parameters:
doc - The document where the collection is stored.
logger - The logger.
Throws:
org.apache.lenya.cms.publication.DocumentException - if an error occurs.
Method Detail

getKey

protected java.lang.String getKey(java.lang.String uuid,
                                  java.lang.String language)

getLanguage

protected java.lang.String getLanguage(java.lang.String key)

getUuid

protected java.lang.String getUuid(java.lang.String key)

createDocumentElement

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
Overrides:
createDocumentElement in class org.apache.lenya.modules.collection.CollectionWrapper
Throws:
org.apache.lenya.cms.publication.DocumentException
See Also:
CollectionWrapper.createDocumentElement(org.apache.lenya.cms.publication.Document, org.apache.lenya.xml.NamespaceHelper)

loadDocument

protected org.apache.lenya.cms.publication.Document loadDocument(org.w3c.dom.Element documentElement)
                                                          throws org.apache.lenya.cms.publication.DocumentBuildException
Overrides:
loadDocument in class org.apache.lenya.modules.collection.CollectionWrapper
Throws:
org.apache.lenya.cms.publication.DocumentBuildException
See Also:
CollectionWrapper.loadDocument(org.w3c.dom.Element)

exists

public boolean exists()
               throws org.apache.lenya.cms.publication.DocumentException
Returns:
if the document exists.
Throws:
org.apache.lenya.cms.publication.DocumentException - if an error occurs.

getRepositoryNode

public org.apache.lenya.cms.repository.Node getRepositoryNode()
Specified by:
getRepositoryNode in interface org.apache.lenya.cms.site.SiteStructure

contains

public boolean contains(java.lang.String path)
Specified by:
contains in interface org.apache.lenya.cms.site.SiteStructure

containsByUuid

public boolean containsByUuid(java.lang.String uuid,
                              java.lang.String language)
Specified by:
containsByUuid in interface org.apache.lenya.cms.site.SiteStructure

containsInAnyLanguage

public boolean containsInAnyLanguage(java.lang.String uuid)
Specified by:
containsInAnyLanguage in interface org.apache.lenya.cms.site.SiteStructure

getDocument

protected org.apache.lenya.cms.publication.Document getDocument(java.lang.String uuid)

getByUuid

public org.apache.lenya.cms.site.Link getByUuid(java.lang.String uuid,
                                                java.lang.String language)
                                         throws org.apache.lenya.cms.site.SiteException
Specified by:
getByUuid in interface org.apache.lenya.cms.site.SiteStructure
Throws:
org.apache.lenya.cms.site.SiteException

getPath

protected java.lang.String getPath(java.lang.String uuid,
                                   java.lang.String language)

getNode

public org.apache.lenya.cms.site.SiteNode getNode(java.lang.String path)
                                           throws org.apache.lenya.cms.site.SiteException
Specified by:
getNode in interface org.apache.lenya.cms.site.SiteStructure
Throws:
org.apache.lenya.cms.site.SiteException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPublication

public org.apache.lenya.cms.publication.Publication getPublication()
Specified by:
getPublication in interface org.apache.lenya.cms.site.SiteStructure

getArea

public java.lang.String getArea()
Specified by:
getArea in interface org.apache.lenya.cms.site.SiteStructure

add

public org.apache.lenya.cms.site.Link add(java.lang.String path,
                                          org.apache.lenya.cms.publication.Document document)
                                   throws org.apache.lenya.cms.site.SiteException
Specified by:
add in interface org.apache.lenya.cms.site.SiteStructure
Throws:
org.apache.lenya.cms.site.SiteException

setPath

public void setPath(org.apache.lenya.cms.publication.Document document,
                    java.lang.String path)
             throws org.apache.lenya.transaction.TransactionException
Sets the path for a document.

Parameters:
document -
path -
Throws:
org.apache.lenya.transaction.TransactionException

doc2path

protected java.util.Map doc2path()

getNodes

public org.apache.lenya.cms.site.SiteNode[] getNodes()
Specified by:
getNodes in interface org.apache.lenya.cms.site.SiteStructure

add

public org.apache.lenya.cms.site.SiteNode add(java.lang.String path)
                                       throws org.apache.lenya.cms.site.SiteException
Specified by:
add in interface org.apache.lenya.cms.site.SiteStructure
Throws:
org.apache.lenya.cms.site.SiteException

remove

public void remove(org.apache.lenya.cms.publication.Document document)
            throws org.apache.lenya.cms.publication.DocumentException
Specified by:
remove in interface org.apache.lenya.modules.collection.Collection
Overrides:
remove in class org.apache.lenya.modules.collection.CollectionWrapper
Throws:
org.apache.lenya.cms.publication.DocumentException

add

public org.apache.lenya.cms.site.SiteNode add(java.lang.String path,
                                              java.lang.String followingSiblingPath)
                                       throws org.apache.lenya.cms.site.SiteException
Specified by:
add in interface org.apache.lenya.cms.site.SiteStructure
Throws:
org.apache.lenya.cms.site.SiteException

getTopLevelNodes

public org.apache.lenya.cms.site.SiteNode[] getTopLevelNodes()
Specified by:
getTopLevelNodes in interface org.apache.lenya.cms.site.SiteStructure

contains

public boolean contains(java.lang.String path,
                        java.lang.String language)
Specified by:
contains in interface org.apache.lenya.cms.site.SiteStructure

getSession

public org.apache.lenya.cms.repository.Session getSession()
Specified by:
getSession in interface org.apache.lenya.cms.repository.RepositoryItem


Copyright © $ Apache Software Foundation. All Rights Reserved.