Package dev.dokimos.server.service
Class AnnotationService
java.lang.Object
dev.dokimos.server.service.AnnotationService
Service for human review annotations on run item results. Each item result holds at most one
annotation;
upsert(java.util.UUID, java.util.UUID, dev.dokimos.server.dto.v1.AnnotationRequest, java.lang.String) creates it on first call and updates the same row thereafter.-
Constructor Summary
ConstructorsConstructorDescriptionAnnotationService(AnnotationRepository annotationRepository, ItemResultRepository itemResultRepository) -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves the annotation for the given run item result if one exists.Returns the annotation for the given run item result.upsert(UUID runId, UUID itemResultId, AnnotationRequest req, String principalId) Creates or updates the single annotation for the given item result.
-
Constructor Details
-
AnnotationService
public AnnotationService(AnnotationRepository annotationRepository, ItemResultRepository itemResultRepository)
-
-
Method Details
-
upsert
@Transactional public AnnotationView upsert(UUID runId, UUID itemResultId, AnnotationRequest req, String principalId) Creates or updates the single annotation for the given item result. The item result must exist and belong to the given run. On an existing annotation this overwrites its fields and stampsupdatedAt; thecreatedByprincipal is recorded only when the annotation is first created.- Throws:
IllegalArgumentException- if the item result does not exist or does not belong to the run (mapped to 404)
-
get
Returns the annotation for the given run item result.- Throws:
IllegalArgumentException- if the item result does not belong to the run, or has no annotation (mapped to 404)
-
delete
Removes the annotation for the given run item result if one exists. No-op when the item result is un-annotated.- Throws:
IllegalArgumentException- if the item result does not belong to the run (mapped to 404)
-