Class RecordResource
- Author:
- Florian Alpers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionde.intranda.api.iiif.search.AutoSuggestResultReturns auto-complete suggestions for search terms within a IIIF manifest.de.intranda.api.annotation.IAnnotationCollectionReturns all W3C Web Annotations recorded for the record as a single annotation collection.de.intranda.api.annotation.wa.collection.AnnotationPageReturns the single page of the record's annotation collection, containing all of its annotations.de.intranda.api.annotation.IAnnotationCollectionReturns all user comments recorded for the record as a single annotation collection.de.intranda.api.annotation.IAnnotationCollectionReturns the single page of the record's comment collection, containing all of its comments.de.intranda.api.iiif.presentation.IPresentationModelElementReturns the IIIF Presentation 3.0 manifest (or collection, for anchor records) for the record.de.intranda.api.iiif.search.SearchResultServes the IIIF Search API of the record's manifest.
-
Constructor Details
-
RecordResource
-
-
Method Details
-
getManifest
@GET @Path("/manifest") @Produces("application/json") public de.intranda.api.iiif.presentation.IPresentationModelElement getManifest() throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOException, de.unigoettingen.sub.commons.util.datasource.media.PageSource.IllegalPathSyntaxException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibExceptionReturns the IIIF Presentation 3.0 manifest (or collection, for anchor records) for the record.When the record is configured to delegate to an external IIIF service, the response is instead an HTTP redirect to that service's manifest URL rather than a locally generated manifest. The manifest embeds the record's crowdsourcing annotations and user comments as annotation pages, hiding the annotation items behind an authorization service when the requester lacks the record's user-generated-content view privilege.
- Returns:
- the generated manifest or collection, or
nullwhen a redirect to an external manifest was issued instead - Throws:
PresentationExceptionIndexUnreachableExceptionURISyntaxExceptionViewerConfigurationExceptionDAOExceptionde.unigoettingen.sub.commons.util.datasource.media.PageSource.IllegalPathSyntaxExceptionde.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException
-
getAnnotationsForRecord
@GET @Path("/annotations") @Produces("application/json") public de.intranda.api.annotation.IAnnotationCollection getAnnotationsForRecord() throws DAOException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestExceptionReturns all W3C Web Annotations recorded for the record as a single annotation collection.The collection contains every annotation for the record on one page (its item count equals the total number of annotations).
- Returns:
- the record's annotation collection
- Throws:
DAOException- if the annotations cannot be read from the databasede.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
-
getCommentsForRecord
@GET @Path("/comments") @Produces("application/json") public de.intranda.api.annotation.IAnnotationCollection getCommentsForRecord() throws DAOExceptionReturns all user comments recorded for the record as a single annotation collection.The collection contains every comment for the record on one page (its item count equals the total number of comments).
- Returns:
- the record's comment collection
- Throws:
DAOException- if the comments cannot be read from the database
-
getAnnotationsPageForRecord
@GET @Path("/annotations/1") @Produces("application/json") public de.intranda.api.annotation.wa.collection.AnnotationPage getAnnotationsPageForRecord() throws DAOException, de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestExceptionReturns the single page of the record's annotation collection, containing all of its annotations.Because the collection has exactly one page, this endpoint always returns page 1; there is no parameter for requesting further pages. A record without annotations yields an empty page instead of an error.
- Returns:
- the record's annotation page
- Throws:
DAOException- if the annotations cannot be read from the databasede.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
-
getCommentsForRecordPage
@GET @Path("/comments/1") @Produces("application/json") public de.intranda.api.annotation.IAnnotationCollection getCommentsForRecordPage() throws DAOExceptionReturns the single page of the record's comment collection, containing all of its comments.Because the collection has exactly one page, this endpoint always returns page 1; there is no parameter for requesting further pages. A record without comments yields an empty page instead of an error.
- Returns:
- the record's comment page
- Throws:
DAOException- if the comments cannot be read from the database
-
searchInManifest
@GET @Path("/manifest/search") @Produces("application/json") public de.intranda.api.iiif.search.SearchResult searchInManifest(@QueryParam("q") String query, @QueryParam("motivation") String motivation, @QueryParam("date") String date, @QueryParam("user") String user, @QueryParam("page") Integer page) throws IndexUnreachableException, PresentationException Serves the IIIF Search API of the record's manifest.Depending on the given motivation parameter, fulltext (motivation=painting) and/or crowdsourcing annotations, indexed metadata and user comments together (motivation=non-painting or motivation=describing) may be searched; omitting the parameter searches everything. Fulltext is only searched if the fulltext view permission is granted for the record.
- Parameters:
query- The search query; a list of space separated terms. The search is for all complete words which match any of the query terms. Terms may contain the wildcard character '*' to represent an arbitrary number of characters within the wordmotivation- a space separated list of motivations of annotations to search for. Search for the following motivations is implemented:- painting: fulltext resources, searched only if the fulltext view permission is granted
- non-painting or describing: crowdsourcing annotations, indexed metadata and user comments
date- not supported. If this parameter is given, its name is listed in the 'ignored' property of the 'within' property of the answeruser- not supported. If this parameter is given, its name is listed in the 'ignored' property of the 'within' property of the answerpage- the page number for paged result sets. if this is empty, page=1 is assumed- Returns:
- a
SearchResultcontaining all annotations matching the query in the 'resources' property - Throws:
IndexUnreachableException- if any.PresentationException- if any.
-
autoCompleteInManifest
@GET @Path("/manifest/autocomplete") @Produces("application/json") public de.intranda.api.iiif.search.AutoSuggestResult autoCompleteInManifest(@QueryParam("q") String query, @QueryParam("motivation") String motivation, @QueryParam("date") String date, @QueryParam("user") String user, @QueryParam("page") Integer page) throws IndexUnreachableException, PresentationException Returns auto-complete suggestions for search terms within a IIIF manifest.- Parameters:
query- partial query string for auto-completionmotivation- space-separated list of annotation motivations to filterdate- date filter (not supported; passed to 'ignored' property)user- user filter (not supported; passed to 'ignored' property)page- page number; not supported for auto-completion, the full term list is always returned- Returns:
- the IIIF AutoSuggest result containing auto-completion candidates for the given query
- Throws:
IndexUnreachableException- if any.PresentationException- if any.
-