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
public class CmsResourceWrapperReplaceDeleted extends A_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
Constructors Constructor Description CmsResourceWrapperReplaceDeleted()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CmsResourcecreateResource(CmsObject cms, java.lang.String resourcename, int type, byte[] content, java.util.List<CmsProperty> properties)Creates a new resource of the given resource type with the provided content and properties.booleanisWrappedResource(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 Detail
-
CmsResourceWrapperReplaceDeleted
public CmsResourceWrapperReplaceDeleted()
-
-
Method Detail
-
createResource
public CmsResource createResource(CmsObject cms, java.lang.String resourcename, int type, byte[] content, java.util.List<CmsProperty> properties) throws CmsException, CmsIllegalArgumentException
Description copied from interface:I_CmsResourceWrapperCreates 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:
createResourcein interfaceI_CmsResourceWrapper- Overrides:
createResourcein 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 thesourceargument is null or of length 0- See Also:
A_CmsResourceWrapper.createResource(org.opencms.file.CmsObject, java.lang.String, int, byte[], java.util.List)
-
isWrappedResource
public boolean isWrappedResource(CmsObject cms, CmsResource res)
Description copied from interface:I_CmsResourceWrapperIs 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:
I_CmsResourceWrapper.isWrappedResource(org.opencms.file.CmsObject, org.opencms.file.CmsResource)
-
-