Class UserBookmarkResourceBuilder
java.lang.Object
io.goobi.viewer.api.rest.resourcebuilders.AbstractBookmarkResourceBuilder
io.goobi.viewer.api.rest.resourcebuilders.UserBookmarkResourceBuilder
REST resource builder for bookmark lists owned by an authenticated user. Implements bookmark
list operations backed by the database, including support for sharing lists with user groups.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a new BookmarkList with the given name to the current users bookmark lists.addBookmarkList(String name) Adds a new BookmarkList with the given name to the current users bookmark lists.addBookmarkToBookmarkList(Long id, String pi) Adds a new Bookmark with the given pi to the current users bookmark list with the given id.addBookmarkToBookmarkList(Long id, String pi, String logId, String pageString) Adds a new Bookmark with the given pi, LOGID and page number to the current user's bookmark list with the given id.Adds the current session bookmark list to the current user bookmark lists under a newly generated name.addUserBookmarkListFromSession(String name, HttpSession session) Adds the current session bookmark list to the current user's bookmark lists under the given name.Counts the items contained in the current user's bookmark list with the given id and returns the number as plain integer.de.intranda.api.iiif.presentation.v2.Collection2createCollection(BookmarkList list, AbstractApiUrlManager urls) deleteBookmarkFromBookmarkList(Long id, String pi) Removes a Bookmark with the given pi from the current users bookmark list with the given id.deleteBookmarkFromBookmarkList(Long id, String pi, String logId, String pageString) Removes a Bookmark with the given pi, logid and page number from the current users bookmark list with the given id.Deletes the current user's bookmark list with the given id.Returns all BookmarkList owned by the current user.de.intranda.api.iiif.presentation.v2.Collection2getAsCollection(Long id, AbstractApiUrlManager urls) getAsCollection.Returns the bookmark list with the given id, provided it is owned by the user or it is public or shared to him.Returns the user bookmark list with the given ID.Returns the bookmark list containing the object with the given pi if is contained in any bookmark list of the current user.getContainingUserBookmarkLists(String pi, String logId, String pageString) Returns the bookmark list containing the object with the given pi, logid and page number if is contained in any bookmark list of the current user.booleanisInGroup.voidupdateBookmarkList(BookmarkList bookmarkList) Methods inherited from class io.goobi.viewer.api.rest.resourcebuilders.AbstractBookmarkResourceBuilder
createCollection, getAllPublicBookmarkLists, getAsCollection, getPageOrder, getSharedBookmarkList, getSharedBookmarkListForMirador
-
Constructor Details
-
UserBookmarkResourceBuilder
-
-
Method Details
-
getAllBookmarkLists
Returns all BookmarkList owned by the current user.- Specified by:
getAllBookmarkListsin classAbstractBookmarkResourceBuilder- Returns:
- a list of all bookmark lists owned by the current user
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
getBookmarkListById
Returns the bookmark list with the given id, provided it is owned by the user or it is public or shared to him.- Specified by:
getBookmarkListByIdin classAbstractBookmarkResourceBuilder- Parameters:
id- database ID of the bookmark list to retrieve- Returns:
- the BookmarkList with the given ID if accessible by the current user
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
addBookmarkToBookmarkList
public SuccessMessage addBookmarkToBookmarkList(Long id, String pi, String logId, String pageString) throws DAOException, IOException, RestApiException Adds a new Bookmark with the given pi, LOGID and page number to the current user's bookmark list with the given id. Returns 203 if no matching bookmark list was found or 400 if the Bookmark could not be created (wrong pi/logid/page).- Specified by:
addBookmarkToBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
id- database ID of the target bookmark listpi- persistent identifier of the record to bookmarklogId- structural element LOGID, or "-" for nonepageString- page order number as string, or null- Returns:
- a SuccessMessage indicating whether the bookmark was successfully added
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
addBookmarkToBookmarkList
public SuccessMessage addBookmarkToBookmarkList(Long id, String pi) throws DAOException, IOException, RestApiException Adds a new Bookmark with the given pi to the current users bookmark list with the given id. Returns 203 if no matching bookmark list was found or 400 if the Bookmark could not be created (wrong pi).- Specified by:
addBookmarkToBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
id- database ID of the target bookmark listpi- persistent identifier of the record to bookmark- Returns:
- a SuccessMessage indicating whether the bookmark was successfully added
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
deleteBookmarkFromBookmarkList
public SuccessMessage deleteBookmarkFromBookmarkList(Long id, String pi, String logId, String pageString) throws DAOException, IOException, RestApiException Removes a Bookmark with the given pi, logid and page number from the current users bookmark list with the given id. Returns 203 if no matching bookmark list was found or 400 if the requested Bookmark is invalid (wrong pi/logid/page).- Specified by:
deleteBookmarkFromBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
id- database ID of the target bookmark listpi- persistent identifier of the record to removelogId- structural element LOGID, or "-" for nonepageString- page order number as string, or null- Returns:
- a SuccessMessage indicating whether the bookmark was successfully removed
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
deleteBookmarkFromBookmarkList
public SuccessMessage deleteBookmarkFromBookmarkList(Long id, String pi) throws DAOException, IOException, RestApiException Removes a Bookmark with the given pi from the current users bookmark list with the given id. Returns 203 if no matching bookmark list was found or 400 if the requested Bookmark is invalid (wrong pi).- Specified by:
deleteBookmarkFromBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
id- database ID of the target bookmark listpi- persistent identifier of the record to remove- Returns:
- a SuccessMessage indicating whether the bookmark was successfully removed
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
addBookmarkList
public SuccessMessage addBookmarkList(String name) throws DAOException, IOException, RestApiException Adds a new BookmarkList with the given name to the current users bookmark lists.- Specified by:
addBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
name- desired name for the new bookmark list- Returns:
- a SuccessMessage indicating whether the new bookmark list was successfully created
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
addBookmarkList
Adds a new BookmarkList with the given name to the current users bookmark lists.- Specified by:
addBookmarkListin classAbstractBookmarkResourceBuilder- Returns:
- a SuccessMessage indicating whether the new bookmark list was successfully created
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
addUserBookmarkListFromSession
public SuccessMessage addUserBookmarkListFromSession(HttpSession session) throws DAOException, IOException, RestApiException Adds the current session bookmark list to the current user bookmark lists under a newly generated name.- Parameters:
session- the current HTTP session containing the session bookmark list- Returns:
- a SuccessMessage indicating whether the session bookmark list was successfully persisted to the user account
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
addUserBookmarkListFromSession
public SuccessMessage addUserBookmarkListFromSession(String name, HttpSession session) throws DAOException, IOException, RestApiException Adds the current session bookmark list to the current user's bookmark lists under the given name.- Parameters:
name- desired name for the persisted bookmark listsession- the current HTTP session containing the session bookmark list- Returns:
- a SuccessMessage indicating whether the session bookmark list was successfully persisted under the given name
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
deleteBookmarkList
public SuccessMessage deleteBookmarkList(Long id) throws DAOException, IOException, RestApiException Deletes the current user's bookmark list with the given id. If no such bookmark list could be found a message with 'success:false' is returned, otherwise one with 'success:true'.- Specified by:
deleteBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
id- The bookmark list id- Returns:
- an object containing the boolean property 'success', detailing whether the operation was successful
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
getBookmarkListForMirador
public String getBookmarkListForMirador(Long id, AbstractApiUrlManager urls) throws DAOException, IOException, RestApiException, ViewerConfigurationException, IndexUnreachableException, PresentationException Returns the user bookmark list with the given ID.- Specified by:
getBookmarkListForMiradorin classAbstractBookmarkResourceBuilder- Parameters:
id- database ID of the bookmark list to serializeurls- API URL manager used to construct absolute resource URLs- Returns:
- the bookmark list serialized as a Mirador-compatible JSON string
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.ViewerConfigurationException- if any.IndexUnreachableException- if any.PresentationException- if any.
-
getContainingUserBookmarkLists
public List<BookmarkList> getContainingUserBookmarkLists(String pi, String logId, String pageString) throws DAOException, IOException, RestApiException Returns the bookmark list containing the object with the given pi, logid and page number if is contained in any bookmark list of the current user. Otherwise an json object with the property "success:false" is returned.- Parameters:
pi- persistent identifier of the record to search forlogId- structural element LOGID, or "-" for nonepageString- page order number as string, or null- Returns:
- a list of bookmark lists belonging to the current user that contain the specified item
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
getContainingUserBookmarkLists
public List<BookmarkList> getContainingUserBookmarkLists(String pi) throws DAOException, IOException, RestApiException Returns the bookmark list containing the object with the given pi if is contained in any bookmark list of the current user. Otherwise an json object with the property "success:false" is returned.- Parameters:
pi- persistent identifier of the record to search for- Returns:
- a list of bookmark lists belonging to the current user that contain the record with the given PI
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
countUserBookmarks
Counts the items contained in the current user's bookmark list with the given id and returns the number as plain integer. If no session store bookmark list exists, 0 is returned.- Parameters:
id- database ID of the bookmark list to count items in- Returns:
- the number of bookmarks in the user's bookmark list with the given ID
- Throws:
RestApiException- if any.DAOException- if any.IOException- if any.
-
isInGroup
isInGroup.- Parameters:
user- user to check membership forgroup- group whose member list is inspected- Returns:
- true if the given user is a member of the given group, false otherwise
-
getAsCollection
public de.intranda.api.iiif.presentation.v2.Collection2 getAsCollection(Long id, AbstractApiUrlManager urls) throws DAOException, RestApiException getAsCollection.- Specified by:
getAsCollectionin classAbstractBookmarkResourceBuilder- Parameters:
id- database ID of the bookmark list to converturls- API URL manager used to construct absolute resource URLs- Returns:
- the IIIF Presentation v2 Collection representing the user's bookmark list with the given ID
- Throws:
DAOException- if any.RestApiException- if any.
-
createCollection
public de.intranda.api.iiif.presentation.v2.Collection2 createCollection(BookmarkList list, AbstractApiUrlManager urls) - Specified by:
createCollectionin classAbstractBookmarkResourceBuilder
-
updateBookmarkList
public void updateBookmarkList(BookmarkList bookmarkList) throws de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException, DAOException - Specified by:
updateBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
bookmarkList- the bookmark list to update- Throws:
de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestExceptionDAOException
-