org.opencms.file.types
Class A_CmsResourceTypeFolderBase

java.lang.Object
  extended byorg.opencms.file.types.A_CmsResourceType
      extended byorg.opencms.file.types.A_CmsResourceTypeFolderBase
All Implemented Interfaces:
I_CmsConfigurationParameterHandler, I_CmsResourceType
Direct Known Subclasses:
CmsResourceTypeFolder, CmsResourceTypeFolderExtended

public abstract class A_CmsResourceTypeFolderBase
extends A_CmsResourceType

Resource type descriptor for the type "folder".

Since:
6.0.0
Version:
$Revision: 1.16 $
Author:
Alexander Kandzior

Field Summary
 
Fields inherited from class org.opencms.file.types.A_CmsResourceType
m_addititionalModuleResourceType, m_className, m_copyResources, m_defaultProperties, m_frozen, m_mappings, m_typeId, m_typeName, MACRO_RESOURCE_FOLDER_PATH, MACRO_RESOURCE_NAME, MACRO_RESOURCE_PARENT_PATH, MACRO_RESOURCE_ROOT_PATH, MACRO_RESOURCE_SITE_PATH
 
Fields inherited from interface org.opencms.file.types.I_CmsResourceType
ADD_MAPPING_METHOD, ADD_RESOURCE_TYPE_METHOD, CONFIGURATION_PROPERTY_CREATE, CONFIGURATION_RESOURCE_TYPE_ID, CONFIGURATION_RESOURCE_TYPE_NAME, PROPERTY_ON_RESOURCE, PROPERTY_ON_STRUCTURE
 
Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
 
Constructor Summary
A_CmsResourceTypeFolderBase()
          Default constructor, used to initialize member variables.
 
Method Summary
 void changeLastModifiedProjectId(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource)
          Changes the project id of the resource to the current project, indicating that the resource was last modified in this project.
 void chtype(CmsObject cms, CmsSecurityManager securityManager, CmsResource filename, int newType)
          Changes the resource type of a resource.
 void copyResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource source, java.lang.String destination, int siblingMode)
          Copies a resource.
 CmsResource createResource(CmsObject cms, CmsSecurityManager securityManager, java.lang.String resourcename, byte[] content, java.util.List properties)
          Creates a new resource of the given resource type with the provided content and properties.
 void deleteResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int siblingMode)
          Deletes a resource given its name.
 int getLoaderId()
          Returns the loader type id of this resource type.
 boolean isFolder()
          Returns true if this resource type is a folder.
 void moveResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, java.lang.String destination)
          Moves a resource to the given destination.
 void replaceResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int type, byte[] content, java.util.List properties)
          Replaces the content, type and properties of a resource.
 void restoreResourceBackup(CmsObject cms, CmsSecurityManager securityManager, CmsResource resourename, int tag)
          Restores a file in the current project with a version from the backup archive.
 void setDateExpired(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateLastModified, boolean recursive)
          Changes the "expire" date of a resource.
 void setDateLastModified(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateLastModified, boolean recursive)
          Changes the "last modified" date of a resource.
 void setDateReleased(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateLastModified, boolean recursive)
          Changes the "release" date of a resource.
 void undoChanges(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, boolean recursive)
          Undos all changes in the resource by restoring the version from the online project to the current offline project.
 
Methods inherited from class org.opencms.file.types.A_CmsResourceType
addConfigurationParameter, addCopyResource, addDefaultProperty, addMappingType, changeLock, chflags, copyResourceToProject, createSibling, getCachePropertyDefault, getClassName, getConfiguration, getConfiguredCopyResources, getConfiguredDefaultProperties, getConfiguredMappings, getMacroResolver, getResourceType, getTypeId, getTypeName, importResource, initConfiguration, initConfiguration, initConfiguration, initialize, isAdditionalModuleResourceType, isDirectEditable, lockResource, processCopyResources, processDefaultProperties, removeResourceFromProject, setAdditionalModuleResourceType, toString, unlockResource, writeFile, writePropertyObject, writePropertyObjects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

A_CmsResourceTypeFolderBase

