RED-9790: manual changes not applied when too many redaction requests was sent #691

Merged
yannik.hampe merged 1 commits from RED-9790 into master 2024-08-23 14:28:58 +02:00

View File

@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iqser.red.service.persistence.management.v1.processor.exception.BadRequestException;
import com.iqser.red.service.persistence.management.v1.processor.model.ManualChangesQueryOptions;
import com.iqser.red.service.persistence.management.v1.processor.service.AccessControlService;
import com.iqser.red.service.persistence.management.v1.processor.service.CommentService;
@ -182,6 +183,9 @@ public class ManualRedactionController implements ManualRedactionResource {
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
.build()));
if (responseList.isEmpty()) {
throw new BadRequestException("There were no manualRedactions added");
}
return ManualRedactionResponse.builder().manualAddResponses(responseList).build();
}
@ -216,6 +220,9 @@ public class ManualRedactionController implements ManualRedactionResource {
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
.build()));
if (responseList.isEmpty()) {
throw new BadRequestException("There were no manualRedactions removed");
}
return ManualRedactionResponse.builder().manualAddResponses(responseList).build();
}
@ -239,6 +246,9 @@ public class ManualRedactionController implements ManualRedactionResource {
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
.build()));
if (responseList.isEmpty()) {
throw new BadRequestException("There were no manualRedactions added");
}
return ManualRedactionResponse.builder().manualAddResponses(responseList).build();
}
@ -261,7 +271,9 @@ public class ManualRedactionController implements ManualRedactionResource {
.message("Legal basis reason was changed")
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
.build()));
if (responseList.isEmpty()) {
throw new BadRequestException("There were no manualRedactions changed ");
}
return ManualRedactionResponse.builder().manualAddResponses(responseList).build();
}
@ -277,11 +289,7 @@ public class ManualRedactionController implements ManualRedactionResource {
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
accessControlService.verifyUserIsMemberOrApprover(dossierId);
List<ManualAddResponse> responseList = manualRedactionService.addRecategorization(dossierId,
fileId,
dossier,
recategorizationRequests,
includeUnprocessed);
List<ManualAddResponse> responseList = manualRedactionService.addRecategorization(dossierId, fileId, dossier, recategorizationRequests, includeUnprocessed);
responseList.forEach(response -> auditPersistenceService.audit(AuditRequest.builder()
.userId(KeycloakSecurity.getUserId())
@ -291,6 +299,10 @@ public class ManualRedactionController implements ManualRedactionResource {
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
.build()));
if (responseList.isEmpty()) {
throw new BadRequestException("There were no manualRedactions recategorized");
}
return ManualRedactionResponse.builder().manualAddResponses(responseList).build();
}
@ -314,7 +326,9 @@ public class ManualRedactionController implements ManualRedactionResource {
.message("Skipped annotation was resized to be redacted")
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
.build()));
if (responseList.isEmpty()) {
throw new BadRequestException("There were no manualRedactions resized");
}
return ManualRedactionResponse.builder().manualAddResponses(responseList).build();
}