org.apache.lenya.cms.publication
Class DefaultDocument

java.lang.Object
  extended by org.apache.lenya.cms.publication.DefaultDocument
All Implemented Interfaces:
Document
Direct Known Subclasses:
CollectionImpl

public class DefaultDocument
extends java.lang.Object
implements Document

A typical CMS document.


Field Summary
 
Fields inherited from interface org.apache.lenya.cms.publication.Document
DEFAULT_PREFIX, NAMESPACE
 
Constructor Summary
  DefaultDocument(Publication publication, java.lang.String id)
          Deprecated. Use DefaultDocumentBuilder instead.
protected DefaultDocument(Publication publication, java.lang.String id, java.lang.String area)
          Creates a new instance of DefaultDocument.
protected DefaultDocument(Publication publication, java.lang.String id, java.lang.String area, java.lang.String language)
          Creates a new instance of DefaultDocument.
 
Method Summary
 boolean equals(java.lang.Object object)
           
 boolean exists()
          (non-Javadoc)
 boolean existsInAnyLanguage()
          (non-Javadoc)
 java.lang.String getArea()
          Returns the area this document belongs to.
 java.lang.String getCompleteInfoURL()
          Returns the complete URL of this document in the info area:
/{publication-id}/info-{area}{document-id}{language-suffix}.
 java.lang.String getCompleteURL()
          Returns the complete URL of this document:
/{publication-id}/{area}{document-id}{language-suffix}.
 java.lang.String getCompleteURLWithoutLanguage()
          Returns the complete URL of this document without the language-suffix: /{publication-id}/{area}{document-id}.
 java.lang.String getDocumentURL()
          Returns the URL of this document: {document-id}{language-suffix}.
 DublinCore getDublinCore()
          Returns the dublin core class for this document.
 java.lang.String getExtension()
          Returns the extension in the URL.
 java.io.File getFile()
          Returns the file for this document.
 java.lang.String getId()
          Returns the document ID of this document.
 java.lang.String getLabel()
          Get the navigation label associated with this document for the language.
 java.lang.String getLanguage()
          Returns the language of this document.
 java.lang.String[] getLanguages()
          Returns all the languages this document is available in.
 java.util.Date getLastModified()
          Returns the date of the last modification of this document.
 java.lang.String getName()
          Returns the document name of this document.
 java.lang.String getNodeId()
          Deprecated. replaced by getName()
 Publication getPublication()
          Returns the publication this document belongs to.
 int hashCode()
           
protected  void setArea(java.lang.String area)
          Sets the area.
 void setDocumentURL(java.lang.String url)
          Sets the document URL.
protected  void setExtension(java.lang.String extension)
          Sets the extension of the file in the URL.
 void setLanguage(java.lang.String language)
          Sets the language of this document.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultDocument

public DefaultDocument(Publication publication,
                       java.lang.String id)
Deprecated. Use DefaultDocumentBuilder instead.

Creates a new instance of DefaultDocument.

Parameters:
publication - The publication the document belongs to.
id - The document ID (starting with a slash).

DefaultDocument

protected DefaultDocument(Publication publication,
                          java.lang.String id,
                          java.lang.String area)
Creates a new instance of DefaultDocument. The language of the document is the default language of the publication.

Parameters:
publication - The publication the document belongs to.
id - The document ID (starting with a slash).
area - The area.

DefaultDocument

protected DefaultDocument(Publication publication,
                          java.lang.String id,
                          java.lang.String area,
                          java.lang.String language)
Creates a new instance of DefaultDocument.

Parameters:
publication - The publication the document belongs to.
id - The document ID (starting with a slash).
area - The area.
language - the language
Method Detail

getId

public java.lang.String getId()
Description copied from interface: Document
Returns the document ID of this document.

Specified by:
getId in interface Document
Returns:
the document-id of this document.
See Also:
Document.getId()

getName

public java.lang.String getName()
Description copied from interface: Document
Returns the document name of this document.

Specified by:
getName in interface Document
Returns:
the document-name of this document.
See Also:
Document.getName()

getNodeId

public java.lang.String getNodeId()
Deprecated. replaced by getName()

Description copied from interface: Document
Instead of returning the full document-id for this document it just returns the id of the particular node, basically the basename of the document-id.

Specified by:
getNodeId in interface Document
Returns:
the node id, i.e. the basename of the document-id
See Also:
Document.getNodeId()

getPublication

public Publication getPublication()
Description copied from interface: Document
Returns the publication this document belongs to.

