Class InfobaseReferences


  • public final class InfobaseReferences
    extends Object
    Infobase references utility methods.
    Restriction:
    This class is not intended to be sub-classed by clients.
    Restriction:
    This class is not intended to be instantiated by clients.
    • Method Detail

      • asPlainList

        public static List<InfobaseReference> asPlainList​(Collection<Section> sections)
        Return tree-structured section list as plain infobase references list.
        Parameters:
        sections - the tree-structured section collection, cannot be null
        Returns:
        a plain infobase references list, never null
      • asPlainListWithGroups

        public static List<Section> asPlainListWithGroups​(Collection<Section> sections)
        Return tree-structured section list as plain infobase references list.
        Parameters:
        sections - the tree-structured section collection, cannot be null
        Returns:
        a plain infobase references list, never null
      • compare

        public static int compare​(Section section,
                                  Section other,
                                  SectionPresentationMode mode)
        Compares two specified Section values in terms of sections order, using the provided section presentation mode.
        Parameters:
        section - the first Section to compare, cannot be null
        other - the second Section to compare, cannot be null
        mode - the mode of section presentation: as list or as tree, cannot be null
        Returns:
        the value 0 if section has the same order as other; a value less than 0 if section is less in order than other; and a value greater than 0 if section is numerically greater than other
      • contains

        public static boolean contains​(Collection<InfobaseReference> infobases,
                                       InfobaseReference candidate)
        Returns, whether the provided infobase is contained inside the provided infobases collection. Method uses InfobaseReferences.equals instead of objects identity.
        Parameters:
        infobases - the collection of infobases, cannot be null
        candidate - the infoabse to check containment for, cannot be null
        Returns:
        whether the provided infobase is contained inside the provided infobases collection
      • equals

        public static boolean equals​(Section first,
                                     Section second)
        Determines whether two possibly-null infobase sections are equal. Returns:
        • true if first and second are both null.
        • true if first and second are both non-null and they have same UUID.
        • false in all other situations.
        Parameters:
        first - the fist infobase section to check equality, cannot be null
        second - the second infobase section to check equality, cannot be null
        Returns:
        whether two possibly-null infobases are equal
      • findByUuid

        public static <T extends Section> T findByUuid​(UUID uuid,
                                                       Collection<T> sections)
        Finds an infobase section in the provided section collection by the provided section UUID.
        Parameters:
        uuid - the UUID to find infobase reference with, cannot be null
        sections - a collection of sections to search in, cannot be null
        Returns:
        the section with the provided UUID if found, or null if not found
      • getAlias

        public static String getAlias​(InfobaseReference infobase)
        Returns the infobase alias for provided infobase:
        • DefAlias for file infobases
        • infobase server reference for server infobases
        Parameters:
        infobase - the infobase to define alias for, file or server type, cannot be null
        Returns:
        the infobase alias, never null
        Throws:
        IllegalArgumentException - if the provided infobase is not file or server
      • getGroupNames

        public static List<String> getGroupNames​(Collection<Section> sections)
        Returns a list of all group names from provided sections and its subsections.
        Parameters:
        sections - the section collection to iterate and get names, cannot be null
        Returns:
        a list of all group names, never null
      • getInfobaseNames

        public static List<String> getInfobaseNames​(Collection<Section> sections)
        Returns a list of all infobase names of provided sections and its subsections.
        Parameters:
        sections - the section collection to iterate and get names, cannot be null
        Returns:
        a list of all names, never null
      • getInfobasesPresentation

        public static String getInfobasesPresentation​(Collection<InfobaseReference> infobases)
        Return a UI presentation for the collection of infobases. May be used to show probably-long collection of infobases.
        Parameters:
        infobases - a collection of infobases, cannot be null
        Returns:
        the UI presentation, never null
      • getNames

        public static List<String> getNames​(Collection<Section> sections)
        Returns a list of all names of provided sections and its subsections.
        Parameters:
        sections - the section collection to iterate and get names, cannot be null
        Returns:
        the list of all names, never null
      • newFileInfobaseReference

        public static InfobaseReference newFileInfobaseReference​(String fileLocation)
        Creates and returns model instance of infobase reference of file type located in the provided fileLocation.
        Parameters:
        fileLocation - the file system infobase location, cannot be null
        Returns:
        a file infobase referece, never null
      • newServerInfobaseReference

        public static InfobaseReference newServerInfobaseReference​(String server,
                                                                   String reference)
        Creates and returns model instance of infobase reference of server type located in the provided server and referenced with reference.
        Parameters:
        server - a server name, cannot be null
        reference - an infobase reference in this server, cannot be null
        Returns:
        a server infobase referece, never null
      • newWebInfobaseReference

        public static InfobaseReference newWebInfobaseReference​(String url)
        Creates and returns model instance of infobase reference of web type with URL reference to provided url.
        Parameters:
        url - the URL, cannot be null
        Returns:
        a web infobase referece, never null
      • notExists

        public static boolean notExists​(InfobaseReference infobase)
        Returns whether the provided infobase does not exist.
        Parameters:
        infobase - the infobase to check existence form cannot be null
        Returns:
        whether the provided infobase does not exist
      • notWeb

        public static boolean notWeb​(InfobaseReference infobase)
        Returns wheter the provided infobase has not a web type.
        Returns:
        wheter the provided infobase has not a web type
      • remove

        public static boolean remove​(Collection<InfobaseReference> infobases,
                                     InfobaseReference candidate)
        Remove infobase from the infobase collection. Method uses InfobaseReferences.equals instead of objects identity.
        Parameters:
        infobases - a collection of infobases, cannot be null
        candidate - the infoabse to remove for, cannot be null
        Returns:
        whether infobase was actually removed