Class Content

  • All Implemented Interfaces:
    java.io.Serializable

    @StableMinor(version="17.0",
                 sinceVersion="4.2")
    public class Content
    extends java.lang.Object
    implements java.io.Serializable
    A content entity object. A content may have its data specified in multiple locales.
    Since:
    4.2.0
    Version:
    $Revision$ $Date$
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Content()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ContentLocale addContentLocale​(java.util.Locale locale)
      Adds a new locale specific content object in this content.
      ContentLocale getContentLocale​(java.util.Locale locale, boolean fallbackToDefaultLocale)
      Returns the locale specific content object, for the given locale, optionally using the default locale.
      java.util.Collection<ContentLocale> getContentLocales()
      Returns the locale specific objects of this content.
      java.util.Locale getDefaultLocale()
      Returns the default locale for this content.
      java.lang.String getId()
      Returns this content's identifier.
      java.lang.String getServiceInstanceId()
      Returns the identifier of the service instance this content belongs to.
      java.lang.String getSourceId()
      Returns the source this content belongs to.
      void setDefaultLocale​(java.util.Locale defaultLocale)
      Sets the default locale for this content.
      void setServiceInstanceId​(java.lang.String serviceInstanceId)
      Sets the service instance this content belongs to.
      void setSourceId​(java.lang.String sourceId)
      Sets the source this content belongs to.
      • Methods inherited from class java.lang.Object

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

      • Content

        public Content()
    • Method Detail

      • getId

        public java.lang.String getId()
        Returns this content's identifier.
        Returns:
        this content's identifier.
        Since:
        4.2.0
      • getServiceInstanceId

        public java.lang.String getServiceInstanceId()
        Returns the identifier of the service instance this content belongs to.
        Returns:
        the identifier of the service instance this content belongs to.
        Since:
        4.2.0
      • setServiceInstanceId

        public void setServiceInstanceId​(java.lang.String serviceInstanceId)
        Sets the service instance this content belongs to.
        Parameters:
        serviceInstanceId - the service instance identifier.
        Since:
        4.2.0
      • getSourceId

        public java.lang.String getSourceId()
        Returns the source this content belongs to.
        Parameters:
        sourceId - the source identifier.
        Since:
        4.2.0
      • setSourceId

        public void setSourceId​(java.lang.String sourceId)
        Sets the source this content belongs to.
        Parameters:
        sourceId - the source identifier.
        Since:
        4.2.0
      • getDefaultLocale

        public java.util.Locale getDefaultLocale()
        Returns the default locale for this content.
        Returns:
        the default locale for this content, or null if this content has no default locale.
        Since:
        4.2.0
      • setDefaultLocale

        public void setDefaultLocale​(java.util.Locale defaultLocale)
        Sets the default locale for this content.
        Parameters:
        defaultLocale - the locale to set. May be null to set that this content has no default locale.
        Since:
        4.2.0
      • getContentLocales

        public java.util.Collection<ContentLocale> getContentLocales()
        Returns the locale specific objects of this content.
        Returns:
        the locale specific objects of this content.
        Since:
        4.2.0
      • addContentLocale

        public ContentLocale addContentLocale​(java.util.Locale locale)
                                       throws PortalException
        Adds a new locale specific content object in this content.
        Parameters:
        locale - the locale.
        Returns:
        the locale specific content object created.
        Throws:
        PortalObjectAlreadyExistsException - if this content already contains an object for the given locale.
        PortalException
        Since:
        4.2.0
      • getContentLocale

        public ContentLocale getContentLocale​(java.util.Locale locale,
                                              boolean fallbackToDefaultLocale)
        Returns the locale specific content object, for the given locale, optionally using the default locale.
        Parameters:
        locale - the locale.
        fallbackToDefaultLocale - if true, the default locale for this content will be used if no contentLocale for the specified locale exists.
        Returns:
        the locale specific content object, or null if no object exists, according to the given parameters.
        Since:
        4.2.0