public A_CmsResourceTypeFolderBase()
Default constructor, used to initialize member variables.

Method Detail

changeLastModifiedProjectId

public void changeLastModifiedProjectId(CmsObject cms,
                                        CmsSecurityManager securityManager,
                                        CmsResource resource)
                                 throws CmsException
Description copied from interface: I_CmsResourceType
Changes the project id of the resource to the current project, indicating that the resource was last modified in this project.

This information is used while publishing. Only resources inside the project folders that are new/modified/changed and that "belong" to the project (i.e. have the id of the project set) are published with the project.

Specified by:
changeLastModifiedProjectId in interface I_CmsResourceType
Overrides:
changeLastModifiedProjectId in class A_CmsResourceType
Throws:
CmsException
See Also:
I_CmsResourceType.changeLastModifiedProjectId(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource)

chtype

public void chtype(CmsObject cms,
                   CmsSecurityManager securityManager,
                   CmsResource filename,
                   int newType)
            throws CmsException,
                   CmsDataNotImplementedException
Description copied from interface: I_CmsResourceType
Changes the resource type of a resource.

OpenCms handles resources according to the resource type, not the file suffix. This is e.g. why a JSP in OpenCms can have the suffix ".html" instead of ".jsp" only. Changing the resource type makes sense e.g. if you want to make a plain text file a JSP resource, or a binary file an image, etc.

Specified by:
chtype in interface I_CmsResourceType
Overrides:
chtype in class A_CmsResourceType
Throws:
CmsException
CmsDataNotImplementedException
See Also:
I_CmsResourceType.chtype(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int)

copyResource

public void copyResource(CmsObject cms,
                         CmsSecurityManager securityManager,
                         CmsResource source,
                         java.lang.String destination,
                         int siblingMode)
                  throws CmsIllegalArgumentException,
                         CmsException
Description copied from interface: I_CmsResourceType
Copies a resource.

You must ensure that the destination path is an absolute, valid and existing VFS path. Relative paths from the source are currently not supported.

The copied resource will always be locked to the current user after the copy operation.

In case the target resource already exists, it is overwritten with the source resource.

The siblingMode parameter controls how to handle siblings during the copy operation.
Possible values for this parameter are:

Specified by:
copyResource in interface I_CmsResourceType
Overrides:
copyResource in class A_CmsResourceType
Throws:
CmsIllegalArgumentException
CmsException
See Also:
I_CmsResourceType.copyResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, java.lang.String, int)

createResource

public CmsResource createResource(CmsObject cms,
                                  CmsSecurityManager securityManager,
                                  java.lang.String resourcename,
                                  byte[] content,
                                  java.util.List properties)
                           throws CmsException
Description copied from interface: I_CmsResourceType
Creates a new resource of the given resource type with the provided content and properties.

Specified by:
createResource in interface I_CmsResourceType
Overrides:
createResource in class A_CmsResourceType
Throws:
CmsException
See Also:
I_CmsResourceType.createResource(org.opencms.file.CmsObject, CmsSecurityManager, java.lang.String, byte[], List)

deleteResource

public void deleteResource(CmsObject cms,
                           CmsSecurityManager securityManager,
                           CmsResource resource,
                           int siblingMode)
                    throws CmsException
Description copied from interface: I_CmsResourceType
Deletes a resource given its name.

The siblingMode parameter controls how to handle siblings during the delete operation.
Possible values for this parameter are:

Specified by:
deleteResource in interface I_CmsResourceType
Overrides:
deleteResource in class A_CmsResourceType
Throws:
CmsException
See Also:
I_CmsResourceType.deleteResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int)

getLoaderId

public int getLoaderId()
Description copied from interface: I_CmsResourceType
Returns the loader type id of this resource type.

Specified by:
getLoaderId in interface I_CmsResourceType
Specified by:
getLoaderId in class A_CmsResourceType
See Also:
I_CmsResourceType.getLoaderId()

isFolder

public boolean isFolder()
Description copied from interface: I_CmsResourceType
Returns true if this resource type is a folder.

