org.apache.lenya.cms.publication
Interface DocumentManager


public interface DocumentManager

Helper to manage documents. It takes care of attachments etc.

Version:
$Id: DocumentManager.java 527520 2007-04-11 15:22:11Z andreas $

Field Summary
static java.lang.String ROLE
          The Avalon component role.
 
Method Summary
 Document add(DocumentFactory factory, ResourceType resourceType, java.lang.String contentSourceUri, Publication pub, java.lang.String area, java.lang.String language, java.lang.String extension)
          Creates a new document without adding it to the site structure.
 Document add(DocumentFactory factory, ResourceType resourceType, java.lang.String contentSourceUri, Publication pub, java.lang.String area, java.lang.String path, java.lang.String language, java.lang.String extension, java.lang.String navigationTitle, boolean visibleInNav)
          Creates a new document with the given parameters:
 Document add(Document sourceDocument, java.lang.String area, java.lang.String path, java.lang.String language, java.lang.String extension, java.lang.String navigationTitle, boolean visibleInNav)
          Creates a new document in the same publication the parentDocument belongs to with the given parameters:
 Document addVersion(Document sourceDocument, java.lang.String area, java.lang.String language)
          Adds a new version of a document with a different language and / or in a different area.
 Document addVersion(Document sourceDocument, java.lang.String area, java.lang.String language, boolean addToSite)
          Adds a new version of a document with a different language and / or in a different area.
 void copy(Document sourceDocument, DocumentLocator destination)
          Copies a document from one location to another location.
 void copy(DocumentSet sources, DocumentSet destinations)
          Copies a document set from one location to another.
 void copyAll(Area sourceArea, java.lang.String sourcePath, Area targetArea, java.lang.String targetPath)
          Copies a document to another location, incl. all requiring documents.
 void copyAllLanguageVersions(Area sourceArea, java.lang.String sourcePath, Area targetArea, java.lang.String targetPath)
          Copies all language versions of a document to another location.
 void copyToArea(DocumentSet documentSet, java.lang.String destinationArea)
          Copies a document set to another area.
 void copyToArea(Document sourceDocument, java.lang.String destinationArea)
          Copies a document to another area.
 void delete(Document document)
          Deletes a document from the content repository and from the site structure.
 void delete(DocumentSet documents)
          Deletes a set of documents.
 void deleteAll(Document document)
          Deletes a document, incl. all requiring documents.
 void deleteAllLanguageVersions(Document document)
          Deletes all language versions of a document.
 boolean exists(DocumentFactory factory, Publication pub, java.lang.String area, java.lang.String uuid, java.lang.String language)
          Checks if a document exists.
 void move(Document sourceDocument, DocumentLocator destination)
          Moves a document from one location to another.
 void move(DocumentSet sources, DocumentSet destinations)
          Moves a document set from one location to another.
 void moveAll(Area sourceArea, java.lang.String sourcePath, Area targetArea, java.lang.String targetPath)
          Moves a document to another location, incl. all requiring documents.
 void moveAllLanguageVersions(Area sourceArea, java.lang.String sourcePath, Area targetArea, java.lang.String targetPath)
          Moves all language versions of a document to another location.
 

Field Detail

ROLE

static final java.lang.String ROLE
The Avalon component role.

Method Detail

exists

boolean exists(DocumentFactory factory,
               Publication pub,
               java.lang.String area,
               java.lang.String uuid,
               java.lang.String language)
               throws PublicationException
Checks if a document exists.

Parameters:
factory - The document factory.
pub - The publication.
area - The area.
uuid - The UUID.
language - The language.
Returns:
A boolean value.
Throws:
PublicationException - if an error occurs.

copy

void copy(Document sourceDocument,
          DocumentLocator destination)
          throws PublicationException
Copies a document from one location to another location.

Parameters:
sourceDocument - The document to copy.
destination - The destination document.
Throws:
PublicationException - if a document which destinationDocument depends on does not exist.

copyToArea

void copyToArea(Document sourceDocument,
                java.lang.String destinationArea)
                throws PublicationException
Copies a document to another area.

Parameters:
sourceDocument - The document to copy.
destinationArea - The destination area.
Throws:
PublicationException - if a document which the destination document depends on does not exist.

copyToArea

void copyToArea(DocumentSet documentSet,
                java.lang.String destinationArea)
                throws PublicationException
Copies a document set to another area.

Parameters:
documentSet - The document set to copy.
destinationArea - The destination area.
Throws:
PublicationException - if a document which one of the destination documents depends on does not exist.

add

Document add(Document sourceDocument,
             java.lang.String area,
             java.lang.String path,
             java.lang.String language,
             java.lang.String extension,
             java.lang.String navigationTitle,
             boolean visibleInNav)
             throws DocumentBuildException,
                    PublicationException
Creates a new document in the same publication the parentDocument belongs to with the given parameters:

Parameters:
sourceDocument - The document to initialize the contents and meta data from.
area - The target area.
path - The target path.
language - The target language.
extension - The extension to use for the document source.
navigationTitle - navigation title
visibleInNav - determines the visibility of a node in the navigation
Returns:
The added document.
Throws:
DocumentBuildException - if the document can not be created
PublicationException - if the document is already contained.

add

Document add(DocumentFactory factory,
             ResourceType resourceType,
             java.lang.String contentSourceUri,
             Publication pub,
             java.lang.String area,
             java.lang.String path,
             java.lang.String language,
             java.lang.String extension,
             java.lang.String navigationTitle,
             boolean visibleInNav)
             throws DocumentBuildException,
                    PublicationException
