Class CategorizationUtil


  • public class CategorizationUtil
    extends java.lang.Object
    Contains utility methods related to content categorization features.
    Since:
    6.2.0
    Version:
    $Revision: 20509 $ $Date: 2017-09-11 16:18:14 -0300 (Mon, 11 Sep 2017) $
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CategorizationUtil.CyclicTermsException
      Exception thrown when the path of a term cannot be determined because its ancestral are in a cyclic graph.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getBestTermName​(java.lang.String termContentId)
      Returns the best name of the specified term to be shown to current user.
      static java.lang.String getBestTermName​(java.lang.String termContentId, java.util.Locale locale)
      Returns the best name of the specified term to be shown to current user.
      static java.util.Set<java.lang.String> getDirectTermAssociationsContentIds​(CategorizationDataType.Data terms)
      Returns a list of all direct term associations related the a collection of term data tree
      static java.util.List<java.lang.String> getTermChildrenByContentId​(java.lang.String contentId, java.util.Locale locale)
      Returns a list of all direct children from a given term content identifier.
      static java.util.List<java.lang.String> getTermPathContentIds​(java.lang.String termContentId)
      Returns the content identifiers that make up the path to the specified term.
      static java.util.List<java.lang.String> getTermPathNames​(java.lang.String termContentId)
      Returns the names of terms make up the path to the specified term.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CategorizationUtil

        public CategorizationUtil()
    • Method Detail

      • getTermPathNames

        public static java.util.List<java.lang.String> getTermPathNames​(java.lang.String termContentId)
                                                                 throws PortalException,
                                                                        CategorizationUtil.CyclicTermsException
        Returns the names of terms make up the path to the specified term.
        Parameters:
        termContentId - the term's content identifier.
        Returns:
        a list of term names, from farthest ancestral to the specified term inclusive. If a term has multiple name, the best name appropriate to current user session locale is used.
        Throws:
        PortalObjectNotFoundException - if the specified content could not be found.
        CategorizationUtil.CyclicTermsException - if the path cannot be determined because the term's parent are in a cyclic graph.
        PortalException
        Since:
        6.2.0
      • getBestTermName

        public static java.lang.String getBestTermName​(java.lang.String termContentId)
                                                throws PortalException
        Returns the best name of the specified term to be shown to current user.
        Parameters:
        termContentId - the term's content identifier.
        Returns:
        the name.
        Throws:
        PortalObjectNotFoundException - if the specified content could not be found.
        PortalException
        Since:
        6.2.0
      • getBestTermName

        public static java.lang.String getBestTermName​(java.lang.String termContentId,
                                                       java.util.Locale locale)
                                                throws PortalException
        Returns the best name of the specified term to be shown to current user.
        Parameters:
        termContentId - the term's content identifier.
        Returns:
        the name.
        Throws:
        PortalObjectNotFoundException - if the specified content could not be found.
        PortalException
        Since:
        9.0.0
      • getDirectTermAssociationsContentIds

        public static java.util.Set<java.lang.String> getDirectTermAssociationsContentIds​(CategorizationDataType.Data terms)
        Returns a list of all direct term associations related the a collection of term data tree
        Parameters:
        terms - a collection of term data to extract all terms with direct association.
        Returns:
        a list of all direct term associations related the a collection of term data tree.
        Since:
        9.0.0
      • getTermChildrenByContentId

        public static java.util.List<java.lang.String> getTermChildrenByContentId​(java.lang.String contentId,
                                                                                  java.util.Locale locale)
        Returns a list of all direct children from a given term content identifier.
        Parameters:
        contentId - a term content identifier.
        Returns:
        a list of all direct children.
        Since:
        9.0.0