Package com.adobe.granite.rest.utils
Class Resources
java.lang.Object
com.adobe.granite.rest.utils.Resources
Resources provides helper methods to deal with modifying a
Resource.-
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceCopies theresourceinto thedestinationParent.static ResourceCopies theresourceinto thedestinationParent.static Resourcecopy(Resource src, Resource dstParent, String name, int depth, Set<String> ignoreProperties, Set<String> ignoreChildren) Copies theresourceinto thedestinationParent.static intReturns the number of child resources for the specifiedResource.
-
Method Details
-
getSize
Returns the number of child resources for the specifiedResource.- Parameters:
children- Iterator to get size fromfilter- AFilterimplementation ornull- Returns:
- Number of elements in provided
children
-
copy
public static Resource copy(Resource src, Resource dstParent, String name, int depth) throws PersistenceException Copies theresourceinto thedestinationParent. The name of the newly created item is set toname.- Parameters:
src- The resource to copy to the new locationdstParent- The resource into which theresourceis to be copied.name- The name of the newly created item. If this isnullthe new item gets the same name as thesrcitem.depth- Traversal depth of copy. 0 indicates that only the source and its properties are copied. A value > 0 indicates the depth of childs to be copied.- Returns:
- The copied
Resource - Throws:
PersistenceException- May be thrown in case of any problem copying the content.
-
copy
public static Resource copy(Resource src, Resource dstParent, String name, int depth, Set<String> ignoreProperties, Set<String> ignoreChildren) throws PersistenceException Copies theresourceinto thedestinationParent. The name of the newly created item is set toname.- Parameters:
src- The resource to copy to the new locationdstParent- The resource into which theresourceis to be copied.name- The name of the newly created item. If this isnullthe new item gets the same name as thesrcitem.depth- Traversal depth of copy. 0 indicates that only the source and its properties are copied. A value > 0 indicates the depth of childs to be copied.ignoreProperties- A set of all properties that will be excluded from the copy.ignoreChildren- A set of all children that will be excluded from the copy.- Returns:
- The copied
Resource - Throws:
PersistenceException- May be thrown in case of any problem copying the content.
-
copy
public static Resource copy(Resource src, Resource dstParent, String name, int depth, Set<String> ignoreProperties) throws PersistenceException Copies theresourceinto thedestinationParent. The name of the newly created item is set toname.- Parameters:
src- The resource to copy to the new locationdstParent- The resource into which theresourceis to be copied.name- The name of the newly created item. If this isnullthe new item gets the same name as thesrcitem.depth- Traversal depth of copy. 0 indicates that only the source and its properties are copied. A value > 0 indicates the depth of childs to be copied.ignoreProperties- A set of all properties that will be excluded from the copy.- Returns:
- The copied
Resource - Throws:
PersistenceException- May be thrown in case of any problem copying the content.
-