org.apache.lenya.cms.publication
Interface Document

All Superinterfaces:
MetaDataOwner, RepositoryItem

public interface Document
extends MetaDataOwner, RepositoryItem

A CMS document.

Version:
$Id: Document.java 586495 2007-10-19 15:13:36Z rfrovarp $

Field Summary
static java.lang.String DEFAULT_PREFIX
          The default namespace prefix.
static java.lang.String DOCUMENT_META_SUFFIX
          DOCUMENT_META_SUFFIX The suffix for document meta Uris
static java.lang.String NAMESPACE
          The document namespace URI.
static java.lang.String TRANSACTIONABLE_TYPE
          The transactionable type for document objects.
 
Method Summary
 void accept(DocumentVisitor visitor)
          Accepts a document visitor.
 Area area()
           
 void delete()
          Deletes the document.
 boolean exists()
          Check if a document with the given document-uuid, language and in the given area actually exists.
 boolean existsAreaVersion(java.lang.String area)
          Checks if this document exists in a certain area.
 boolean existsInAnyLanguage()
          Check if a document exists with the given document-uuid and the given area independently of the given language.
 boolean existsTranslation(java.lang.String language)
          Checks if a certain translation (language version) of this document exists.
 boolean existsVersion(java.lang.String area, java.lang.String language)
          Checks if a translation of this document exists in a certain area.
 java.lang.String getArea()
          Returns the area this document belongs to.
 Document getAreaVersion(java.lang.String area)
          Returns the document in a certain area.
 java.lang.String getCanonicalDocumentURL()
          Returns the canonical document URL.
 java.lang.String getCanonicalWebappURL()
          Returns the canonical web application URL.
 long getContentLength()
           
 java.util.Date getExpires()
          Returns the date at which point the requested document is considered expired
 java.lang.String getExtension()
          Returns the extension in the URL without the dot.
 DocumentFactory getFactory()
          Returns the identity map this document belongs to.
 java.io.File getFile()
          Deprecated. This implies the usage of a filesystem based storage. Use getSourceURI() instead.
 DocumentIdentifier getIdentifier()
           
 java.io.InputStream getInputStream()
           
 java.lang.String getLanguage()
          Returns the language of this document.
 java.lang.String[] getLanguages()
          Returns all the languages this document is available in.
 long getLastModified()
          Returns the date of the last modification of this document.
 Link getLink()
           
 DocumentLocator getLocator()
           
 java.lang.String getMimeType()
           
 java.lang.String getName()
          Returns the document name of this document.
 java.io.OutputStream getOutputStream()
           
 java.lang.String getPath()
          This is a shortcut to getLink().getNode().getPath().
 Publication getPublication()
          Returns the publication this document belongs to.
 Node getRepositoryNode()
           
 ResourceType getResourceType()
           
 int getRevisionNumber()
           
 java.lang.String getSourceExtension()
           
 java.lang.String getSourceURI()
          Returns the URI to resolve the document's source.
 Document getTranslation(java.lang.String language)
          Returns a certain translation (language version) of this document.
 java.lang.String getUUID()
          Returns the UUID.
 Document getVersion(java.lang.String area, java.lang.String language)
          Returns a translation of this document in a certain area.
 boolean hasLink()
           
 void setMimeType(java.lang.String mimeType)
          Sets the mime type of this document.
 void setResourceType(ResourceType resourceType)
           
 void setSourceExtension(java.lang.String extension)
           
 
Methods inherited from interface org.apache.lenya.cms.metadata.MetaDataOwner
getMetaData, getMetaDataNamespaceUris
 
Methods inherited from interface org.apache.lenya.cms.repository.RepositoryItem
getSession
 

Field Detail

NAMESPACE

static final java.lang.String NAMESPACE
The document namespace URI.

See Also:
Constant Field Values

DEFAULT_PREFIX

static final java.lang.String DEFAULT_PREFIX
The default namespace prefix.

See Also:
Constant Field Values

TRANSACTIONABLE_TYPE

static final java.lang.String TRANSACTIONABLE_TYPE
The transactionable type for document objects.

See Also:
Constant Field Values

DOCUMENT_META_SUFFIX

static final java.lang.String DOCUMENT_META_SUFFIX
DOCUMENT_META_SUFFIX The suffix for document meta Uris

See Also:
Constant Field Values
Method Detail

getExpires

java.util.Date getExpires()
                          throws DocumentException
Returns the date at which point the requested document is considered expired

Returns:
a string in RFC 1123 date format
Throws:
DocumentException - if an error occurs.

getName

java.lang.String getName()
Returns the document name of this document.

Returns:
the document-name of this document.

getPublication

Publication getPublication()
Returns the publication this document belongs to.

Returns:
A publication object.

getCanonicalWebappURL

java.lang.String getCanonicalWebappURL()
Returns the canonical web application URL.

Returns:
A string.

getCanonicalDocumentURL

java.lang.String getCanonicalDocumentURL()
Returns the canonical document URL.

Returns:
A string.

getLanguage

java.lang.String getLanguage()
Returns the language of this document. Each document has one language associated to it.

Returns:
A string denoting the language.

getLanguages

java.lang.String[] getLanguages()
                                throws DocumentException
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-uuid is also available in.

