Class CmsLocaleGroup


  • public class CmsLocaleGroup
    extends java.lang.Object
    Represents a group of resources which are locale variants of each other.

    • Constructor Detail

      • CmsLocaleGroup

        public CmsLocaleGroup​(CmsObject cms,
                              CmsResource primaryResource,
                              java.util.List<CmsResource> secondaryResources)
        Creates a new instance.

        Parameters:
        cms - the CMS context to use
        primaryResource - the primary resource
        secondaryResources - the secondary resources
    • Method Detail

      • getAllResources

        public java.util.List<CmsResourcegetAllResources()
        Gets the list of all resources of this group (primary and secondary).

        Returns:
        the list of all resources of this group
      • getMainLocale

        public java.util.Locale getMainLocale()
        Gets the main locale (i.e. the locale of the primary resource of this group).

        Returns:
        the main locale
      • getResourcesByLocale

        public java.util.Map<java.util.Locale,​CmsResourcegetResourcesByLocale()
        Gets a map which contains the resources of the locale group as keys, indexed by their locale.

        If the locale group contains more than one resource from the same locale,, which one is used a map value is undefined.

        Returns:
        the map of resources by locale
      • getResourcesForLocale

        public java.util.Collection<CmsResourcegetResourcesForLocale​(java.util.Locale locale)
        Gets the resources of this group which have the given locale.

        Parameters:
        locale - a locale
        Returns:
        the collection of resources with the given locale
      • getSecondaryResources

        public java.util.Set<CmsResourcegetSecondaryResources()
        Gets the secondary resources of this group.

        Returns:
        the collection of secondary resources
      • hasLocale

        public boolean hasLocale​(java.util.Locale locale)
        Checks if this group has a resource with the given locale.

        Parameters:
        locale - the locale
        Returns:
        true if the group has a resource with the locale
      • isMarkedNoTranslation

        public boolean isMarkedNoTranslation​(java.util.Locale locale)
        Checks if the locale group is marked as not translatable for the given locale.

        Parameters:
        locale - a locale
        Returns:
        true if the locale group is marked as not translatable for the given locale
      • isMarkedNoTranslation

        public boolean isMarkedNoTranslation​(java.util.Set<java.util.Locale> locales)
        Checks if the locale group is marked as not translatable for any of the given locales.

        Parameters:
        locales - a set of locales
        Returns:
        true if the locale group is marked as not translatable for any of the given resources
      • isPotentialGroupHead

        public boolean isPotentialGroupHead()
        Returns true if this is a potential group head, i.e. the locale of the primary resource is the main translation locale configured for the site in which it is located.

        Returns:
        true if this is a potential group head
      • isRealGroup

        public boolean isRealGroup()
        Checks if this group is a real group, i.e. consists of more than one resource.

        Returns:
        true if this is a real group
      • isRealGroupOrPotentialGroupHead

        public boolean isRealGroupOrPotentialGroupHead()
        Checks if this is either a real group or a potential group head (i.e. a potential primary resource).

        Returns:
        true if this is a real group or a potential group head