Specified by:
getPublication in interface Document
Returns:
A publication object.
See Also:
Document.getPublication()

getLastModified

public java.util.Date getLastModified()
Description copied from interface: Document
Returns the date of the last modification of this document.

Specified by:
getLastModified in interface Document
Returns:
A date denoting the date of the last modification.
See Also:
Document.getLastModified()

getDublinCore

public DublinCore getDublinCore()
Description copied from interface: Document
Returns the dublin core class for this document.

Specified by:
getDublinCore in interface Document
Returns:
A DublinCore object.
See Also:
Document.getDublinCore()

getFile

public java.io.File getFile()
Returns the file for this document.

Specified by:
getFile in interface Document
Returns:
A file object.

getLanguage

public java.lang.String getLanguage()
Description copied from interface: Document
Returns the language of this document. Each document has one language associated to it.

Specified by:
getLanguage in interface Document
Returns:
A string denoting the language.
See Also:
Document.getLanguage()

getLanguages

public java.lang.String[] getLanguages()
                                throws DocumentException
Description copied from interface: Document
Returns all the languages this document is available in. A document has one associated language (@see Document#getLanguage) but there are possibly a number of other languages for which a document with the same document-id is also available in.

Specified by:
getLanguages in interface Document
Returns:
An array of strings denoting the languages.
Throws:
DocumentException - if an error occurs
See Also:
Document.getLanguage()

setLanguage

public void setLanguage(java.lang.String language)
Sets the language of this document.

Parameters:
language - The language.

getLabel

public java.lang.String getLabel()
                          throws DocumentException
Description copied from interface: Document
Get the navigation label associated with this document for the language.

Specified by:
getLabel in interface Document
Returns:
the label String
Throws:
DocumentException - if an error occurs
See Also:
Document.getLabel()

getArea

public java.lang.String getArea()
Description copied from interface: Document
Returns the area this document belongs to.

Specified by:
getArea in interface Document
Returns:
The area.
See Also:
Document.getArea()

getCompleteURL

public java.lang.String getCompleteURL()
Description copied from interface: Document
Returns the complete URL of this document:
/{publication-id}/{area}{document-id}{language-suffix}.{extension}

Specified by:
getCompleteURL in interface Document
Returns:
A string.
See Also:
Document#getCompleteURL(String)

getCompleteInfoURL

public java.lang.String getCompleteInfoURL()
Description copied from interface: Document
Returns the complete URL of this document in the info area:
/{publication-id}/info-{area}{document-id}{language-suffix}.{extension}

Specified by:
getCompleteInfoURL in interface Document
Returns:
A string.
See Also:
Document#getCompleteInfoURL(String)

getCompleteURLWithoutLanguage

public java.lang.String getCompleteURLWithoutLanguage()
Description copied from interface: Document
Returns the complete URL of this document without the language-suffix: /{publication-id}/{area}{document-id}.{extension} The URL always starts with a slash (/).

Specified by:
getCompleteURLWithoutLanguage in interface Document
Returns:
A string.
See Also:
Document#getCompleteURL(String)

setArea

protected void setArea(java.lang.String area)
Sets the area.

Parameters:
area - A string.

getExtension

public java.lang.String getExtension()
Description copied from interface: Document
Returns the extension in the URL.

Specified by:
getExtension in interface Document
Returns:
A string.
See Also:
Document.getExtension()

setExtension

protected void setExtension(java.lang.String extension)
Sets the extension of the file in the URL.

Parameters:
extension - A string.

setDocumentURL

public void setDocumentURL(java.lang.String url)
Sets the document URL.

Parameters:
url - The document URL (without publication ID and area).

getDocumentURL

public java.lang.String getDocumentURL()
Description copied from interface: Document
Returns the URL of this document: {document-id}{language-suffix}.{extension} The URL always starts with a slash (/).

Specified by:
getDocumentURL in interface Document
Returns:
A string.
See Also:
Document.getDocumentURL()

exists

public boolean exists()
               throws DocumentException
(non-Javadoc)

Specified by:
exists in interface Document
Returns:
true if the document exists, false otherwise
Throws:
DocumentException - if an error occurs
See Also:
Document.exists()

existsInAnyLanguage

public boolean existsInAnyLanguage()
                            throws DocumentException
(non-Javadoc)

Specified by:
existsInAnyLanguage in interface Document
Returns:
true if a document with the given document-id and area exists, null otherwise
Throws:
DocumentException - if an error occurs
See Also:
Document.existsInAnyLanguage()

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

toString

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


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.