Class CmsCollectionsBean

java.lang.Object
io.goobi.viewer.managedbeans.CmsCollectionsBean
All Implemented Interfaces:
Serializable

@Named @SessionScoped public class CmsCollectionsBean extends Object implements Serializable
Bean handling CMS settings for collections.
Author:
Florian Alpers
See Also:
  • Constructor Details

    • CmsCollectionsBean

      public CmsCollectionsBean()
      Creates a new CmsCollectionsBean instance.
  • Method Details

    • isDisplayTranslationWidget

      public boolean isDisplayTranslationWidget()
      Returns:
      true if the if translations for the values of solrField are not or only partially translated; false if they are fully translated
    • isDisplayTranslationWidgetEdit

      public boolean isDisplayTranslationWidgetEdit()
      Returns:
      true if the if translations for the values of solrField and solrFieldValue are not or only partially translated; false if they are fully translated
    • isDisplaySolrFieldSelectionWidget

      public boolean isDisplaySolrFieldSelectionWidget()
      Returns:
      true if number of available collections is greater than 1; false otherwise
    • getMessageEntryForFieldValue

      public MessageEntry getMessageEntryForFieldValue()
      Returns the MessageEntry representing existing translations for the current value of solrFieldValue. Use for the info widget in the collection administration.
      Returns:
      MessageEntry containing the translations for solrFieldValue; empty MessageEntry if none found
    • isDisplayImportDescriptionsWidget

      public boolean isDisplayImportDescriptionsWidget()
      Returns:
      true keys with description suffix found; false otherwise
    • importDescriptionsAction

      public String importDescriptionsAction(String solrField) throws DAOException
      Parameters:
      solrField - Solr field whose collection descriptions to import
      Returns:
      empty string
      Throws:
      DAOException
    • getCurrentCollection

      public CMSCollection getCurrentCollection()
      Getter for the field currentCollection.
      Returns:
      the currently selected CMS collection being edited
    • setCurrentCollection

      public void setCurrentCollection(CMSCollection currentCollection)
      Setter for the field currentCollection.
      Parameters:
      currentCollection - the CMSCollection to set as the currently selected collection
    • getSolrField

      public String getSolrField()
      Getter for the field solrField.
      Returns:
      the Solr field name used to group and display collections
    • setSolrField

      public void setSolrField(String solrField)
      Setter for the field solrField.
      Parameters:
      solrField - the Solr field name used to group and display collections
    • getSolrFieldValue

      public String getSolrFieldValue()
      Getter for the field solrFieldValue.
      Returns:
      the value of the Solr field identifying the current collection
    • setSolrFieldValue

      public void setSolrFieldValue(String solrFieldValue)
      Setter for the field solrFieldValue.
      Parameters:
      solrFieldValue - the value of the Solr field identifying the current collection
    • getCollectionName

      public String getCollectionName()
    • setCollectionName

      public void setCollectionName(String collectionName) throws DAOException
      Loads existing or creates a new CMSCollection for the current solrfield and the given collectionName.
      Parameters:
      collectionName - Collection field value
      Throws:
      DAOException
    • getAllCollectionFields

      public List<String> getAllCollectionFields()
      getAllCollectionFields.
      Returns:
      a list of all configured collection Solr field names
    • getCollections

      public List<CMSCollection> getCollections()
      Getter for the field collections.
      Returns:
      the list of all CMS collections for the currently selected Solr field
    • updateCollections

      public void updateCollections() throws DAOException
      updateCollections.
      Throws:
      DAOException - if any.
    • deleteCollection

      public void deleteCollection(CMSCollection collection) throws DAOException
      deleteCollection.
      Parameters:
      collection - collection to delete from the database
      Throws:
      DAOException - if any.
    • editCollection

      public String editCollection(CMSCollection collection)
      editCollection.
      Parameters:
      collection - collection to set as current and prepare for editing
      Returns:
      the pretty URL name for the collection edit view
    • getCurrentLabel

      public CMSCollectionTranslation getCurrentLabel(String language)
      getCurrentLabel.
      Parameters:
      language - ISO language code to retrieve the label for
      Returns:
      the label translation of the current collection for the given language
    • getCurrentDescription

      public CMSCollectionTranslation getCurrentDescription(String language)
      getCurrentDescription.
      Parameters:
      language - ISO language code to retrieve the description for
      Returns:
      the description translation of the current collection for the given language
    • saveCurrentCollection

      public String saveCurrentCollection() throws DAOException
      saveCurrentCollection.
      Returns:
      the pretty URL name for the collections overview after saving the current collection
      Throws:
      DAOException - if any.
    • resetCurrentCollection

      public String resetCurrentCollection() throws DAOException
      resetCurrentCollection.
      Returns:
      the pretty URL name for the collections overview after discarding changes to the current collection
      Throws:
      DAOException - if any.
    • isCurrentCollectionValid

      public boolean isCurrentCollectionValid()
      Checks the current collection for validity. Currently only checks if a possibly entered PI exists in the solr
      Returns:
      true if the current collection is valid (i.e. any configured representative work PI exists in Solr), false otherwise
    • validatePI

      public void validatePI(FacesContext context, UIComponent comp, Object value) throws ValidatorException
      validatePI.
      Parameters:
      context - current JSF faces context
      comp - UI component that triggered the validation
      value - PI value submitted by the user
      Throws:
      ValidatorException - if any.
    • validatePI

      public static boolean validatePI(String pi) throws IndexUnreachableException, PresentationException
      Checks if the given pi matches a known PI in the solr index. If the pi is empty, true is returned to allow not setting any pi
      Parameters:
      pi - persistent identifier to look up in the Solr index
      Returns:
      false if no current collection is set, the pi does not match any known work
      Throws:
      IndexUnreachableException - if any.
      PresentationException - if any.
    • getImageMode

    • setImageMode

      public void setImageMode(CmsCollectionsBean.CMSCollectionImageMode imageMode)
    • initImageMode

      public void initImageMode()
      Sets the value of imageMode depending on the properties of currentCollection.
    • getCurrentTab

      public CMSCollectionTreeTab getCurrentTab()
    • setCurrentTab

      public void setCurrentTab(CMSCollectionTreeTab currentTab)
    • loadCollection

      public void loadCollection(String field) throws de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException, IndexUnreachableException
      Initializes the collection tree for the given index field name.
      Parameters:
      field - Solr field name to load the collection for
      Throws:
      de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
      IndexUnreachableException
    • initSolrField

      public void initSolrField() throws de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException, IndexUnreachableException
      Initializes the collection tree for the current solrField, but only if not yet loaded.
      Throws:
      de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
      IndexUnreachableException
    • isDirty

      public boolean isDirty()
    • getSearchUrl

      public String getSearchUrl(CMSCollection collection)