RED-7241: adapted resize endpoints for multi-level dictionaries and added... #67
@ -1,6 +1,10 @@
|
|||||||
package com.iqser.red.persistence.service.v1.external.api.impl.controller;
|
package com.iqser.red.persistence.service.v1.external.api.impl.controller;
|
||||||
|
|
||||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.*;
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.ADD_COMMENT;
|
||||||
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.DELETE_COMMENT;
|
||||||
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.DELETE_MANUAL_REDACTION;
|
||||||
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.DO_MANUAL_REDACTION;
|
||||||
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.READ_MANUAL_REDACTIONS;
|
||||||
import static com.iqser.red.service.persistence.management.v1.processor.utils.TypeIdUtils.toTypeId;
|
import static com.iqser.red.service.persistence.management.v1.processor.utils.TypeIdUtils.toTypeId;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -37,7 +41,6 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations
|
|||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.audit.AuditRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.audit.AuditRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.AddCommentRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.AddCommentRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.AddRedactionRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.AddRedactionRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ApproveRequest;
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ForceRedactionRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ForceRedactionRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ImageRecategorizationRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ImageRecategorizationRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.LegalBasisChangeRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.LegalBasisChangeRequest;
|
||||||
@ -63,395 +66,6 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
private final AccessControlService accessControlService;
|
private final AccessControlService accessControlService;
|
||||||
|
|
||||||
|
|
||||||
/* Reviewer Operations*/
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse requestAddRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody AddRedactionRequest addRedactionRequest) {
|
|
||||||
|
|
||||||
return requestBulkAddRedaction(dossierId, fileId, Set.of(addRedactionRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public List<ManualAddResponse> requestBulkAddRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<AddRedactionRequest> addRedactionRequests) {
|
|
||||||
|
|
||||||
var dossier = dossierManagementService.getDossierById(dossierId, false, false);
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
|
||||||
accessControlService.verifyUserIsReviewer(dossierId, fileId);
|
|
||||||
|
|
||||||
List<com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AddRedactionRequest> requests = new ArrayList<>();
|
|
||||||
|
|
||||||
for (var addRedactionRequest : addRedactionRequests) {
|
|
||||||
|
|
||||||
var addRedactionRequestBuilder = com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AddRedactionRequest.builder()
|
|
||||||
.user(KeycloakSecurity.getUserId())
|
|
||||||
.dossierTemplateTypeId(toTypeId(addRedactionRequest.getType(), dossier.getDossierTemplateId()))
|
|
||||||
.value(addRedactionRequest.getValue())
|
|
||||||
.reason(addRedactionRequest.getReason())
|
|
||||||
.legalBasis(addRedactionRequest.getLegalBasis())
|
|
||||||
.addToDictionary(addRedactionRequest.isAddToDictionary())
|
|
||||||
.status(AnnotationStatus.REQUESTED)
|
|
||||||
.section(addRedactionRequest.getSection())
|
|
||||||
.positions(addRedactionRequest.getPositions())
|
|
||||||
.comment(addRedactionRequest.getComment() != null ? addRedactionRequest.getComment().getText() : null)
|
|
||||||
.addToAllDossiers(addRedactionRequest.isAddToAllDossiers())
|
|
||||||
.forceAddToDictionary(addRedactionRequest.isForceAddToDictionary())
|
|
||||||
.rectangle(addRedactionRequest.isRectangle())
|
|
||||||
.dictionaryEntryType(addRedactionRequest.getDictionaryEntryType())
|
|
||||||
.sourceId(addRedactionRequest.getSourceId());
|
|
||||||
|
|
||||||
requests.add(addRedactionRequestBuilder.build());
|
|
||||||
}
|
|
||||||
List<ManualAddResponse> responseList = new ArrayList<>();
|
|
||||||
responseList = manualRedactionService.addAddRedaction(dossierId, fileId, requests);
|
|
||||||
responseList.forEach(response -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Manual redaction was requested.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
|
|
||||||
.build()));
|
|
||||||
return responseList;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse requestRemoveRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody RemoveRedactionRequest removeRedactionRequest) {
|
|
||||||
|
|
||||||
return processRequestRemoveRedactionBulk(dossierId, fileId, Set.of(removeRedactionRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<ManualAddResponse> processRequestRemoveRedactionBulk(String dossierId, String fileId, Set<RemoveRedactionRequest> removeRedactionRequests) {
|
|
||||||
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
|
||||||
accessControlService.verifyUserIsReviewer(dossierId, fileId);
|
|
||||||
|
|
||||||
List<com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.RemoveRedactionRequest> requests = removeRedactionRequests.stream()
|
|
||||||
.map(removeRedactionRequest -> com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.RemoveRedactionRequest.builder()
|
|
||||||
.annotationId(removeRedactionRequest.getAnnotationId())
|
|
||||||
.user(KeycloakSecurity.getUserId())
|
|
||||||
.status(AnnotationStatus.REQUESTED)
|
|
||||||
.removeFromDictionary(removeRedactionRequest.isRemoveFromDictionary())
|
|
||||||
.comment(removeRedactionRequest.getComment())
|
|
||||||
.build())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<ManualAddResponse> responseList = manualRedactionService.addRemoveRedaction(dossierId, fileId, requests);
|
|
||||||
|
|
||||||
responseList.forEach(response -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Manual removed redaction was requested.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
|
|
||||||
.build()));
|
|
||||||
|
|
||||||
return responseList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public List<ManualAddResponse> requestBulkRemoveRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<RemoveRedactionRequest> removeRedactionRequests) {
|
|
||||||
|
|
||||||
return processRequestRemoveRedactionBulk(dossierId, fileId, removeRedactionRequests);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse requestForceRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody ForceRedactionRequest forceRedactionRequest) {
|
|
||||||
|
|
||||||
return processRequestForceRedactionBulk(dossierId, fileId, Set.of(forceRedactionRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<ManualAddResponse> processRequestForceRedactionBulk(String dossierId, String fileId, Set<ForceRedactionRequest> forceRedactionRequests) {
|
|
||||||
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
|
||||||
accessControlService.verifyUserIsReviewer(dossierId, fileId);
|
|
||||||
|
|
||||||
List<com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ForceRedactionRequest> requests = forceRedactionRequests.stream()
|
|
||||||
.map(forceRedactionRequest -> com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ForceRedactionRequest.builder()
|
|
||||||
.annotationId(forceRedactionRequest.getAnnotationId())
|
|
||||||
.user(KeycloakSecurity.getUserId())
|
|
||||||
.status(AnnotationStatus.REQUESTED)
|
|
||||||
.comment(forceRedactionRequest.getComment())
|
|
||||||
.legalBasis(forceRedactionRequest.getLegalBasis())
|
|
||||||
.build())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<ManualAddResponse> responseList = manualRedactionService.addForceRedaction(dossierId, fileId, requests);
|
|
||||||
|
|
||||||
responseList.forEach(response -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Manual force redaction was requested.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
|
|
||||||
.build()));
|
|
||||||
|
|
||||||
return responseList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public List<ManualAddResponse> requestBulkForceRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<ForceRedactionRequest> forceRedactionRequests) {
|
|
||||||
|
|
||||||
return processRequestForceRedactionBulk(dossierId, fileId, forceRedactionRequests);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse requestLegalBasisChange(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody LegalBasisChangeRequest legalBasisChangeRequest) {
|
|
||||||
|
|
||||||
return processRequestLegalBasisChangeBulk(dossierId, fileId, Set.of(legalBasisChangeRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<ManualAddResponse> processRequestLegalBasisChangeBulk(String dossierId, String fileId, Set<LegalBasisChangeRequest> legalBasisChangeRequests) {
|
|
||||||
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
|
||||||
accessControlService.verifyUserIsReviewer(dossierId, fileId);
|
|
||||||
|
|
||||||
List<com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.LegalBasisChangeRequest> requests = legalBasisChangeRequests.stream()
|
|
||||||
.map(legalBasisChangeRequest -> com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.LegalBasisChangeRequest.builder()
|
|
||||||
.annotationId(legalBasisChangeRequest.getAnnotationId())
|
|
||||||
.user(KeycloakSecurity.getUserId())
|
|
||||||
.status(AnnotationStatus.REQUESTED)
|
|
||||||
.section(legalBasisChangeRequest.getSection())
|
|
||||||
.comment(legalBasisChangeRequest.getComment())
|
|
||||||
.legalBasis(legalBasisChangeRequest.getLegalBasis())
|
|
||||||
.value(legalBasisChangeRequest.getValue())
|
|
||||||
.build())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<ManualAddResponse> responseList = manualRedactionService.addLegalBasisChange(dossierId, fileId, requests);
|
|
||||||
|
|
||||||
responseList.forEach(response -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Manual force redaction was requested.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
|
|
||||||
.build()));
|
|
||||||
|
|
||||||
return responseList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public List<ManualAddResponse> requestBulkLegalBasisChange(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<LegalBasisChangeRequest> legalBasisChangeRequests) {
|
|
||||||
|
|
||||||
return processRequestLegalBasisChangeBulk(dossierId, fileId, legalBasisChangeRequests);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse requestImageRecategorization(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody ImageRecategorizationRequest imageRecategorizationRequest) {
|
|
||||||
|
|
||||||
return processRequestImageRecategorizationBulk(dossierId, fileId, Set.of(imageRecategorizationRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<ManualAddResponse> processRequestImageRecategorizationBulk(String dossierId, String fileId, Set<ImageRecategorizationRequest> imageRecategorizationRequests) {
|
|
||||||
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
|
||||||
accessControlService.verifyUserIsReviewer(dossierId, fileId);
|
|
||||||
var dossier = dossierManagementService.getDossierById(dossierId, false, false);
|
|
||||||
|
|
||||||
List<com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ImageRecategorizationRequest> requests = imageRecategorizationRequests.stream()
|
|
||||||
.map(imageRecategorizationRequest -> com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ImageRecategorizationRequest.builder()
|
|
||||||
.annotationId(imageRecategorizationRequest.getAnnotationId())
|
|
||||||
.user(KeycloakSecurity.getUserId())
|
|
||||||
.status(AnnotationStatus.REQUESTED)
|
|
||||||
.typeId(toTypeId(imageRecategorizationRequest.getType(), dossier.getDossierTemplateId()))
|
|
||||||
.comment(imageRecategorizationRequest.getComment())
|
|
||||||
.build())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<ManualAddResponse> responseList = manualRedactionService.addImageRecategorization(dossierId, fileId, requests);
|
|
||||||
|
|
||||||
responseList.forEach(response -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Image recategorization was requested.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
|
|
||||||
.build()));
|
|
||||||
|
|
||||||
return responseList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public List<ManualAddResponse> requestBulkImageRecategorization(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<ImageRecategorizationRequest> imageRecategorizationRequests) {
|
|
||||||
|
|
||||||
return processRequestImageRecategorizationBulk(dossierId, fileId, imageRecategorizationRequests);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse requestResizeRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody ResizeRedactionRequest resizeRedactionRequest) {
|
|
||||||
|
|
||||||
return processRequestResizeRedactionBulk(dossierId, fileId, Set.of(resizeRedactionRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<ManualAddResponse> processRequestResizeRedactionBulk(String dossierId, String fileId, Set<ResizeRedactionRequest> resizeRedactionRequests) {
|
|
||||||
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
|
||||||
accessControlService.verifyUserIsReviewer(dossierId, fileId);
|
|
||||||
|
|
||||||
List<com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ResizeRedactionRequest> requests = resizeRedactionRequests.stream()
|
|
||||||
.map(resizeRedactionRequest -> com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ResizeRedactionRequest.builder()
|
|
||||||
.annotationId(resizeRedactionRequest.getAnnotationId())
|
|
||||||
.user(KeycloakSecurity.getUserId())
|
|
||||||
.status(AnnotationStatus.REQUESTED)
|
|
||||||
.comment(resizeRedactionRequest.getComment())
|
|
||||||
.positions(resizeRedactionRequest.getPositions())
|
|
||||||
.value(resizeRedactionRequest.getValue())
|
|
||||||
.updateDictionary(resizeRedactionRequest.getUpdateDictionary())
|
|
||||||
.build())
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<ManualAddResponse> responseList = manualRedactionService.addResizeRedaction(dossierId, fileId, requests);
|
|
||||||
|
|
||||||
responseList.forEach(response -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Manual resize redaction was requested.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, response.getAnnotationId()))
|
|
||||||
.build()));
|
|
||||||
|
|
||||||
return responseList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + REQUEST_MANUAL_REDACTION + "')")
|
|
||||||
public List<ManualAddResponse> requestBulkResizeRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<ResizeRedactionRequest> resizeRedactionRequests) {
|
|
||||||
|
|
||||||
return processRequestResizeRedactionBulk(dossierId, fileId, resizeRedactionRequests);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + DELETE_MANUAL_REDACTION + "')")
|
|
||||||
public void undo(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @PathVariable(ANNOTATION_ID) String annotationId) {
|
|
||||||
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
|
||||||
accessControlService.verifyUserIsReviewer(dossierId, fileId);
|
|
||||||
|
|
||||||
ManualRedactions manualRedactions = manualRedactionService.getManualRedactions(fileId);
|
|
||||||
|
|
||||||
ManualRedactionWrapper manualRedactionWrapper = getLatestManualRedactionForAnnotationId(manualRedactions, annotationId);
|
|
||||||
|
|
||||||
if (manualRedactionWrapper == null) {
|
|
||||||
throw new NotFoundException(String.format("ManualRedaction with annotationId %s could not be found.", annotationId));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (manualRedactionWrapper.getItem() instanceof ManualRedactionEntry) {
|
|
||||||
|
|
||||||
manualRedactionService.deleteAddRedaction(dossierId, fileId, List.of(annotationId));
|
|
||||||
auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of manual add redaction was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build());
|
|
||||||
} else if (manualRedactionWrapper.getItem() instanceof IdRemoval) {
|
|
||||||
|
|
||||||
manualRedactionService.deleteRemoveRedaction(dossierId, fileId, List.of(annotationId));
|
|
||||||
auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of manual remove redaction was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build());
|
|
||||||
} else if (manualRedactionWrapper.getItem() instanceof ManualForceRedaction) {
|
|
||||||
|
|
||||||
manualRedactionService.deleteForceRedaction(dossierId, fileId, List.of(annotationId));
|
|
||||||
auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of manual force redaction was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build());
|
|
||||||
} else if (manualRedactionWrapper.getItem() instanceof ManualImageRecategorization) {
|
|
||||||
|
|
||||||
manualRedactionService.deleteImageRecategorization(dossierId, fileId, List.of(annotationId));
|
|
||||||
auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of manual image recategorization was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build());
|
|
||||||
} else if (manualRedactionWrapper.getItem() instanceof ManualLegalBasisChange) {
|
|
||||||
|
|
||||||
manualRedactionService.deleteLegalBasisChange(dossierId, fileId, List.of(annotationId));
|
|
||||||
auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of legal basis change was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build());
|
|
||||||
} else if (manualRedactionWrapper.getItem() instanceof ManualResizeRedaction) {
|
|
||||||
|
|
||||||
manualRedactionService.deleteResizeRedaction(dossierId, fileId, List.of(annotationId));
|
|
||||||
auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of manual resize redaction was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ManualRedactionWrapper getLatestManualRedactionForAnnotationId(ManualRedactions manualRedactions, String annotationId) {
|
private ManualRedactionWrapper getLatestManualRedactionForAnnotationId(ManualRedactions manualRedactions, String annotationId) {
|
||||||
|
|
||||||
@ -649,150 +263,6 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + PROCESS_MANUAL_REDACTION_REQUEST + "')")
|
|
||||||
public void declineRequest(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @PathVariable(ANNOTATION_ID) String annotationId) {
|
|
||||||
|
|
||||||
declineRequestBulk(dossierId, fileId, Set.of(annotationId));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Approver Operations*/
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + PROCESS_MANUAL_REDACTION_REQUEST + "')")
|
|
||||||
public void declineRequestBulk(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody Set<String> annotationIds) {
|
|
||||||
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
|
||||||
accessControlService.verifyUserIsApprover(dossierId);
|
|
||||||
|
|
||||||
updateAnnotationStatus(dossierId, fileId, annotationIds, AnnotationStatus.DECLINED);
|
|
||||||
|
|
||||||
annotationIds.forEach(annotationId -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Suggestion was declined")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void updateAnnotationStatus(String dossierId, String fileId, Set<String> annotationIds, AnnotationStatus status) {
|
|
||||||
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
|
||||||
ManualRedactions manualRedactions = manualRedactionService.getManualRedactions(fileId);
|
|
||||||
|
|
||||||
Map<String, ManualRedactionWrapper> manualRedactionWrappers = getLatestManualRedactionsForAnnotationIds(manualRedactions, annotationIds);
|
|
||||||
|
|
||||||
if (manualRedactionWrappers.isEmpty()) {
|
|
||||||
throw new NotFoundException(String.format("ManualRedaction with annotationIds %s could not be found.", annotationIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> manualRedactionEntries = manualRedactionWrappers.values()
|
|
||||||
.stream()
|
|
||||||
.filter(manualRedactionWrapper -> manualRedactionWrapper.getItem() instanceof ManualRedactionEntry)
|
|
||||||
.map(ManualRedactionWrapper::getId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (!manualRedactionEntries.isEmpty()) {
|
|
||||||
manualRedactionService.updateAddRedactionStatus(dossierId, fileId, manualRedactionEntries, status);
|
|
||||||
manualRedactionEntries.forEach(annotationId -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of manual add redaction was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build()));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> idRemovals = manualRedactionWrappers.values()
|
|
||||||
.stream()
|
|
||||||
.filter(manualRedactionWrapper -> manualRedactionWrapper.getItem() instanceof IdRemoval)
|
|
||||||
.map(ManualRedactionWrapper::getId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (!idRemovals.isEmpty()) {
|
|
||||||
|
|
||||||
manualRedactionService.updateRemoveRedactionStatus(dossierId, fileId, idRemovals, status);
|
|
||||||
idRemovals.forEach(annotationId -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of manual remove redaction was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build()));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> manualForceRedactions = manualRedactionWrappers.values()
|
|
||||||
.stream()
|
|
||||||
.filter(manualRedactionWrapper -> manualRedactionWrapper.getItem() instanceof ManualForceRedaction)
|
|
||||||
.map(ManualRedactionWrapper::getId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (!manualForceRedactions.isEmpty()) {
|
|
||||||
|
|
||||||
manualRedactionService.updateForceRedactionStatus(dossierId, fileId, manualForceRedactions, status);
|
|
||||||
manualForceRedactions.forEach(annotationId -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of manual force redaction was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build()));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> manualImageRecategorizations = manualRedactionWrappers.values()
|
|
||||||
.stream()
|
|
||||||
.filter(manualRedactionWrapper -> manualRedactionWrapper.getItem() instanceof ManualImageRecategorization)
|
|
||||||
.map(ManualRedactionWrapper::getId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (!manualImageRecategorizations.isEmpty()) {
|
|
||||||
|
|
||||||
manualRedactionService.updateImageRecategorizationStatus(dossierId, fileId, manualImageRecategorizations, status);
|
|
||||||
manualImageRecategorizations.forEach(annotationId -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of manual image recategorization was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build()));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> manualLegalBasisChanges = manualRedactionWrappers.values()
|
|
||||||
.stream()
|
|
||||||
.filter(manualRedactionWrapper -> manualRedactionWrapper.getItem() instanceof ManualLegalBasisChange)
|
|
||||||
.map(ManualRedactionWrapper::getId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (!manualLegalBasisChanges.isEmpty()) {
|
|
||||||
|
|
||||||
manualRedactionService.updateLegalBasisChangeStatus(dossierId, fileId, manualLegalBasisChanges, status);
|
|
||||||
manualLegalBasisChanges.forEach(annotationId -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of legal basis change was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build()));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> manualResizeRedactions = manualRedactionWrappers.values()
|
|
||||||
.stream()
|
|
||||||
.filter(manualRedactionWrapper -> manualRedactionWrapper.getItem() instanceof ManualResizeRedaction)
|
|
||||||
.map(ManualRedactionWrapper::getId)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (!manualResizeRedactions.isEmpty()) {
|
|
||||||
|
|
||||||
manualRedactionService.updateResizeRedactionStatus(dossierId, fileId, manualResizeRedactions, status);
|
|
||||||
manualResizeRedactions.forEach(annotationId -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Undo of manual resize redaction was done.")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PreAuthorize("hasAuthority('" + READ_MANUAL_REDACTIONS + "')")
|
@PreAuthorize("hasAuthority('" + READ_MANUAL_REDACTIONS + "')")
|
||||||
public ManualRedactions getManualRedactions(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
public ManualRedactions getManualRedactions(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
||||||
@ -827,45 +297,6 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + PROCESS_MANUAL_REDACTION_REQUEST + "')")
|
|
||||||
public void approveRequest(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@PathVariable(ANNOTATION_ID) String annotationId,
|
|
||||||
@RequestBody ApproveRequest approveRequest) {
|
|
||||||
|
|
||||||
approveRequestBulk(dossierId, fileId, Set.of(annotationId));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + PROCESS_MANUAL_REDACTION_REQUEST + "')")
|
|
||||||
public void approveRequestBulk(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody Set<String> annotationIds) {
|
|
||||||
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
|
||||||
accessControlService.verifyUserIsApprover(dossierId);
|
|
||||||
|
|
||||||
updateAnnotationStatus(dossierId, fileId, annotationIds, AnnotationStatus.APPROVED);
|
|
||||||
|
|
||||||
annotationIds.forEach(annotationId -> auditPersistenceService.audit(AuditRequest.builder()
|
|
||||||
.userId(KeycloakSecurity.getUserId())
|
|
||||||
.objectId(fileId)
|
|
||||||
.category(AuditCategory.DOCUMENT.name())
|
|
||||||
.message("Suggestion was approved")
|
|
||||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, ANNOTATION_ID, annotationId))
|
|
||||||
.build()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse addRedaction(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody AddRedactionRequest addRedactionRequest) {
|
|
||||||
|
|
||||||
return addRedactionBulk(dossierId, fileId, Set.of(addRedactionRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
||||||
public List<ManualAddResponse> addRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
public List<ManualAddResponse> addRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@ -917,17 +348,6 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse removeRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody RemoveRedactionRequest removeRedactionRequest) {
|
|
||||||
|
|
||||||
return removeRedactionBulk(dossierId, fileId, Set.of(removeRedactionRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
||||||
public List<ManualAddResponse> removeRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
public List<ManualAddResponse> removeRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@ -970,17 +390,6 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse forceRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody ForceRedactionRequest forceRedactionRequest) {
|
|
||||||
|
|
||||||
return forceRedactionBulk(dossierId, fileId, Set.of(forceRedactionRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
||||||
public List<ManualAddResponse> forceRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
public List<ManualAddResponse> forceRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@ -1012,16 +421,6 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse legalBasisChange(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody LegalBasisChangeRequest legalBasisChangeRequest) {
|
|
||||||
|
|
||||||
return legalBasisChangeBulk(dossierId, fileId, Set.of(legalBasisChangeRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
||||||
public List<ManualAddResponse> legalBasisChangeBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
public List<ManualAddResponse> legalBasisChangeBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@ -1056,16 +455,6 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse recategorizeImage(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody ImageRecategorizationRequest imageRecategorizationRequest) {
|
|
||||||
|
|
||||||
return recategorizeImageBulk(dossierId, fileId, Set.of(imageRecategorizationRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
||||||
public List<ManualAddResponse> recategorizeImageBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
public List<ManualAddResponse> recategorizeImageBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@ -1099,22 +488,10 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
|
||||||
public ManualAddResponse resizeRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody ResizeRedactionRequest resizeRedactionRequest) {
|
|
||||||
|
|
||||||
return resizeRedactionBulk(dossierId, fileId, Set.of(resizeRedactionRequest)).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
@PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')")
|
||||||
public List<ManualAddResponse> resizeRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
public List<ManualAddResponse> resizeRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@RequestBody Set<ResizeRedactionRequest> resizeRedactionRequests) {
|
@RequestBody Set<ResizeRedactionRequest> resizeRedactionRequests) {
|
||||||
|
|
||||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
||||||
accessControlService.verifyUserIsMemberOrApprover(dossierId);
|
accessControlService.verifyUserIsMemberOrApprover(dossierId);
|
||||||
|
|
||||||
@ -1127,6 +504,7 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
.value(resizeRedactionRequest.getValue())
|
.value(resizeRedactionRequest.getValue())
|
||||||
.comment(resizeRedactionRequest.getComment())
|
.comment(resizeRedactionRequest.getComment())
|
||||||
.updateDictionary(resizeRedactionRequest.getUpdateDictionary())
|
.updateDictionary(resizeRedactionRequest.getUpdateDictionary())
|
||||||
|
.addToAllDossiers(resizeRedactionRequest.isAddToAllDossiers())
|
||||||
.build())
|
.build())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,6 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations
|
|||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ManualRedactions;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ManualRedactions;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.AddCommentRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.AddCommentRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.AddRedactionRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.AddRedactionRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ApproveRequest;
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ForceRedactionRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ForceRedactionRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ImageRecategorizationRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ImageRecategorizationRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.LegalBasisChangeRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.LegalBasisChangeRequest;
|
||||||
@ -45,129 +44,6 @@ public interface ManualRedactionResource {
|
|||||||
String COMMENT_ID_PATH_VARIABLE = "/{" + COMMENT_ID + "}";
|
String COMMENT_ID_PATH_VARIABLE = "/{" + COMMENT_ID + "}";
|
||||||
|
|
||||||
|
|
||||||
/* Reviewer Operations*/
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/request/add" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a request for a redaction.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse requestAddRedaction(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody AddRedactionRequest addRedactionRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/request/add" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a request for a redaction.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
List<ManualAddResponse> requestBulkAddRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<AddRedactionRequest> addRedactionRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/request/remove" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a request to remove a redaction.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse requestRemoveRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody RemoveRedactionRequest removeRedactionRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/request/remove" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a bulk of requests to remove a redaction.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
List<ManualAddResponse> requestBulkRemoveRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<RemoveRedactionRequest> removeRedactionRequests);
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/request/force" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a request to force a redaction.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse requestForceRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody ForceRedactionRequest forceRedactionRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/request/force" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a bulk of requests to force a redaction.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
List<ManualAddResponse> requestBulkForceRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<ForceRedactionRequest> forceRedactionRequests);
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/request/legalBasis" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a request to change the legal basis reason.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse requestLegalBasisChange(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody LegalBasisChangeRequest legalBasisChangeRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/request/legalBasis" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a bulk of requests to change the legal basis reason.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
List<ManualAddResponse> requestBulkLegalBasisChange(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<LegalBasisChangeRequest> legalBasisChangeRequests);
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/request/recategorize" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a request to recategorize a image.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse requestImageRecategorization(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody ImageRecategorizationRequest imageRecategorizationRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/request/recategorize" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a bulk of requests to recategorize a image.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
List<ManualAddResponse> requestBulkImageRecategorization(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<ImageRecategorizationRequest> imageRecategorizationRequests);
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/request/resize" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a request to resize a redaction.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse requestResizeRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody ResizeRedactionRequest resizeRedactionRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/request/resize" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a bulk of requests to resize a redaction.", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
List<ManualAddResponse> requestBulkResizeRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody Set<ResizeRedactionRequest> resizeRedactionRequests);
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
|
||||||
@DeleteMapping(MANUAL_REDACTION_REST_PATH + "/undo" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + ANNOTATION_ID_PATH_VARIABLE)
|
|
||||||
@Operation(summary = "Undo a manual request or redaction", description = "Can only be done be the " + "user who added the request/redaction.")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK")})
|
|
||||||
void undo(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @PathVariable(ANNOTATION_ID) String annotationId);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
@DeleteMapping(MANUAL_REDACTION_REST_PATH + "/bulk/undo" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE)
|
@DeleteMapping(MANUAL_REDACTION_REST_PATH + "/bulk/undo" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE)
|
||||||
@Operation(summary = "Undo a list of manual requests or redactions", description = "Can only be done be the " + "user who added the request/redaction.")
|
@Operation(summary = "Undo a list of manual requests or redactions", description = "Can only be done be the " + "user who added the request/redaction.")
|
||||||
@ -195,50 +71,6 @@ public interface ManualRedactionResource {
|
|||||||
@PathVariable(COMMENT_ID) String commentId);
|
@PathVariable(COMMENT_ID) String commentId);
|
||||||
|
|
||||||
|
|
||||||
/* Approver Operations*/
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/approve" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + ANNOTATION_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Approves a redaction request/ remove redaction request", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK")})
|
|
||||||
void approveRequest(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@PathVariable(ANNOTATION_ID) String annotationId,
|
|
||||||
@RequestBody ApproveRequest approveRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/approve" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Approves a list of redaction requests/ remove redaction requests", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK")})
|
|
||||||
void approveRequestBulk(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody Set<String> annotationIds);
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/decline" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + ANNOTATION_ID_PATH_VARIABLE)
|
|
||||||
@Operation(summary = "Declines a redaction request/ remove redaction request", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK")})
|
|
||||||
void declineRequest(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @PathVariable(ANNOTATION_ID) String annotationId);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/decline" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE)
|
|
||||||
@Operation(summary = "Declines a redaction request/ remove redaction request list", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK")})
|
|
||||||
void declineRequestBulk(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody Set<String> annotationIds);
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/redaction/add" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Adds a manual redaction", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse addRedaction(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody AddRedactionRequest addRedactionRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/add" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/add" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Adds a manual redaction", description = "None")
|
@Operation(summary = "Adds a manual redaction", description = "None")
|
||||||
@ -248,14 +80,6 @@ public interface ManualRedactionResource {
|
|||||||
@RequestBody Set<AddRedactionRequest> addRedactionRequest);
|
@RequestBody Set<AddRedactionRequest> addRedactionRequest);
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/redaction/remove" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Removes a redaction", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse removeRedaction(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody RemoveRedactionRequest removeRedactionRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/remove" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/remove" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Removes the redactions list", description = "None")
|
@Operation(summary = "Removes the redactions list", description = "None")
|
||||||
@ -265,14 +89,6 @@ public interface ManualRedactionResource {
|
|||||||
@RequestBody Set<RemoveRedactionRequest> removeRedactionRequests);
|
@RequestBody Set<RemoveRedactionRequest> removeRedactionRequests);
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/redaction/force" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Forces a redaction", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse forceRedaction(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody ForceRedactionRequest forceRedactionRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/force" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/force" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Forces the redactions list", description = "None")
|
@Operation(summary = "Forces the redactions list", description = "None")
|
||||||
@ -282,16 +98,6 @@ public interface ManualRedactionResource {
|
|||||||
@RequestBody Set<ForceRedactionRequest> forceRedactionRequests);
|
@RequestBody Set<ForceRedactionRequest> forceRedactionRequests);
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/redaction/legalBasisChange" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Changes a legal basis reason", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse legalBasisChange(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody LegalBasisChangeRequest legalBasisChangeRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/legalBasisChange" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/legalBasisChange" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Changes the legal basis reasons list", description = "None")
|
@Operation(summary = "Changes the legal basis reasons list", description = "None")
|
||||||
@ -301,16 +107,6 @@ public interface ManualRedactionResource {
|
|||||||
@RequestBody Set<LegalBasisChangeRequest> legalBasisChangeRequests);
|
@RequestBody Set<LegalBasisChangeRequest> legalBasisChangeRequests);
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/redaction/recategorize" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Recategorizes an image", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse recategorizeImage(@PathVariable(DOSSIER_ID) String dossierId,
|
|
||||||
@PathVariable(FILE_ID) String fileId,
|
|
||||||
@RequestBody ImageRecategorizationRequest imageRecategorizationRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/recategorize" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/recategorize" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Recategorizes the images list", description = "None")
|
@Operation(summary = "Recategorizes the images list", description = "None")
|
||||||
@ -320,14 +116,6 @@ public interface ManualRedactionResource {
|
|||||||
@RequestBody Set<ImageRecategorizationRequest> imageRecategorizationRequests);
|
@RequestBody Set<ImageRecategorizationRequest> imageRecategorizationRequests);
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/redaction/resize" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Resizes a redaction", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
ManualAddResponse resizeRedaction(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody ResizeRedactionRequest resizeRedactionRequest);
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/resize" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = MANUAL_REDACTION_REST_PATH + "/bulk/redaction/resize" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Resizes the redactions list", description = "None")
|
@Operation(summary = "Resizes the redactions list", description = "None")
|
||||||
@ -337,8 +125,6 @@ public interface ManualRedactionResource {
|
|||||||
@RequestBody Set<ResizeRedactionRequest> resizeRedactionRequests);
|
@RequestBody Set<ResizeRedactionRequest> resizeRedactionRequests);
|
||||||
|
|
||||||
|
|
||||||
/* Other operations */
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@GetMapping(value = MANUAL_REDACTION_REST_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = MANUAL_REDACTION_REST_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
|||||||
@ -2,7 +2,15 @@ package com.iqser.red.service.persistence.management.v1.processor.entity.annotat
|
|||||||
|
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Fetch;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
|
||||||
|
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileEntity;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.ElementCollection;
|
import jakarta.persistence.ElementCollection;
|
||||||
@ -13,13 +21,6 @@ import jakarta.persistence.Enumerated;
|
|||||||
import jakarta.persistence.FetchType;
|
import jakarta.persistence.FetchType;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.Fetch;
|
|
||||||
import org.hibernate.annotations.FetchMode;
|
|
||||||
|
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileEntity;
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -65,4 +66,10 @@ public class ManualResizeRedactionEntity implements IBaseAnnotation {
|
|||||||
@Column
|
@Column
|
||||||
private String textAfter;
|
private String textAfter;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
private boolean addToAllDossiers;
|
||||||
|
|
||||||
|
@ElementCollection
|
||||||
|
@Fetch(value = FetchMode.SUBSELECT)
|
||||||
|
private Set<String> typeIdsOfModifiedDictionaries = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,8 +14,6 @@ import java.util.function.Predicate;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
|
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -29,13 +27,14 @@ import com.iqser.red.service.persistence.management.v1.processor.exception.NotAl
|
|||||||
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.DictionaryPersistenceService;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.DictionaryPersistenceService;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.EntryPersistenceService;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.EntryPersistenceService;
|
||||||
import com.knecon.fforesight.databasetenantcommons.providers.utils.MagicConverter;
|
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.utils.TextNormalizationUtilities;
|
import com.iqser.red.service.persistence.management.v1.processor.utils.TextNormalizationUtilities;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.utils.TypeMapper;
|
import com.iqser.red.service.persistence.management.v1.processor.utils.TypeMapper;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.validation.DictionaryValidator;
|
import com.iqser.red.service.persistence.management.v1.processor.validation.DictionaryValidator;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.DictionaryEntryType;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.DictionaryEntryType;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.Type;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.Type;
|
||||||
|
import com.knecon.fforesight.databasetenantcommons.providers.utils.MagicConverter;
|
||||||
|
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,6 @@ import com.iqser.red.service.persistence.management.v1.processor.service.persist
|
|||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.LegalBasisChangePersistenceService;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.LegalBasisChangePersistenceService;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.RemoveRedactionPersistenceService;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.RemoveRedactionPersistenceService;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.ResizeRedactionPersistenceService;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.ResizeRedactionPersistenceService;
|
||||||
import com.knecon.fforesight.databasetenantcommons.providers.utils.MagicConverter;
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.AnalyzeRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.AnalyzeRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.MessageType;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.MessageType;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AddRedactionRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AddRedactionRequest;
|
||||||
@ -59,6 +58,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemp
|
|||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.DictionaryEntryType;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.DictionaryEntryType;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.RedactionLog;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.RedactionLog;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.RedactionLogEntry;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.RedactionLogEntry;
|
||||||
|
import com.knecon.fforesight.databasetenantcommons.providers.utils.MagicConverter;
|
||||||
|
|
||||||
import feign.FeignException;
|
import feign.FeignException;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -100,7 +100,9 @@ public class ManualRedactionService {
|
|||||||
dossierPersistenceService.getAndValidateDossier(dossierId);
|
dossierPersistenceService.getAndValidateDossier(dossierId);
|
||||||
var actionPerformed = false;
|
var actionPerformed = false;
|
||||||
// validate add to dossier template dictionaries
|
// validate add to dossier template dictionaries
|
||||||
addRedactionRequests.forEach(request -> dictionaryManagementService.validateAddRemoveToDossierTemplateDictionary(request.getDossierTemplateTypeId(), request.isAddToDictionary(), request.isAddToAllDossiers()));
|
addRedactionRequests.forEach(request -> dictionaryManagementService.validateAddRemoveToDossierTemplateDictionary(request.getDossierTemplateTypeId(),
|
||||||
|
request.isAddToDictionary(),
|
||||||
|
request.isAddToAllDossiers()));
|
||||||
|
|
||||||
for (var addRedactionRequest : addRedactionRequests) {
|
for (var addRedactionRequest : addRedactionRequests) {
|
||||||
if (addRedactionRequest.isAddToDictionary()) {
|
if (addRedactionRequest.isAddToDictionary()) {
|
||||||
@ -280,8 +282,6 @@ public class ManualRedactionService {
|
|||||||
|
|
||||||
public List<ManualAddResponse> addRemoveRedaction(String dossierId, String fileId, List<RemoveRedactionRequest> removeRedactionRequests) {
|
public List<ManualAddResponse> addRemoveRedaction(String dossierId, String fileId, List<RemoveRedactionRequest> removeRedactionRequests) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var response = new ArrayList<ManualAddResponse>();
|
var response = new ArrayList<ManualAddResponse>();
|
||||||
var dossier = dossierPersistenceService.getAndValidateDossier(dossierId);
|
var dossier = dossierPersistenceService.getAndValidateDossier(dossierId);
|
||||||
RedactionLog redactionLog = fileManagementStorageService.getRedactionLog(dossier.getId(), fileId);
|
RedactionLog redactionLog = fileManagementStorageService.getRedactionLog(dossier.getId(), fileId);
|
||||||
@ -294,7 +294,9 @@ public class ManualRedactionService {
|
|||||||
if (request.isRemoveFromDictionary()) {
|
if (request.isRemoveFromDictionary()) {
|
||||||
RedactionLogEntry redactionLogEntry = getRedactionLogEntry(redactionLog, request.getAnnotationId());
|
RedactionLogEntry redactionLogEntry = getRedactionLogEntry(redactionLog, request.getAnnotationId());
|
||||||
var dossierTemplateTypeId = toTypeId(redactionLogEntry.getType(), dossier.getDossierTemplateId());
|
var dossierTemplateTypeId = toTypeId(redactionLogEntry.getType(), dossier.getDossierTemplateId());
|
||||||
dictionaryManagementService.validateAddRemoveToDossierTemplateDictionary(dossierTemplateTypeId, request.isRemoveFromDictionary(), request.isRemoveFromAllDossiers());
|
dictionaryManagementService.validateAddRemoveToDossierTemplateDictionary(dossierTemplateTypeId,
|
||||||
|
request.isRemoveFromDictionary(),
|
||||||
|
request.isRemoveFromAllDossiers());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -387,8 +389,8 @@ public class ManualRedactionService {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (removeFromAllDossiers) {
|
if (removeFromAllDossiers) {
|
||||||
var dictionaryEntriesToRemove = dictionaryManagementService.getAllEntriesInDossierTemplate(toTypeId(redactionLogEntry.getType(),dossier.getDossierTemplateId()),
|
var dictionaryEntriesToRemove = dictionaryManagementService.getAllEntriesInDossierTemplate(toTypeId(redactionLogEntry.getType(),
|
||||||
redactionLogEntry.getValue());
|
dossier.getDossierTemplateId()), redactionLogEntry.getValue());
|
||||||
dictionaryEntriesToRemove.forEach(entry -> {
|
dictionaryEntriesToRemove.forEach(entry -> {
|
||||||
typeIdsOfModifiedDictionaries.add(entry.getTypeId());
|
typeIdsOfModifiedDictionaries.add(entry.getTypeId());
|
||||||
removeFromDictionary(entry.getTypeId(), entry.getValue(), dossier.getId(), fileId, DictionaryEntryType.ENTRY);
|
removeFromDictionary(entry.getTypeId(), entry.getValue(), dossier.getId(), fileId, DictionaryEntryType.ENTRY);
|
||||||
@ -417,10 +419,7 @@ public class ManualRedactionService {
|
|||||||
|
|
||||||
private RedactionLogEntry getRedactionLogEntry(RedactionLog redactionLog, String annotationId) {
|
private RedactionLogEntry getRedactionLogEntry(RedactionLog redactionLog, String annotationId) {
|
||||||
|
|
||||||
Optional<RedactionLogEntry> redactionLogEntryOptional = redactionLog.getRedactionLogEntry()
|
Optional<RedactionLogEntry> redactionLogEntryOptional = redactionLog.getRedactionLogEntry().stream().filter(entry -> entry.getId().equals(annotationId)).findFirst();
|
||||||
.stream()
|
|
||||||
.filter(entry -> entry.getId().equals(annotationId))
|
|
||||||
.findFirst();
|
|
||||||
|
|
||||||
if (redactionLogEntryOptional.isEmpty()) {
|
if (redactionLogEntryOptional.isEmpty()) {
|
||||||
throw new NotFoundException("Annotation does not exist in redaction log.");
|
throw new NotFoundException("Annotation does not exist in redaction log.");
|
||||||
@ -431,16 +430,6 @@ public class ManualRedactionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String buildTypeId(RedactionLogEntry redactionLogEntry, DossierEntity dossier) {
|
|
||||||
|
|
||||||
if (redactionLogEntry.isDossierDictionaryEntry()) {
|
|
||||||
return toTypeId(redactionLogEntry.getType(), dossier.getDossierTemplateId(), dossier.getId());
|
|
||||||
} else {
|
|
||||||
return toTypeId(redactionLogEntry.getType(), dossier.getDossierTemplateId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void removeResizeRedactionsWithAddToDictionary(String dossierTemplateId, String redactionLogEntryValue) {
|
private void removeResizeRedactionsWithAddToDictionary(String dossierTemplateId, String redactionLogEntryValue) {
|
||||||
|
|
||||||
var resizeRedactionsWithSameValue = resizeRedactionPersistenceService.findByAnnotationStatusAndValue(AnnotationStatus.APPROVED, redactionLogEntryValue);
|
var resizeRedactionsWithSameValue = resizeRedactionPersistenceService.findByAnnotationStatusAndValue(AnnotationStatus.APPROVED, redactionLogEntryValue);
|
||||||
@ -718,33 +707,60 @@ public class ManualRedactionService {
|
|||||||
|
|
||||||
private void updateDictionaryForResizeRedactions(String dossierId, String fileId, ManualResizeRedactionEntity resizeRedaction, RedactionLog redactionLog) {
|
private void updateDictionaryForResizeRedactions(String dossierId, String fileId, ManualResizeRedactionEntity resizeRedaction, RedactionLog redactionLog) {
|
||||||
|
|
||||||
RedactionLogEntry redactionLogEntry = null;
|
RedactionLogEntry redactionLogEntry = getRedactionLogEntry(redactionLog, resizeRedaction.getId().getAnnotationId());
|
||||||
try {
|
|
||||||
redactionLogEntry = getRedactionLogEntry(redactionLog, resizeRedaction.getId().getAnnotationId());
|
|
||||||
} catch (NotFoundException e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resizeRedaction.getUpdateDictionary() != null && resizeRedaction.getUpdateDictionary() && resizeRedaction.getStatus()
|
if (resizeRedaction.getUpdateDictionary() != null && resizeRedaction.getUpdateDictionary() && resizeRedaction.getStatus()
|
||||||
.equals(AnnotationStatus.APPROVED) && (redactionLogEntry.isDictionaryEntry() || redactionLogEntry.isDossierDictionaryEntry())) {
|
.equals(AnnotationStatus.APPROVED) && (redactionLogEntry.isDictionaryEntry() || redactionLogEntry.isDossierDictionaryEntry())) {
|
||||||
|
|
||||||
var dossier = dossierPersistenceService.findByDossierId(dossierId);
|
var dossier = dossierPersistenceService.findByDossierId(dossierId);
|
||||||
|
|
||||||
var typeId = buildTypeId(redactionLogEntry, dossier);
|
var typeId = buildTypeId(redactionLogEntry, resizeRedaction, dossier);
|
||||||
var newValue = resizeRedaction.getValue();
|
var newValue = resizeRedaction.getValue();
|
||||||
var oldValue = redactionLogEntry.getValue();
|
var oldValue = redactionLogEntry.getValue();
|
||||||
var dictionaryEntryType = getDictionaryEntryType(redactionLogEntry);
|
var dictionaryEntryType = getDictionaryEntryType(redactionLogEntry);
|
||||||
|
|
||||||
if (oldValue != null && oldValue.length() > newValue.length()) {
|
boolean isShrinking = oldValue != null && oldValue.length() > newValue.length();
|
||||||
|
|
||||||
|
Set<String> typeIdsOfModifiedDictionaries = new HashSet<>();
|
||||||
|
|
||||||
|
if (isShrinking) {
|
||||||
log.info("Remove old value '{}' from dictionary", oldValue);
|
log.info("Remove old value '{}' from dictionary", oldValue);
|
||||||
removeFromDictionary(buildTypeId(redactionLogEntry, dossier), oldValue, dossierId, fileId, dictionaryEntryType);
|
removeFromDictionary(typeId, oldValue, dossierId, fileId, dictionaryEntryType);
|
||||||
|
typeIdsOfModifiedDictionaries.add(typeId);
|
||||||
|
|
||||||
|
if (resizeRedaction.isAddToAllDossiers() && redactionLogEntry.isDictionaryEntry()) {
|
||||||
|
String dossierTemplateId = dossier.getDossierTemplateId();
|
||||||
|
var dossiersOfThisDossierTemplate = dossierPersistenceService.findAllDossiersForDossierTemplateId(dossierTemplateId);
|
||||||
|
var type = redactionLogEntry.getType();
|
||||||
|
dossiersOfThisDossierTemplate.forEach(dossierEntity -> {
|
||||||
|
var typeIdOfDossierEntity = toTypeId(type, dossierTemplateId, dossierEntity.getId());
|
||||||
|
removeFromDictionary(typeIdOfDossierEntity, oldValue, dossierId, fileId, dictionaryEntryType);
|
||||||
|
typeIdsOfModifiedDictionaries.add(typeIdOfDossierEntity);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Add new value '{}' to dictionary", newValue);
|
log.info("Add new value '{}' to dictionary", newValue);
|
||||||
addToDictionary(typeId, newValue, dossierId, fileId, dictionaryEntryType);
|
addToDictionary(typeId, newValue, dossierId, fileId, dictionaryEntryType);
|
||||||
|
typeIdsOfModifiedDictionaries.add(typeId);
|
||||||
|
|
||||||
|
resizeRedactionPersistenceService.updateStatus(resizeRedaction.getId().getFileId(), resizeRedaction.getId().getAnnotationId(), resizeRedaction.getStatus(), typeIdsOfModifiedDictionaries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String buildTypeId(RedactionLogEntry redactionLogEntry, ManualResizeRedactionEntity resizeRedaction, DossierEntity dossier) {
|
||||||
|
|
||||||
|
if (resizeRedaction.isAddToAllDossiers()) {
|
||||||
|
return toTypeId(redactionLogEntry.getType(), dossier.getDossierTemplateId());
|
||||||
|
} else {
|
||||||
|
return toTypeId(redactionLogEntry.getType(), dossier.getDossierTemplateId(), dossier.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private DictionaryEntryType getDictionaryEntryType(RedactionLogEntry redactionLogEntry) {
|
private DictionaryEntryType getDictionaryEntryType(RedactionLogEntry redactionLogEntry) {
|
||||||
|
|
||||||
if (redactionLogEntry.isRecommendation() && redactionLogEntry.isFalsePositive()) {
|
if (redactionLogEntry.isRecommendation() && redactionLogEntry.isFalsePositive()) {
|
||||||
@ -757,133 +773,12 @@ public class ManualRedactionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@SuppressWarnings("PMD")
|
|
||||||
public void updateRemoveRedactionStatus(String dossierId, String fileId, List<String> annotationIds, AnnotationStatus annotationStatus) {
|
|
||||||
|
|
||||||
var dossier = dossierPersistenceService.getAndValidateDossier(dossierId);
|
|
||||||
RedactionLog redactionLog = redactionLogService.getRedactionLog(dossierId, fileId, true, true);
|
|
||||||
|
|
||||||
for (var annotationId : annotationIds) {
|
|
||||||
var idRemoval = MagicConverter.convert(removeRedactionPersistenceService.findRemoveRedaction(fileId, annotationId), IdRemoval.class);
|
|
||||||
|
|
||||||
RedactionLogEntry redactionLogEntry = getRedactionLogEntry(redactionLog, idRemoval.getAnnotationId());
|
|
||||||
|
|
||||||
if (idRemoval.isRemoveFromDictionary()) {
|
|
||||||
|
|
||||||
if (annotationStatus == AnnotationStatus.APPROVED) {
|
|
||||||
removeFromDictionary(buildTypeId(redactionLogEntry, dossier), redactionLogEntry.getValue(), dossierId, fileId, DictionaryEntryType.ENTRY);
|
|
||||||
approveStatusForRedactionsWithSameValue(dossier, false, true, redactionLogEntry.getValue());
|
|
||||||
reprocess(dossierId, fileId);
|
|
||||||
|
|
||||||
} else if (annotationStatus == AnnotationStatus.DECLINED) {
|
|
||||||
|
|
||||||
// if it was previously approved, revert the delete
|
|
||||||
if (idRemoval.getStatus() == AnnotationStatus.APPROVED) {
|
|
||||||
addToDictionary(buildTypeId(redactionLogEntry, dossier), redactionLogEntry.getValue(), dossierId, fileId, DictionaryEntryType.ENTRY);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (redactionLogEntry.isHint()) {
|
|
||||||
reprocess(dossierId, fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
removeRedactionPersistenceService.updateStatus(fileId, annotationId, annotationStatus);
|
|
||||||
|
|
||||||
}
|
|
||||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void approveStatusForRedactionsWithSameValue(DossierEntity dossier, boolean addToDictionary, boolean addToDossierDictionary, String value) {
|
|
||||||
|
|
||||||
List<DossierEntity> dossiers = new ArrayList<>();
|
|
||||||
if (addToDictionary) {
|
|
||||||
dossiers = dossierTemplatePersistenceService.getDossierTemplate(dossier.getDossierTemplateId()).getDossiers();
|
|
||||||
|
|
||||||
}
|
|
||||||
if (addToDossierDictionary) {
|
|
||||||
dossiers.add(dossier);
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<String> fileIds = new HashSet<>();
|
|
||||||
for (DossierEntity d : dossiers) {
|
|
||||||
var files = fileStatusService.getDossierStatus(d.getId());
|
|
||||||
files.forEach(f -> fileIds.add(f.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fileIds.isEmpty()) {
|
|
||||||
log.debug("Approve status for requested redactions with same value '{}' for files {}", value, fileIds);
|
|
||||||
addRedactionPersistenceService.approveStatusForRequestedRedactionsWithSameValue(fileIds, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void updateForceRedactionStatus(String dossierId, String fileId, List<String> annotationIds, AnnotationStatus annotationStatus) {
|
|
||||||
|
|
||||||
dossierPersistenceService.getAndValidateDossier(dossierId);
|
|
||||||
var actionPerformed = false;
|
|
||||||
|
|
||||||
for (var annotationId : annotationIds) {
|
|
||||||
var forceRedaction = forceRedactionPersistenceService.findForceRedaction(fileId, annotationId);
|
|
||||||
forceRedactionPersistenceService.updateStatus(fileId, annotationId, annotationStatus);
|
|
||||||
boolean isDeclined = forceRedaction.getStatus() == AnnotationStatus.REQUESTED && annotationStatus == AnnotationStatus.DECLINED;
|
|
||||||
actionPerformed = actionPerformed || !isDeclined;
|
|
||||||
if (isDeclined) {
|
|
||||||
forceRedactionPersistenceService.markAsProcessed(annotationId, fileId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actionPerformed) {
|
|
||||||
reprocess(dossierId, fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ManualRedactions getManualRedactions(String fileId) {
|
public ManualRedactions getManualRedactions(String fileId) {
|
||||||
|
|
||||||
return manualRedactionProviderService.getManualRedactions(fileId);
|
return manualRedactionProviderService.getManualRedactions(fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void updateLegalBasisChangeStatus(String dossierId, String fileId, List<String> annotationIds, AnnotationStatus annotationStatus) {
|
|
||||||
|
|
||||||
dossierPersistenceService.getAndValidateDossier(dossierId);
|
|
||||||
for (var annotationId : annotationIds) {
|
|
||||||
legalBasisChangePersistenceService.updateStatus(fileId, annotationId, annotationStatus);
|
|
||||||
}
|
|
||||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void updateImageRecategorizationStatus(String dossierId, String fileId, List<String> annotationIds, AnnotationStatus annotationStatus) {
|
|
||||||
|
|
||||||
dossierPersistenceService.getAndValidateDossier(dossierId);
|
|
||||||
var actionPerformed = false;
|
|
||||||
|
|
||||||
for (var annotationId : annotationIds) {
|
|
||||||
var imageRecategorization = recategorizationPersistenceService.findRecategorization(fileId, annotationId);
|
|
||||||
recategorizationPersistenceService.updateStatus(fileId, annotationId, annotationStatus);
|
|
||||||
boolean isDeclined = imageRecategorization.getStatus() == AnnotationStatus.REQUESTED && annotationStatus == AnnotationStatus.DECLINED;
|
|
||||||
actionPerformed = actionPerformed || !isDeclined;
|
|
||||||
if (isDeclined) {
|
|
||||||
recategorizationPersistenceService.markAsProcessed(annotationId, fileId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actionPerformed) {
|
|
||||||
reprocess(dossierId, fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateSurroundingText(String fileId, ManualRedactions manualRedactions) {
|
public void updateSurroundingText(String fileId, ManualRedactions manualRedactions) {
|
||||||
|
|
||||||
@ -893,64 +788,6 @@ public class ManualRedactionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void updateResizeRedactionStatus(String dossierId, String fileId, List<String> annotationIds, AnnotationStatus annotationStatus) {
|
|
||||||
|
|
||||||
dossierPersistenceService.getAndValidateDossier(dossierId);
|
|
||||||
|
|
||||||
var actionPerformed = false;
|
|
||||||
|
|
||||||
RedactionLog redactionLog = redactionLogService.getRedactionLog(dossierId, fileId, true, true);
|
|
||||||
|
|
||||||
for (var annotationId : annotationIds) {
|
|
||||||
|
|
||||||
var resizeRedaction = resizeRedactionPersistenceService.findResizeRedaction(fileId, annotationId);
|
|
||||||
|
|
||||||
actionPerformed = actionPerformed || !(resizeRedaction.getStatus() == AnnotationStatus.REQUESTED && annotationStatus == AnnotationStatus.DECLINED);
|
|
||||||
|
|
||||||
resizeRedactionPersistenceService.updateStatus(fileId, annotationId, annotationStatus);
|
|
||||||
resizeRedaction.setStatus(annotationStatus);
|
|
||||||
|
|
||||||
updateDictionaryForResizeRedactions(dossierId, fileId, resizeRedaction, redactionLog);
|
|
||||||
}
|
|
||||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
|
||||||
|
|
||||||
if (actionPerformed) {
|
|
||||||
reprocess(dossierId, fileId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("PMD")
|
|
||||||
@Transactional
|
|
||||||
public void updateAddRedactionStatus(String dossierId, String fileId, List<String> annotationIds, AnnotationStatus annotationStatus) {
|
|
||||||
|
|
||||||
var dossier = dossierPersistenceService.getAndValidateDossier(dossierId);
|
|
||||||
for (var annotationId : annotationIds) {
|
|
||||||
ManualRedactionEntryEntity manualRedactionEntry = addRedactionPersistenceService.findAddRedaction(fileId, annotationId);
|
|
||||||
if (manualRedactionEntry.isAddToDictionary() || manualRedactionEntry.isAddToDossierDictionary()) {
|
|
||||||
if (annotationStatus == AnnotationStatus.APPROVED) {
|
|
||||||
addToDictionary(manualRedactionEntry.getTypeId(), manualRedactionEntry.getValue(), dossierId, fileId, manualRedactionEntry.getDictionaryEntryType());
|
|
||||||
reprocess(dossierId, fileId);
|
|
||||||
approveStatusForRedactionsWithSameValue(dossier,
|
|
||||||
manualRedactionEntry.isAddToDictionary(),
|
|
||||||
manualRedactionEntry.isAddToDossierDictionary(),
|
|
||||||
manualRedactionEntry.getValue());
|
|
||||||
|
|
||||||
} else if (annotationStatus == AnnotationStatus.DECLINED) {
|
|
||||||
// if it was previously approved, revert the add
|
|
||||||
if (manualRedactionEntry.getStatus() == AnnotationStatus.APPROVED) {
|
|
||||||
removeFromDictionary(manualRedactionEntry.getTypeId(), manualRedactionEntry.getValue(), dossierId, fileId, manualRedactionEntry.getDictionaryEntryType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addRedactionPersistenceService.updateStatus(fileId, annotationId, annotationStatus, OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
|
|
||||||
}
|
|
||||||
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateProcessedDate(String fileId, ManualRedactions manualRedactions) {
|
public void updateProcessedDate(String fileId, ManualRedactions manualRedactions) {
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,6 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.entity.configuration.BaseDictionaryEntry;
|
import com.iqser.red.service.persistence.management.v1.processor.entity.configuration.BaseDictionaryEntry;
|
||||||
@ -19,6 +17,7 @@ import com.iqser.red.service.persistence.management.v1.processor.service.persist
|
|||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.DictionaryEntryType;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.DictionaryEntryType;
|
||||||
import com.knecon.fforesight.databasetenantcommons.providers.utils.JDBCWriteUtils;
|
import com.knecon.fforesight.databasetenantcommons.providers.utils.JDBCWriteUtils;
|
||||||
|
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.iqser.red.service.persistence.management.v1.processor.service.persis
|
|||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -12,10 +13,11 @@ import com.iqser.red.service.persistence.management.v1.processor.entity.annotati
|
|||||||
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ManualResizeRedactionEntity;
|
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ManualResizeRedactionEntity;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.RectangleEntity;
|
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.RectangleEntity;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
||||||
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.annotationentity.ManualRedactionRepository;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.annotationentity.ResizeRedactionRepository;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.annotationentity.ResizeRedactionRepository;
|
||||||
import com.knecon.fforesight.databasetenantcommons.providers.utils.MagicConverter;
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ResizeRedactionRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ResizeRedactionRequest;
|
||||||
|
import com.knecon.fforesight.databasetenantcommons.providers.utils.MagicConverter;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -25,6 +27,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ResizeRedactionPersistenceService {
|
public class ResizeRedactionPersistenceService {
|
||||||
|
|
||||||
|
private final ManualRedactionRepository manualRedactionRepository;
|
||||||
|
|
||||||
private final ResizeRedactionRepository resizeRedactionRepository;
|
private final ResizeRedactionRepository resizeRedactionRepository;
|
||||||
|
|
||||||
|
|
||||||
@ -52,11 +56,14 @@ public class ResizeRedactionPersistenceService {
|
|||||||
resizeRedactionRepository.updateSurroundingText(id, textBefore, textAfter);
|
resizeRedactionRepository.updateSurroundingText(id, textBefore, textAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateStatus(String fileId, String annotationId, AnnotationStatus annotationStatus) {
|
public void updateStatus(String fileId, String annotationId, AnnotationStatus annotationStatus, Set<String> typeIdsOfModifiedDictionaries) {
|
||||||
|
|
||||||
resizeRedactionRepository.updateStatus(new AnnotationEntityId(annotationId, fileId), annotationStatus, OffsetDateTime.now());
|
var resizeRedaction = resizeRedactionRepository.findById(new AnnotationEntityId(annotationId, fileId))
|
||||||
|
.orElseThrow(() -> new NotFoundException("Unknown file/annotation combination: " + fileId + "/" + annotationId));
|
||||||
|
|
||||||
|
resizeRedaction.setStatus(annotationStatus);
|
||||||
|
resizeRedaction.setTypeIdsOfModifiedDictionaries(typeIdsOfModifiedDictionaries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -151,3 +151,5 @@ databaseChangeLog:
|
|||||||
file: db/changelog/tenant/104-add-ocr-by-default-to-dossier-template.yaml
|
file: db/changelog/tenant/104-add-ocr-by-default-to-dossier-template.yaml
|
||||||
- include:
|
- include:
|
||||||
file: db/changelog/tenant/105-add-remove-watermark-to-dossier-template.yaml
|
file: db/changelog/tenant/105-add-remove-watermark-to-dossier-template.yaml
|
||||||
|
- include:
|
||||||
|
file: db/changelog/tenant/106-add-add-to-all-dossiers-to-resize-redactions.yaml
|
||||||
|
|||||||
@ -0,0 +1,46 @@
|
|||||||
|
databaseChangeLog:
|
||||||
|
- changeSet:
|
||||||
|
id: add-add-to-all-dossiers-to-resize-redactions
|
||||||
|
author: ali
|
||||||
|
changes:
|
||||||
|
- addColumn:
|
||||||
|
columns:
|
||||||
|
- column:
|
||||||
|
name: add_to_all_dossiers
|
||||||
|
type: BOOLEAN
|
||||||
|
tableName: manual_resize_redaction
|
||||||
|
- changeSet:
|
||||||
|
id: add-add-to-all-dossiers-to-resize-redactions-2
|
||||||
|
author: ali
|
||||||
|
changes:
|
||||||
|
- createTable:
|
||||||
|
columns:
|
||||||
|
- column:
|
||||||
|
constraints:
|
||||||
|
nullable: false
|
||||||
|
name: manual_resize_redaction_entity_annotation_id
|
||||||
|
type: VARCHAR(255)
|
||||||
|
- column:
|
||||||
|
constraints:
|
||||||
|
nullable: false
|
||||||
|
name: manual_resize_redaction_entity_file_id
|
||||||
|
type: VARCHAR(255)
|
||||||
|
- column:
|
||||||
|
name: type_ids_of_modified_dictionaries
|
||||||
|
type: VARCHAR(255)
|
||||||
|
tableName: manual_resize_redaction_entity_type_ids_of_modified_dictionaries
|
||||||
|
- changeSet:
|
||||||
|
id: add-add-to-all-dossiers-to-resize-redactions-3
|
||||||
|
author: ali
|
||||||
|
changes:
|
||||||
|
- addForeignKeyConstraint:
|
||||||
|
baseColumnNames: manual_resize_redaction_entity_annotation_id, manual_resize_redaction_entity_file_id
|
||||||
|
baseTableName: manual_resize_redaction_entity_type_ids_of_modified_dictionaries
|
||||||
|
constraintName: fk_resize_entity_annotation_id_file_id_for_type_ids_of_modified_dictionaries
|
||||||
|
deferrable: false
|
||||||
|
initiallyDeferred: false
|
||||||
|
onDelete: NO ACTION
|
||||||
|
onUpdate: NO ACTION
|
||||||
|
referencedColumnNames: annotation_id, file_id
|
||||||
|
referencedTableName: manual_resize_redaction
|
||||||
|
validate: true
|
||||||
@ -33,6 +33,9 @@ public class TypeProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TypeValue testAndProvideType(DossierTemplateModel dossierTemplate, Dossier dossier, String typeName, boolean dossierDictionaryOnly) {
|
public TypeValue testAndProvideType(DossierTemplateModel dossierTemplate, Dossier dossier, String typeName, boolean dossierDictionaryOnly) {
|
||||||
|
return testAndProvideType(dossierTemplate, dossier, typeName, dossierDictionaryOnly, 100);
|
||||||
|
}
|
||||||
|
public TypeValue testAndProvideType(DossierTemplateModel dossierTemplate, Dossier dossier, String typeName, boolean dossierDictionaryOnly, int rank) {
|
||||||
|
|
||||||
var type = new CreateTypeValue();
|
var type = new CreateTypeValue();
|
||||||
type.setType(typeName);
|
type.setType(typeName);
|
||||||
@ -42,7 +45,7 @@ public class TypeProvider {
|
|||||||
type.setRecommendationHexColor("#aaaaaa");
|
type.setRecommendationHexColor("#aaaaaa");
|
||||||
type.setSkippedHexColor("#aaaaaa");
|
type.setSkippedHexColor("#aaaaaa");
|
||||||
type.setHint(false);
|
type.setHint(false);
|
||||||
type.setRank(100);
|
type.setRank(rank);
|
||||||
type.setRecommendation(false);
|
type.setRecommendation(false);
|
||||||
type.setCaseInsensitive(true);
|
type.setCaseInsensitive(true);
|
||||||
type.setDossierTemplateId(dossierTemplate.getId());
|
type.setDossierTemplateId(dossierTemplate.getId());
|
||||||
@ -53,7 +56,7 @@ public class TypeProvider {
|
|||||||
var allTypes = dictionaryClient.getAllTypes(dossierTemplate.getDossierTemplateId(),dossier != null ? dossier.getId() : null,false);
|
var allTypes = dictionaryClient.getAllTypes(dossierTemplate.getDossierTemplateId(),dossier != null ? dossier.getId() : null,false);
|
||||||
|
|
||||||
var foundType =allTypes.getTypes().stream().filter(t -> t.getType().equalsIgnoreCase(typeName)).findAny();
|
var foundType =allTypes.getTypes().stream().filter(t -> t.getType().equalsIgnoreCase(typeName)).findAny();
|
||||||
assertThat(foundType.isPresent()).isTrue();
|
assertThat(foundType).isPresent();
|
||||||
|
|
||||||
return foundType.get();
|
return foundType.get();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -420,11 +420,11 @@ public class FileTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
fileClient.setStatusUnderReview(dossier.getId(), file.getId(), userId);
|
fileClient.setStatusUnderReview(dossier.getId(), file.getId(), userId);
|
||||||
|
|
||||||
var addRedaction = manualRedactionClient.requestBulkAddRedaction(dossierId,
|
var addRedaction = manualRedactionClient.addRedactionBulk(dossierId,
|
||||||
fileId,
|
fileId,
|
||||||
Set.of(AddRedactionRequest.builder()
|
Set.of(AddRedactionRequest.builder()
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToDossierDictionary(false)
|
.addToAllDossiers(true)
|
||||||
.comment(new AddCommentRequest("comment"))
|
.comment(new AddCommentRequest("comment"))
|
||||||
.type(type.getType())
|
.type(type.getType())
|
||||||
.reason("1")
|
.reason("1")
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -28,4 +28,6 @@ public class ResizeRedactionRequest {
|
|||||||
private String textBefore;
|
private String textBefore;
|
||||||
private String textAfter;
|
private String textAfter;
|
||||||
|
|
||||||
|
private boolean addToAllDossiers;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ public class ManualResizeRedaction extends BaseAnnotation {
|
|||||||
private String textBefore;
|
private String textBefore;
|
||||||
private String textAfter;
|
private String textAfter;
|
||||||
private Boolean updateDictionary;
|
private Boolean updateDictionary;
|
||||||
|
private boolean addToAllDossiers;
|
||||||
|
|
||||||
|
|
||||||
@Builder
|
@Builder
|
||||||
|
|||||||
@ -38,9 +38,6 @@ public class AddRedactionRequest {
|
|||||||
|
|
||||||
private AddCommentRequest comment;
|
private AddCommentRequest comment;
|
||||||
|
|
||||||
@Deprecated // Do not use this anymore. will be removed.
|
|
||||||
private boolean addToDossierDictionary;
|
|
||||||
|
|
||||||
private boolean forceAddToDictionary;
|
private boolean forceAddToDictionary;
|
||||||
|
|
||||||
private String section;
|
private String section;
|
||||||
|
|||||||
@ -26,6 +26,8 @@ public class ResizeRedactionRequest {
|
|||||||
|
|
||||||
private Boolean updateDictionary;
|
private Boolean updateDictionary;
|
||||||
|
|
||||||
|
private boolean addToAllDossiers;
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private List<Rectangle> positions = new ArrayList<>();
|
private List<Rectangle> positions = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user