Creates a new document with the given parameters:

Parameters:
factory - The document factory.
resourceType - the document type (aka resource type) of the new document
contentSourceUri - The URI to read the content from.
pub - The publication.
area - The area.
path - The path.
language - The language.
extension - The extension to use for the document source, without the leading dot.
navigationTitle - The navigation title.
visibleInNav - The navigation visibility.
Returns:
The added document.
Throws:
DocumentBuildException - if the document can not be created
PublicationException - if the document is already contained.

add

Document add(DocumentFactory factory,
             ResourceType resourceType,
             java.lang.String contentSourceUri,
             Publication pub,
             java.lang.String area,
             java.lang.String language,
             java.lang.String extension)
             throws DocumentBuildException,
                    PublicationException
Creates a new document without adding it to the site structure.

Parameters:
factory - The document factory.
resourceType - the document type (aka resource type) of the new document
contentSourceUri - The URI to read the content from.
pub - The publication.
area - The area.
language - The language.
extension - The extension to use for the document source, without the leading dot.
Returns:
The added document.
Throws:
DocumentBuildException - if the document can not be created
PublicationException - if the document is already contained.

addVersion

Document addVersion(Document sourceDocument,
                    java.lang.String area,
                    java.lang.String language)
                    throws DocumentBuildException,
                           PublicationException
Adds a new version of a document with a different language and / or in a different area.

Parameters:
sourceDocument - The document to initialize the contents and meta data from.
area - The area.
language - The language of the new document.
Returns:
The added document.
Throws:
DocumentBuildException - if the document can not be created
PublicationException - if the document is already contained.

addVersion

Document addVersion(Document sourceDocument,
                    java.lang.String area,
                    java.lang.String language,
                    boolean addToSite)
                    throws DocumentBuildException,
                           PublicationException
Adds a new version of a document with a different language and / or in a different area.

Parameters:
sourceDocument - The document to initialize the contents and meta data from.
area - The area.
language - The language of the new document.
addToSite - If the new version should be added to the site structure.
Returns:
The added document.
Throws:
DocumentBuildException - if the document can not be created
PublicationException - if the document is already contained.

delete

void delete(Document document)
            throws PublicationException
Deletes a document from the content repository and from the site structure.

Parameters:
document - The document to delete.
Throws:
PublicationException - when something went wrong.

move

void move(Document sourceDocument,
          DocumentLocator destination)
          throws PublicationException
Moves a document from one location to another.

Parameters:
sourceDocument - The source document.
destination - The destination document.
Throws:
PublicationException - if a document which the destination document depends on does not exist.

move

void move(DocumentSet sources,
          DocumentSet destinations)
          throws PublicationException
Moves a document set from one location to another. A source is moved to the destination of the same position in the set.

Parameters:
sources - The source documents.
destinations - The destination documents.
Throws:
PublicationException - if a document which the destination document depends on does not exist.

copy

void copy(DocumentSet sources,
          DocumentSet destinations)
          throws PublicationException
Copies a document set from one location to another. A source is copied to the destination of the same position in the set.

Parameters:
sources - The source documents.
destinations - The destination documents.
Throws:
PublicationException - if a document which the destination document depends on does not exist.

moveAll

void moveAll(Area sourceArea,
             java.lang.String sourcePath,
             Area targetArea,
             java.lang.String targetPath)
             throws PublicationException
Moves a document to another location, incl. all requiring documents. If a sitetree is used, this means that the whole subtree is moved.

Parameters:
sourceArea - The source area.
sourcePath - The source path.
targetArea - The target area.
targetPath - The target path.
Throws:
PublicationException - if an error occurs.

moveAllLanguageVersions

void moveAllLanguageVersions(Area sourceArea,
                             java.lang.String sourcePath,
                             Area targetArea,
                             java.lang.String targetPath)
                             throws PublicationException
Moves all language versions of a document to another location.

Parameters:
sourceArea - The source area.
sourcePath - The source path.
targetArea - The target area.
targetPath - The target path.
Throws:
PublicationException - if the documents could not be moved.

copyAll

void copyAll(Area sourceArea,
             java.lang.String sourcePath,
             Area targetArea,
             java.lang.String targetPath)
             throws PublicationException
Copies a document to another location, incl. all requiring documents. If a sitetree is used, this means that the whole subtree is copied.

Parameters:
sourceArea - The source area.
sourcePath - The source path.
targetArea - The target area.
targetPath - The target path.
Throws:
PublicationException - if an error occurs.

copyAllLanguageVersions

void copyAllLanguageVersions(Area sourceArea,
                             java.lang.String sourcePath,
                             Area targetArea,
                             java.lang.String targetPath)
                             throws PublicationException
Copies all language versions of a document to another location.

Parameters:
sourceArea - The source area.
sourcePath - The source path.
targetArea - The target area.
targetPath - The target path.
Throws:
PublicationException - if the documents could not be copied.

deleteAll

void deleteAll(Document document)
               throws PublicationException
Deletes a document, incl. all requiring documents. If a sitetree is used, this means that the whole subtree is deleted.

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

deleteAllLanguageVersions

void deleteAllLanguageVersions(Document document)
                               throws PublicationException
Deletes all language versions of a document.

Parameters:
document - The document.
Throws:
PublicationException - if the documents could not be copied.

delete

void delete(DocumentSet documents)
            throws PublicationException
Deletes a set of documents.

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


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