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 aCampaignItemfor 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
Nested ClassesModifier and TypeClassDescriptionstatic classUsed to create or read a list of WebAnnotations sorted by their target (a iiif manifest or canvas). -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCampaignItemResource(jakarta.servlet.http.HttpServletRequest servletRequest, AbstractApiUrlManager urls, Long campaignId) CampaignItemResource(jakarta.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, jakarta.servlet.http.HttpServletRequest request) Get all annotations for the given campaign and work, sorted by target.getItemForManifest(String persistentIdentifier, jakarta.servlet.http.HttpServletRequest servletRequest) Get theCampaignItemfor 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.voidTakes 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.voidsetItemForManifest(CampaignItem item, String persistentIdentifier, int page) Sets theCrowdsourcingStatusfor the given campaign and work and records theUserwho made the change.
-
Field Details
-
urls
-
-
Constructor Details
-
CampaignItemResource
public CampaignItemResource(@Context jakarta.servlet.http.HttpServletRequest servletRequest, @PathParam("campaignId") Long campaignId) Constructor for CampaignItemResource.
- Parameters:
servletRequest-campaignId-
-
CampaignItemResource
public CampaignItemResource(@Context jakarta.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 jakarta.servlet.http.HttpServletRequest servletRequest) throws URISyntaxException, DAOException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException Get theCampaignItemfor 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- aStringobject.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 theCrowdsourcingStatusfor the given campaign and work and records theUserwho made the change.- Parameters:
item- aCampaignItemobject.persistentIdentifier- aStringobject.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 jakarta.servlet.http.HttpServletRequest request) throws URISyntaxException, DAOException Get all annotations for the given campaign and work, sorted by target.- Parameters:
pi- aStringobject.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- aListobject.pi- aStringobject.- 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
-