Class CmsResourceTypeXmlContent
- java.lang.Object
-
- org.opencms.file.types.A_CmsResourceType
-
- org.opencms.file.types.A_CmsResourceTypeLinkParseable
-
- org.opencms.file.types.CmsResourceTypeXmlContent
-
- All Implemented Interfaces:
java.io.Serializable
,I_CmsConfigurationParameterHandler
,I_CmsResourceType
,I_CmsLinkParseable
- Direct Known Subclasses:
CmsResourceTypeLocaleIndependentXmlContent
,CmsResourceTypeXmlAdeConfiguration
,CmsResourceTypeXmlContainerPage
public class CmsResourceTypeXmlContent extends A_CmsResourceTypeLinkParseable
Resource type descriptor for the type "xmlcontent".- 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
ATTR_REVERSE_AVAILABILITY_MAPPING
Request context attribute used to enable reverse availability mapping.static java.lang.String
CONFIGURATION_SCHEMA
Configuration key for the (optional) schema.static java.lang.String
DIALOG_CHOOSEMODEL
The name for the choose model file form action.static java.lang.String
RESOURCE_TYPE_NAME
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 Constructor Description CmsResourceTypeXmlContent()
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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.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.void
deleteResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode)
Deletes a resource given its name.java.lang.String
getCachePropertyDefault()
Returns the default for thecache
property setting of this resource type.CmsParameterConfiguration
getConfiguration()
Returns the parameters of this configurable class instance, ornull
if the class does not need any parameters.I_CmsEditHandler
getEditHandler(CmsObject cms)
Returns the edit handler if configured.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.int
getLoaderId()
Returns the loader type id of this resource type.protected java.util.Locale
getLocaleForNewContent(CmsObject cms, CmsSecurityManager securityManager, java.lang.String resourcename, java.util.List<CmsProperty> properties)
Gets the locale which should be used for creating an empty content.static java.util.List<CmsResource>
getModelFiles(CmsObject cms, java.lang.String currentFolder, java.lang.String newResourceTypeName)
Returns the possible model files for the new resource.java.lang.String
getSchema()
Returns the configured xsd schema uri.static java.lang.String
getStaticTypeName()
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
isXmlContent(CmsResource resource)
Returnstrue
in case the given resource is an XML content.void
moveResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, java.lang.String destination)
Moves a resource to the given destination.java.util.List<CmsLink>
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.CmsFile
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 Detail
-
ATTR_REVERSE_AVAILABILITY_MAPPING
public static final java.lang.String ATTR_REVERSE_AVAILABILITY_MAPPING
Request context attribute used to enable reverse availability mapping.- See Also:
- Constant Field Values
-
CONFIGURATION_SCHEMA
public static final java.lang.String CONFIGURATION_SCHEMA
Configuration key for the (optional) schema.- See Also:
- Constant Field Values
-
DIALOG_CHOOSEMODEL
public static final java.lang.String DIALOG_CHOOSEMODEL
The name for the choose model file form action.- See Also:
- Constant Field Values
-
RESOURCE_TYPE_NAME
public static final java.lang.String RESOURCE_TYPE_NAME
The name of this resource type.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsResourceTypeXmlContent
public CmsResourceTypeXmlContent()
-
-
Method Detail
-
getModelFiles
public static java.util.List<CmsResource> getModelFiles(CmsObject cms, java.lang.String currentFolder, java.lang.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
public static java.lang.String getStaticTypeName()
Returns the static type name of this (default) resource type.- Returns:
- the static type name of this (default) resource type
-
isXmlContent
public static boolean isXmlContent(CmsResource resource)
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
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
- Overrides:
addConfigurationParameter
in classA_CmsResourceType
- Parameters:
paramName
- the name of the parameterparamValue
- the value for the parameter- See Also:
A_CmsResourceType.addConfigurationParameter(java.lang.String, java.lang.String)
-
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
- 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:
I_CmsResourceType.createResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, java.lang.String, byte[], 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
- 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:
A_CmsResourceType.deleteResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource, org.opencms.file.CmsResource.CmsResourceDeleteMode)
-
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
- Overrides:
getCachePropertyDefault
in classA_CmsResourceType
- Returns:
- the default for the
cache
property setting of this resource type - See Also:
I_CmsResourceType.getCachePropertyDefault()
-
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
- 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:
A_CmsResourceType.getConfiguration()
-
getEditHandler
public I_CmsEditHandler getEditHandler(CmsObject cms)
Returns the edit handler if configured.- Parameters:
cms
- the cms context- Returns:
- the edit handler
-
getFormattersForResource
public CmsFormatterConfiguration getFormattersForResource(CmsObject cms, CmsResource resource)
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:
A_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
- Overrides:
getGalleryPreviewProvider
in classA_CmsResourceType
- Returns:
- the gallery preview provider class name
- See Also:
A_CmsResourceType.getGalleryPreviewProvider()
-
getLoaderId
public int 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:
I_CmsResourceType.getLoaderId()
-
getSchema
public java.lang.String getSchema()
Returns the configured xsd schema uri.- Returns:
- the configured xsd schema uri, or
null
if not set
-
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
- Overrides:
initialize
in classA_CmsResourceType
- Parameters:
cms
- a OpenCms context initialized with "Admin" permissions- See Also:
A_CmsResourceType.initialize(org.opencms.file.CmsObject)
-
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
- 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:
A_CmsResourceType.moveResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource, java.lang.String)
-
parseLinks
public java.util.List<CmsLink> parseLinks(CmsObject cms, CmsFile file)
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:
I_CmsLinkParseable.parseLinks(org.opencms.file.CmsObject, org.opencms.file.CmsFile)
-
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:
A_CmsResourceType.setDateExpired(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.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
- 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:
A_CmsResourceType.setDateReleased(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsResource, long, boolean)
-
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:
I_CmsResourceType.writeFile(org.opencms.file.CmsObject, CmsSecurityManager, CmsFile)
-
getLocaleForNewContent
protected java.util.Locale getLocaleForNewContent(CmsObject cms, CmsSecurityManager securityManager, java.lang.String resourcename, java.util.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
protected CmsLink getXsdLink(CmsObject cms, CmsXmlContent xmlContent)
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
-
-