Search in sources :

Example 41 with AnnotationDocument

use of de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocument in project webanno by webanno.

the class RemoteApiController2 method annotationsList.

@ApiOperation(value = "List annotations of a document in a project")
@RequestMapping(value = "/" + PROJECTS + "/{" + PARAM_PROJECT_ID + "}/" + DOCUMENTS + "/{" + PARAM_DOCUMENT_ID + "}/" + ANNOTATIONS, method = RequestMethod.GET, produces = APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<RResponse<List<RAnnotation>>> annotationsList(@PathVariable(PARAM_PROJECT_ID) long aProjectId, @PathVariable(PARAM_DOCUMENT_ID) long aDocumentId) throws Exception {
    // Get project (this also ensures that it exists and that the current user can access it
    Project project = getProject(aProjectId);
    SourceDocument doc = getDocument(project, aDocumentId);
    List<AnnotationDocument> annotations = documentService.listAnnotationDocuments(doc);
    List<RAnnotation> annotationList = new ArrayList<>();
    for (AnnotationDocument annotation : annotations) {
        annotationList.add(new RAnnotation(annotation));
    }
    return ResponseEntity.ok(new RResponse<>(annotationList));
}
Also used : RProject(de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.v2.model.RProject) Project(de.tudarmstadt.ukp.clarin.webanno.model.Project) RAnnotation(de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.v2.model.RAnnotation) SourceDocument(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument) ArrayList(java.util.ArrayList) AnnotationDocument(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocument) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

AnnotationDocument (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocument)41 SourceDocument (de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument)22 JCas (org.apache.uima.jcas.JCas)19 User (de.tudarmstadt.ukp.clarin.webanno.security.model.User)14 AnnotatorState (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState)11 Project (de.tudarmstadt.ukp.clarin.webanno.model.Project)11 IOException (java.io.IOException)10 AnnotationException (de.tudarmstadt.ukp.clarin.webanno.api.annotation.exception.AnnotationException)6 Sentence (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence)6 ArrayList (java.util.ArrayList)6 NoResultException (javax.persistence.NoResultException)6 UIMAException (org.apache.uima.UIMAException)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 File (java.io.File)4 Transactional (org.springframework.transaction.annotation.Transactional)4 AutomationTypeAdapter (de.tudarmstadt.ukp.clarin.webanno.api.annotation.adapter.AutomationTypeAdapter)3 RProject (de.tudarmstadt.ukp.clarin.webanno.webapp.remoteapi.v2.model.RProject)3 ApiOperation (io.swagger.annotations.ApiOperation)3 HashMap (java.util.HashMap)3 DataRetrievalFailureException (org.springframework.dao.DataRetrievalFailureException)3