Class CollectionViewBean

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

@Named @SessionScoped public class CollectionViewBean extends Object implements Serializable
Creates and stored CollectionViews for a session.
Author:
Florian Alpers
See Also:
  • Constructor Details

    • CollectionViewBean

      public CollectionViewBean()
  • Method Details

    • getCollection

      public CollectionView getCollection(CMSCollectionContent content) throws PresentationException, IndexUnreachableException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
      Gets the CollectionView of the given content item in the given page. If the view hasn't been initialized yet, do so and add it to the Bean's CollectionView map
      Parameters:
      content - a CMSCollectionContent instance providing the base data for this collection
      Returns:
      The CollectionView or null if no matching ContentItem was found
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
    • getCollection

      public CollectionView getCollection(CMSCollectionContent content, String topVisibleElement) throws PresentationException, IndexUnreachableException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
      getCollection.
      Parameters:
      content - collection content item providing base configuration
      topVisibleElement - collection name to use as the top visible element
      Returns:
      the CollectionView for the given content, creating and caching it if not yet initialized
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException - if any.
    • getCollectionId

      public static String getCollectionId(CMSCollectionContent content)
      getCollectionId.
      Parameters:
      content - collection content item to derive the ID from
      Returns:
      a unique string ID derived from the owning page or template and the content item ID
    • getCollectionIfStored

      public Optional<CollectionView> getCollectionIfStored(CMSCollectionContent content)
      getCollectionIfStored.
      Parameters:
      content - collection content item identifying the desired collection
      Returns:
      an Optional containing the cached CollectionView, or empty if not yet initialized
    • removeCollection

      public boolean removeCollection(CMSCollectionContent content)
      removeCollection.
      Parameters:
      content - collection content item identifying the collection to remove
      Returns:
      true if the collection was present and has been removed, false if it was not found
    • initializeCollection

      public CollectionView initializeCollection(CMSCollectionContent content, String topVisibleElement) throws PresentationException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException, IndexUnreachableException
      Creates a collection view object from the item's collection related properties.
      Parameters:
      content - collection content item providing Solr field and filter configuration
      topVisibleElement - collection name to display at the root level
      Returns:
      the newly created and populated CollectionView for the given content configuration
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
    • getPossibleIgnoreCollectionList

      public List<SelectItem> getPossibleIgnoreCollectionList(CMSCollectionContent content, boolean includeSubcollections) throws IndexUnreachableException
      Queries Solr for a list of all values of the set collectionField which my serve as a collection.
      Parameters:
      content - collection content item providing Solr field and filter configuration
      includeSubcollections - if true, nested subcollections are included in the list
      Returns:
      a list of select items representing collection names that can be excluded from the given collection content
      Throws:
      IndexUnreachableException - if any.
    • getPossibleBaseCollectionList

      public List<SelectItem> getPossibleBaseCollectionList(CMSCollectionContent content) throws IndexUnreachableException
      Queries Solr for a list of all values of the set collectionField which my serve as a collection.
      Parameters:
      content - collection content item providing Solr field and filter configuration
      Returns:
      a list of select items representing all possible base collection names for the given collection content
      Throws:
      IndexUnreachableException - if any.
    • getColletionMap

      public Map<String,CollectionResult> getColletionMap(CMSCollectionContent content) throws IndexUnreachableException
      getColletionMap.
      Parameters:
      content - collection content item providing Solr field and filter configuration
      Returns:
      Map<String, CollectionResult>
      Throws:
      IndexUnreachableException
    • removeCollectionsForPage

      public void removeCollectionsForPage(CMSPage page)
      removeCollectionsForPage.
      Parameters:
      page - CMS page whose associated collections should be removed
    • getLoadedCollectionsForPage

      public List<CollectionView> getLoadedCollectionsForPage(CMSPage page)
      getLoadedCollectionsForPage.
      Parameters:
      page - CMS page whose loaded collections to retrieve
      Returns:
      a list of CollectionView instances already loaded for the given CMS page
    • getCollections

      public List<CollectionView> getCollections(String field)
      Get a list of all CollectionViews with the given solr field which are already loaded via getCollection(CMSCollectionContent).
      Parameters:
      field - The solr field the collection is based on
      Returns:
      a list of already-loaded CollectionView instances for the given Solr field
    • invalidate

      public void invalidate()
      invalidate.