Class SessionBookmarkResourceBuilder
java.lang.Object
io.goobi.viewer.api.rest.resourcebuilders.AbstractBookmarkResourceBuilder
io.goobi.viewer.api.rest.resourcebuilders.SessionBookmarkResourceBuilder
REST resource builder for bookmark lists stored in the HTTP session. Provides bookmark
list operations for unauthenticated users whose bookmarks are held transiently in the
current session rather than persisted in the database.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBookmarkList(String name) addBookmarkToBookmarkList(Long id, String pi) Adds an item with the given pi to the session stored bookmark list, creating a new bookmark list if needed.addBookmarkToBookmarkList(Long id, String pi, String logId, String pageString) Adds an item with the given pi, logid and page number to the session stored bookmark list, creating a new bookmark list if needed.Counts the items contained in the session store bookmark list and returns the number as plain integer.de.intranda.api.iiif.presentation.v2.Collection2createCollection(BookmarkList list, AbstractApiUrlManager urls) deleteBookmarkFromBookmarkList(Long id, String pi) Deletes the bookmark with the given pi from the session store bookmark list.deleteBookmarkFromBookmarkList(Long id, String pi, String logId, String pageString) Deletes the bookmark with the given pi, logid and page number from the session store bookmark list.Deletes the entry bookmark list from the session store.Returns the session stored bookmark list, creating a new empty one if needed.de.intranda.api.iiif.presentation.v2.Collection2getAsCollection(Long id, AbstractApiUrlManager urls) Returns the session stored bookmark list, creating a new empty one if needed.getSharedBookmarkList(String shareKey) Returns the bookmark list with the given id, provided it is owned by the user or it is public or shared to him.Returns "true" if the object with the given IP is in the session store bookmark list, "false" otherwise.isInSessionBookmarkList(String pi, String logId, String pageString) Returns "true" if the object with the given IP, logid and page number is in the session store bookmark list, "false" otherwise.voidMethods inherited from class io.goobi.viewer.api.rest.resourcebuilders.AbstractBookmarkResourceBuilder
createCollection, getAllPublicBookmarkLists, getAsCollection, getPageOrder, getSharedBookmarkListForMirador
-
Constructor Details
-
SessionBookmarkResourceBuilder
-
-
Method Details
-
getAllBookmarkLists
Returns the session stored bookmark list, creating a new empty one if needed.- Specified by:
getAllBookmarkListsin classAbstractBookmarkResourceBuilder- Returns:
- a singleton list containing the session-stored bookmark list
- 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 session stored bookmark list, creating a new empty one if needed.- Specified by:
getBookmarkListForMiradorin classAbstractBookmarkResourceBuilder- Parameters:
id- ignored; session has only one bookmark listurls- URL manager used to build application and API URLs- Returns:
- the Mirador-compatible JSON representation of the session bookmark list, or an empty string if no list exists
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.ViewerConfigurationException- if any.IndexUnreachableException- if any.PresentationException- if any.
-
addBookmarkToBookmarkList
public SuccessMessage addBookmarkToBookmarkList(Long id, String pi) throws DAOException, IOException, RestApiException Adds an item with the given pi to the session stored bookmark list, creating a new bookmark list if needed.- Specified by:
addBookmarkToBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
id- ignored; session has only one bookmark listpi- persistent identifier of the record to bookmark- Returns:
- a SuccessMessage indicating whether the bookmark was successfully added to the session list
- 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 an item with the given pi, logid and page number to the session stored bookmark list, creating a new bookmark list if needed.- Specified by:
addBookmarkToBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
id- ignored; session has only one bookmark listpi- persistent identifier of the record to bookmarklogId- structural element log ID, or "-" to indicate nonepageString- page order number as string, may be null- Returns:
- a SuccessMessage indicating whether the bookmark was successfully added to the session list
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
deleteBookmarkFromBookmarkList
public SuccessMessage deleteBookmarkFromBookmarkList(Long id, String pi) throws DAOException, IOException, RestApiException Deletes the bookmark with the given pi from the session store bookmark list. This operation returns an object with the property "success: false" if the operation failed (usually because the object wasn't in the bookmark list to begin with). Otherwise the return object contains "success: true"- Specified by:
deleteBookmarkFromBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
id- ignored; session has only one bookmark listpi- persistent identifier of the record to remove- Returns:
- an object containing the boolean property 'success', detailing whether the operation was successful
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
deleteBookmarkFromBookmarkList
public SuccessMessage deleteBookmarkFromBookmarkList(Long id, String pi, String logId, @PathParam("page") String pageString) throws DAOException, IOException, RestApiException Deletes the bookmark with the given pi, logid and page number from the session store bookmark list. This operation returns an object with the property "success: false" if the operation failed (usually because the object wasn't in the bookmark list to begin with). Otherwise the return object contains "success: true"- Specified by:
deleteBookmarkFromBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
id- ignored; session has only one bookmark listpi- persistent identifier of the record to removelogId- structural element log ID, or "-" to indicate nonepageString- page order number as string, may be null- Returns:
- an object containing the boolean property 'success', detailing whether the operation was successful
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
deleteSessionBookmarkList
Deletes the entry bookmark list from the session store. Always returns an object with the property "success: true", unless an error occurs in which case an error status code and an error object is returned- Returns:
- a SuccessMessage with success set to true if the session bookmark list was deleted successfully
- Throws:
RestApiException- if any.
-
isInSessionBookmarkList
public Boolean isInSessionBookmarkList(String pi) throws DAOException, IOException, RestApiException Returns "true" if the object with the given IP is in the session store bookmark list, "false" otherwise.- Parameters:
pi- persistent identifier of the record to look up- Returns:
- true if the record with the given PI is in the session bookmark list, false otherwise
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
isInSessionBookmarkList
public Boolean isInSessionBookmarkList(String pi, String logId, String pageString) throws DAOException, IOException, RestApiException Returns "true" if the object with the given IP, logid and page number is in the session store bookmark list, "false" otherwise.- Parameters:
pi- persistent identifier of the record to look uplogId- structural element log ID, or "-" to indicate nonepageString- page order number as string, may be null- Returns:
- true if the specified item is in the session bookmark list, false otherwise
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
countSessionBookmarks
Counts the items contained in the session store bookmark list and returns the number as plain integer. If no session store bookmark list exists, 0 is returned- Returns:
- the number of items in the session bookmark list, or 0 if no list exists
- Throws:
RestApiException- if any.
-
getUserBookmarkListById
public BookmarkList getUserBookmarkListById(Long id) throws DAOException, IOException, RestApiException Returns the bookmark list with the given id, provided it is owned by the user or it is public or shared to him.- Parameters:
id- database ID of the requested bookmark list- Returns:
- the publicly accessible BookmarkList with the given database ID
- Throws:
DAOException- if any.IOException- if any.RestApiException- if any.
-
createCollection
public de.intranda.api.iiif.presentation.v2.Collection2 createCollection(BookmarkList list, AbstractApiUrlManager urls) - Specified by:
createCollectionin classAbstractBookmarkResourceBuilder
-
addBookmarkList
public SuccessMessage addBookmarkList() throws DAOException, IOException, RestApiException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException- Specified by:
addBookmarkListin classAbstractBookmarkResourceBuilder- Throws:
DAOExceptionIOExceptionRestApiExceptionde.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
-
addBookmarkList
public SuccessMessage addBookmarkList(String name) throws DAOException, IOException, RestApiException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException - Specified by:
addBookmarkListin classAbstractBookmarkResourceBuilder- Throws:
DAOExceptionIOExceptionRestApiExceptionde.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
-
getBookmarkListById
- Specified by:
getBookmarkListByIdin classAbstractBookmarkResourceBuilder- Throws:
DAOExceptionIOExceptionRestApiException
-
updateBookmarkList
public void updateBookmarkList(BookmarkList list) throws de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException - Specified by:
updateBookmarkListin classAbstractBookmarkResourceBuilder- Parameters:
list- the bookmark list to update- Throws:
de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
-
deleteBookmarkList
public SuccessMessage deleteBookmarkList(Long id) throws DAOException, IOException, RestApiException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException - Specified by:
deleteBookmarkListin classAbstractBookmarkResourceBuilder- Throws:
DAOExceptionIOExceptionRestApiExceptionde.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
-
getAsCollection
public de.intranda.api.iiif.presentation.v2.Collection2 getAsCollection(Long id, AbstractApiUrlManager urls) throws DAOException, RestApiException, IOException - Specified by:
getAsCollectionin classAbstractBookmarkResourceBuilder- Throws:
DAOExceptionRestApiExceptionIOException
-