Package org.opencms.file.wrapper
Class CmsResourceWrapperReplaceDeleted
java.lang.Object
org.opencms.file.wrapper.A_CmsResourceWrapper
org.opencms.file.wrapper.CmsResourceWrapperReplaceDeleted
- All Implemented Interfaces:
I_CmsResourceWrapper
Resource wrapper which intercepts createResource calls and substitutes them with replaceResource if there is already a deleted file at the same path.
This is useful because when accessing a repository, users can neither see nor publish deleted files, and thus can not re-create a file of state "deleted".
-
Field Summary
Fields inherited from class org.opencms.file.wrapper.A_CmsResourceWrapper
m_isWrappedResource
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateResource
(CmsObject cms, String resourcename, int type, byte[] content, List<CmsProperty> properties) Creates a new resource of the given resource type with the provided content and properties.boolean
isWrappedResource
(CmsObject cms, CmsResource res) Is called to check if the given resource is handled by this wrapper.Methods inherited from class org.opencms.file.wrapper.A_CmsResourceWrapper
addResourcesToFolder, configure, copyResource, deleteResource, getLock, lockResource, moveResource, readFile, readResource, restoreLink, rewriteLink, unlockResource, wrapResource, writeFile
-
Constructor Details
-
CmsResourceWrapperReplaceDeleted
public CmsResourceWrapperReplaceDeleted()
-
-
Method Details
-
createResource
public CmsResource createResource(CmsObject cms, String resourcename, int type, byte[] content, List<CmsProperty> properties) throws CmsException, CmsIllegalArgumentException Description copied from interface:I_CmsResourceWrapper
Creates a new resource of the given resource type with the provided content and properties.First should be a check if the resourcename is handled by this resource wrapper.
It is possible that the path in the resourcename is a virtual path and so has to be translated into a valid path existing in the VFS to create the resource.
- Specified by:
createResource
in interfaceI_CmsResourceWrapper
- Overrides:
createResource
in classA_CmsResourceWrapper
- Parameters:
cms
- the initialized CmsObjectresourcename
- the name of the resource to create (full path)type
- the type of the resource to createcontent
- the content for the new resourceproperties
- the properties for the new resource- Returns:
- the created resource or null if not handled by this resource wrapper
- Throws:
CmsException
- if something goes wrongCmsIllegalArgumentException
- if thesource
argument is null or of length 0- See Also:
-
isWrappedResource
Description copied from interface:I_CmsResourceWrapper
Is called to check if the given resource is handled by this wrapper.- Parameters:
cms
- the initialized CmsObjectres
- the resource to check- Returns:
- true if the resource will be handled by the wrapper otherwise false
- See Also:
-