@POST public Response createAnnotation(Annotation annotation) { AnnotationService annotationService = Framework.getService(AnnotationService.class); Annotation result = annotationService.createAnnotation(getContext().getCoreSession(), annotation); return Response.status(Response.Status.CREATED).entity(result).build(); }
@DELETE @Path("{annotationId}") public Response deleteAnnotation(@PathParam("annotationId") String annotationId) { AnnotationService annotationService = Framework.getService(AnnotationService.class); annotationService.deleteAnnotation(getContext().getCoreSession(), annotationId); return Response.noContent().build(); }
@DELETE @Path("external/{entityId}") public Response deleteExternalAnnotation(@PathParam("entityId") String entityId) { AnnotationService annotationService = Framework.getService(AnnotationService.class); annotationService.deleteExternalAnnotation(getContext().getCoreSession(), entityId); return Response.noContent().build(); }
@PUT @Path("external/{entityId}") public Annotation updateExternalAnnotation(@PathParam("entityId") String entityId, Annotation annotation) { AnnotationService annotationService = Framework.getService(AnnotationService.class); annotationService.updateExternalAnnotation(getContext().getCoreSession(), entityId, annotation); return annotation; }
@GET @Path("{annotationId}") public Annotation getAnnotation(@PathParam("annotationId") String annotationId) { AnnotationService annotationService = Framework.getService(AnnotationService.class); return annotationService.getAnnotation(getContext().getCoreSession(), annotationId); }
@GET @Path("external/{entityId}") public Annotation getExternalAnnotation(@PathParam("entityId") String entityId) { AnnotationService annotationService = Framework.getService(AnnotationService.class); return annotationService.getExternalAnnotation(getContext().getCoreSession(), entityId); }
@PUT @Path("{annotationId}") public Annotation updateAnnotation(@PathParam("annotationId") String annotationId, Annotation annotation) { AnnotationService annotationService = Framework.getService(AnnotationService.class); annotationService.updateAnnotation(getContext().getCoreSession(), annotationId, annotation); return annotation; }
@GET public List<Annotation> getAnnotations(@QueryParam("xpath") String xpath) { DocumentModel doc = getTarget().getAdapter(DocumentModel.class); AnnotationService annotationService = Framework.getService(AnnotationService.class); return annotationService.getAnnotations(getContext().getCoreSession(), doc.getId(), xpath); }