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));
}
Aggregations