Class CmsResourceTypeXmlContent
- All Implemented Interfaces:
Serializable
,I_CmsConfigurationParameterHandler
,I_CmsResourceType
,I_CmsLinkParseable
- Direct Known Subclasses:
CmsResourceTypeLocaleIndependentXmlContent
,CmsResourceTypeXmlAdeConfiguration
,CmsResourceTypeXmlContainerPage
- Since:
- 6.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opencms.file.types.I_CmsResourceType
I_CmsResourceType.Formatter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Request context attribute used to enable reverse availability mapping.static final String
Configuration key for the (optional) schema.static final String
The name for the choose model file form action.static final String
The name of this resource type.Fields inherited from class org.opencms.file.types.A_CmsResourceType
CONFIGURATION_GALLERY_JAVASCRIPT_PATH, CONFIGURATION_GALLERY_PREVIEW_PROVIDER, CONFIGURATION_GALLERY_TYPE_NAMES, CONFIGURATION_INTERNAL, DEFAULT_GALLERY_PREVIEW_PROVIDER, m_addititionalModuleResourceType, m_className, m_configuration, m_copyResources, m_defaultProperties, m_frozen, m_galleryPreviewProvider, m_mappings, m_moduleName, m_typeId, m_typeName, MACRO_RESOURCE_FOLDER_PATH, MACRO_RESOURCE_FOLDER_PATH_TOUCH, MACRO_RESOURCE_NAME, MACRO_RESOURCE_PARENT_PATH, MACRO_RESOURCE_ROOT_PATH, MACRO_RESOURCE_SITE_PATH
Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
Fields inherited from interface org.opencms.file.types.I_CmsResourceType
ADD_MAPPING_METHOD, ADD_RESOURCE_TYPE_METHOD, CONFIGURATION_PROPERTY_CREATE, CONFIGURATION_RESOURCE_TYPE_ID, CONFIGURATION_RESOURCE_TYPE_NAME, PROPERTY_ON_RESOURCE, PROPERTY_ON_STRUCTURE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConfigurationParameter
(String paramName, String paramValue) Adds a configuration parameter to this parameter configurable class instance.createResource
(CmsObject cms, CmsSecurityManager securityManager, String resourcename, byte[] content, List<CmsProperty> properties) Creates a new resource of the given resource type with the provided content and properties.void
deleteResource
(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode) Deletes a resource given its name.Returns the default for thecache
property setting of this resource type.Returns the parameters of this configurable class instance, ornull
if the class does not need any parameters.getEditHandler
(CmsObject cms) Returns the edit handler if configured.getFormattersForResource
(CmsObject cms, CmsResource resource) Returns the formatter configuration for the given resource.Returns the gallery preview provider class name.int
Returns the loader type id of this resource type.protected Locale
getLocaleForNewContent
(CmsObject cms, CmsSecurityManager securityManager, String resourcename, List<CmsProperty> properties) Gets the locale which should be used for creating an empty content.static List<CmsResource>
getModelFiles
(CmsObject cms, String currentFolder, String newResourceTypeName) Returns the possible model files for the new resource.Returns the configured xsd schema uri.static String
Returns the static type name of this (default) resource type.protected CmsLink
getXsdLink
(CmsObject cms, CmsXmlContent xmlContent) Creates a new link object for the schema definition.void
initialize
(CmsObject cms) Initializes this resource type.static boolean
isPossiblyDetailContent
(CmsResource resource) Checks if the resource is possibly a detail content.static boolean
isXmlContent
(CmsResource resource) Returnstrue
in case the given resource is an XML content.void
moveResource
(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, String destination) Moves a resource to the given destination.parseLinks
(CmsObject cms, CmsFile file) Returns a list of all links from the specified file.void
setDateExpired
(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateExpired, boolean recursive) Changes the "expire" date of a resource.void
setDateReleased
(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateReleased, boolean recursive) Changes the "release" date of a resource.writeFile
(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource) Writes a resource, including it's content.Methods inherited from class org.opencms.file.types.A_CmsResourceTypeLinkParseable
isDirectEditable
Methods inherited from class org.opencms.file.types.A_CmsResourceType
addCopyResource, addDefaultProperty, addMappingType, changeLock, chflags, chtype, chtype, copyResource, copyResourceToProject, createRelations, createSibling, equals, getAdjustLinksFolder, getClassName, getConfiguredCopyResources, getConfiguredDefaultProperties, getConfiguredMappings, getCopyResources, getGalleryTypes, getMacroResolver, getModuleName, getResourceType, getTypeId, getTypeName, hashCode, importResource, initConfiguration, initConfiguration, isAdditionalModuleResourceType, isFolder, isIdentical, lockResource, processCopyResources, processDefaultProperties, removeResourceFromProject, replaceResource, replaceResource, restoreResource, setAdditionalModuleResourceType, setAdjustLinksFolder, setDateLastModified, setModuleName, toString, undelete, undoChanges, unlockResource, updateRelationForUndo, writePropertyObject, writePropertyObjects
-
Field Details
-
ATTR_REVERSE_AVAILABILITY_MAPPING
Request context attribute used to enable reverse availability mapping.- See Also:
-
CONFIGURATION_SCHEMA
Configuration key for the (optional) schema.- See Also:
-
DIALOG_CHOOSEMODEL
The name for the choose model file form action.- See Also:
-
RESOURCE_TYPE_NAME
The name of this resource type.- See Also:
-
-
Constructor Details
-
CmsResourceTypeXmlContent
public CmsResourceTypeXmlContent()
-
-
Method Details
-
getModelFiles
public static List<CmsResource> getModelFiles(CmsObject cms, String currentFolder, String newResourceTypeName) Returns the possible model files for the new resource.- Parameters:
cms
- the current users context to work withcurrentFolder
- the foldernewResourceTypeName
- the resource type name for the new resource to create- Returns:
- the possible model files for the new resource
-
getStaticTypeName
Returns the static type name of this (default) resource type.- Returns:
- the static type name of this (default) resource type
-
isPossiblyDetailContent
Checks if the resource is possibly a detail content.- Parameters:
resource
- the resource to check- Returns:
- true if the resource is possibly a detail content
-
isXmlContent
Returnstrue
in case the given resource is an XML content.- Parameters:
resource
- the resource to check- Returns:
true
in case the given resource is an XML content- Since:
- 7.0.2
-
addConfigurationParameter
Description copied from interface:I_CmsConfigurationParameterHandler
Adds a configuration parameter to this parameter configurable class instance.- Specified by:
addConfigurationParameter
in interfaceI_CmsConfigurationParameterHandler
- Overrides:
addConfigurationParameter
in classA_CmsResourceType
- Parameters:
paramName
- the name of the parameterparamValue
- the value for the parameter- See Also:
-
createResource
public CmsResource createResource(CmsObject cms, CmsSecurityManager securityManager, String resourcename, byte[] content, List<CmsProperty> properties) throws CmsException Description copied from interface:I_CmsResourceType
Creates a new resource of the given resource type with the provided content and properties.- Specified by:
createResource
in interfaceI_CmsResourceType
- Overrides:
createResource
in classA_CmsResourceType
- Parameters:
cms
- the initialized CmsObjectsecurityManager
- the initialized OpenCms security managerresourcename
- the name of the resource to create (full path)content
- the content for the new resourceproperties
- the properties for the new resource- Returns:
- the created resource
- Throws:
CmsException
- if something goes wrong- See Also:
-
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
- Overrides:
deleteResource
in classA_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:
-
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
- Overrides:
getCachePropertyDefault
in classA_CmsResourceType
- Returns:
- the default for the
cache
property setting of this resource type - See Also:
-
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
- Overrides:
getConfiguration
in classA_CmsResourceType
- Returns:
- the parameters of this configurable class instance,
or
null
if the class does not need any parameters - See Also:
-
getEditHandler
Returns the edit handler if configured.- Parameters:
cms
- the cms context- Returns:
- the edit handler
-
getFormattersForResource
Description copied from interface:I_CmsResourceType
Returns the formatter configuration for the given resource.- Specified by:
getFormattersForResource
in interfaceI_CmsResourceType
- Overrides:
getFormattersForResource
in classA_CmsResourceType
- Parameters:
cms
- the current cms contextresource
- the resource to get the formatter configuration for- Returns:
- the formatter configuration for the given resource
- See Also:
-
getGalleryPreviewProvider
Description copied from interface:I_CmsResourceType
Returns the gallery preview provider class name.- Specified by:
getGalleryPreviewProvider
in interfaceI_CmsResourceType
- Overrides:
getGalleryPreviewProvider
in classA_CmsResourceType
- Returns:
- the gallery preview provider class name
- See Also:
-
getLoaderId
Description copied from interface:I_CmsResourceType
Returns the loader type id of this resource type.- Specified by:
getLoaderId
in interfaceI_CmsResourceType
- Specified by:
getLoaderId
in classA_CmsResourceType
- Returns:
- the loader type id of this resource type
- See Also:
-
getSchema
Returns the configured xsd schema uri.- Returns:
- the configured xsd schema uri, or
null
if not set
-
initialize
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
- Overrides:
initialize
in classA_CmsResourceType
- Parameters:
cms
- a OpenCms context initialized with "Admin" permissions- See Also:
-
moveResource
public void moveResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, String destination) throws CmsException, CmsIllegalArgumentException Description copied from interface:I_CmsResourceType
Moves a resource to the given destination.A move operation in OpenCms is always a copy (as sibling) followed by a delete, this is a result of the online/offline structure of the OpenCms VFS. This way you can see the deleted files/folders in the offline project, and you will be unable to undelete them.
- Specified by:
moveResource
in interfaceI_CmsResourceType
- Overrides:
moveResource
in classA_CmsResourceType
- Parameters:
cms
- the current cms contextsecurityManager
- the initialized OpenCms security managerresource
- the resource to movedestination
- the destination resource name- Throws:
CmsException
- if something goes wrongCmsIllegalArgumentException
- if thesource
argument is null or of length 0- See Also:
-
parseLinks
Description copied from interface:I_CmsLinkParseable
Returns a list of all links from the specified file.Implementations of this method must return an empty list, or better
Collections.EMPTY_LIST
, if no link is found at all.Implementations of this method should return the list of links including internal (OpenCms VFS) and external links (http, https, mailto, ftp, etc.).
- Parameters:
cms
- the current user's contextfile
- the file to be parsed- Returns:
- a list of
CmsLink
objects with the URIs of all linked resources - See Also:
-
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
- Overrides:
setDateExpired
in classA_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:
-
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
- Overrides:
setDateReleased
in classA_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:
-
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
- Overrides:
writeFile
in classA_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:
-
getLocaleForNewContent
protected Locale getLocaleForNewContent(CmsObject cms, CmsSecurityManager securityManager, String resourcename, List<CmsProperty> properties) Gets the locale which should be used for creating an empty content.- Parameters:
cms
- the current CMS contextsecurityManager
- the security managerresourcename
- the name of the resource to createproperties
- the properties for the resource to create- Returns:
- the locale to use
-
getXsdLink
Creates a new link object for the schema definition.- Parameters:
cms
- the current CMS contextxmlContent
- the xml content to crete the link for- Returns:
- the generated link
-