Class Category


  • public class Category
    extends Object
    The Category represents a hierarchical entry of a category path and allows to get locale specific information of such an entry, like a name.

    The locale specific information is stored in the CMS. E.g. the name of the category Finance/Invoices is stored in the CMS below /Categories/Finance/Invoices/name.

    Example:

     ivy.case.setCategoryPath("Finance/Invoices");
     
     ivy.case.getCategory().getName() = EN: "Invoices", DE: "Rechnungen"
     ivy.case.getCategory().getPath() = EN: "Finance/Invoices", DE: "Finanzen/Rechnungen"
     ivy.case.getCategory().getPath(":") = EN: "Finance:Invoices", DE: "Finanzen:Rechnungen"
     
    API:
    This is a public API.
    • Method Detail

      • getPath

        public String getPath()
        Returns the localized category path with default path separator "/".
        Returns:
        the localized category path with default path separator "/"
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • getPath

        public String getPath​(String separator)
        Returns the localized category path with the given separator.
        Parameters:
        separator - the separator between the parts of the path
        Returns:
        the localized category path with the given separator
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • getPath

        public String getPath​(Locale locale)
        Returns the localized category path with default path separator "/".
        Parameters:
        locale - the requested locale
        Returns:
        the localized category path with default path separator "/"
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • getPath

        public String getPath​(String separator,
                              Locale locale)
        Returns the localized category path with the given separator and locale.
        Parameters:
        separator - the separator between the parts of the path
        locale - the requested locale
        Returns:
        the localized category path with the given separator and locale
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • getName

        public String getName()
        Returns the locale specific name of this category as defined in the CMS.

        E.g. the name of the category Finance/Invoices is stored in the CMS below /Categories/Finance/Invoices/name.

        The locale is evaluated from the current context/user. If no CMS entry for the locale exists then the default CMS language is used.

        If the CMS entry does not exists or is empty, the last part of the underlying CategoryPath is returned. E.g. for the category Finance/Invoices the value Invoices will be returned.

        Returns:
        the name of this category
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • getName

        public String getName​(Locale locale)
        Returns the name of this category as defined in the CMS for the given locale.

        E.g. the name of the category Finance/Invoices is stored in the CMS below /Categories/Finance/Invoices/name.

        If no entry for the given locale exists then the default CMS language is used.

        If the CMS entry does not exists or the value is empty, the last part of the underlying CategoryPath is returned. E.g. for the category Finance/Invoices the value Invoices will be returned.

        Parameters:
        locale - the requested locale
        Returns:
        the name of this category
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • getLocalizedText

        public String getLocalizedText​(String key)
        Returns the localized text from the CMS for the given key under this category.

        E.g. The key tooltip of the category Finance/Invoices is stored in the CMS below /Categories/Finance/Invoices/tooltip.

        The locale is evaluated from the current context/user. If no CMS entry for the locale exists then the default CMS language is used.

        If the CMS entry does not exists then an empty string will be returned.

        Example:

         ivy.case.setCategoryPath("Finance/Invoices");
        
         // Will request the CMS entry below 'Case/Categories/Finance/Invoices/tooltip'
         String categoryTooltip = ivy.case.getCategory().getLocalizedText("tooltip");
         
        Parameters:
        key - The key of the requested entry
        Returns:
        the text for the given key of this category as defined in the CMS.
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • getLocalizedText

        public String getLocalizedText​(String key,
                                       Locale locale)
        Returns the localized text from the CMS for the given key under this category.

        E.g. The key tooltip of the category Finance/Invoices is stored in the CMS below /Categories/Finance/Invoices/tooltip.

        If no CMS entry for the locale exists then the default CMS language is used.

        If the CMS entry does not exists then an empty string will be returned.

        Parameters:
        key - the key of the requested entry
        locale - the requested locale
        Returns:
        the text for the given key of this category as defined in the CMS.
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • getParts

        public List<Category> getParts()
        Returns all category parts of this category
        Returns:
        a list of Categories of this category beginning form the top category
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • getParent

        public Category getParent()
        Returns the parent Category or null it this is top category

        Example:

         ivy.case.getCategory().getPath(); // returns: "foo/bar"
         ivy.case.getCategory().getParent().getPath(); // returns: "foo"
         ivy.case.getCategory().getParent().getParent(); // returns: null
         
        Returns:
        the parent Category or null
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • getCmsUri

        public String getCmsUri()
        Returns the CMS URI of this category.

        E.g. For the category Finance/Invoices the path /Categories/Finance/Invoices will be returned.

        Returns:
        the CMS URI of this category.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.