org.opencms.db
Class CmsPublishList

java.lang.Object
  extended byorg.opencms.db.CmsPublishList

public class CmsPublishList
extends java.lang.Object

A container for all new/changed/deteled Cms resources that are published together.

Only classes inside the org.opencms.db package can add or remove elements to or from this list. This allows the OpenCms API to pass the list around between classes, but with restricted access to create this list.

To create a publish list, one of the public constructors must be used in order to set the basic operation mode (project publish or direct publish). After this, use CmsDriverManager.fillPublishList(CmsDbContext, CmsPublishList) to fill the actual values of the publish list.

Since:
6.0.0
Version:
$Revision: 1.25 $
Author:
Alexander Kandzior, Thomas Weckert
See Also:
CmsDriverManager.fillPublishList(CmsDbContext, CmsPublishList)

Constructor Summary
CmsPublishList(CmsProject project)
          Constructs a publish list for a given project.
CmsPublishList(CmsResource directPublishResource, boolean publishSiblings)
          Constructs a publish list for a single direct publish resource.
CmsPublishList(java.util.List directPublishResources, boolean publishSiblings)
          Constructs a publish list for a list of direct publish resources.
CmsPublishList(java.util.List directPublishResources, boolean publishSiblings, boolean publishSubResources)
          Constructs a publish list for a list of direct publish resources.
 
Method Summary
protected  void addFile(CmsResource resource)
          Adds a new/changed/deleted Cms file resource to the publish list.
protected  void addFiles(java.util.List list)
          Appends all of the new/changed/deleted Cms file resources in the specified list to the end of this publish list.
protected  void addFolder(CmsResource resource)
          Adds a new/changed Cms folder resource to the publish list.
protected  void addFolders(java.util.List list)
          Appends all of the new/changed Cms folder resources in the specified list to the end of this publish list.
protected  void finalize()
           
 java.util.List getDeletedFolderList()
          Returns a list of folder resources with the given state.
 java.util.List getDirectPublishResources()
          Returns the list of resources that should be published for a "direct" publish operation.
 java.util.List getFileList()
          Returns an unmodifiable list of the Cms file resources in this publish list.
 java.util.List getFolderList()
          Returns an unmodifiable list of the new/changed Cms folder resources in this publish list.
protected  java.util.List getFolderListInstance()
          Returns the list with the new/changed Cms folder resources.
 int getProjectId()
          Returns the id of the project that should be published, or -1 if this publish list is initialized for a "direct publish" operation.
 CmsUUID getPublishHistoryId()
          Returns the publish history Id for this publish list.
protected  void initialize()
          Initializes the publish list, ensuring all internal lists are in the right order.
 boolean isDirectPublish()
          Checks if this is a publish list is used for a "direct publish" operation.
 boolean isPublishSiblings()
          Returns true if all siblings of the project resources are to be published.
 boolean isPublishSubResources()
          Returns true if sub-resources in folders should be published (for direct publish only).
protected  boolean remove(CmsResource resource)
          Removes a Cms resource from the publish list.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsPublishList

public CmsPublishList(CmsProject project)
Constructs a publish list for a given project.

Parameters:
project - the project to publish, this should always be the id of the current project

CmsPublishList

public CmsPublishList(CmsResource directPublishResource,
                      boolean publishSiblings)
Constructs a publish list for a single direct publish resource.

Parameters:
directPublishResource - a VFS resource to be published directly
publishSiblings - indicates if all siblings of the selected resources should be published

CmsPublishList

public CmsPublishList(java.util.List directPublishResources,
                      boolean publishSiblings)
Constructs a publish list for a list of direct publish resources.

Parameters:
directPublishResources - a list of CmsResource instances to be published directly
publishSiblings - indicates if all siblings of the selected resources should be published

CmsPublishList

public CmsPublishList(java.util.List directPublishResources,
                      boolean publishSiblings,
                      boolean publishSubResources)
Constructs a publish list for a list of direct publish resources.

Parameters:
directPublishResources - a list of CmsResource instances to be published directly
publishSiblings - indicates if all siblings of the selected resources should be published
publishSubResources - indicates if sub-resources in folders should be published (for direct publish only)
Method Detail

getDeletedFolderList

public java.util.List getDeletedFolderList()
Returns a list of folder resources with the given state.

Returns:
a list of folder resources with the desired state

getDirectPublishResources

public java.util.List getDirectPublishResources()
Returns the list of resources that should be published for a "direct" publish operation.

Will return null if this publish list was not initilaized for a "direct publish" but for a project publish.

Returns:
the list of resources that should be published for a "direct" publish operation, or null

getFileList

public java.util.List getFileList()
Returns an unmodifiable list of the Cms file resources in this publish list.

Returns:
the list with the Cms file resources in this publish list

getFolderList

public java.util.List getFolderList()
Returns an unmodifiable list of the new/changed Cms folder resources in this publish list.

Returns:
the list with the new/changed Cms file resources in this publish list

getProjectId

public int getProjectId()
Returns the id of the project that should be published, or -1 if this publish list is initialized for a "direct publish" operation.

Returns:
the id of the project that should be published, or -1

getPublishHistoryId

public CmsUUID getPublishHistoryId()
Returns the publish history Id for this publish list.

Returns:
the publish history Id

isDirectPublish

public boolean isDirectPublish()
Checks if this is a publish list is used for a "direct publish" operation.

Returns:
true if this is a publish list is used for a "direct publish" operation

isPublishSiblings

public boolean isPublishSiblings()
Returns true if all siblings of the project resources are to be published.

Returns:
true if all siblings of the project resources are to be publisheds

isPublishSubResources

public boolean isPublishSubResources()
Returns true if sub-resources in folders should be published (for direct publish only).

Returns:
true if sub-resources in folders should be published (for direct publish only)

toString

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

addFile

protected void addFile(CmsResource resource)
                throws CmsIllegalArgumentException
Adds a new/changed/deleted Cms file resource to the publish list.

Parameters:
resource - a new/changed/deleted Cms file resource
Throws:
CmsIllegalArgumentException - if the specified resource is not a file or unchanged

addFiles

protected void addFiles(java.util.List list)
                 throws java.lang.IllegalArgumentException
Appends all of the new/changed/deleted Cms file resources in the specified list to the end of this publish list.

Parameters:
list - a list with new/changed/deleted Cms file resources to be added to this publish list
Throws:
java.lang.IllegalArgumentException - if one of the resources is not a file or unchanged

addFolder

protected void addFolder(CmsResource resource)
                  throws java.lang.IllegalArgumentException
Adds a new/changed Cms folder resource to the publish list.

Parameters:
resource - a new/changed Cms folder resource
Throws:
java.lang.IllegalArgumentException - if the specified resource is not a folder or unchanged

addFolders

protected void addFolders(java.util.List list)
                   throws java.lang.IllegalArgumentException
Appends all of the new/changed Cms folder resources in the specified list to the end of this publish list.

Parameters:
list - a list with new/changed Cms folder resources to be added to this publish list
Throws:
java.lang.IllegalArgumentException - if one of the resources is not a folder or unchanged

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable
See Also:
Object.finalize()

getFolderListInstance

protected java.util.List getFolderListInstance()
Returns the list with the new/changed Cms folder resources.

Returns:
the list with the new/changed Cms folder resources

initialize

protected void initialize()
Initializes the publish list, ensuring all internal lists are in the right order.


remove

protected boolean remove(CmsResource resource)
Removes a Cms resource from the publish list.

Parameters:
resource - a Cms resource
Returns:
true if this publish list contains the specified resource
See Also:
List.remove(java.lang.Object)