Class CampaignItemResource

java.lang.Object
io.goobi.viewer.api.rest.v1.crowdsourcing.CampaignItemResource

@Path("/crowdsourcing/campaigns/{campaignId}") public class CampaignItemResource extends Object
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 a CampaignItem 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
  • Field Details

  • 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 the CampaignItem 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 - a String 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 the io.goobi.viewer.model.crowdsourcing.campaigns.CampaignRecordStatistic.CrowdsourcingStatus for the given campaign and work and records the User who made the change
      Parameters:
      item - a CampaignItem object.
      persistentIdentifier - a String 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 - a String 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 - a List object.
      pi - a String 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