Class CampaignItemResource
java.lang.Object
io.goobi.viewer.api.rest.v1.crowdsourcing.CampaignItemResource
Rest resources to create a frontend-view for a campaign to annotate or review a work, and to process the created annotations and/or changes to the
campaign status.
The following api points are defined:
- /crowdsourcing/campaigns/{campaignId}/{pi}/
GET aCampaignItem
for the given campaignId and pi, or PUT the status for that combination - /crowdsourcing/campaigns/{campaignId}/{pi}/annotations/
GET a list of annotations for the given campaignId and pi, sorted by target, or PUT the annotations for this combination
- Author:
- florian
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Used to create or read a list of WebAnnotations sorted by their target (a iiif manifest or canvas). -
Field Summary
-
Constructor Summary
ConstructorDescriptionCampaignItemResource
(javax.servlet.http.HttpServletRequest servletRequest, AbstractApiUrlManager urls, Long campaignId) CampaignItemResource
(javax.servlet.http.HttpServletRequest servletRequest, Long campaignId) Constructor for CampaignItemResource. -
Method Summary
Modifier and TypeMethodDescriptioncreatePersistentAnnotation
(String pi, Integer pageOrder, de.intranda.api.annotation.wa.WebAnnotation anno) List<de.intranda.api.annotation.wa.WebAnnotation>
getAnnotationsForManifest
(String pi, javax.servlet.http.HttpServletRequest request) Get all annotations for the given campaign and work, sorted by target.getItemForManifest
(String persistentIdentifier, javax.servlet.http.HttpServletRequest servletRequest) Get theCampaignItem
for a campaign and work, containing the URL of the targeted resource (IIIF manifest) and all information to create a GUI for the campaign's questions.void
Takes a map of annotation target (canvas/manifest) ids and replaces all annotations for the given campaign, pi and targeted pages if target is canvas) with the ones contained in the map.void
setItemForManifest
(CampaignItem item, String persistentIdentifier, int page) Sets theCrowdsourcingStatus
for the given campaign and work and records theUser
who made the change.
-
Field Details
-
urls
-
-
Constructor Details
-
CampaignItemResource
public CampaignItemResource(@Context javax.servlet.http.HttpServletRequest servletRequest, @PathParam("campaignId") Long campaignId) Constructor for CampaignItemResource.
- Parameters:
servletRequest
-campaignId
-
-
CampaignItemResource
public CampaignItemResource(@Context javax.servlet.http.HttpServletRequest servletRequest, AbstractApiUrlManager urls, @PathParam("campaignId") Long campaignId) - Parameters:
servletRequest
-urls
-campaignId
-
-
-
Method Details
-
getItemForManifest
@GET @Path("/{pi}") @Produces("application/json") public CampaignItem getItemForManifest(@PathParam("pi") String persistentIdentifier, @Context javax.servlet.http.HttpServletRequest servletRequest) throws URISyntaxException, DAOException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException Get theCampaignItem
for a campaign and work, containing the URL of the targeted resource (IIIF manifest) and all information to create a GUI for the campaign's questions.- Parameters:
persistentIdentifier
- aString
object.servletRequest
-- Returns:
- a
CampaignItem
- Throws:
URISyntaxException
- if any.DAOException
- if any.de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException
- if any.
-
setItemForManifest
@PUT @Path("/{pi}/{page}") @Consumes("application/json") public void setItemForManifest(CampaignItem item, @PathParam("pi") String persistentIdentifier, @PathParam("page") int page) throws DAOException Sets theCrowdsourcingStatus
for the given campaign and work and records theUser
who made the change.- Parameters:
item
- aCampaignItem
object.persistentIdentifier
- aString
object.page
-- Throws:
DAOException
- if any.
-
getAnnotationsForManifest
@GET @Path("/{pi}/annotations") @Produces("application/json") public List<de.intranda.api.annotation.wa.WebAnnotation> getAnnotationsForManifest(@PathParam("pi") String pi, @Context javax.servlet.http.HttpServletRequest request) throws URISyntaxException, DAOException Get all annotations for the given campaign and work, sorted by target.- Parameters:
pi
- aString
object.request
-- Returns:
- A map of target URIs (manifest or canvas) mapped to a submap of question URIs mapped to questions
- Throws:
URISyntaxException
- if any.DAOException
- if any.
-
setAnnotationsForManifest
@PUT @Path("/{pi}/annotations") @Consumes("application/json") public void setAnnotationsForManifest(List<CampaignItemResource.AnnotationPage> pages, @PathParam("pi") String pi) throws URISyntaxException, DAOException Takes a map of annotation target (canvas/manifest) ids and replaces all annotations for the given campaign, pi and targeted pages if target is canvas) with the ones contained in the map.- Parameters:
pages
- aList
object.pi
- aString
object.- Throws:
URISyntaxException
- if any.DAOException
- if any.
-
createPersistentAnnotation
public CrowdsourcingAnnotation createPersistentAnnotation(String pi, Integer pageOrder, de.intranda.api.annotation.wa.WebAnnotation anno) - Parameters:
pi
-pageOrder
-anno
-- Returns:
- a
CrowdsourcingAnnotation
. Either with an existing database id, or without id if ann doesn't has an empty id property
-