Class ResourceHelper
java.lang.Object
org.apache.sling.discovery.commons.providers.util.ResourceHelper
Some helper methods surrounding resources
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandeleteResource(ResourceResolver resourceResolver, String path) static ResourcegetOrCreateResource(ResourceResolver resourceResolver, String path) static StringBuildergetPropertiesForLogging(Resource resource) Compile a string builder containing the properties of a resource - used for loggingstatic voidmoveResource(Resource res, String path) Move resource to given path.
-
Constructor Details
-
ResourceHelper
public ResourceHelper()
-
-
Method Details
-
getOrCreateResource
public static Resource getOrCreateResource(ResourceResolver resourceResolver, String path) throws PersistenceException - Throws:
PersistenceException
-
deleteResource
public static boolean deleteResource(ResourceResolver resourceResolver, String path) throws PersistenceException - Throws:
PersistenceException
-
getPropertiesForLogging
Compile a string builder containing the properties of a resource - used for logging -
moveResource
Move resource to given path. Try to do it optimized via JCR API. If JCR is not available, fallback to Sling Resource API.- Parameters:
res- Source resourcepath- Target path- Throws:
PersistenceException
-