Class PropertyUtil


  • public class PropertyUtil
    extends Object
    This class provides various utility methods that are used by the property test cases.
    • Method Detail

      • getValue

        public static Value getValue​(Property prop)
                              throws RepositoryException
        Returns the value of a property. If prop is multi valued this method returns the first value.
        Parameters:
        prop - the property from which to return the value.
        Returns:
        the value of the property.
        Throws:
        RepositoryException
      • checkNameFormat

        public static boolean checkNameFormat​(String name,
                                              Session session)
                                       throws RepositoryException
        checks if the given name follows the NAME syntax rules and if a present prefix is mapped to a registered namespace
        Parameters:
        name - the string to test
        Throws:
        RepositoryException
      • isDateFormat

        public static boolean isDateFormat​(String str)
        Checks if the String is a valid date in string format.
        Parameters:
        str - the string to test.
        Returns:
        true if str is a valid date format.
      • countBytes

        public static long countBytes​(Value val)
        Counts the number of bytes of a Binary value.
        Parameters:
        val - the binary value.
        Returns:
        the number of bytes or -1 in case of any exception
      • equalValues

        public static boolean equalValues​(Value val1,
                                          Value val2)
                                   throws RepositoryException
        Helper method to compare the equality of two values for equality with the fulfilling of the equality conditions. These conditions for the values are to have the same type and the same string representation.
        Parameters:
        val1 - first value
        val2 - second value
        Returns:
        true if the equals method is equivalent to the normative definition of value equality, false in the other case.
        Throws:
        RepositoryException
      • nullValues

        public static boolean nullValues​(Node node)
                                  throws RepositoryException
        Helper method to assure that no property with a null value exist.
        Parameters:
        node - the node to start the search from.
        Returns:
        true if a null value property is found; false in the other case.
        Throws:
        RepositoryException
      • searchMultivalProp

        public static Property searchMultivalProp​(Node node)
                                           throws RepositoryException
        Helper method to find a multivalue property.
        Parameters:
        node - the node to start the search from.
        Returns:
        a multivalue property or null if not found any.
        Throws:
        RepositoryException
      • searchMultivalProp

        public static Property searchMultivalProp​(Node node,
                                                  int type)
                                           throws RepositoryException
        Helper method to find a multivalue property of a given type.
        Parameters:
        node - the node to start the search from.
        type - the property type.
        Returns:
        a multivalue property or null if not found any.
        Throws:
        RepositoryException