Class BookmarkList

java.lang.Object
io.goobi.viewer.model.bookmark.BookmarkList
All Implemented Interfaces:
Serializable, Comparable<BookmarkList>

@Entity public class BookmarkList extends Object implements Serializable, Comparable<BookmarkList>
Represents a named list of bookmarks owned by a user, optionally shareable with others.
See Also:
  • Field Details

  • Constructor Details

    • BookmarkList

      public BookmarkList()
  • Method Details

    • hashCode

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

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

      public int compareTo(BookmarkList o)
      Descending order by dateUpdated.
      Specified by:
      compareTo in interface Comparable<BookmarkList>
      Parameters:
      o - the other bookmark list to compare to
      Returns:
      a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
    • addItem

      public boolean addItem(Bookmark item)
      Add bookshelf to list and save.
      Parameters:
      item - bookmark to add to this list
      Returns:
      boolean if list changed
    • removeItem

      public boolean removeItem(Bookmark item)
      Remove bookshelf from list and save.
      Parameters:
      item - bookmark to remove from this list
      Returns:
      boolean if list changed
    • addGroupShare

      public boolean addGroupShare(UserGroup group)
      Add user group to list and save.
      Parameters:
      group - user group to grant shared access
      Returns:
      boolean if list changed
    • removeGroupShare

      public boolean removeGroupShare(UserGroup group)
      Remove user group from list and save.
      Parameters:
      group - user group to revoke shared access from
      Returns:
      boolean if list changed
    • generateSolrQueryForItems

      public String generateSolrQueryForItems()
      Returns a Solr query that would retrieve the Solr documents representing the items listed on this bookshelf.
      Returns:
      the Solr query string matching all records in this bookmark list
    • isMayView

      public boolean isMayView(User user)
      isMayView.
      Parameters:
      user - user requesting view access; may be null for anonymous
      Returns:
      true if the list is public, if the user is the owner, or if the list has been shared with the user, false otherwise
      Throws:
      DAOException - if any.
    • isMayEdit

      public boolean isMayEdit(User user) throws DAOException
      isMayEdit.
      Parameters:
      user - user requesting edit access; may be null
      Returns:
      true if the user is the owner or a member/owner of a group with which this list is shared, false otherwise
      Throws:
      DAOException - if any.
    • getId

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

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

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

      public void setName(String name)
      Setter for the field name.
      Parameters:
      name - the display name of this bookmark list; leading and trailing whitespace is trimmed
    • getDescription

      public String getDescription()
      Getter for the field description.
      Returns:
      an optional description of this bookmark list
    • setDescription

      public void setDescription(String description)
      Setter for the field description.
      Parameters:
      description - an optional description of this bookmark list
    • hasDescription

      public boolean hasDescription()
      hasDescription.
      Returns:
      true if this bookmark list has a non-blank description, false otherwise
    • getOwner

      public User getOwner()
      Getter for the field owner.
      Returns:
      the user who owns this bookmark list
    • setOwner

      public void setOwner(User owner)
      Setter for the field owner.
      Parameters:
      owner - the user who owns this bookmark list
    • isIsPublic

      public boolean isIsPublic()
      isIsPublic.
      Returns:
      true if this bookmark list is publicly visible without authentication, false otherwise
    • getPublicString

      public String getPublicString()
      getPublicString.
      Returns:
      the isPublic Value as a String
      surrounded with ()
    • setIsPublic

      public void setIsPublic(boolean isPublic)
      Setter for the field isPublic.
      Parameters:
      isPublic - true to make this list publicly visible without authentication
    • getShareKey

      public String getShareKey()
      Getter for the field shareKey.
      Returns:
      the unique key used to share this list via a public URL, or null if sharing is disabled
    • setShareKey

      public void setShareKey(String shareKey)
      Setter for the field shareKey.
      Parameters:
      shareKey - the unique key used to share this list via a public URL; null removes sharing
    • hasShareKey

      public boolean hasShareKey()
    • generateShareKey

      public void generateShareKey()
      Generates a persistent share key for public sharing via link.
    • removeShareKey

      public void removeShareKey()
      Removes the share key.
    • getDateUpdated

      public LocalDateTime getDateUpdated()
    • setDateUpdated

      public void setDateUpdated(LocalDateTime dateUpdated)
    • getNumItems

      public int getNumItems()
      getNumItems.
      Returns:
      Number of items
    • getItems

      public List<Bookmark> getItems()
      Getter for the field items.
      Returns:
      the list of bookmarks contained in this bookmark list
    • setItems

      public void setItems(List<Bookmark> items)
      Setter for the field items.
      Parameters:
      items - the list of bookmarks contained in this bookmark list
    • getGroupShares

      public List<UserGroup> getGroupShares()
      Getter for the field groupShares.
      Returns:
      the list of user groups with whom this bookmark list is shared
    • setGroupShares

      public void setGroupShares(List<UserGroup> groupShares)
      Setter for the field groupShares.
      Parameters:
      groupShares - the user groups that have shared access to this bookmark list
    • getOwnerName

      public String getOwnerName()
      getOwnerName.
      Returns:
      the display name of the owner of this bookmark list, or null if no owner is set
    • getMiradorJsonObject

      public String getMiradorJsonObject(String applicationRoot, String restApiUrl) throws ViewerConfigurationException, IndexUnreachableException, PresentationException
      getMiradorJsonObject.
      Parameters:
      applicationRoot - a String object.
      restApiUrl - base URL of the REST API for manifest links
      Returns:
      the Mirador viewer JSON configuration object for this bookmark list
      Throws:
      ViewerConfigurationException - if any.
      IndexUnreachableException - if any.
      PresentationException - if any.
    • getLegacyManifestUrl

      public String getLegacyManifestUrl(String pi)
      Parameters:
      pi - persistent identifier of the record
      Returns:
      Generated URL
    • getFilterQuery

      public String getFilterQuery()
      getFilterQuery.
      Returns:
      the Solr filter query string matching all PI values in this bookmark list
    • getIIIFCollectionURI

      public String getIIIFCollectionURI()
      getIIIFCollectionURI.
      Returns:
      the IIIF Collection URI for this shared bookmark list, or null if the list has no share key
    • getEscapedName

      public String getEscapedName()
      Returns:
      the URL encoded name
    • isOwnedBy

      public boolean isOwnedBy(User user)
    • numItemsWithoutImages

      public long numItemsWithoutImages()
    • sortBookmarkLists

      public static void sortBookmarkLists(List<BookmarkList> bookmarkLists)
      Parameters:
      bookmarkLists - list of bookmark lists to sort in place