Class HighlightsBean

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

@Named @SessionScoped public class HighlightsBean extends Object implements Serializable
Managed bean handling Highlight objects.
See Also:
  • Constructor Details

    • HighlightsBean

      public HighlightsBean()
      Empty defaul constructor. The required properties are being injected automatically
    • HighlightsBean

      public HighlightsBean(IDAO dao, NavigationHelper navigationHelper, ImageDeliveryBean imaging)
      Testing constructor explicitly initializing required properties.
      Parameters:
      dao - The IDAO in which to store the highlight data
      navigationHelper - NavigationHelper to handle URL resolving
      imaging - ImageDeliveryBean to handle image URL creation
  • Method Details

    • init

      @PostConstruct public void init()
      Called after initialization to load listing of existing highlights.
    • getAllObjectsProvider

      public TableDataProvider<Highlight> getAllObjectsProvider()
      Get a TableDataProvider to all saved highlights.
      Returns:
      the TableDataProvider for all saved highlights
    • getCurrentObjectsProvider

      public TableDataProvider<Highlight> getCurrentObjectsProvider()
      Get a TableDataProvider to all current highlights. That is all highlights which are valid for the current date and set to active
      Returns:
      the TableDataProvider for all currently active highlights
    • getUrl

      public String getUrl(Highlight object)
      Get the URL to the highlighted object. Either the record page URL of the URL given in highlight creation
      Parameters:
      object - the highlight object
      Returns:
      the URL of the highlighted object, or an empty string if none can be determined
    • deleteObject

      public void deleteObject(Highlight object)
      Delete a Highlight.
      Parameters:
      object - the highlight to delete
    • getSelectedObject

      public Highlight getSelectedObject()
      Get the currently selected Highlight.
      Returns:
      the currently selected highlight, or null if none is selected
    • setSelectedObject

      public void setSelectedObject(Highlight selectedObject)
      Sets the Highlight selected for editing.
      Parameters:
      selectedObject - the highlight to set as selected for editing
    • setSelectedObjectId

      public void setSelectedObjectId(long id)
      Sets the Highlight selected for editing via its database id.
      Parameters:
      id - database id of the highlight to select
    • setNewSelectedObject

      public void setNewSelectedObject()
      Creates a new Highlight and set as the selected highlight.
    • isNewObject

      public boolean isNewObject()
      Checks if the currently selected highlight has been persisted already.
      Returns:
      true if getSelectedObject() has no database id and has thus not been persisted yet
    • saveObject

      public void saveObject(Highlight object) throws DAOException
      Persist the given Highlight to the database.
      Parameters:
      object - the highlight to persist to the database
      Throws:
      DAOException
    • getMetadataElement

      public MetadataElement getMetadataElement()
      If a Highlight has been selected and it points to a record (rather than a URL), retrieve the metadata for this record.
      Returns:
      A MetadataElement with metadata for the related record if one exists. Otherwise null
    • getCurrentHighlight

      public Highlight getCurrentHighlight() throws DAOException
      Get the currently displayed highlight. This highlight is randomly chosen from all highlights valid for the current day which are set to enabled
      Returns:
      a randomly selected currently active highlight, or null if none are active
      Throws:
      DAOException
    • getRecordRepresentativeURI

      Get the URL of a representative image for the record related to the currently selected highlight if a highlight is selected and it refers to a record. Otherwise return null
      Returns:
      A URL to the record for the selected highlight if one exists. Otherwise null
      Throws:
      IndexUnreachableException
      PresentationException
      ViewerConfigurationException
    • getRecordRepresentativeURI

      public URI getRecordRepresentativeURI(int width, int height) throws IndexUnreachableException, PresentationException, ViewerConfigurationException
      Get the URL of a representative image for the record related to the currently selected highlight if a highlight is selected and it refers to a record. Otherwise return null
      Parameters:
      width - the desired width of the image. Chose '0' for original image width
      height - the desired height of the image. Chose '0' for original image height
      Returns:
      A URL to the record for the selected highlight if one exists. Otherwise null
      Throws:
      IndexUnreachableException
      PresentationException
      ViewerConfigurationException
    • getCurrentObjects

      public List<Highlight> getCurrentObjects()
      Get all objected contained in getCurrentObjectsProvider().
      Returns:
      A list of all currently active Highlights
    • getEditStatus

      public HighlightsBean.EditStatus getEditStatus()
      Get the current HighlightsBean.EditStatus.
      Returns:
      the current edit status of the highlight editor
    • setEditStatus

      public void setEditStatus(HighlightsBean.EditStatus editStatus)
      Parameters:
      editStatus - the edit status to set
    • getHighlightsBefore

      public List<Highlight> getHighlightsBefore(LocalDate date) throws DAOException
      Get all Highlights which are not valid for the given date but were before. Only highlights with Highlight.isEnabled() true are included
      Parameters:
      date - the date up to which to return the highlights (exclusively)
      Returns:
      A list of Highlights
      Throws:
      DAOException