Interface I_CmsResourceType
-
- All Superinterfaces:
I_CmsConfigurationParameterHandler
,java.io.Serializable
- All Known Implementing Classes:
A_CmsResourceType
,A_CmsResourceTypeFolderBase
,A_CmsResourceTypeLinkParseable
,CmsResourceTypeBinary
,CmsResourceTypeFolder
,CmsResourceTypeFolderExtended
,CmsResourceTypeFolderSubSitemap
,CmsResourceTypeFunctionConfig
,CmsResourceTypeHtmlRedirect
,CmsResourceTypeImage
,CmsResourceTypeJsp
,CmsResourceTypeLocaleIndependentXmlContent
,CmsResourceTypeMacroFormatter
,CmsResourceTypePlain
,CmsResourceTypePointer
,CmsResourceTypeSeoFile
,CmsResourceTypeSubsitemapContentFolder
,CmsResourceTypeUnknown
,CmsResourceTypeUnknownFile
,CmsResourceTypeUnknownFolder
,CmsResourceTypeXmlAdeConfiguration
,CmsResourceTypeXmlContainerPage
,CmsResourceTypeXmlContent
,CmsResourceTypeXmlPage
public interface I_CmsResourceType extends I_CmsConfigurationParameterHandler, java.io.Serializable
Resource type descriptors for all resources in the VFS.Each file in the VFS must belong to an initialized resource type. The available resource type are read during system startup from the configuration file
opencms-vfs.xml
.Certain resource types may require special handling for certain operations. This is usually required for write operations, or other operations that modify the VFS database. Therefore, the
CmsObject
defers handling of this operations to implementations of this interface.If you implement a new resource type, it's a good idea to extend the abstract class
A_CmsResourceType
.Important: The
CmsObject
passes theCmsSecurityManager
object to implementations of this class. Using this object correctly is key to the resource type operations. Mistakes made in the implementation of a resource type can screw up the system security and the database structure, and make you unhappy.- Since:
- 6.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
I_CmsResourceType.Formatter
Resource formatter.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ADD_MAPPING_METHOD
The name of the addMapping() method.static java.lang.String
ADD_RESOURCE_TYPE_METHOD
Name of the addResourceType() method to add a resource type from the configuration.static java.lang.String
CONFIGURATION_PROPERTY_CREATE
Configuration key prefix for properties that are attached when creating a new resource.static java.lang.String
CONFIGURATION_RESOURCE_TYPE_ID
Configuration key for the resource type id.static java.lang.String
CONFIGURATION_RESOURCE_TYPE_NAME
Configuration key for the resource type name.static java.lang.String
PROPERTY_ON_RESOURCE
Store the property on resource record.static java.lang.String
PROPERTY_ON_STRUCTURE
Store the property on structure record.-
Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description 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.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.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 class name configured for this resource type.java.util.List<CmsConfigurationCopyResource>
getConfiguredCopyResources()
Returns the configured copy resources for this resource type in an unmodifiable List.java.util.List<CmsProperty>
getConfiguredDefaultProperties()
Returns the configured 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.CmsFormatterConfiguration
getFormattersForResource(CmsObject cms, CmsResource resource)
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.int
getLoaderId()
Returns the loader type id of this resource type.java.lang.String
getModuleName()
Returns the module name if this is an additional resource type which is defined in a module, ornull
.int
getTypeId()
Deprecated.Use this class orgetTypeName()
instead.java.lang.String
getTypeName()
Returns the name of this resource type.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(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.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
.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.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.-
Methods inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
addConfigurationParameter, getConfiguration, initConfiguration
-
-
-
-
Field Detail
-
ADD_MAPPING_METHOD
static final java.lang.String ADD_MAPPING_METHOD
The name of the addMapping() method.- See Also:
- Constant Field Values
-
ADD_RESOURCE_TYPE_METHOD
static final java.lang.String ADD_RESOURCE_TYPE_METHOD
Name of the addResourceType() method to add a resource type from the configuration.- See Also:
- Constant Field Values
-
CONFIGURATION_PROPERTY_CREATE
static final java.lang.String CONFIGURATION_PROPERTY_CREATE
Configuration key prefix for properties that are attached when creating a new resource.- See Also:
- Constant Field Values
-
CONFIGURATION_RESOURCE_TYPE_ID
static final java.lang.String CONFIGURATION_RESOURCE_TYPE_ID
Configuration key for the resource type id.- See Also:
- Constant Field Values
-
CONFIGURATION_RESOURCE_TYPE_NAME
static final java.lang.String CONFIGURATION_RESOURCE_TYPE_NAME
Configuration key for the resource type name.- See Also:
- Constant Field Values
-
PROPERTY_ON_RESOURCE
static final java.lang.String PROPERTY_ON_RESOURCE
Store the property on resource record.- See Also:
- Constant Field Values
-
PROPERTY_ON_STRUCTURE
static final java.lang.String PROPERTY_ON_STRUCTURE
Store the property on structure record.- See Also:
- Constant Field Values
-
-
Method Detail
-
addMappingType
void addMappingType(java.lang.String mapping)
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.
- Parameters:
mapping
- the file extension mapped to the resource type
-
changeLock
void changeLock(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource) throws CmsException
Changes the lock of a resource to the current user, that is "steals" the lock from another user.- 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:
CmsObject.changeLock(String)
,CmsSecurityManager.changeLock(org.opencms.file.CmsRequestContext, CmsResource)
-
chflags
void chflags(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int flags) throws CmsException
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.
- 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:
CmsObject.chflags(String, int)
,CmsSecurityManager.chflags(org.opencms.file.CmsRequestContext, CmsResource, int)
-
chtype
void chtype(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, I_CmsResourceType type) throws CmsException
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.
- 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:
CmsObject.chtype(String, int)
,CmsSecurityManager.chtype(org.opencms.file.CmsRequestContext, CmsResource, int)
-
chtype
@Deprecated 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 this type class (preferred) or by type name. Use of int based resource type references will be discontinued in a future OpenCms release.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.
- 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:
CmsObject.chtype(String, int)
,CmsSecurityManager.chtype(org.opencms.file.CmsRequestContext, CmsResource, int)
-
copyResource
void copyResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource source, java.lang.String destination, CmsResource.CmsResourceCopyMode siblingMode) throws CmsException, CmsIllegalArgumentException
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:
- 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:
CmsObject.copyResource(String, String, CmsResource.CmsResourceCopyMode)
,CmsSecurityManager.copyResource(org.opencms.file.CmsRequestContext, CmsResource, String, CmsResource.CmsResourceCopyMode)
-
copyResourceToProject
void copyResourceToProject(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource) throws CmsException, CmsIllegalArgumentException
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.
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresource
- the resource to apply this operation to- Throws:
CmsException
- if something goes wrongCmsIllegalArgumentException
- if theresource
argument is null or of length 0- See Also:
CmsObject.copyResourceToProject(String)
,CmsSecurityManager.copyResourceToProject(org.opencms.file.CmsRequestContext, CmsResource)
-
createResource
CmsResource createResource(CmsObject cms, CmsSecurityManager securityManager, java.lang.String resourcename, byte[] content, java.util.List<CmsProperty> properties) throws CmsException, CmsIllegalArgumentException
Creates a new resource of the given resource type with the provided content and properties.- 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 wrongCmsIllegalArgumentException
- if thesource
argument is null or of length 0- See Also:
CmsObject.createResource(String, int, byte[], List)
,CmsObject.createResource(String, int)
,CmsSecurityManager.createResource(org.opencms.file.CmsRequestContext, String, int, byte[], List)
-
createSibling
CmsResource createSibling(CmsObject cms, CmsSecurityManager securityManager, CmsResource source, java.lang.String destination, java.util.List<CmsProperty> properties) throws CmsException
Creates a new sibling of the source resource.- 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:
CmsObject.createSibling(String, String, List)
,CmsSecurityManager.createSibling(org.opencms.file.CmsRequestContext, CmsResource, String, List)
-
deleteResource
void deleteResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException
Deletes a resource given its name.The
siblingMode
parameter controls how to handle siblings during the delete operation.
Possible values for this parameter are:
- 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:
CmsObject.deleteResource(String, CmsResource.CmsResourceDeleteMode)
,CmsSecurityManager.deleteResource(org.opencms.file.CmsRequestContext, CmsResource, CmsResource.CmsResourceDeleteMode)
-
getAdjustLinksFolder
java.lang.String getAdjustLinksFolder()
Gets the folder for which the links should be adjusted after processing the copy resources.- Returns:
- the path of the folder for which the links should be adjusted
-
getCachePropertyDefault
java.lang.String getCachePropertyDefault()
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.- Returns:
- the default for the
cache
property setting of this resource type - See Also:
CmsFlexCache
,CmsFlexCacheKey
-
getClassName
java.lang.String getClassName()
Returns the class name configured for this resource type.This may be different from the instance class name in case the configured class could not be instantiated. If the configured class is unavailable, an instance of
is used. This enables the import of modules that contain their own resource types classes (which are not available before the module is fully imported).CmsResourceTypeUnknown
- Returns:
- the class name configured for this resource type
-
getConfiguredCopyResources
java.util.List<CmsConfigurationCopyResource> getConfiguredCopyResources()
Returns the configured copy resources for this resource type in an unmodifiable List.- Returns:
- the configured copy resources for this resource type in an unmodifiable List
-
getConfiguredDefaultProperties
java.util.List<CmsProperty> getConfiguredDefaultProperties()
Returns the configured default properties for this resource type in an unmodifiable List.- Returns:
- the configured default properties for this resource type in an unmodifiable List
-
getConfiguredMappings
java.util.List<java.lang.String> getConfiguredMappings()
Returns the file extensions mappings for this resource type in an unmodifiable List.- Returns:
- a list of file extensions mappings for this resource type in an unmodifiable List
-
getFormattersForResource
CmsFormatterConfiguration getFormattersForResource(CmsObject cms, CmsResource resource)
Returns the formatter configuration for the given resource.- Parameters:
cms
- the current cms contextresource
- the resource to get the formatter configuration for- Returns:
- the formatter configuration for the given resource
-
getGalleryPreviewProvider
java.lang.String getGalleryPreviewProvider()
Returns the gallery preview provider class name.- Returns:
- the gallery preview provider class name
-
getGalleryTypes
java.util.List<I_CmsResourceType> getGalleryTypes()
Returns the gallery types for this resource type.- Returns:
- the gallery types, if no gallery is configured
null
will be returned
-
getLoaderId
int getLoaderId()
Returns the loader type id of this resource type.- Returns:
- the loader type id of this resource type
-
getModuleName
java.lang.String getModuleName()
Returns the module name if this is an additional resource type which is defined in a module, ornull
.- Returns:
- the module name if this is an additional resource type which is defined in a module, or
null
-
getTypeId
@Deprecated int getTypeId()
Deprecated.Use this class orgetTypeName()
instead. Resource types should always be referenced either by this type class (preferred) or by type name. Use of int based resource type references will be discontinued in a future OpenCms release.Returns the type id of this resource type.- Returns:
- the type id of this resource type
-
getTypeName
java.lang.String getTypeName()
Returns the name of this resource type.- Returns:
- the name of this resource type
-
importResource
CmsResource importResource(CmsObject cms, CmsSecurityManager securityManager, I_CmsReport report, java.lang.String resourcename, CmsResource resource, byte[] content, java.util.List<CmsProperty> properties) throws CmsException
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.
- 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:
CmsSecurityManager.moveToLostAndFound(org.opencms.file.CmsRequestContext, CmsResource, boolean)
,CmsObject.importResource(String, CmsResource, byte[], List)
,CmsSecurityManager.importResource(org.opencms.file.CmsRequestContext, String, CmsResource, byte[], List, boolean)
-
initConfiguration
void initConfiguration(java.lang.String name, java.lang.String id, java.lang.String className) throws CmsConfigurationException
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
- 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
-
initialize
void initialize(CmsObject cms)
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.
- Parameters:
cms
- a OpenCms context initialized with "Admin" permissions
-
isAdditionalModuleResourceType
boolean isAdditionalModuleResourceType()
Indicates that this is an additional resource type which is defined in a module.- Returns:
- true or false
-
isDirectEditable
boolean isDirectEditable()
Returnstrue
if this resource type is direct editable.- Returns:
true
if this resource type is direct editable
-
isFolder
boolean isFolder()
Returnstrue
if this resource type is a folder.- Returns:
true
if this resource type is a folder
-
isIdentical
boolean isIdentical(I_CmsResourceType type)
Tests if the given resource type definition is identical to this resource type definition.Two resource types are considered identical if their names
getTypeName()
and their idsgetTypeId()
are both the same.Please note: Two resource type are considered equal in the sense of
Object.equals(Object)
if either if their namesgetTypeName()
or their idsgetTypeId()
are equal.- Parameters:
type
- another resource type- Returns:
- true, if the specified resource type is identical to this resource type
-
lockResource
void lockResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsLockType type) throws CmsException
Locks a resource.The
type
parameter controls what kind of lock is used.
Possible values for this parameter are:
- 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:
CmsObject.lockResource(String)
,CmsSecurityManager.lockResource(org.opencms.file.CmsRequestContext, CmsResource, CmsLockType)
-
moveResource
void moveResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, java.lang.String destination) throws CmsException, CmsIllegalArgumentException
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.
- 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:
CmsObject.moveResource(String, String)
,CmsObject.renameResource(String, String)
,CmsSecurityManager.copyResource(org.opencms.file.CmsRequestContext, CmsResource, String, CmsResource.CmsResourceCopyMode)
,CmsSecurityManager.deleteResource(org.opencms.file.CmsRequestContext, CmsResource, CmsResource.CmsResourceDeleteMode)
-
removeResourceFromProject
void removeResourceFromProject(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource) throws CmsException, CmsIllegalArgumentException
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.
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresource
- the resource to apply this operation to- Throws:
CmsException
- if something goes wrongCmsIllegalArgumentException
- if theresource
argument is null or of length 0- See Also:
CmsObject.copyResourceToProject(String)
,CmsSecurityManager.copyResourceToProject(org.opencms.file.CmsRequestContext, CmsResource)
-
replaceResource
void replaceResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, I_CmsResourceType type, byte[] content, java.util.List<CmsProperty> properties) throws CmsException
Replaces the content, type and properties of a resource.- 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:
CmsObject.replaceResource(String, int, byte[], List)
,CmsSecurityManager.replaceResource(org.opencms.file.CmsRequestContext, CmsResource, int, byte[], List)
-
replaceResource
@Deprecated 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 this type class (preferred) or by type name. Use of int based resource type references will be discontinued in a future OpenCms release.Replaces the content, type and properties of a resource.- 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:
CmsObject.replaceResource(String, int, byte[], List)
,CmsSecurityManager.replaceResource(org.opencms.file.CmsRequestContext, CmsResource, int, byte[], List)
-
restoreResource
void restoreResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, int version) throws CmsException
Restores a resource in the current project with a version from the historical archive.- 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:
CmsObject.restoreResourceVersion(org.opencms.util.CmsUUID, int)
,CmsSecurityManager.restoreResource(org.opencms.file.CmsRequestContext, CmsResource, int)
-
setAdditionalModuleResourceType
void setAdditionalModuleResourceType(boolean additionalType)
Sets the additional resource type flag.- Parameters:
additionalType
- true or false
-
setAdjustLinksFolder
void setAdjustLinksFolder(java.lang.String adjustLinksFolder)
Sets the folder for adjusting links after copying the copy-resources.- Parameters:
adjustLinksFolder
- the folder for which links should be adjusted
-
setDateExpired
void setDateExpired(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateExpired, boolean recursive) throws CmsException
Changes the "expire" date of a resource.- 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:
CmsObject.setDateExpired(String, long, boolean)
,CmsSecurityManager.setDateExpired(org.opencms.file.CmsRequestContext, CmsResource, long)
-
setDateLastModified
void setDateLastModified(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateLastModified, boolean recursive) throws CmsException
Changes the "last modified" date of a resource.- 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:
CmsObject.setDateLastModified(String, long, boolean)
,CmsSecurityManager.setDateLastModified(org.opencms.file.CmsRequestContext, CmsResource, long)
-
setDateReleased
void setDateReleased(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateReleased, boolean recursive) throws CmsException
Changes the "release" date of a resource.- 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:
CmsObject.setDateReleased(String, long, boolean)
,CmsSecurityManager.setDateReleased(org.opencms.file.CmsRequestContext, CmsResource, long)
-
setModuleName
void setModuleName(java.lang.String moduleName)
Sets the module name if this is an additional resource type which is defined in a module, ornull
.- Parameters:
moduleName
- the module name if this is an additional resource type which is defined in a module, ornull
-
undelete
void undelete(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, boolean recursive) throws CmsException
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.
- 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:
CmsObject.undeleteResource(String, boolean)
,CmsSecurityManager.undelete(org.opencms.file.CmsRequestContext, CmsResource)
-
undoChanges
void undoChanges(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsResource.CmsResourceUndoMode mode) throws CmsException
Undos all changes in the resource by restoring the version from the online project to the current offline project.- 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:
CmsResource.UNDO_CONTENT
,CmsResource.UNDO_CONTENT_RECURSIVE
,CmsResource.UNDO_MOVE_CONTENT
,CmsResource.UNDO_MOVE_CONTENT_RECURSIVE
,CmsObject.undoChanges(String, CmsResource.CmsResourceUndoMode)
,CmsSecurityManager.undoChanges(org.opencms.file.CmsRequestContext, CmsResource, org.opencms.file.CmsResource.CmsResourceUndoMode)
-
unlockResource
void unlockResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource) throws CmsException
Unlocks a resource.- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to unlock- Throws:
CmsException
- if something goes wrong- See Also:
CmsObject.unlockResource(String)
,CmsSecurityManager.unlockResource(org.opencms.file.CmsRequestContext, CmsResource)
-
writeFile
CmsFile writeFile(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource) throws CmsException
Writes a resource, including it's content.Applies only to resources of type
that have a binary content attached.CmsFile
- 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:
CmsObject.writeFile(CmsFile)
,CmsSecurityManager.writeFile(org.opencms.file.CmsRequestContext, CmsFile)
-
writePropertyObject
void writePropertyObject(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsProperty property) throws CmsException
Writes a property for a specified resource.- 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:
CmsObject.writePropertyObject(String, CmsProperty)
,CmsSecurityManager.writePropertyObject(org.opencms.file.CmsRequestContext, CmsResource, CmsProperty)
-
writePropertyObjects
void writePropertyObjects(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, java.util.List<CmsProperty> properties) throws CmsException
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.- 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:
CmsObject.writePropertyObjects(String, List)
,CmsSecurityManager.writePropertyObjects(org.opencms.file.CmsRequestContext, CmsResource, List)
-
-