Class A_CmsResourceType
- java.lang.Object
-
- org.opencms.file.types.A_CmsResourceType
-
- All Implemented Interfaces:
java.io.Serializable
,I_CmsConfigurationParameterHandler
,I_CmsResourceType
- Direct Known Subclasses:
A_CmsResourceTypeFolderBase
,A_CmsResourceTypeLinkParseable
,CmsResourceTypeBinary
,CmsResourceTypeImage
,CmsResourceTypePlain
,CmsResourceTypePointer
,CmsResourceTypeUnknown
,CmsResourceTypeUnknownFile
public abstract class A_CmsResourceType extends java.lang.Object implements I_CmsResourceType
Base implementation for resource type classes.- Since:
- 6.0.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opencms.file.types.I_CmsResourceType
I_CmsResourceType.Formatter
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONFIGURATION_GALLERY_JAVASCRIPT_PATH
Configuration key for optional javascript in galleries.static java.lang.String
CONFIGURATION_GALLERY_PREVIEW_PROVIDER
Configuration key for optional preview provider in galleries.static java.lang.String
CONFIGURATION_GALLERY_TYPE_NAMES
Configuration key for the optional folder class name.static java.lang.String
CONFIGURATION_INTERNAL
Configuration key for the (optional) internal flag.static java.lang.String
DEFAULT_GALLERY_PREVIEW_PROVIDER
The default gallery preview provider.protected boolean
m_addititionalModuleResourceType
Flag for showing that this is an additional resource type which is defined in a module.protected java.lang.String
m_className
The configured class name of this resource type.protected CmsParameterConfiguration
m_configuration
Configuration parameters.protected java.util.List<CmsConfigurationCopyResource>
m_copyResources
The list of resources to copy.protected java.util.List<CmsProperty>
m_defaultProperties
The list of configured default properties.protected boolean
m_frozen
Indicates that the configuration of the resource type has been frozen.protected java.lang.String
m_galleryPreviewProvider
The gallery preview provider.protected java.util.List<java.lang.String>
m_mappings
Contains the file extensions mapped to this resource type.protected java.lang.String
m_moduleName
The module name if this is an additional resource type which is defined in a module.protected int
m_typeId
The configured id of this resource type.protected java.lang.String
m_typeName
The configured name of this resource type.static java.lang.String
MACRO_RESOURCE_FOLDER_PATH
Macro for the folder path of the current resource.static java.lang.String
MACRO_RESOURCE_FOLDER_PATH_TOUCH
Macro for the folder path of the current resource, with touch enabled for the copied resources.static java.lang.String
MACRO_RESOURCE_NAME
Macro for the name of the current resource.static java.lang.String
MACRO_RESOURCE_PARENT_PATH
Macro for the parent folder path of the current resource.static java.lang.String
MACRO_RESOURCE_ROOT_PATH
Macro for the root path of the current resource.static java.lang.String
MACRO_RESOURCE_SITE_PATH
Macro for the site path of the current resource.-
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
Constructors Constructor Description A_CmsResourceType()
Default constructor, used to initialize some member variables.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addConfigurationParameter(java.lang.String paramName, java.lang.String paramValue)
Adds a configuration parameter to this parameter configurable class instance.void
addCopyResource(java.lang.String source, java.lang.String target, java.lang.String type)
Adds a new "copy resource" to this resource type, allowed only during the configuration phase.void
addDefaultProperty(CmsProperty property)
Adds a default property to this resource type, allowed only during the configuration phase.void
addMappingType(java.lang.String mapping)
Maps a file extension to a resource type.void
changeLock(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource)
Changes the lock of a resource to the current user, that is "steals" the lock from another user.void
chflags(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int flags)
Changes the resource flags of a resource.void
chtype(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int type)
Deprecated.void
chtype(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, I_CmsResourceType type)
Changes the resource type of a resource.void
copyResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource source, java.lang.String destination, CmsResource.CmsResourceCopyMode siblingMode)
Copies a resource.void
copyResourceToProject(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource)
Copies a resource to the current project of the user.protected CmsResource
createRelations(CmsObject cms, CmsSecurityManager securityManager, java.lang.String resourceName)
Creates the relation information for the resource with the given resource name.CmsResource
createResource(CmsObject cms, CmsSecurityManager securityManager, java.lang.String resourcename, byte[] content, java.util.List<CmsProperty> properties)
Creates a new resource of the given resource type with the provided content and properties.CmsResource
createSibling(CmsObject cms, CmsSecurityManager securityManager, CmsResource source, java.lang.String destination, java.util.List<CmsProperty> properties)
Creates a new sibling of the source resource.void
deleteResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode)
Deletes a resource given its name.boolean
equals(java.lang.Object obj)
Returnstrue
, if this resource type is equal to the given Object.java.lang.String
getAdjustLinksFolder()
Gets the folder for which the links should be adjusted after processing the copy resources.java.lang.String
getCachePropertyDefault()
Returns the default for thecache
property setting of this resource type.java.lang.String
getClassName()
Returns the configured class name of this resource type.CmsParameterConfiguration
getConfiguration()
Returns the parameters of this configurable class instance, ornull
if the class does not need any parameters.java.util.List<CmsConfigurationCopyResource>
getConfiguredCopyResources()
Returns the (unmodifiable) list of copy resources.java.util.List<CmsProperty>
getConfiguredDefaultProperties()
Returns the default properties for this resource type in an unmodifiable List.java.util.List<java.lang.String>
getConfiguredMappings()
Returns the file extensions mappings for this resource type in an unmodifiable List.protected java.util.List<CmsConfigurationCopyResource>
getCopyResources(CmsObject cms, java.lang.String resourcename, CmsMacroResolver resolver)
Gets the actual copy resources to use when creating a resource.CmsFormatterConfiguration
getFormattersForResource(CmsObject cms, CmsResource res)
Returns the formatter configuration for the given resource.java.lang.String
getGalleryPreviewProvider()
Returns the gallery preview provider class name.java.util.List<I_CmsResourceType>
getGalleryTypes()
Returns the gallery types for this resource type.abstract int
getLoaderId()
Returns the loader type id of this resource type.protected CmsMacroResolver
getMacroResolver(CmsObject cms, java.lang.String resourcename)
Creates a macro resolver based on the current users OpenCms context and the provided resource name.java.lang.String
getModuleName()
Returns the module name if this is an additional resource type which is defined in a module, ornull
.protected I_CmsResourceType
getResourceType(CmsResource resource)
Convenience method to get the initialized resource type instance for the given resource, with a fall back to special "unknown" resource types in case the resource type is not configured.int
getTypeId()
Deprecated.Use this class orgetTypeName()
instead.java.lang.String
getTypeName()
Returns the name of this resource type.int
hashCode()
The hash code implementation uses the type name to generate a hash code.CmsResource
importResource(CmsObject cms, CmsSecurityManager securityManager, I_CmsReport report, java.lang.String resourcename, CmsResource resource, byte[] content, java.util.List<CmsProperty> properties)
Imports a resource to the OpenCms VFS.void
initConfiguration()
Initializes a configuration after all parameters have been added.void
initConfiguration(java.lang.String name, java.lang.String id, java.lang.String className)
Special version of the configuration initialization used with resource types to set resource type, id and class name, required for the XML configuration.void
initialize(CmsObject cms)
Initializes this resource type.boolean
isAdditionalModuleResourceType()
Indicates that this is an additional resource type which is defined in a module.boolean
isDirectEditable()
Returnstrue
if this resource type is direct editable.boolean
isFolder()
Returnstrue
if this resource type is a folder.boolean
isIdentical(I_CmsResourceType type)
Tests if the given resource type definition is identical to this resource type definition.void
lockResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsLockType type)
Locks a resource.void
moveResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, java.lang.String destination)
Moves a resource to the given destination.protected void
processCopyResources(CmsObject cms, java.lang.String resourcename, CmsMacroResolver resolver)
Processes the copy resources of this resource type.protected java.util.List<CmsProperty>
processDefaultProperties(java.util.List<CmsProperty> properties, CmsMacroResolver resolver)
Returns a list of property objects that are attached to the resource on creation.void
removeResourceFromProject(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource)
Removes a resource from the current project of the user.void
replaceResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int type, byte[] content, java.util.List<CmsProperty> properties)
Deprecated.void
replaceResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, I_CmsResourceType type, byte[] content, java.util.List<CmsProperty> properties)
Replaces the content, type and properties of a resource.void
restoreResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int version)
Restores a resource in the current project with a version from the historical archive.void
setAdditionalModuleResourceType(boolean additionalType)
Sets the additional resource type flag.void
setAdjustLinksFolder(java.lang.String adjustLinksFolder)
Sets the folder for adjusting links after copying the copy-resources.void
setDateExpired(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateExpired, 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 dateReleased, boolean recursive)
Changes the "release" date of a resource.void
setModuleName(java.lang.String moduleName)
Sets the module name if this is an additional resource type which is defined in a module, ornull
.java.lang.String
toString()
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.void
unlockResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource)
Unlocks a resource.protected void
updateRelationForUndo(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource)
Update the relations after an undo changes operation.CmsFile
writeFile(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource)
Writes a resource, including it's content.void
writePropertyObject(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsProperty property)
Writes a property for a specified resource.void
writePropertyObjects(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, java.util.List<CmsProperty> properties)
Writes a list of properties for a specified resource.
-
-
-
Field Detail
-
CONFIGURATION_GALLERY_JAVASCRIPT_PATH
public static final java.lang.String CONFIGURATION_GALLERY_JAVASCRIPT_PATH
Configuration key for optional javascript in galleries.- See Also:
- Constant Field Values
-
CONFIGURATION_GALLERY_PREVIEW_PROVIDER
public static final java.lang.String CONFIGURATION_GALLERY_PREVIEW_PROVIDER
Configuration key for optional preview provider in galleries.- See Also:
- Constant Field Values
-
CONFIGURATION_GALLERY_TYPE_NAMES
public static final java.lang.String CONFIGURATION_GALLERY_TYPE_NAMES
Configuration key for the optional folder class name.- See Also:
- Constant Field Values
-
CONFIGURATION_INTERNAL
public static final java.lang.String CONFIGURATION_INTERNAL
Configuration key for the (optional) internal flag.- See Also:
- Constant Field Values
-
DEFAULT_GALLERY_PREVIEW_PROVIDER
public static final java.lang.String DEFAULT_GALLERY_PREVIEW_PROVIDER
The default gallery preview provider.- See Also:
- Constant Field Values
-
MACRO_RESOURCE_FOLDER_PATH
public static final java.lang.String MACRO_RESOURCE_FOLDER_PATH
Macro for the folder path of the current resource.- See Also:
- Constant Field Values
-
MACRO_RESOURCE_FOLDER_PATH_TOUCH
public static final java.lang.String MACRO_RESOURCE_FOLDER_PATH_TOUCH
Macro for the folder path of the current resource, with touch enabled for the copied resources.- See Also:
- Constant Field Values
-
MACRO_RESOURCE_NAME
public static final java.lang.String MACRO_RESOURCE_NAME
Macro for the name of the current resource.- See Also:
- Constant Field Values
-
MACRO_RESOURCE_PARENT_PATH
public static final java.lang.String MACRO_RESOURCE_PARENT_PATH
Macro for the parent folder path of the current resource.- See Also:
- Constant Field Values
-
MACRO_RESOURCE_ROOT_PATH
public static final java.lang.String MACRO_RESOURCE_ROOT_PATH
Macro for the root path of the current resource.- See Also:
- Constant Field Values
-
MACRO_RESOURCE_SITE_PATH
public static final java.lang.String MACRO_RESOURCE_SITE_PATH
Macro for the site path of the current resource.- See Also:
- Constant Field Values
-
m_addititionalModuleResourceType
protected boolean m_addititionalModuleResourceType
Flag for showing that this is an additional resource type which is defined in a module.
-
m_className
protected java.lang.String m_className
The configured class name of this resource type.
-
m_configuration
protected CmsParameterConfiguration m_configuration
Configuration parameters.
-
m_copyResources
protected java.util.List<CmsConfigurationCopyResource> m_copyResources
The list of resources to copy.
-
m_defaultProperties
protected java.util.List<CmsProperty> m_defaultProperties
The list of configured default properties.
-
m_frozen
protected boolean m_frozen
Indicates that the configuration of the resource type has been frozen.
-
m_galleryPreviewProvider
protected java.lang.String m_galleryPreviewProvider
The gallery preview provider.
-
m_mappings
protected java.util.List<java.lang.String> m_mappings
Contains the file extensions mapped to this resource type.
-
m_moduleName
protected java.lang.String m_moduleName
The module name if this is an additional resource type which is defined in a module.
-
m_typeId
protected int m_typeId
The configured id of this resource type.
-
m_typeName
protected java.lang.String m_typeName
The configured name of this resource type.
-
-
Constructor Detail
-
A_CmsResourceType
public A_CmsResourceType()
Default constructor, used to initialize some member variables.
-
-
Method Detail
-
addConfigurationParameter
public void addConfigurationParameter(java.lang.String paramName, java.lang.String paramValue)
Description copied from interface:I_CmsConfigurationParameterHandler
Adds a configuration parameter to this parameter configurable class instance.- Specified by:
addConfigurationParameter
in interfaceI_CmsConfigurationParameterHandler
- Parameters:
paramName
- the name of the parameterparamValue
- the value for the parameter- See Also:
I_CmsConfigurationParameterHandler.addConfigurationParameter(java.lang.String, java.lang.String)
-
addCopyResource
public void addCopyResource(java.lang.String source, java.lang.String target, java.lang.String type) throws CmsConfigurationException
Adds a new "copy resource" to this resource type, allowed only during the configuration phase.The "copy resources" are copied to the specified location after a new resource of this type is created. Usually this feature is used to populate a newly created folder with some default resources.
If target is
null
, the macroMACRO_RESOURCE_FOLDER_PATH
is used as default. If type isnull
, the copy typeCmsResource.COPY_AS_NEW
is used as default.- Parameters:
source
- the source resourcetarget
- the target resource (may contain macros)type
- the type of the copy, for example "as new", "as sibling" etc- Throws:
CmsConfigurationException
- if the configuration is already frozen
-
addDefaultProperty
public void addDefaultProperty(CmsProperty property) throws CmsConfigurationException
Adds a default property to this resource type, allowed only during the configuration phase.- Parameters:
property
- the default property to add- Throws:
CmsConfigurationException
- if the configuration is already frozen
-
addMappingType
public void addMappingType(java.lang.String mapping)
Description copied from interface:I_CmsResourceType
Maps a file extension to a resource type.When uploading files into OpenCms, they must be mapped to the different OpenCms resource types. The configuration, to map which extension to which resouce type is done in the OpenCms VFS configuration.
- Specified by:
addMappingType
in interfaceI_CmsResourceType
- Parameters:
mapping
- the file extension mapped to the resource type- See Also:
I_CmsResourceType.addMappingType(java.lang.String)
-
changeLock
public void changeLock(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource) throws CmsException
Description copied from interface:I_CmsResourceType
Changes the lock of a resource to the current user, that is "steals" the lock from another user.- Specified by:
changeLock
in interfaceI_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the name of the resource to change the lock with complete path- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.changeLock(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource)
-
chflags
public void chflags(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int flags) throws CmsException
Description copied from interface:I_CmsResourceType
Changes the resource flags of a resource.The resource flags are used to indicate various "special" conditions for a resource. Most notably, the "internal only" setting which signals that a resource can not be directly requested with it's URL.
- Specified by:
chflags
in interfaceI_CmsResourceType
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresource
- the resource to change the flags forflags
- the new resource flags for this resource- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.chflags(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int)
-
chtype
public void chtype(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, I_CmsResourceType type) throws CmsException
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
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresource
- the resource to change the type fortype
- the new resource type for this resource- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.chtype(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource, org.opencms.file.types.I_CmsResourceType)
-
chtype
@Deprecated public void chtype(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int type) throws CmsException
Deprecated.Usechtype(CmsObject, CmsSecurityManager, CmsResource, I_CmsResourceType)
instead. Resource types should always be referenced either by its type class (preferred) or by type name. Use of int based resource type references will be discontinued in a future OpenCms release.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
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresource
- the resource to change the type fortype
- the new resource type for this resource- Throws:
CmsException
- if something goes wrong- 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, CmsResource.CmsResourceCopyMode siblingMode) throws 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
- 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:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.copyResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, java.lang.String, CmsResource.CmsResourceCopyMode)
-
copyResourceToProject
public void copyResourceToProject(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource) throws CmsException
Description copied from interface:I_CmsResourceType
Copies a resource to the current project of the user.This is used to extend the current users project with the specified resource, in case that the resource is not yet part of the project. The resource is not really copied like in a regular copy operation, it is in fact only "enabled" in the current users project.
- Specified by:
copyResourceToProject
in interfaceI_CmsResourceType
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresource
- the resource to apply this operation to- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.copyResourceToProject(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource)
-
createResource
public CmsResource createResource(CmsObject cms, CmsSecurityManager securityManager, java.lang.String resourcename, byte[] content, java.util.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
- 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:
I_CmsResourceType.createResource(org.opencms.file.CmsObject, CmsSecurityManager, java.lang.String, byte[], List)
-
createSibling
public CmsResource createSibling(CmsObject cms, CmsSecurityManager securityManager, CmsResource source, java.lang.String destination, java.util.List<CmsProperty> properties) throws CmsException
Description copied from interface:I_CmsResourceType
Creates a new sibling of the source resource.- Specified by:
createSibling
in interfaceI_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managersource
- the resource to create a sibling fordestination
- the name of the sibling to create with complete pathproperties
- the individual properties for the new sibling- Returns:
- the new created sibling
- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.createSibling(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, CmsResource, java.lang.String, java.util.List)
-
deleteResource
public void deleteResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsResource.CmsResourceDeleteMode 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 interfaceI_CmsResourceType
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresource
- the resource to deletesiblingMode
- indicates how to handle siblings of the deleted resource- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.deleteResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, CmsResource.CmsResourceDeleteMode)
-
equals
public boolean equals(java.lang.Object obj)
Returnstrue
, if this resource type is equal to the given Object.Please note: A resource type is identified by it's id
getTypeId()
and it's namegetTypeName()
. Two resource types are considered equal, if either their id or their name is equal. This is to prevent issues in the configuration with multiple occurrences of the same name or id.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the Object to compare this resource type with- Returns:
true
, if this resource type is equal to the given Object- See Also:
getTypeId()
,getTypeName()
,isIdentical(I_CmsResourceType)
,Object.equals(java.lang.Object)
-
getAdjustLinksFolder
public java.lang.String getAdjustLinksFolder()
Description copied from interface:I_CmsResourceType
Gets the folder for which the links should be adjusted after processing the copy resources.- Specified by:
getAdjustLinksFolder
in interfaceI_CmsResourceType
- Returns:
- the path of the folder for which the links should be adjusted
- See Also:
I_CmsResourceType.getAdjustLinksFolder()
-
getCachePropertyDefault
public java.lang.String getCachePropertyDefault()
Description copied from interface:I_CmsResourceType
Returns the default for thecache
property setting of this resource type.The
cache
property is used by the Flex cache implementation to build the cache key that controls the caching behaviour of a resource.If
null
is returnd, this is the same as turning the cache off by default for this resource type.- Specified by:
getCachePropertyDefault
in interfaceI_CmsResourceType
- Returns:
- the default for the
cache
property setting of this resource type - See Also:
I_CmsResourceType.getCachePropertyDefault()
-
getClassName
public java.lang.String getClassName()
Returns the configured class name of this resource type.- Specified by:
getClassName
in interfaceI_CmsResourceType
- Returns:
- the class name configured for this resource type
- See Also:
I_CmsResourceType.getClassName()
-
getConfiguration
public CmsParameterConfiguration getConfiguration()
Description copied from interface:I_CmsConfigurationParameterHandler
Returns the parameters of this configurable class instance, ornull
if the class does not need any parameters.- Specified by:
getConfiguration
in interfaceI_CmsConfigurationParameterHandler
- Returns:
- the parameters of this configurable class instance,
or
null
if the class does not need any parameters - See Also:
I_CmsConfigurationParameterHandler.getConfiguration()
-
getConfiguredCopyResources
public java.util.List<CmsConfigurationCopyResource> getConfiguredCopyResources()
Returns the (unmodifiable) list of copy resources.- Specified by:
getConfiguredCopyResources
in interfaceI_CmsResourceType
- Returns:
- the (unmodifiable) list of copy resources
-
getConfiguredDefaultProperties
public java.util.List<CmsProperty> getConfiguredDefaultProperties()
Returns the default properties for this resource type in an unmodifiable List.- Specified by:
getConfiguredDefaultProperties
in interfaceI_CmsResourceType
- Returns:
- the default properties for this resource type in an unmodifiable List
-
getConfiguredMappings
public java.util.List<java.lang.String> getConfiguredMappings()
Description copied from interface:I_CmsResourceType
Returns the file extensions mappings for this resource type in an unmodifiable List.- Specified by:
getConfiguredMappings
in interfaceI_CmsResourceType
- Returns:
- a list of file extensions mappings for this resource type in an unmodifiable List
- See Also:
I_CmsResourceType.getConfiguredMappings()
-
getFormattersForResource
public CmsFormatterConfiguration getFormattersForResource(CmsObject cms, CmsResource res)
Description copied from interface:I_CmsResourceType
Returns the formatter configuration for the given resource.- Specified by:
getFormattersForResource
in interfaceI_CmsResourceType
- Parameters:
cms
- the current cms contextres
- the resource to get the formatter configuration for- Returns:
- the formatter configuration for the given resource
- See Also:
I_CmsResourceType.getFormattersForResource(org.opencms.file.CmsObject, org.opencms.file.CmsResource)
-
getGalleryPreviewProvider
public java.lang.String getGalleryPreviewProvider()
Description copied from interface:I_CmsResourceType
Returns the gallery preview provider class name.- Specified by:
getGalleryPreviewProvider
in interfaceI_CmsResourceType
- Returns:
- the gallery preview provider class name
- See Also:
I_CmsResourceType.getGalleryPreviewProvider()
-
getGalleryTypes
public java.util.List<I_CmsResourceType> getGalleryTypes()
Description copied from interface:I_CmsResourceType
Returns the gallery types for this resource type.- Specified by:
getGalleryTypes
in interfaceI_CmsResourceType
- Returns:
- the gallery types, if no gallery is configured
null
will be returned - See Also:
I_CmsResourceType.getGalleryTypes()
-
getLoaderId
public abstract int getLoaderId()
Description copied from interface:I_CmsResourceType
Returns the loader type id of this resource type.- Specified by:
getLoaderId
in interfaceI_CmsResourceType
- Returns:
- the loader type id of this resource type
- See Also:
I_CmsResourceType.getLoaderId()
-
getModuleName
public java.lang.String getModuleName()
Description copied from interface:I_CmsResourceType
Returns the module name if this is an additional resource type which is defined in a module, ornull
.- Specified by:
getModuleName
in interfaceI_CmsResourceType
- Returns:
- the module name if this is an additional resource type which is defined in a module, or
null
- See Also:
I_CmsResourceType.getModuleName()
-
getTypeId
@Deprecated public int getTypeId()
Deprecated.Use this class orgetTypeName()
instead. Resource types should always be referenced either by its type class (preferred) or by type name. Use of int based resource type references will be discontinued in a future OpenCms release.Description copied from interface:I_CmsResourceType
Returns the type id of this resource type.- Specified by:
getTypeId
in interfaceI_CmsResourceType
- Returns:
- the type id of this resource type
- See Also:
I_CmsResourceType.getTypeId()
-
getTypeName
public java.lang.String getTypeName()
Description copied from interface:I_CmsResourceType
Returns the name of this resource type.- Specified by:
getTypeName
in interfaceI_CmsResourceType
- Returns:
- the name of this resource type
- See Also:
I_CmsResourceType.getTypeName()
-
hashCode
public int hashCode()
The hash code implementation uses the type name to generate a hash code.- Overrides:
hashCode
in classjava.lang.Object
- See Also:
getTypeId()
,Object.hashCode()
-
importResource
public CmsResource importResource(CmsObject cms, CmsSecurityManager securityManager, I_CmsReport report, java.lang.String resourcename, CmsResource resource, byte[] content, java.util.List<CmsProperty> properties) throws CmsException
Description copied from interface:I_CmsResourceType
Imports a resource to the OpenCms VFS.If a resource already exists in the VFS (i.e. has the same name and same id) it is replaced by the imported resource.
If a resource with the same name but a different id exists, the imported resource is (usually) moved to the "lost and found" folder.
- Specified by:
importResource
in interfaceI_CmsResourceType
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerreport
- optional report to write non-critical import problems toresourcename
- the target name (with full path) for the resource after importresource
- the resource to be importedcontent
- the content of the resourceproperties
- the properties of the resource- Returns:
- the imported resource
- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.importResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.report.I_CmsReport, java.lang.String, org.opencms.file.CmsResource, byte[], java.util.List)
-
initConfiguration
public final void initConfiguration()
Description copied from interface:I_CmsConfigurationParameterHandler
Initializes a configuration after all parameters have been added.- Specified by:
initConfiguration
in interfaceI_CmsConfigurationParameterHandler
- See Also:
I_CmsConfigurationParameterHandler.initConfiguration()
-
initConfiguration
public void initConfiguration(java.lang.String name, java.lang.String id, java.lang.String className) throws CmsConfigurationException
Description copied from interface:I_CmsResourceType
Special version of the configuration initialization used with resource types to set resource type, id and class name, required for the XML configuration.Please note: Many resource types defined in the core have in fact a fixed resource type and a fixed id. Configurable name and id is used only for certain types.
The provided named class must implement this interface (
). Usually the provided class name should be the class name of the resource type instance, but this may be different in special cases or configuration errors. For example, if a module is imported that contains it's own resource type class files, the included class file are usually not be available until the server is restarted. If the named class given in the XML configuration (or module manifest.xml) is not available, or not implementingI_CmsResourceType
, thenI_CmsResourceType
is used for the resource type instance.CmsResourceTypeUnknown
- Specified by:
initConfiguration
in interfaceI_CmsResourceType
- Parameters:
name
- the resource type nameid
- the resource type idclassName
- the class name of the resource type (read from the XML configuration)- Throws:
CmsConfigurationException
- if the configuration is invalid- See Also:
I_CmsResourceType.initConfiguration(java.lang.String, java.lang.String, java.lang.String)
-
initialize
public void initialize(CmsObject cms)
Description copied from interface:I_CmsResourceType
Initializes this resource type.This method will be called once during the OpenCms initialization processs. The VFS will already be available at the time the method is called.
- Specified by:
initialize
in interfaceI_CmsResourceType
- Parameters:
cms
- a OpenCms context initialized with "Admin" permissions- See Also:
I_CmsResourceType.initialize(org.opencms.file.CmsObject)
-
isAdditionalModuleResourceType
public boolean isAdditionalModuleResourceType()
Description copied from interface:I_CmsResourceType
Indicates that this is an additional resource type which is defined in a module.- Specified by:
isAdditionalModuleResourceType
in interfaceI_CmsResourceType
- Returns:
- true or false
- See Also:
I_CmsResourceType.isAdditionalModuleResourceType()
-
isDirectEditable
public boolean isDirectEditable()
Description copied from interface:I_CmsResourceType
Returnstrue
if this resource type is direct editable.- Specified by:
isDirectEditable
in interfaceI_CmsResourceType
- Returns:
true
if this resource type is direct editable- See Also:
I_CmsResourceType.isDirectEditable()
-
isFolder
public boolean isFolder()
Description copied from interface:I_CmsResourceType
Returnstrue
if this resource type is a folder.- Specified by:
isFolder
in interfaceI_CmsResourceType
- Returns:
true
if this resource type is a folder- See Also:
I_CmsResourceType.isFolder()
-
isIdentical
public boolean isIdentical(I_CmsResourceType type)
Description copied from interface:I_CmsResourceType
Tests if the given resource type definition is identical to this resource type definition.Two resource types are considered identical if their names
I_CmsResourceType.getTypeName()
and their idsI_CmsResourceType.getTypeId()
are both the same.Please note: Two resource type are considered equal in the sense of
Object.equals(Object)
if either if their namesI_CmsResourceType.getTypeName()
or their idsI_CmsResourceType.getTypeId()
are equal.- Specified by:
isIdentical
in interfaceI_CmsResourceType
- Parameters:
type
- another resource type- Returns:
- true, if the specified resource type is identical to this resource type
- See Also:
I_CmsResourceType.isIdentical(org.opencms.file.types.I_CmsResourceType)
-
lockResource
public void lockResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsLockType type) throws CmsException
Description copied from interface:I_CmsResourceType
Locks a resource.The
type
parameter controls what kind of lock is used.
Possible values for this parameter are:
- Specified by:
lockResource
in interfaceI_CmsResourceType
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresource
- the resource to locktype
- type of the lock- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.lockResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource, org.opencms.lock.CmsLockType)
-
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 interfaceI_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:
I_CmsResourceType.moveResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource, java.lang.String)
-
removeResourceFromProject
public void removeResourceFromProject(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource) throws CmsException
Description copied from interface:I_CmsResourceType
Removes a resource from the current project of the user.This is used to reduce the current users project with the specified resource, in case that the resource is already part of the project. The resource is not really removed like in a regular copy operation, it is in fact only "disabled" in the current users project.
- Specified by:
removeResourceFromProject
in interfaceI_CmsResourceType
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresource
- the resource to apply this operation to- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.removeResourceFromProject(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource)
-
replaceResource
public void replaceResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, I_CmsResourceType type, byte[] content, java.util.List<CmsProperty> properties) throws CmsException
Description copied from interface:I_CmsResourceType
Replaces the content, type and properties of a resource.- Specified by:
replaceResource
in interfaceI_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 wrong- See Also:
I_CmsResourceType.replaceResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource, org.opencms.file.types.I_CmsResourceType, byte[], java.util.List)
-
replaceResource
@Deprecated public void replaceResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int type, byte[] content, java.util.List<CmsProperty> properties) throws CmsException
Deprecated.UsereplaceResource(CmsObject, CmsSecurityManager, CmsResource, I_CmsResourceType, byte[], List)
instead. Resource types should always be referenced either by its type class (preferred) or by type name. Use of int based resource type references will be discontinued in a future OpenCms release.Description copied from interface:I_CmsResourceType
Replaces the content, type and properties of a resource.- Specified by:
replaceResource
in interfaceI_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 wrong- See Also:
I_CmsResourceType.replaceResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int, byte[], List)
-
restoreResource
public void restoreResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int version) throws CmsException
Description copied from interface:I_CmsResourceType
Restores a resource in the current project with a version from the historical archive.- Specified by:
restoreResource
in interfaceI_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to restore from the archiveversion
- the version number of the resource to restore- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.restoreResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, int)
-
setAdditionalModuleResourceType
public void setAdditionalModuleResourceType(boolean additionalType)
Description copied from interface:I_CmsResourceType
Sets the additional resource type flag.- Specified by:
setAdditionalModuleResourceType
in interfaceI_CmsResourceType
- Parameters:
additionalType
- true or false- See Also:
I_CmsResourceType.setAdditionalModuleResourceType(boolean)
-
setAdjustLinksFolder
public void setAdjustLinksFolder(java.lang.String adjustLinksFolder)
Description copied from interface:I_CmsResourceType
Sets the folder for adjusting links after copying the copy-resources.- Specified by:
setAdjustLinksFolder
in interfaceI_CmsResourceType
- Parameters:
adjustLinksFolder
- the folder for which links should be adjusted- See Also:
I_CmsResourceType.setAdjustLinksFolder(String)
-
setDateExpired
public void setDateExpired(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateExpired, boolean recursive) throws CmsException
Description copied from interface:I_CmsResourceType
Changes the "expire" date of a resource.- Specified by:
setDateExpired
in interfaceI_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to touchdateExpired
- 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:
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 interfaceI_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:
I_CmsResourceType.setDateLastModified(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, long, boolean)
-
setDateReleased
public void setDateReleased(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateReleased, boolean recursive) throws CmsException
Description copied from interface:I_CmsResourceType
Changes the "release" date of a resource.- Specified by:
setDateReleased
in interfaceI_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to touchdateReleased
- 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:
I_CmsResourceType.setDateReleased(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, long, boolean)
-
setModuleName
public void setModuleName(java.lang.String moduleName)
Description copied from interface:I_CmsResourceType
Sets the module name if this is an additional resource type which is defined in a module, ornull
.- Specified by:
setModuleName
in interfaceI_CmsResourceType
- Parameters:
moduleName
- the module name if this is an additional resource type which is defined in a module, ornull
- See Also:
I_CmsResourceType.setModuleName(java.lang.String)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
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
- 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:
I_CmsResourceType.undelete(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, boolean)
-
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
- 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:
I_CmsResourceType.undoChanges(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource, CmsResource.CmsResourceUndoMode)
-
unlockResource
public void unlockResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource) throws CmsException
Description copied from interface:I_CmsResourceType
Unlocks a resource.- Specified by:
unlockResource
in interfaceI_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to unlock- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.unlockResource(org.opencms.file.CmsObject, CmsSecurityManager, CmsResource)
-
writeFile
public CmsFile writeFile(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource) throws CmsException
Description copied from interface:I_CmsResourceType
Writes a resource, including it's content.Applies only to resources of type
that have a binary content attached.CmsFile
- Specified by:
writeFile
in interfaceI_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to apply this operation to- Returns:
- the written resource
- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.writeFile(org.opencms.file.CmsObject, CmsSecurityManager, CmsFile)
-
writePropertyObject
public void writePropertyObject(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsProperty property) throws CmsException
Description copied from interface:I_CmsResourceType
Writes a property for a specified resource.- Specified by:
writePropertyObject
in interfaceI_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to write the property forproperty
- the property to write- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.writePropertyObject(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, CmsResource, org.opencms.file.CmsProperty)
-
writePropertyObjects
public void writePropertyObjects(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, java.util.List<CmsProperty> properties) throws CmsException
Description copied from interface:I_CmsResourceType
Writes a list of properties for a specified resource.Code calling this method has to ensure that the no properties
a, b
are contained in the specified list so thata.equals(b)
, otherwise an exception is thrown.- Specified by:
writePropertyObjects
in interfaceI_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to write the properties forproperties
- the list of properties to write- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsResourceType.writePropertyObjects(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, CmsResource, java.util.List)
-
createRelations
protected CmsResource createRelations(CmsObject cms, CmsSecurityManager securityManager, java.lang.String resourceName) throws CmsException
Creates the relation information for the resource with the given resource name.- Parameters:
cms
- the cms contextsecurityManager
- the security managerresourceName
- the resource name of the resource to update the relations for- Returns:
- the fresh read resource
- Throws:
CmsException
- if something goes wrong
-
getCopyResources
protected java.util.List<CmsConfigurationCopyResource> getCopyResources(CmsObject cms, java.lang.String resourcename, CmsMacroResolver resolver)
Gets the actual copy resources to use when creating a resource.- Parameters:
cms
- the CMS contextresourcename
- the path of the resource to createresolver
- the macro resolver to use- Returns:
- the copy resources to use
-
getMacroResolver
protected CmsMacroResolver getMacroResolver(CmsObject cms, java.lang.String resourcename)
Creates a macro resolver based on the current users OpenCms context and the provided resource name.- Parameters:
cms
- the current OpenCms user contextresourcename
- the resource name for macros likeMACRO_RESOURCE_FOLDER_PATH
- Returns:
- a macro resolver based on the current users OpenCms context and the provided resource name
-
getResourceType
protected I_CmsResourceType getResourceType(CmsResource resource)
Convenience method to get the initialized resource type instance for the given resource, with a fall back to special "unknown" resource types in case the resource type is not configured.- Parameters:
resource
- the resource to get the type for- Returns:
- the initialized resource type instance for the given resource
- See Also:
CmsResourceManager.getResourceType(int)
-
processCopyResources
protected void processCopyResources(CmsObject cms, java.lang.String resourcename, CmsMacroResolver resolver)
Processes the copy resources of this resource type.- Parameters:
cms
- the current OpenCms user contextresourcename
- the name of the base resourceresolver
- the resolver used for resolving target macro names
-
processDefaultProperties
protected java.util.List<CmsProperty> processDefaultProperties(java.util.List<CmsProperty> properties, CmsMacroResolver resolver)
Returns a list of property objects that are attached to the resource on creation.It's possible to use OpenCms macros for the property values. Please see
CmsMacroResolver
for allowed macro values.- Parameters:
properties
- the (optional) properties provided by the userresolver
- the resolver used to resolve the macro values- Returns:
- a list of property objects that are attached to the resource on creation
-
updateRelationForUndo
protected void updateRelationForUndo(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource) throws CmsException
Update the relations after an undo changes operation.- Parameters:
cms
- the cms contextsecurityManager
- the security managerresource
- the resource that has been undone- Throws:
CmsException
- if something goes wrong
-
-