Returns:
An array of strings denoting the languages.
Throws:
DocumentException - if an error occurs

getLastModified

long getLastModified()
                     throws DocumentException
Returns the date of the last modification of this document.

Returns:
A date denoting the date of the last modification.
Throws:
DocumentException - if an error occurs.

getArea

java.lang.String getArea()
Returns the area this document belongs to.

Returns:
The area.

getFile

java.io.File getFile()
Deprecated. This implies the usage of a filesystem based storage. Use getSourceURI() instead.

Returns the file for this document.

Returns:
A file object.

getExtension

java.lang.String getExtension()
Returns the extension in the URL without the dot.

Returns:
A string.

getUUID

java.lang.String getUUID()
Returns the UUID.

Returns:
A string.

exists

boolean exists()
               throws DocumentException
Check if a document with the given document-uuid, language and in the given area actually exists.

Returns:
true if the document exists, false otherwise
Throws:
DocumentException - if an error occurs

existsInAnyLanguage

boolean existsInAnyLanguage()
                            throws DocumentException
Check if a document exists with the given document-uuid and the given area independently of the given language.

Returns:
true if a document with the given document-uuid and area exists, false otherwise
Throws:
DocumentException - if an error occurs

getFactory

DocumentFactory getFactory()
Returns the identity map this document belongs to.

Returns:
A document identity map.

getSourceURI

java.lang.String getSourceURI()
Returns the URI to resolve the document's source. The source can only be used for read-only access. For write access, use getOutputStream().

Returns:
A string.

getOutputStream

java.io.OutputStream getOutputStream()
Returns:
The output stream to write the document content to.

accept

void accept(DocumentVisitor visitor)
            throws PublicationException
Accepts a document visitor.

Parameters:
visitor - The visitor.
Throws:
PublicationException - if an error occurs.

delete

void delete()
            throws DocumentException
Deletes the document.

Throws:
DocumentException - if an error occurs.

getRepositoryNode

Node getRepositoryNode()
Returns:
The repository node that represents this document.

getResourceType

ResourceType getResourceType()
                             throws DocumentException
Returns:
The resource type of this document (formerly known as doctype)
Throws:
DocumentException - if an error occurs.

setResourceType

void setResourceType(ResourceType resourceType)
Parameters:
resourceType - The resource type of this document.

getSourceExtension

java.lang.String getSourceExtension()
Returns:
The source extension used by this document, without the dot.

setSourceExtension

void setSourceExtension(java.lang.String extension)
Parameters:
extension - The source extension used by this document, without the dot.

setMimeType

void setMimeType(java.lang.String mimeType)
                 throws DocumentException
Sets the mime type of this document.

Parameters:
mimeType - The mime type.
Throws:
DocumentException - if an error occurs.

getMimeType

java.lang.String getMimeType()
                             throws DocumentException
Returns:
The mime type of this document.
Throws:
DocumentException - if an error occurs.

getContentLength

long getContentLength()
                      throws DocumentException
Returns:
The content length of the document.
Throws:
DocumentException - if an error occurs.

getIdentifier

DocumentIdentifier getIdentifier()
Returns:
The document identifier for this document.

getPath

java.lang.String getPath()
                         throws DocumentException
This is a shortcut to getLink().getNode().getPath().

Returns:
The path of this document in the site structure.
Throws:
DocumentException - if the document is not linked in the site structure.

existsTranslation

boolean existsTranslation(java.lang.String language)
Checks if a certain translation (language version) of this document exists.

Parameters:
language - The language.
Returns:
A boolean value.

getTranslation

Document getTranslation(java.lang.String language)
                        throws DocumentException
Returns a certain translation (language version) of this document.

Parameters:
language - The language.
Returns:
A document.
Throws:
DocumentException - if the language version doesn't exist.

existsAreaVersion

boolean existsAreaVersion(java.lang.String area)
Checks if this document exists in a certain area.

Parameters:
area - The area.
Returns:
A boolean value.

getAreaVersion

Document getAreaVersion(java.lang.String area)
                        throws DocumentException
Returns the document in a certain area.

Parameters:
area - The area.
Returns:
A document.
Throws:
DocumentException - if the area version doesn't exist.

existsVersion

boolean existsVersion(java.lang.String area,
                      java.lang.String language)
Checks if a translation of this document exists in a certain area.

Parameters:
area - The area.
language - The language.
Returns:
A boolean value.

getVersion

Document getVersion(java.lang.String area,
                    java.lang.String language)
                    throws DocumentException
Returns a translation of this document in a certain area.

Parameters:
area - The area.
language - The language.
Returns:
A document.
Throws:
DocumentException - if the area version doesn't exist.

getLocator

DocumentLocator getLocator()
Returns:
A document locator.

getLink

Link getLink()
             throws DocumentException
Returns:
The link to this document in the site structure.
Throws:
DocumentException - if the document is not referenced in the site structure.

area

Area area()
Returns:
The area the document belongs to.

hasLink

boolean hasLink()
Returns:
if the document is linked in the site structure.

getInputStream

java.io.InputStream getInputStream()
Returns:
The input stream to obtain the document's content.

getRevisionNumber

int getRevisionNumber()
Returns:
The revision number of this document.


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