Class A_CmsResourceTypeFolderBase
- All Implemented Interfaces:
Serializable
,I_CmsConfigurationParameterHandler
,I_CmsResourceType
- Direct Known Subclasses:
CmsResourceTypeFolder
,CmsResourceTypeFolderExtended
,CmsResourceTypeUnknownFolder
- Since:
- 6.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opencms.file.types.I_CmsResourceType
I_CmsResourceType.Formatter
-
Field Summary
FieldsFields inherited from class org.opencms.file.types.A_CmsResourceType
CONFIGURATION_GALLERY_JAVASCRIPT_PATH, CONFIGURATION_GALLERY_PREVIEW_PROVIDER, CONFIGURATION_GALLERY_TYPE_NAMES, CONFIGURATION_INTERNAL, DEFAULT_GALLERY_PREVIEW_PROVIDER, m_addititionalModuleResourceType, m_className, m_configuration, m_copyResources, m_defaultProperties, m_frozen, m_galleryPreviewProvider, m_mappings, m_moduleName, m_typeId, m_typeName, MACRO_RESOURCE_FOLDER_PATH, MACRO_RESOURCE_FOLDER_PATH_TOUCH, MACRO_RESOURCE_NAME, MACRO_RESOURCE_PARENT_PATH, MACRO_RESOURCE_ROOT_PATH, MACRO_RESOURCE_SITE_PATH
Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
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
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor, used to initialize member variables. -
Method Summary
Modifier and TypeMethodDescriptionvoid
chtype
(CmsObject cms, CmsSecurityManager securityManager, CmsResource filename, int newType) Changes the resource type of a resource.void
copyResource
(CmsObject cms, CmsSecurityManager securityManager, CmsResource source, String destination, CmsResource.CmsResourceCopyMode siblingMode) Copies a resource.createResource
(CmsObject cms, CmsSecurityManager securityManager, String resourcename, byte[] content, List<CmsProperty> properties) Creates a new resource of the given resource type with the provided content and properties.int
Returns the loader type id of this resource type.boolean
isFolder()
Returnstrue
if this resource type is a folder.void
moveResource
(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, String destination) Moves a resource to the given destination.void
replaceResource
(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int type, byte[] content, List<CmsProperty> properties) Replaces the content, type and properties of a resource.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
undelete
(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, boolean recursive) Undeletes a resource.void
undoChanges
(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsResource.CmsResourceUndoMode mode) 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, chtype, copyResourceToProject, createRelations, createSibling, deleteResource, equals, getAdjustLinksFolder, getCachePropertyDefault, getClassName, getConfiguration, getConfiguredCopyResources, getConfiguredDefaultProperties, getConfiguredMappings, getCopyResources, getFormattersForResource, getGalleryPreviewProvider, getGalleryTypes, getMacroResolver, getModuleName, getResourceType, getTypeId, getTypeName, hashCode, importResource, initConfiguration, initConfiguration, initialize, isAdditionalModuleResourceType, isDirectEditable, isIdentical, lockResource, processCopyResources, processDefaultProperties, removeResourceFromProject, replaceResource, restoreResource, setAdditionalModuleResourceType, setAdjustLinksFolder, setModuleName, toString, unlockResource, updateRelationForUndo, writeFile, writePropertyObject, writePropertyObjects
-
Field Details
-
ATTR_SHALLOW_FOLDER_COPY
Attribute to control shallow copying.- See Also:
-
-
Constructor Details
-
A_CmsResourceTypeFolderBase
public A_CmsResourceTypeFolderBase()Default constructor, used to initialize member variables.
-
-
Method Details
-
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 interfaceI_CmsResourceType
- Overrides:
chtype
in classA_CmsResourceType
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerfilename
- the resource to change the type fornewType
- the new resource type for this resource- Throws:
CmsException
- if something goes wrongCmsDataNotImplementedException
- See Also:
-
copyResource
public void copyResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource source, String destination, CmsResource.CmsResourceCopyMode 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 interfaceI_CmsResourceType
- Overrides:
copyResource
in classA_CmsResourceType
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managersource
- the resource to copydestination
- the name of the copy destination with complete pathsiblingMode
- indicates how to handle siblings during copy- Throws:
CmsIllegalArgumentException
- if thedestination
argument is null or of length 0CmsException
- if something goes wrong- See Also:
-
createResource
public CmsResource createResource(CmsObject cms, CmsSecurityManager securityManager, String resourcename, byte[] content, List<CmsProperty> 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 interfaceI_CmsResourceType
- Overrides:
createResource
in classA_CmsResourceType
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresourcename
- the name of the resource to create (full path)content
- the content for the new resourceproperties
- the properties for the new resource- Returns:
- the created resource
- Throws:
CmsException
- if something goes wrong- See Also:
-
getLoaderId
Description copied from interface:I_CmsResourceType
Returns the loader type id of this resource type.- Specified by:
getLoaderId
in interfaceI_CmsResourceType
- Specified by:
getLoaderId
in classA_CmsResourceType
- Returns:
- the loader type id of this resource type
- See Also:
-
isFolder
Description copied from interface:I_CmsResourceType
Returnstrue
if this resource type is a folder.- Specified by:
isFolder
in interfaceI_CmsResourceType
- Overrides:
isFolder
in classA_CmsResourceType
- Returns:
true
if this resource type is a folder- See Also:
-
moveResource
public void moveResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, 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 interfaceI_CmsResourceType
- Overrides:
moveResource
in classA_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to movedestination
- the destination resource name- Throws:
CmsException
- if something goes wrongCmsIllegalArgumentException
- if thesource
argument is null or of length 0- See Also:
-
replaceResource
public void replaceResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int type, byte[] content, List<CmsProperty> properties) throws CmsException, CmsDataNotImplementedException Description copied from interface:I_CmsResourceType
Replaces the content, type and properties of a resource.- Specified by:
replaceResource
in interfaceI_CmsResourceType
- Overrides:
replaceResource
in classA_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the name of the resource to replacetype
- the new type of the resourcecontent
- the new content of the resourceproperties
- the new properties of the resource- Throws:
CmsException
- if something goes wrongCmsDataNotImplementedException
- See Also:
-
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 interfaceI_CmsResourceType
- Overrides:
setDateExpired
in classA_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to touchdateLastModified
- the new expire date of the changed resourcerecursive
- if this operation is to be applied recursively to all resources in a folder- Throws:
CmsException
- if something goes wrong- See Also:
-
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 interfaceI_CmsResourceType
- Overrides:
setDateLastModified
in classA_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to touchdateLastModified
- timestamp the new timestamp of the changed resourcerecursive
- if this operation is to be applied recursively to all resources in a folder- Throws:
CmsException
- if something goes wrong- See Also:
-
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 interfaceI_CmsResourceType
- Overrides:
setDateReleased
in classA_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to touchdateLastModified
- the new release date of the changed resourcerecursive
- if this operation is to be applied recursively to all resources in a folder- Throws:
CmsException
- if something goes wrong- See Also:
-
undelete
public void undelete(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, boolean recursive) throws CmsException Description copied from interface:I_CmsResourceType
Undeletes a resource.Only resources that have already been published once can be undeleted, if a "new" resource is deleted it can not be undeleted.
- Specified by:
undelete
in interfaceI_CmsResourceType
- Overrides:
undelete
in classA_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to undeleterecursive
- if this operation is to be applied recursively to all resources in a folder- Throws:
CmsException
- if something goes wrong- See Also:
-
undoChanges
public void undoChanges(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsResource.CmsResourceUndoMode mode) 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.- Specified by:
undoChanges
in interfaceI_CmsResourceType
- Overrides:
undoChanges
in classA_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to undo the changes formode
- the undo mode, one of the
constantsCmsResource.CmsResourceUndoMode
#UNDO_XXX- Throws:
CmsException
- if something goes wrong- See Also:
-