Class Resources


  • public final class Resources
    extends java.lang.Object
    Resources provides helper methods to deal with modifying a Resource.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Resource copy​(Resource src, Resource dstParent, java.lang.String name, int depth)
      Copies the resource into the destinationParent.
      static Resource copy​(Resource src, Resource dstParent, java.lang.String name, int depth, java.util.Set<java.lang.String> ignoreProperties)
      Copies the resource into the destinationParent.
      static Resource copy​(Resource src, Resource dstParent, java.lang.String name, int depth, java.util.Set<java.lang.String> ignoreProperties, java.util.Set<java.lang.String> ignoreChildren)
      Copies the resource into the destinationParent.
      static int getSize​(java.util.Iterator<Resource> children, Filter<Resource> filter)
      Returns the number of child resources for the specified Resource.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getSize

        public static int getSize​(java.util.Iterator<Resource> children,
                                  Filter<Resource> filter)
        Returns the number of child resources for the specified Resource.
        Parameters:
        children - Iterator to get size from
        filter - A Filter implementation or null
        Returns:
        Number of elements in provided children
      • copy

        public static Resource copy​(Resource src,
                                    Resource dstParent,
                                    java.lang.String name,
                                    int depth)
                             throws PersistenceException
        Copies the resource into the destinationParent. The name of the newly created item is set to name.
        Parameters:
        src - The resource to copy to the new location
        dstParent - The resource into which the resource is to be copied.
        name - The name of the newly created item. If this is null the new item gets the same name as the src item.
        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,
                                    java.lang.String name,
                                    int depth,
                                    java.util.Set<java.lang.String> ignoreProperties,
                                    java.util.Set<java.lang.String> ignoreChildren)
                             throws PersistenceException
        Copies the resource into the destinationParent. The name of the newly created item is set to name.
        Parameters:
        src - The resource to copy to the new location
        dstParent - The resource into which the resource is to be copied.
        name - The name of the newly created item. If this is null the new item gets the same name as the src item.
        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,
                                    java.lang.String name,
                                    int depth,
                                    java.util.Set<java.lang.String> ignoreProperties)
                             throws PersistenceException
        Copies the resource into the destinationParent. The name of the newly created item is set to name.
        Parameters:
        src - The resource to copy to the new location
        dstParent - The resource into which the resource is to be copied.
        name - The name of the newly created item. If this is null the new item gets the same name as the src item.
        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.