Package lumis.service.categorization
Class CategorizationUtil
- java.lang.Object
-
- lumis.service.categorization.CategorizationUtil
-
public class CategorizationUtil extends java.lang.Object
Contains utility methods related to content categorization features.- Since:
- 6.2.0
- Version:
- $Revision$ $Date$
-
-
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.
-
Constructor Summary
Constructors Constructor Description CategorizationUtil()
-
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 ofterm 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.
-
-
-
Method Detail
-
getTermPathContentIds
public static java.util.List<java.lang.String> getTermPathContentIds(java.lang.String termContentId) throws PortalException, CategorizationUtil.CyclicTermsException
Returns the content identifiers that make up the path to the specified term.- Parameters:
termContentId
- the term's content identifier.- Returns:
- a list of content identifiers, from farthest ancestral to the specified term inclusive.
- 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
-
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 ofterm data tree
- Parameters:
terms
- a collection ofterm 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
-
-