Class Bookmark

java.lang.Object
io.goobi.viewer.model.bookmark.Bookmark
All Implemented Interfaces:
Serializable

@Entity public class Bookmark extends Object implements Serializable
Represents a single bookmark entry linking a user to a specific record or page.
See Also:
  • Constructor Details

    • Bookmark

      public Bookmark()
      Empty constructor.
    • Bookmark

      public Bookmark(String pi, String mainTitle, String name)
      Creates a new Bookmark instance.
      Parameters:
      pi - persistent identifier of the record
      mainTitle - main title of the bookmarked record
      name - display name for this bookmark
    • Bookmark

      public Bookmark(String pi, String logId, Integer order) throws IndexUnreachableException, PresentationException
      Creates a new bookmark based in book pi, section logId and page order logId and order my be empty or null, if only the book itself is references. PI must be non-empty, otherwise a NullPointerException is thrown The item name will be inferred from the book/section title from Solr. If that fails, an IndexUnreachableException or PresentationException is thrown
      Parameters:
      pi - persistent identifier of the record
      logId - structural element log ID, may be null or empty
      order - page order number, may be null
      Throws:
      NullPointerException - if pi is null or blank
      IndexUnreachableException - if any.
      PresentationException - if any.
    • Bookmark

      public Bookmark(String pi, String logId, Integer order, boolean ignoreMissingSolrDoc) throws IndexUnreachableException, PresentationException
      Creates a new bookmark based in book pi, section logId and page order logId and order my be empty or null, if only the book itself is references. PI must be non-empty, otherwise a NullPointerException is thrown The item name will be inferred from the book/section title from Solr. If that fails, an IndexUnreachableException or PresentationException is thrown
      Parameters:
      pi - persistent identifier of the record
      logId - structural element log ID, may be null or empty
      order - page order number, may be null
      ignoreMissingSolrDoc - should be false, unless arbitrary pi/logid values should be allowed (e.g. for testing)
      Throws:
      NullPointerException - if pi is null or blank
      IndexUnreachableException - if any.
      PresentationException - if any.
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • bothEqualOrNull

      public boolean bothEqualOrNull(Object o1, Object o2)
      bothEqualOrNull.
      Parameters:
      o1 - first object to compare
      o2 - second object to compare
      Returns:
      true if both objects are null or if o1 equals o2, false otherwise
    • bothEqualOrBlank

      public boolean bothEqualOrBlank(String o1, String o2)
      bothEqualOrBlank.
      Parameters:
      o1 - first string to compare
      o2 - second string to compare
      Returns:
      true if both strings are blank or if they are equal after trimming, false otherwise
    • getUrl

      Returns the image view URL for this bookmark. If this is the first call, the url is constructed first.
      Returns:
      The URL as string.
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
    • getRepresentativeImageUrl

      Returns the URL to the representative image thumbnail for the record represented by this item.
      Returns:
      the thumbnail URL for the representative image of this bookmarked record at default dimensions
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      ViewerConfigurationException - if any.
      DAOException - if any.
    • getRepresentativeImageUrl

      public String getRepresentativeImageUrl(int width, int height) throws PresentationException, IndexUnreachableException, ViewerConfigurationException, DAOException
      Returns the URL to the representative image thumbnail for the record represented by this item.
      Parameters:
      width - desired thumbnail width in pixels
      height - desired thumbnail height in pixels
      Returns:
      the thumbnail URL for the representative image of this bookmarked record scaled to the given dimensions
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      ViewerConfigurationException - if any.
      DAOException - if any.
    • getDocumentTitle

      public String getDocumentTitle() throws IndexUnreachableException, PresentationException
      Retrieves the documents title from the Solr index using the stored pi and - if nonempty - the logId.
      Returns:
      the title of the bookmarked document as retrieved from the Solr index
      Throws:
      IndexUnreachableException - if any.
      PresentationException - if any.
    • getId

      public Long getId()
      Getter for the field id.
      Returns:
      the database primary key of this bookmark
    • setId

      public void setId(Long id)
      Setter for the field id.
      Parameters:
      id - the database ID to set
    • getBookmarkList

      public BookmarkList getBookmarkList()
      Getter for the field bookmarkList.
      Returns:
      the parent bookmark list this item belongs to
    • setBookmarkList

      public void setBookmarkList(BookmarkList bookmarkList)
      Setter for the field bookmarkList.
      Parameters:
      bookmarkList - the parent bookmark list this item belongs to
    • getPi

      public String getPi()
      Getter for the field pi.
      Returns:
      the persistent identifier of the bookmarked record
    • setPi

      public void setPi(String pi)
      Setter for the field pi.
      Parameters:
      pi - the persistent identifier of the bookmarked record
    • getLogId

      public String getLogId()
      Getter for the field logId.
      Returns:
      the METS logical structure ID identifying a specific section within the record
    • setLogId

      public void setLogId(String logId)
      Setter for the field logId.
      Parameters:
      logId - the METS logical structure ID identifying a specific section within the record
    • getUrn

      public String getUrn()
      Getter for the field urn.
      Returns:
      the URN identifying the bookmarked resource
    • setUrn

      public void setUrn(String urn)
      Setter for the field urn.
      Parameters:
      urn - the URN identifying the bookmarked resource
    • getName

      public String getName()
      Getter for the field name.
      Returns:
      the display name for this bookmark entry
    • setName

      public void setName(String name)
      Setter for the field name.
      Parameters:
      name - the display name for this bookmark entry
    • getDescription

      public String getDescription()
      Getter for the field description.
      Returns:
      an optional description or note for this bookmark entry
    • setDescription

      public void setDescription(String description)
      Setter for the field description.
      Parameters:
      description - an optional description or note for this bookmark entry
    • getDateAdded

      public LocalDateTime getDateAdded()
      Getter for the field dateAdded.
      Returns:
      the timestamp when this bookmark was added
    • setDateAdded

      public void setDateAdded(LocalDateTime dateAdded)
      Setter for the field dateAdded.
      Parameters:
      dateAdded - the timestamp when this bookmark was added
    • getOrder

      public Integer getOrder()
      Getter for the field order.
      Returns:
      the sort position of this bookmark within its list
    • setOrder

      public void setOrder(Integer order)
      Setter for the field order.
      Parameters:
      order - the sort position of this bookmark within its list
    • getMetadataElement

      public MetadataElement getMetadataElement() throws IndexUnreachableException
      Throws:
      IndexUnreachableException
    • getSolrQueryForDocument

      public String getSolrQueryForDocument()
      0.
      Returns:
      Generated Solr query
    • getBrowseElement

      public BrowseElement getBrowseElement() throws DAOException, IndexUnreachableException
      Throws:
      DAOException
      IndexUnreachableException
    • isHasImages

      public boolean isHasImages()