Specified by:
isFolder in interface I_CmsResourceType
Overrides:
isFolder in class A_CmsResourceType
See Also:
A_CmsResourceType.isFolder()

moveResource

public void moveResource(CmsObject cms,
                         CmsSecurityManager securityManager,
                         CmsResource resource,
                         java.lang.String destination)
                  throws CmsException,
                         CmsIllegalArgumentException
Description copied from interface: I_CmsResourceType
Moves a resource to the given destination.

A move operation in OpenCms is always a copy (as sibling) followed by a delete, this is a result of the online/offline structure of the OpenCms VFS. This way you can see the deleted files/folders in the offline project, and you will be unable to undelete them.

Specified by:
moveResource in interface I_CmsResourceType
Overrides:
moveResource in class A_CmsResourceType
Throws:
CmsException
CmsIllegalArgumentException
See Also:
I_CmsResourceType.moveResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, java.lang.String)

replaceResource

public void replaceResource(CmsObject cms,
                            CmsSecurityManager securityManager,
                            CmsResource resource,
                            int type,
                            byte[] content,
                            java.util.List properties)
                     throws CmsException,
                            CmsDataNotImplementedException
Description copied from interface: I_CmsResourceType
Replaces the content, type and properties of a resource.

Specified by:
replaceResource in interface I_CmsResourceType
Overrides:
replaceResource in class A_CmsResourceType
Throws:
CmsException
CmsDataNotImplementedException
See Also:
I_CmsResourceType.replaceResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int, byte[], List)

restoreResourceBackup

public void restoreResourceBackup(CmsObject cms,
                                  CmsSecurityManager securityManager,
                                  CmsResource resourename,
                                  int tag)
                           throws CmsException
Description copied from interface: I_CmsResourceType
Restores a file in the current project with a version from the backup archive.

Specified by:
restoreResourceBackup in interface I_CmsResourceType
Overrides:
restoreResourceBackup in class A_CmsResourceType
Throws:
CmsException
See Also:
I_CmsResourceType.restoreResourceBackup(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int)

setDateExpired

public void setDateExpired(CmsObject cms,
                           CmsSecurityManager securityManager,
                           CmsResource resource,
                           long dateLastModified,
                           boolean recursive)
                    throws CmsException
Description copied from interface: I_CmsResourceType
Changes the "expire" date of a resource.

Specified by:
setDateExpired in interface I_CmsResourceType
Overrides:
setDateExpired in class A_CmsResourceType
Throws:
CmsException
See Also:
I_CmsResourceType.setDateExpired(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, long, boolean)

setDateLastModified

public void setDateLastModified(CmsObject cms,
                                CmsSecurityManager securityManager,
                                CmsResource resource,
                                long dateLastModified,
                                boolean recursive)
                         throws CmsException
Description copied from interface: I_CmsResourceType
Changes the "last modified" date of a resource.

Specified by:
setDateLastModified in interface I_CmsResourceType
Overrides:
setDateLastModified in class A_CmsResourceType
Throws:
CmsException
See Also:
I_CmsResourceType.setDateLastModified(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, long, boolean)

setDateReleased

public void setDateReleased(CmsObject cms,
                            CmsSecurityManager securityManager,
                            CmsResource resource,
                            long dateLastModified,
                            boolean recursive)
                     throws CmsException
Description copied from interface: I_CmsResourceType
Changes the "release" date of a resource.

Specified by:
setDateReleased in interface I_CmsResourceType
Overrides:
setDateReleased in class A_CmsResourceType
Throws:
CmsException
See Also:
I_CmsResourceType.setDateReleased(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, long, boolean)

undoChanges

public void undoChanges(CmsObject cms,
                        CmsSecurityManager securityManager,
                        CmsResource resource,
                        boolean recursive)
                 throws CmsException
Description copied from interface: I_CmsResourceType
Undos all changes in the resource by restoring the version from the online project to the current offline project.

This is also used when doing an "undelete" operation.

Specified by:
undoChanges in interface I_CmsResourceType
Overrides:
undoChanges in class A_CmsResourceType
Throws:
CmsException
See Also:
I_CmsResourceType.undoChanges(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, boolean)