Class CMSCollection

java.lang.Object
io.goobi.viewer.model.cms.collections.CMSCollection
All Implemented Interfaces:
CMSMediaHolder, IPolyglott, BrowseElementInfo, Serializable, Comparable<CMSCollection>

@Entity public class CMSCollection extends Object implements Comparable<CMSCollection>, BrowseElementInfo, CMSMediaHolder, IPolyglott, Serializable
A class representing persistent configurations for a collection. A collections is identified by a SOLR-field name and a label. The most common SOLR-field is "DC" and label is the internal name of the collection to edit. This class allows setting a representative image, names in multiple languages and a uri linking to a collection page.
Author:
Florian Alpers
See Also:
  • Constructor Details

    • CMSCollection

      public CMSCollection()

      Constructor for CMSCollection.

    • CMSCollection

      public CMSCollection(String solrField, String solrFieldValue)
      Default constructor, creating a Collection from the identifying fields solrField and solrFieldValue
      Parameters:
      solrField - The name of the SOLR field holding the values for the collection
      solrFieldValue - The value of the solrField identifying this collection
      Throws:
      IllegalArgumentException - If either argument returns true for StringUtils.isBlank(CharSequence)
    • CMSCollection

      public CMSCollection(CMSCollection orig)
      Cloning constructor
      Parameters:
      orig -
  • Method Details

    • getMediaItem

      public CMSMediaItem getMediaItem()

      Getter for the field mediaItem.

      Specified by:
      getMediaItem in interface CMSMediaHolder
      Returns:
      the mediaItem
    • setMediaItem

      public void setMediaItem(CMSMediaItem mediaItem)

      setMediaItem.

      Specified by:
      setMediaItem in interface CMSMediaHolder
      Parameters:
      mediaItem - a CMSMediaItem object.
    • getCollectionUrl

      public String getCollectionUrl()

      Getter for the field collectionUrl.

      Returns:
      the collectionUri
    • setCollectionUrl

      public void setCollectionUrl(String collectionUrl)

      Setter for the field collectionUrl.

      Parameters:
      collectionUrl - a String object.
    • addLabel

      public void addLabel(CMSCollectionTranslation label)
      Adds a translation for the collection label
      Parameters:
      label - a CMSCollectionTranslation object.
    • addDescription

      public void addDescription(CMSCollectionTranslation description)
      Adds a translation for the collection description
      Parameters:
      description - a CMSCollectionTranslation object.
    • getLabels

      public List<CMSCollectionTranslation> getLabels()
      returns all translations of this page with the tag LABEL_TAG
      Returns:
      all labels for this collections
    • getDescriptions

      public List<CMSCollectionTranslation> getDescriptions()
      returns all translations of this page with the tag DESCRIPTION_TAG
      Returns:
      all descriptions for this collections
    • getLabel

      public String getLabel(Locale locale)
      get the label for the given locale, or an empty string if no matching label exists
      Parameters:
      locale - a Locale object.
      Returns:
      The string value of the label of the given locale, or an empty string
    • getLabelAsTranslation

      public CMSCollectionTranslation getLabelAsTranslation(String language)

      getLabelAsTranslation.

      Parameters:
      language - a String object.
      Returns:
      a CMSCollectionTranslation object.
    • getDescriptionAsTranslation

      public CMSCollectionTranslation getDescriptionAsTranslation(String language)

      getDescriptionAsTranslation.

      Parameters:
      language - a String object.
      Returns:
      a CMSCollectionTranslation object.
    • getDescriptionAsTranslation

      public CMSCollectionTranslation getDescriptionAsTranslation()
      Returns:
      CMSCollectionTranslation
    • setLabel

      public void setLabel(String value, String language)

      setLabel.

      Parameters:
      language - a String object.
      value - a String object.
    • getDescription

      public String getDescription(String language)
      get the description for the given language, or an empty string if no matching description exists the language should be the language code of a Locale and is case insensitive
      Specified by:
      getDescription in interface BrowseElementInfo
      Parameters:
      language - a String object.
      Returns:
      The string value of the description of the given language, or an empty string
    • getDescription

      public String getDescription(Locale locale)
      get the description for the given locale, or an empty string if no matching description exists
      Parameters:
      locale - a Locale object.
      Returns:
      The string value of the description of the given locale, or an empty string
    • getDescription

      public String getDescription()
      get the description for the current locale (given by BeanUtils.getLocale(), or an empty string if no matching description exists
      Specified by:
      getDescription in interface BrowseElementInfo
      Returns:
      The string value of the description of the current locale, or an empty string
    • setDescription

      public void setDescription(String value, String language)

      setDescription.

      Parameters:
      value - a String object.
      language - a String object.
    • getSolrField

      public String getSolrField()

      Getter for the field solrField.

      Returns:
      the solrField. Guaranteed to hold a non-blank value
    • getSolrFieldValue

      public String getSolrFieldValue()

      Getter for the field solrFieldValue.

      Returns:
      the solrFieldValue. Guaranteed to hold a non-blank value
    • compareTo

      public int compareTo(CMSCollection other)
      Compares collection by the alphabatical sorting of their getSolrFieldValue()
      Specified by:
      compareTo in interface Comparable<CMSCollection>
    • hashCode

      public int hashCode()
      Returns the hashCode of getSolrFieldValue()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      A CMSCollection is equal to any other object if that is also a CMSCollection and returns the same values for getSolrField() and getSolrFieldValue()
      Overrides:
      equals in class Object
    • contentEquals

      public boolean contentEquals(CMSCollection other)
      Parameters:
      other -
      Returns:
      a boolean
    • populateLabels

      public void populateLabels()

      populateLabels.

    • populateDescriptions

      public void populateDescriptions()

      populateDescriptions.

    • populateDescriptions

      public void populateDescriptions(List<String> languages)

      populateDescriptions.

      Parameters:
      languages -
    • hasMediaItem

      public boolean hasMediaItem()

      hasMediaItem.

      Specified by:
      hasMediaItem in interface CMSMediaHolder
      Returns:
      a boolean.
    • hasRepresentativeWork

      public boolean hasRepresentativeWork()

      hasRepresentativeWork.

      Returns:
      a boolean.
    • hasImage

      public boolean hasImage()

      hasImage.

      Returns:
      a boolean.
    • getId

      public Long getId()

      Getter for the field id.

      Returns:
      the id
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getName

      public String getName()

      getName.

      Specified by:
      getName in interface BrowseElementInfo
      Returns:
      a String object.
    • getLinkURI

      public URI getLinkURI()

      getLinkURI.

      Specified by:
      getLinkURI in interface BrowseElementInfo
      Returns:
      a URI object.
    • getLinkURI

      public URI getLinkURI(javax.servlet.http.HttpServletRequest request)

      getLinkURI.

      Specified by:
      getLinkURI in interface BrowseElementInfo
      Parameters:
      request - a HttpServletRequest object.
      Returns:
      a URI object.
    • getIconURI

      public URI getIconURI()

      getIconURI.

      Specified by:
      getIconURI in interface BrowseElementInfo
      Returns:
      a URI object.
    • getIconURI

      public URI getIconURI(int width, int height)

      getIconURI.

      Specified by:
      getIconURI in interface BrowseElementInfo
      Parameters:
      width - a int.
      height - a int.
      Returns:
      a URI object.
    • getIconURI

      public URI getIconURI(int size)

      getIconURI.

      Specified by:
      getIconURI in interface BrowseElementInfo
      Parameters:
      size - a int.
      Returns:
      a URI object.
    • getDefaultIcon

      @Deprecated(since="24.10") public static URI getDefaultIcon(String collectionName)
      Deprecated.
      Parameters:
      collectionName -
      Returns:
      URI
    • getRepresentativeWork

      public Optional<StructElement> getRepresentativeWork()

      getRepresentativeWork.

      Returns:
      a Optional object.
    • getRepresentativeWorkPI

      public String getRepresentativeWorkPI()

      Getter for the field representativeWorkPI.

      Returns:
      the representativeWorkPI
    • setRepresentativeWorkPI

      public void setRepresentativeWorkPI(String representativeWorkPI)

      Setter for the field representativeWorkPI.

      Parameters:
      representativeWorkPI - the representativeWorkPI to set
    • getTranslationsForName

      public de.intranda.metadata.multilanguage.IMetadataValue getTranslationsForName()

      getTranslationsForName.

      Specified by:
      getTranslationsForName in interface BrowseElementInfo
      Returns:
      a IMetadataValue object.
    • getTranslationsForDescription

      public de.intranda.metadata.multilanguage.IMetadataValue getTranslationsForDescription()
      Specified by:
      getTranslationsForDescription in interface BrowseElementInfo
      Returns:
      IMetadataValue
    • getMediaFilter

      public String getMediaFilter()

      A regular expression determining which filenames are shown in the media list and may be uploaded

      Specified by:
      getMediaFilter in interface CMSMediaHolder
      Returns:
      a String object.
    • getMediaTypes

      public String getMediaTypes()
      Description copied from interface: CMSMediaHolder
      A string representing the allowed media formates for a user. Should be a comma separated list of format names or filename suffixes
      Specified by:
      getMediaTypes in interface CMSMediaHolder
      Returns:
      String
    • getMediaItemWrapper

      public CategorizableTranslatedSelectable<CMSMediaItem> getMediaItemWrapper()

      getMediaItemWrapper.

      Specified by:
      getMediaItemWrapper in interface CMSMediaHolder
      Returns:
      a CategorizableTranslatedSelectable object.
    • isComplete

      public boolean isComplete(Locale locale)
      Description copied from interface: IPolyglott
      If this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unless IPolyglott.isEmpty(Locale) also returns true
      Specified by:
      isComplete in interface IPolyglott
      Returns:
      true if IPolyglott.isValid(Locale) returns true for the given locale and all fields contain a value which have a value in the default locale. For the default locale, IPolyglott.isComplete(Locale) and IPolyglott.isValid(Locale) are identical. For implementations with only one field, both methods are also always identical
    • isValid

      public boolean isValid(Locale locale)
      Description copied from interface: IPolyglott
      Only meaningfull for the default language for which all required fields must be filled
      Specified by:
      isValid in interface IPolyglott
      Returns:
      true if all required fields contain a value in the given locale
    • isEmpty

      public boolean isEmpty(Locale locale)
      Description copied from interface: IPolyglott
      If this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class
      Specified by:
      isEmpty in interface IPolyglott
      Returns:
      true if no fields are filled for the given locale
    • getSelectedLocale

      public Locale getSelectedLocale()
      Specified by:
      getSelectedLocale in interface IPolyglott
      Returns:
      the locale currently set by IPolyglott.setSelectedLocale(Locale)
    • setSelectedLocale

      public void setSelectedLocale(Locale locale)
      Description copied from interface: IPolyglott
      Set the locale to use for display and editing
      Specified by:
      setSelectedLocale in interface IPolyglott