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 StringRequest context attribute used to enable reverse availability mapping.static final StringConfiguration key for the (optional) schema.static final StringThe name for the choose model file form action.static final StringThe 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_PATHFields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHODFields 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 TypeMethodDescriptionvoidaddConfigurationParameter(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.voiddeleteResource(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode) Deletes a resource given its name.Returns the default for thecacheproperty setting of this resource type.Returns the parameters of this configurable class instance, ornullif 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.intReturns the loader type id of this resource type.protected LocalegetLocaleForNewContent(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 StringReturns the static type name of this (default) resource type.protected CmsLinkgetXsdLink(CmsObject cms, CmsXmlContent xmlContent) Creates a new link object for the schema definition.voidinitialize(CmsObject cms) Initializes this resource type.static booleanisPossiblyDetailContent(CmsResource resource) Checks if the resource is possibly a detail content.static booleanisXmlContent(CmsResource resource) Returnstruein case the given resource is an XML content.voidmoveResource(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.voidsetDateExpired(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource, long dateExpired, boolean recursive) Changes the "expire" date of a resource.voidsetDateReleased(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
isDirectEditableMethods 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
Returnstruein case the given resource is an XML content.- Parameters:
resource- the resource to check- Returns:
truein case the given resource is an XML content- Since:
- 7.0.2
-
addConfigurationParameter
Description copied from interface:I_CmsConfigurationParameterHandlerAdds a configuration parameter to this parameter configurable class instance.- Specified by:
addConfigurationParameterin interfaceI_CmsConfigurationParameterHandler- Overrides:
addConfigurationParameterin 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_CmsResourceTypeCreates a new resource of the given resource type with the provided content and properties.- Specified by:
createResourcein interfaceI_CmsResourceType- Overrides:
createResourcein 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_CmsResourceTypeDeletes a resource given its name.The
siblingModeparameter controls how to handle siblings during the delete operation.
Possible values for this parameter are:
- Specified by:
deleteResourcein interfaceI_CmsResourceType- Overrides:
deleteResourcein 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_CmsResourceTypeReturns the default for thecacheproperty setting of this resource type.The
cacheproperty is used by the Flex cache implementation to build the cache key that controls the caching behaviour of a resource.If
nullis returnd, this is the same as turning the cache off by default for this resource type.- Specified by:
getCachePropertyDefaultin interfaceI_CmsResourceType- Overrides:
getCachePropertyDefaultin classA_CmsResourceType- Returns:
- the default for the
cacheproperty setting of this resource type - See Also:
-
getConfiguration
Description copied from interface:I_CmsConfigurationParameterHandlerReturns the parameters of this configurable class instance, ornullif the class does not need any parameters.- Specified by:
getConfigurationin interfaceI_CmsConfigurationParameterHandler- Overrides:
getConfigurationin classA_CmsResourceType- Returns:
- the parameters of this configurable class instance,
or
nullif 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_CmsResourceTypeReturns the formatter configuration for the given resource.- Specified by:
getFormattersForResourcein interfaceI_CmsResourceType- Overrides:
getFormattersForResourcein 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_CmsResourceTypeReturns the gallery preview provider class name.- Specified by:
getGalleryPreviewProviderin interfaceI_CmsResourceType- Overrides:
getGalleryPreviewProviderin classA_CmsResourceType- Returns:
- the gallery preview provider class name
- See Also:
-
getLoaderId
Description copied from interface:I_CmsResourceTypeReturns the loader type id of this resource type.- Specified by:
getLoaderIdin interfaceI_CmsResourceType- Specified by:
getLoaderIdin 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
nullif not set
-
initialize
Description copied from interface:I_CmsResourceTypeInitializes 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:
initializein interfaceI_CmsResourceType- Overrides:
initializein 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_CmsResourceTypeMoves 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:
moveResourcein interfaceI_CmsResourceType- Overrides:
moveResourcein 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 thesourceargument is null or of length 0- See Also:
-
parseLinks
Description copied from interface:I_CmsLinkParseableReturns 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
CmsLinkobjects 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_CmsResourceTypeChanges the "expire" date of a resource.- Specified by:
setDateExpiredin interfaceI_CmsResourceType- Overrides:
setDateExpiredin 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_CmsResourceTypeChanges the "release" date of a resource.- Specified by:
setDateReleasedin interfaceI_CmsResourceType- Overrides:
setDateReleasedin 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_CmsResourceTypeWrites a resource, including it's content.Applies only to resources of type
that have a binary content attached.CmsFile- Specified by:
writeFilein interfaceI_CmsResourceType- Overrides:
writeFilein 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
-