RED-7237 - Change to group annotation #686
@ -7,20 +7,20 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.AccessControlService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupRedactionService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupAnnotationService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.AuditPersistenceService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.external.resource.GroupRedactionResource;
|
||||
import com.iqser.red.service.persistence.service.v1.api.external.resource.GroupAnnotationResource;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.AuditCategory;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.audit.AuditRequest;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddTextGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangePageRangeAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangeValueAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.RecategorizeGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ResizeAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddTextGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangePageRangeAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangeValueAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.RecategorizeGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ResizeAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.UpdateLegalBasisRequestModel;
|
||||
import com.knecon.fforesight.keycloakcommons.security.KeycloakSecurity;
|
||||
|
||||
@ -32,268 +32,267 @@ import lombok.experimental.FieldDefaults;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
|
||||
public class GroupRedactionController implements GroupRedactionResource {
|
||||
public class GroupAnnotationController implements GroupAnnotationResource {
|
||||
|
||||
static String GROUP_IDS = "groupIds";
|
||||
AuditPersistenceService auditPersistenceService;
|
||||
AccessControlService accessControlService;
|
||||
GroupRedactionService groupRedactionService;
|
||||
GroupAnnotationService groupAnnotationService;
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse addTextGroupRedaction(String dossierId, String fileId, @Valid @RequestBody List<AddTextGroupRedactionRequestModel> addRedactionRequests) {
|
||||
public GroupAnnotationResponse addTextGroupAnnotation(String dossierId, String fileId, @Valid @RequestBody List<AddTextGroupAnnotationRequestModel> addTextGroupAnnotationRequestModels) {
|
||||
|
||||
accessControlService.checkAccessPermissionsToDossier(dossierId);
|
||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
||||
accessControlService.verifyUserIsMemberOrApprover(dossierId);
|
||||
|
||||
GroupRedactionResponse groupRedactionResponse = groupRedactionService.addTextGroupRedaction(dossierId, fileId, addRedactionRequests);
|
||||
GroupAnnotationResponse groupAnnotationResponse = groupAnnotationService.addTextGroupAnnotation(dossierId, fileId, addTextGroupAnnotationRequestModels);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Group redactions was added")
|
||||
.message("Group annotations were added")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
GROUP_IDS,
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getGroupId)
|
||||
.map(GroupAnnotation::getGroupId)
|
||||
.toList()))
|
||||
.build());
|
||||
return groupRedactionResponse;
|
||||
return groupAnnotationResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse addAreaGroupRedaction(String dossierId, String fileId, List<AddAreaGroupRedactionRequestModel> addRedactionRequests) {
|
||||
public GroupAnnotationResponse addAreaGroupAnnotation(String dossierId, String fileId, List<AddAreaGroupAnnotationRequestModel> addAreaGroupAnnotationRequestModels) {
|
||||
|
||||
accessControlService.checkAccessPermissionsToDossier(dossierId);
|
||||
accessControlService.verifyFileIsNotApproved(dossierId, fileId);
|
||||
accessControlService.verifyUserIsMemberOrApprover(dossierId);
|
||||
|
||||
GroupRedactionResponse groupRedactionResponse = groupRedactionService.addAreaGroupRedaction(dossierId, fileId, addRedactionRequests);
|
||||
GroupAnnotationResponse groupAnnotationResponse = groupAnnotationService.addAreaGroupAnnotation(dossierId, fileId, addAreaGroupAnnotationRequestModels);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Group redactions was added")
|
||||
.message("Group annotations were added")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
GROUP_IDS,
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getGroupId)
|
||||
.map(GroupAnnotation::getGroupId)
|
||||
.toList()))
|
||||
.build());
|
||||
return groupRedactionResponse;
|
||||
return groupAnnotationResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse getGroupRedactions(String dossierId, String fileId, boolean includeSoftDeleted) {
|
||||
public GroupAnnotationResponse getGroupAnnotations(String dossierId, String fileId, boolean includeSoftDeleted) {
|
||||
|
||||
return groupRedactionService.getAllGroupRedactions(fileId, includeSoftDeleted);
|
||||
return groupAnnotationService.getAllGroupAnnotations(fileId, includeSoftDeleted);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedaction getGroupRedaction(String dossierId, String fileId, String groupId) {
|
||||
public GroupAnnotation getGroupAnnotation(String dossierId, String fileId, String groupId) {
|
||||
|
||||
return groupRedactionService.getGroupRedaction(groupId);
|
||||
return groupAnnotationService.getGroupAnnotation(groupId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse updateLegalBasis(String dossierId, String fileId, List<UpdateLegalBasisRequestModel> updateLegalBasisRequestModels) {
|
||||
public GroupAnnotationResponse updateLegalBasis(String dossierId, String fileId, List<UpdateLegalBasisRequestModel> annotationRequestModels) {
|
||||
|
||||
GroupRedactionResponse groupRedactionResponse = groupRedactionService.updateLegalBasis(dossierId, fileId, updateLegalBasisRequestModels);
|
||||
GroupAnnotationResponse groupAnnotationResponse = groupAnnotationService.updateLegalBasis(dossierId, fileId, annotationRequestModels);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Group redactions legal basis was modified.")
|
||||
.message("Group annotations legal basis was modified.")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
GROUP_IDS,
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getGroupId)
|
||||
.map(GroupAnnotation::getGroupId)
|
||||
.toList(),
|
||||
"legalBasis",
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getLegalBasis)
|
||||
.map(GroupAnnotation::getLegalBasis)
|
||||
.toList()))
|
||||
.build());
|
||||
|
||||
return groupRedactionResponse;
|
||||
return groupAnnotationResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse recategorizeGroupRedaction(String dossierId,
|
||||
String fileId,
|
||||
List<RecategorizeGroupRedactionRequestModel> recategorizeGroupRedactionRequestModels) {
|
||||
public GroupAnnotationResponse recategorizeGroupAnnotation(String dossierId,
|
||||
String fileId,
|
||||
List<RecategorizeGroupAnnotationRequestModel> annotationRequestModels) {
|
||||
|
||||
GroupRedactionResponse groupRedactionResponse = groupRedactionService.recategorizeGroupRedaction(dossierId, fileId, recategorizeGroupRedactionRequestModels);
|
||||
GroupAnnotationResponse groupAnnotationResponse = groupAnnotationService.recategorizeGroupAnnotation(dossierId, fileId, annotationRequestModels);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Group redactions type was modified.")
|
||||
.message("Group annotations type was modified.")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
GROUP_IDS,
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getGroupId)
|
||||
.map(GroupAnnotation::getGroupId)
|
||||
.toList(),
|
||||
"type",
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getTypeId)
|
||||
.map(GroupAnnotation::getTypeId)
|
||||
.toList()))
|
||||
.build());
|
||||
|
||||
return groupRedactionResponse;
|
||||
return groupAnnotationResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse forceGroupRedaction(String dossierId, String fileId, List<GroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
public GroupAnnotationResponse forceGroupAnnotation(String dossierId, String fileId, List<GroupAnnotationRequestModel> groupAnnotationRequestModels) {
|
||||
|
||||
GroupRedactionResponse groupRedactionResponse = groupRedactionService.forceGroupRedaction(dossierId, fileId, groupRedactionRequestModels);
|
||||
GroupAnnotationResponse groupAnnotationResponse = groupAnnotationService.forceGroupAnnotation(dossierId, fileId, groupAnnotationRequestModels);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Group redactions forced.")
|
||||
.message("Group annotations forced.")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
GROUP_IDS,
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getGroupId)
|
||||
.map(GroupAnnotation::getGroupId)
|
||||
.toList()))
|
||||
.build());
|
||||
|
||||
return groupRedactionResponse;
|
||||
return groupAnnotationResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse resizeGroupRedaction(String dossierId, String fileId, List<ResizeAreaGroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
public GroupAnnotationResponse resizeGroupAnnotation(String dossierId, String fileId, List<ResizeAreaGroupAnnotationRequestModel> resizeAreaGroupAnnotationRequestModels) {
|
||||
|
||||
GroupRedactionResponse groupRedactionResponse = groupRedactionService.resizeAreaGroupRedaction(dossierId, fileId, groupRedactionRequestModels);
|
||||
GroupAnnotationResponse groupAnnotationResponse = groupAnnotationService.resizeAreaGroupAnnotation(dossierId, fileId, resizeAreaGroupAnnotationRequestModels);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Area Group redactions positions were modified.")
|
||||
.message("Area Group annotations positions were modified.")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
GROUP_IDS,
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getGroupId)
|
||||
.map(GroupAnnotation::getGroupId)
|
||||
.toList()))
|
||||
.build());
|
||||
|
||||
return groupRedactionResponse;
|
||||
return groupAnnotationResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse changeValueGroupRedaction(String dossierId, String fileId, List<ChangeValueAreaGroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
public GroupAnnotationResponse changeValueGroupAnnotation(String dossierId, String fileId, List<ChangeValueAreaGroupAnnotationRequestModel> changeValueAreaGroupAnnotationRequestModels) {
|
||||
|
||||
GroupRedactionResponse groupRedactionResponse = groupRedactionService.changeValueGroupRedaction(dossierId, fileId, groupRedactionRequestModels);
|
||||
GroupAnnotationResponse groupAnnotationResponse = groupAnnotationService.changeValueGroupAnnotation(dossierId, fileId, changeValueAreaGroupAnnotationRequestModels);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Area Group redactions value was modified.")
|
||||
.message("Area Group annotations value was modified.")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
GROUP_IDS,
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getGroupId)
|
||||
.map(GroupAnnotation::getGroupId)
|
||||
.toList()))
|
||||
.build());
|
||||
|
||||
return groupRedactionResponse;
|
||||
return groupAnnotationResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse changePageRangeGroupRedaction(String dossierId, String fileId, List<ChangePageRangeAreaGroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
public GroupAnnotationResponse changePageRangeGroupAnnotation(String dossierId, String fileId, List<ChangePageRangeAreaGroupAnnotationRequestModel> changePageRangeAreaGroupAnnotationRequestModels) {
|
||||
|
||||
GroupRedactionResponse groupRedactionResponse = groupRedactionService.changePageRangesGroupRedaction(dossierId, fileId, groupRedactionRequestModels);
|
||||
GroupAnnotationResponse groupAnnotationResponse = groupAnnotationService.changePageRangesGroupAnnotation(dossierId, fileId, changePageRangeAreaGroupAnnotationRequestModels);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Area Group redactions page ranges were modified.")
|
||||
.message("Area Group annotations page ranges were modified.")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
GROUP_IDS,
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getGroupId)
|
||||
.map(GroupAnnotation::getGroupId)
|
||||
.toList()))
|
||||
.build());
|
||||
|
||||
return groupRedactionResponse;
|
||||
return groupAnnotationResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse removeGroupRedaction(String dossierId, String fileId, List<GroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
public void removeGroupAnnotation(String dossierId, String fileId, List<GroupAnnotationRequestModel> groupAnnotationRequestModelList) {
|
||||
|
||||
GroupRedactionResponse groupRedactionResponse = groupRedactionService.removeGroupRedaction(dossierId, fileId, groupRedactionRequestModels);
|
||||
GroupAnnotationResponse groupAnnotationResponse = groupAnnotationService.removeGroupAnnotation(dossierId, fileId, groupAnnotationRequestModelList);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Group redactions were removed.")
|
||||
.message("Group annotations were removed.")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
GROUP_IDS,
|
||||
groupRedactionResponse.getGroupRedactions()
|
||||
groupAnnotationResponse.getGroupAnnotations()
|
||||
.stream()
|
||||
.map(GroupRedaction::getGroupId)
|
||||
.map(GroupAnnotation::getGroupId)
|
||||
.toList()))
|
||||
.build());
|
||||
|
||||
return groupRedactionResponse;
|
||||
}
|
||||
|
||||
}
|
||||
@ -11,15 +11,15 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddTextGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangePageRangeAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangeValueAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.RecategorizeGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ResizeAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddTextGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangePageRangeAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangeValueAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.RecategorizeGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ResizeAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.UpdateLegalBasisRequestModel;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -27,12 +27,12 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
public interface GroupRedactionResource {
|
||||
public interface GroupAnnotationResource {
|
||||
|
||||
String GROUP_REDACTION_REST_PATH = ExternalApi.BASE_PATH + "/group";
|
||||
String GROUP_ANNOTATION_REST_PATH = ExternalApi.BASE_PATH + "/group";
|
||||
|
||||
String TEXT_GROUP_REDACTION_REST_PATH = GROUP_REDACTION_REST_PATH + "/text";
|
||||
String AREA_GROUP_REDACTION_REST_PATH = GROUP_REDACTION_REST_PATH + "/area";
|
||||
String TEXT_GROUP_ANNOTATION_REST_PATH = GROUP_ANNOTATION_REST_PATH + "/text";
|
||||
String AREA_GROUP_ANNOTATION_REST_PATH = GROUP_ANNOTATION_REST_PATH + "/area";
|
||||
|
||||
String DOSSIER_ID = "dossierId";
|
||||
String DOSSIER_ID_PATH_PARAM = "/{" + DOSSIER_ID + "}";
|
||||
@ -47,128 +47,128 @@ public interface GroupRedactionResource {
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = TEXT_GROUP_REDACTION_REST_PATH
|
||||
@PostMapping(value = TEXT_GROUP_ANNOTATION_REST_PATH
|
||||
+ "/add"
|
||||
+ DOSSIER_ID_PATH_PARAM
|
||||
+ FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Adds a text group redaction", description = "None")
|
||||
@Operation(summary = "Adds a list of text group annotations", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
GroupRedactionResponse addTextGroupRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@Valid @RequestBody List<AddTextGroupRedactionRequestModel> addRedactionRequests);
|
||||
GroupAnnotationResponse addTextGroupAnnotation(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@Valid @RequestBody List<AddTextGroupAnnotationRequestModel> addTextGroupAnnotationRequestModels);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = AREA_GROUP_REDACTION_REST_PATH
|
||||
@PostMapping(value = AREA_GROUP_ANNOTATION_REST_PATH
|
||||
+ "/add"
|
||||
+ DOSSIER_ID_PATH_PARAM
|
||||
+ FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Adds an area group redaction", description = "None")
|
||||
@Operation(summary = "Adds a list of area group annotations", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
GroupRedactionResponse addAreaGroupRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@Valid @RequestBody List<AddAreaGroupRedactionRequestModel> addRedactionRequests);
|
||||
GroupAnnotationResponse addAreaGroupAnnotation(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@Valid @RequestBody List<AddAreaGroupAnnotationRequestModel> addAreaGroupAnnotationRequestModels);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@GetMapping(value = GROUP_REDACTION_REST_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Returns all the group redactions", description = "None")
|
||||
@GetMapping(value = GROUP_ANNOTATION_REST_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Returns all the group annotations", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found")})
|
||||
GroupRedactionResponse getGroupRedactions(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
|
||||
GroupAnnotationResponse getGroupAnnotations(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@GetMapping(value = GROUP_REDACTION_REST_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + GROUP_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Returns a specific the group redactions", description = "None")
|
||||
@GetMapping(value = GROUP_ANNOTATION_REST_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + GROUP_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Returns a specific group annotation", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found")})
|
||||
GroupRedaction getGroupRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@PathVariable(GROUP_ID) String groupId);
|
||||
GroupAnnotation getGroupAnnotation(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@PathVariable(GROUP_ID) String groupId);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = GROUP_REDACTION_REST_PATH
|
||||
@PostMapping(value = GROUP_ANNOTATION_REST_PATH
|
||||
+ "/updateLegalBasis"
|
||||
+ DOSSIER_ID_PATH_PARAM
|
||||
+ FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Update the legal basis of a list of group redactions", description = "None")
|
||||
@Operation(summary = "Update the legal basis of a list of group annotations", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
GroupRedactionResponse updateLegalBasis(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<UpdateLegalBasisRequestModel> updateLegalBasisRequestModels);
|
||||
GroupAnnotationResponse updateLegalBasis(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<UpdateLegalBasisRequestModel> updateLegalBasisRequestModels);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = GROUP_REDACTION_REST_PATH
|
||||
@PostMapping(value = GROUP_ANNOTATION_REST_PATH
|
||||
+ "/recategorize"
|
||||
+ DOSSIER_ID_PATH_PARAM
|
||||
+ FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Update the type of a list of group redactions", description = "None")
|
||||
@Operation(summary = "Update the type of a list of group annotations", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
GroupRedactionResponse recategorizeGroupRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<RecategorizeGroupRedactionRequestModel> recategorizeGroupRedactionRequestModels);
|
||||
GroupAnnotationResponse recategorizeGroupAnnotation(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<RecategorizeGroupAnnotationRequestModel> recategorizeGroupAnnotationRequestModels);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = GROUP_REDACTION_REST_PATH
|
||||
@PostMapping(value = GROUP_ANNOTATION_REST_PATH
|
||||
+ "/force"
|
||||
+ DOSSIER_ID_PATH_PARAM
|
||||
+ FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Force of a list of group redactions", description = "None")
|
||||
@Operation(summary = "Force of a list of group annotations", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
GroupRedactionResponse forceGroupRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<GroupRedactionRequestModel> groupRedactionRequestModels);
|
||||
GroupAnnotationResponse forceGroupAnnotation(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<GroupAnnotationRequestModel> groupAnnotationRequestModels);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = AREA_GROUP_REDACTION_REST_PATH
|
||||
@PostMapping(value = AREA_GROUP_ANNOTATION_REST_PATH
|
||||
+ "/resize"
|
||||
+ DOSSIER_ID_PATH_PARAM
|
||||
+ FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Resize a list of area group redactions", description = "None")
|
||||
@Operation(summary = "Resize a list of area group annotations", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
GroupRedactionResponse resizeGroupRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<ResizeAreaGroupRedactionRequestModel> groupRedactionRequestModels);
|
||||
GroupAnnotationResponse resizeGroupAnnotation(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<ResizeAreaGroupAnnotationRequestModel> resizeAreaGroupAnnotationRequestModels);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = AREA_GROUP_REDACTION_REST_PATH
|
||||
@PostMapping(value = AREA_GROUP_ANNOTATION_REST_PATH
|
||||
+ "/change/value"
|
||||
+ DOSSIER_ID_PATH_PARAM
|
||||
+ FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Change the value for a list of area group redactions", description = "None")
|
||||
@Operation(summary = "Change the value for a list of area group annotations", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
GroupRedactionResponse changeValueGroupRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<ChangeValueAreaGroupRedactionRequestModel> groupRedactionRequestModels);
|
||||
GroupAnnotationResponse changeValueGroupAnnotation(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<ChangeValueAreaGroupAnnotationRequestModel> changeValueAreaGroupAnnotationRequestModels);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = AREA_GROUP_REDACTION_REST_PATH
|
||||
@PostMapping(value = AREA_GROUP_ANNOTATION_REST_PATH
|
||||
+ "/change/pageRange"
|
||||
+ DOSSIER_ID_PATH_PARAM
|
||||
+ FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Change the page range for a list of area group redactions", description = "None")
|
||||
@Operation(summary = "Change the page range for a list of area group annotations", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
GroupRedactionResponse changePageRangeGroupRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<ChangePageRangeAreaGroupRedactionRequestModel> groupRedactionRequestModels);
|
||||
GroupAnnotationResponse changePageRangeGroupAnnotation(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<ChangePageRangeAreaGroupAnnotationRequestModel> changePageRangeAreaGroupAnnotationRequestModels);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = GROUP_REDACTION_REST_PATH
|
||||
@PostMapping(value = GROUP_ANNOTATION_REST_PATH
|
||||
+ "/remove"
|
||||
+ DOSSIER_ID_PATH_PARAM
|
||||
+ FILE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Remove of a list of group redactions", description = "None")
|
||||
@Operation(summary = "Remove of a list of group annotations", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
GroupRedactionResponse removeGroupRedaction(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<GroupRedactionRequestModel> groupRedactionRequestModels);
|
||||
void removeGroupAnnotation(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody List<GroupAnnotationRequestModel> groupAnnotationRequestModelList);
|
||||
|
||||
}
|
||||
@ -10,14 +10,12 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.iqser.red.service.dictionarymerge.commons.DictionaryEntry;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.ColorsService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupRedactionService;
|
||||
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.service.v1.api.internal.resources.DictionaryResource;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.configuration.Colors;
|
||||
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.group.GroupRedactionResponse;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -30,7 +28,6 @@ public class DictionaryInternalController implements DictionaryResource {
|
||||
private final EntryPersistenceService entryPersistenceService;
|
||||
private final DictionaryPersistenceService dictionaryPersistenceService;
|
||||
private final ColorsService colorsService;
|
||||
private final GroupRedactionService groupRedactionService;
|
||||
|
||||
|
||||
@Override
|
||||
@ -86,14 +83,6 @@ public class DictionaryInternalController implements DictionaryResource {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionResponse getGroupRedactions(String fileId, boolean includeSoftDeleted) {
|
||||
|
||||
log.info("Getting text groups for file through dictionary controller {}", fileId);
|
||||
return groupRedactionService.getAllGroupRedactions(fileId, includeSoftDeleted);
|
||||
}
|
||||
|
||||
|
||||
private void setEntriesForTypes(Long fromVersion, List<Type> targets) {
|
||||
|
||||
targets.forEach(target -> {
|
||||
|
||||
@ -2,10 +2,9 @@ package com.iqser.red.service.persistence.v1.internal.api.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupRedactionService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.internal.resources.GroupRedactionResource;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionResponse;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupAnnotationService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.internal.resources.GroupAnnotationResource;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationInternalResponse;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -16,15 +15,15 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@RequiredArgsConstructor
|
||||
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
|
||||
@Slf4j
|
||||
public class GroupRedactionInternalController implements GroupRedactionResource {
|
||||
public class GroupAnnotationInternalController implements GroupAnnotationResource {
|
||||
|
||||
GroupRedactionService groupRedactionService;
|
||||
GroupAnnotationService groupAnnotationService;
|
||||
|
||||
|
||||
@Override
|
||||
public GroupRedactionInternalResponse getGroupRedactions(String dossierId, String fileId, boolean includeSoftDeleted) {
|
||||
public GroupAnnotationInternalResponse getGroupAnnotations(String dossierId, String fileId, boolean includeSoftDeleted) {
|
||||
|
||||
return groupRedactionService.getAllGroupRedactionsInternal(fileId, includeSoftDeleted);
|
||||
return groupAnnotationService.getAllGroupAnnotationsInternal(fileId, includeSoftDeleted);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.internal.resources;
|
||||
|
||||
import static com.iqser.red.service.persistence.service.v1.api.internal.resources.GroupRedactionResource.INCLUDE_SOFT_DELETED_PARAM;
|
||||
import static com.iqser.red.service.persistence.service.v1.api.internal.resources.GroupAnnotationResource.INCLUDE_SOFT_DELETED_PARAM;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.configuration.Colors;
|
||||
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.group.GroupRedactionResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationResponse;
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public interface DictionaryResource {
|
||||
@ -75,8 +75,4 @@ public interface DictionaryResource {
|
||||
@GetMapping(value = InternalApi.BASE_PATH + COLOR_PATH + DOSSIER_TEMPLATE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
Colors getColors(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId);
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH + GROUP_REDACTION_REST_PATH + "2" + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
GroupRedactionResponse getGroupRedactions(@PathVariable(FILE_ID) String fileId, @RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
|
||||
|
||||
}
|
||||
|
||||
@ -7,13 +7,12 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationInternalResponse;
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public interface GroupRedactionResource {
|
||||
public interface GroupAnnotationResource {
|
||||
|
||||
String GROUP_REDACTION_REST_PATH = "/group";
|
||||
String GROUP_ANNOTATION_REST_PATH = "/group";
|
||||
|
||||
String DOSSIER_ID = "dossierId";
|
||||
String DOSSIER_ID_PATH_PARAM = "/{" + DOSSIER_ID + "}";
|
||||
@ -24,9 +23,9 @@ public interface GroupRedactionResource {
|
||||
String INCLUDE_SOFT_DELETED_PARAM = "includeSoftDeleted";
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH + GROUP_REDACTION_REST_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
GroupRedactionInternalResponse getGroupRedactions(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
|
||||
@GetMapping(value = InternalApi.BASE_PATH + GROUP_ANNOTATION_REST_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
GroupAnnotationInternalResponse getGroupAnnotations(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
|
||||
|
||||
}
|
||||
@ -10,7 +10,6 @@ import jakarta.persistence.DiscriminatorValue;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -22,7 +21,7 @@ import lombok.experimental.SuperBuilder;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class AreaGroupEntity extends GroupRedactionEntity {
|
||||
public class AreaGroupEntity extends GroupAnnotationEntity {
|
||||
|
||||
@OneToMany(mappedBy = "areaGroup", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
@JsonManagedReference
|
||||
|
||||
@ -34,7 +34,7 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class GroupRedactionEntity {
|
||||
public class GroupAnnotationEntity {
|
||||
|
||||
@Id
|
||||
@Column(name = "group_id", nullable = false, length = 36)
|
||||
@ -73,7 +73,7 @@ public class GroupRedactionEntity {
|
||||
@JsonManagedReference
|
||||
private List<GroupChangeEntity> groupChanges = new ArrayList<>();
|
||||
|
||||
@OneToOne(mappedBy = "groupRedaction", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
@OneToOne(mappedBy = "groupAnnotation", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
@JsonManagedReference
|
||||
private PositionOnPageEntity positionsOnPage;
|
||||
|
||||
@ -39,7 +39,7 @@ public class GroupChangeEntity {
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "group_id", nullable = false)
|
||||
@JsonBackReference
|
||||
private GroupRedactionEntity group;
|
||||
private GroupAnnotationEntity group;
|
||||
|
||||
@Column(name = "user_id", nullable = false)
|
||||
private String userId;
|
||||
|
||||
@ -4,13 +4,11 @@ import java.util.UUID;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.PrePersist;
|
||||
import jakarta.persistence.Table;
|
||||
@ -34,7 +32,7 @@ public class PositionOnPageEntity {
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "group_id", nullable = false)
|
||||
@JsonBackReference
|
||||
private GroupRedactionEntity groupRedaction;
|
||||
private GroupAnnotationEntity groupAnnotation;
|
||||
|
||||
@Column(name = "x", nullable = false)
|
||||
private float x;
|
||||
|
||||
@ -11,6 +11,6 @@ import lombok.experimental.SuperBuilder;
|
||||
@DiscriminatorValue("text")
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder
|
||||
public class TextGroupEntity extends GroupRedactionEntity {
|
||||
public class TextGroupEntity extends GroupAnnotationEntity {
|
||||
|
||||
}
|
||||
@ -24,11 +24,11 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.configuration.TypeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.DossierEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupRedactionEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupAnnotationEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.BadRequestException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.manualredactions.PendingDictionaryEntryFactory;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.manualredactions.PendingGroupRedactionFactory;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.manualredactions.PendingGroupAnnotationFactory;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.DictionaryPersistenceService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Change;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.ChangeType;
|
||||
@ -71,11 +71,11 @@ public class EntityLogMergeService {
|
||||
DictionaryPersistenceService dictionaryPersistenceService;
|
||||
PendingDictionaryEntryFactory pendingDictionaryEntryFactory;
|
||||
EntityLogMongoService entityLogMongoService;
|
||||
PendingGroupRedactionFactory pendingGroupRedactionFactory;
|
||||
PendingGroupAnnotationFactory pendingGroupAnnotationFactory;
|
||||
|
||||
|
||||
@Observed(name = "EntityLogMergeService", contextualName = "merge-entity-log")
|
||||
public EntityLog mergeEntityLog(ManualRedactions unprocessedManualRedactions, EntityLog entityLog, DossierEntity dossier, List<GroupRedactionEntity> unprocessedGroupRedactions) {
|
||||
public EntityLog mergeEntityLog(ManualRedactions unprocessedManualRedactions, EntityLog entityLog, DossierEntity dossier, List<GroupAnnotationEntity> unprocessedGroupAnnotations) {
|
||||
|
||||
final int analysisNumber = entityLog.getAnalysisNumber();
|
||||
|
||||
@ -83,7 +83,7 @@ public class EntityLogMergeService {
|
||||
|
||||
List<EntityLogEntry> entityLogEntries = new LinkedList<>(entityLog.getEntityLogEntry());
|
||||
|
||||
merge(unprocessedManualRedactions, entityLog.getEntityLogEntry(), dossier, analysisNumber, entityLogEntries, allManualChanges, unprocessedGroupRedactions);
|
||||
merge(unprocessedManualRedactions, entityLog.getEntityLogEntry(), dossier, analysisNumber, entityLogEntries, allManualChanges, unprocessedGroupAnnotations);
|
||||
|
||||
entityLog.setEntityLogEntry(entityLogEntries);
|
||||
return entityLog;
|
||||
@ -112,24 +112,24 @@ public class EntityLogMergeService {
|
||||
int analysisNumber,
|
||||
List<EntityLogEntry> entityLogEntries,
|
||||
Map<String, List<BaseAnnotation>> allManualChanges,
|
||||
List<GroupRedactionEntity> unprocessedGroupRedactions) {
|
||||
List<GroupAnnotationEntity> unprocessedGroupAnnotations) {
|
||||
|
||||
Map<String, String> trackLocalChangesBasedOnDictEntriesMap = new HashMap<>();
|
||||
Map<String, EntityLogEntry> addedLocalManualEntries = buildUnprocessedLocalManualRedactions(unprocessedManualRedactions, entityLog, dossier, analysisNumber)//
|
||||
.collect(Collectors.toMap(EntityLogEntry::getId, Function.identity()));
|
||||
entityLogEntries.addAll(addedLocalManualEntries.values());
|
||||
buildPendingDictionaryChanges(unprocessedManualRedactions).forEach(entityLogEntries::add);
|
||||
buildGroupRedactions(unprocessedGroupRedactions).forEach(entityLogEntries::add);
|
||||
buildGroupAnnotations(unprocessedGroupAnnotations).forEach(entityLogEntries::add);
|
||||
processEntityLogEntries(dossier, entityLogEntries, addedLocalManualEntries, analysisNumber, allManualChanges, trackLocalChangesBasedOnDictEntriesMap);
|
||||
|
||||
adjustEntityLogEntriesAfterLocalChangesBasedOnDict(entityLogEntries, trackLocalChangesBasedOnDictEntriesMap, analysisNumber);
|
||||
}
|
||||
|
||||
|
||||
private Stream<EntityLogEntry> buildGroupRedactions(List<GroupRedactionEntity> unprocessedGroupRedactions) {
|
||||
private Stream<EntityLogEntry> buildGroupAnnotations(List<GroupAnnotationEntity> unprocessedGroupAnnotations) {
|
||||
|
||||
return unprocessedGroupRedactions.stream()
|
||||
.map(pendingGroupRedactionFactory::buildGroupRedactionEntry);
|
||||
return unprocessedGroupAnnotations.stream()
|
||||
.map(pendingGroupAnnotationFactory::buildGroupAnnotationEntry);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,11 +9,10 @@ import java.util.Map;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.DossierEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupRedactionEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupAnnotationEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.model.ManualChangesQueryOptions;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupRedactionPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.manualredactions.ManualRedactionProviderService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.group.GroupRedactionRepository;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.group.GroupAnnotationRepository;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLogEntry;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.FilteredEntityLogRequest;
|
||||
@ -38,7 +37,7 @@ public class EntityLogService {
|
||||
DossierService dossierService;
|
||||
CommentService commentService;
|
||||
EntityLogMergeService entityLogMergeService;
|
||||
GroupRedactionRepository groupRedactionRepository;
|
||||
GroupAnnotationRepository groupAnnotationRepository;
|
||||
|
||||
|
||||
@Observed(name = "EntityLogService", contextualName = "get-entity-log")
|
||||
@ -78,8 +77,8 @@ public class EntityLogService {
|
||||
if (includeUnprocessed) {
|
||||
DossierEntity dossier = dossierService.getDossierById(dossierId);
|
||||
ManualRedactions unprocessedManualRedactions = manualRedactionProviderService.getManualRedactions(fileId, ManualChangesQueryOptions.unprocessedOnly());
|
||||
List<GroupRedactionEntity> unprocessedGroupRedactions = groupRedactionRepository.findAllUnprocessedGroupRedactions(fileId);
|
||||
processedEntityLog = entityLogMergeService.mergeEntityLog(unprocessedManualRedactions, processedEntityLog, dossier, unprocessedGroupRedactions);
|
||||
List<GroupAnnotationEntity> unprocessedGroupAnnotations = groupAnnotationRepository.findAllUnprocessedGroupAnnotations(fileId);
|
||||
processedEntityLog = entityLogMergeService.mergeEntityLog(unprocessedManualRedactions, processedEntityLog, dossier, unprocessedGroupAnnotations);
|
||||
}
|
||||
|
||||
if (fileStatus.getExcludedPages() != null && !fileStatus.getExcludedPages().isEmpty()) {
|
||||
|
||||
@ -5,7 +5,7 @@ import org.springframework.retry.support.RetryTemplate;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.ConflictException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupRedactionService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupAnnotationService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.manualredactions.ManualRedactionService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.DossierPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
||||
@ -32,7 +32,7 @@ public class FileStatusProcessingUpdateService {
|
||||
private final ManualRedactionService manualRedactionService;
|
||||
private final FileManagementServiceSettings settings;
|
||||
private final FileStatusPersistenceService fileStatusPersistenceService;
|
||||
private final GroupRedactionService groupRedactionService;
|
||||
private final GroupAnnotationService groupAnnotationService;
|
||||
|
||||
|
||||
public void analysisSuccessful(String dossierId, String fileId, AnalyzeResult analyzeResult) {
|
||||
@ -54,7 +54,7 @@ public class FileStatusProcessingUpdateService {
|
||||
}
|
||||
|
||||
manualRedactionService.updateProcessedDate(analyzeResult.getManualRedactions());
|
||||
groupRedactionService.updateProcessedDate(analyzeResult.getGroupRedactions());
|
||||
groupAnnotationService.updateProcessedDate(analyzeResult.getGroupAnnotations());
|
||||
|
||||
if (analyzeResult.getAddedFileAttributes() != null && !analyzeResult.getAddedFileAttributes().isEmpty()) {
|
||||
fileStatusPersistenceService.addFileAttributes(dossierId, fileId, analyzeResult.getAddedFileAttributes());
|
||||
|
||||
@ -5,45 +5,45 @@ import java.util.List;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.AreaGroupEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupChangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupRedactionEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupAnnotationEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PageRangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PositionOnPageEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PropertyChangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.TextGroupEntity;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.PageRange;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupChange;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupPropertyChange;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.PositionOnPage;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupAnnotation;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
public class GroupRedactionMapper {
|
||||
public class GroupAnnotationMapper {
|
||||
|
||||
public static GroupRedaction toGroupRedaction(GroupRedactionEntity groupRedactionEntity) {
|
||||
public static GroupAnnotation toGroupAnnotation(GroupAnnotationEntity groupAnnotationEntity) {
|
||||
|
||||
if (groupRedactionEntity instanceof TextGroupEntity textGroupEntity) {
|
||||
return toTextGroupRedaction(textGroupEntity);
|
||||
} else if (groupRedactionEntity instanceof AreaGroupEntity areaGroupEntity) {
|
||||
return toAreaGroupRedaction(areaGroupEntity);
|
||||
if (groupAnnotationEntity instanceof TextGroupEntity textGroupEntity) {
|
||||
return toTextGroupAnnotation(textGroupEntity);
|
||||
} else if (groupAnnotationEntity instanceof AreaGroupEntity areaGroupEntity) {
|
||||
return toAreaGroupAnnotation(areaGroupEntity);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static AreaGroupRedaction toAreaGroupRedaction(AreaGroupEntity areaGroupEntity) {
|
||||
public static AreaGroupAnnotation toAreaGroupAnnotation(AreaGroupEntity areaGroupEntity) {
|
||||
|
||||
List<PageRange> pageRanges = new ArrayList<>();
|
||||
areaGroupEntity.getPageRanges()
|
||||
.forEach(pageRangeEntity -> pageRanges.add(toPageRange(pageRangeEntity)));
|
||||
|
||||
return AreaGroupRedaction.builder()
|
||||
.groupRedactionType(GroupRedactionType.AREA)
|
||||
return AreaGroupAnnotation.builder()
|
||||
.groupAnnotationType(GroupAnnotationType.AREA)
|
||||
.groupId(areaGroupEntity.getGroupId())
|
||||
.legalBasis(areaGroupEntity.getLegalBasis())
|
||||
.value(areaGroupEntity.getValue())
|
||||
@ -98,10 +98,10 @@ public class GroupRedactionMapper {
|
||||
}
|
||||
|
||||
|
||||
public static TextGroupRedaction toTextGroupRedaction(TextGroupEntity textGroupEntity) {
|
||||
public static TextGroupAnnotation toTextGroupAnnotation(TextGroupEntity textGroupEntity) {
|
||||
|
||||
return TextGroupRedaction.builder()
|
||||
.groupRedactionType(GroupRedactionType.TEXT)
|
||||
return TextGroupAnnotation.builder()
|
||||
.groupAnnotationType(GroupAnnotationType.TEXT)
|
||||
.groupId(textGroupEntity.getGroupId())
|
||||
.legalBasis(textGroupEntity.getLegalBasis())
|
||||
.value(textGroupEntity.getValue())
|
||||
@ -0,0 +1,179 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.service.group;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.AreaGroupEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupAnnotationEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PageRangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PositionOnPageEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.TextGroupEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.group.GroupAnnotationRepository;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.PageRange;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntryType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.PositionOnPage;
|
||||
import com.knecon.fforesight.keycloakcommons.security.KeycloakSecurity;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
|
||||
public class GroupAnnotationPersistenceService {
|
||||
|
||||
GroupAnnotationRepository groupAnnotationRepository;
|
||||
|
||||
|
||||
public TextGroupEntity addTextGroupEntity(String fileId, AddGroupAnnotationRequestModel addGroupAnnotationRequestModel) {
|
||||
|
||||
PositionOnPageEntity positionOnPageEntity = GroupAnnotationMapper.toPositionOnPageEntity(addGroupAnnotationRequestModel.getPositionOnPage());
|
||||
|
||||
TextGroupEntity textGroupEntity = TextGroupEntity.builder()
|
||||
.groupId(UUID.randomUUID().toString())
|
||||
.entryType(addGroupAnnotationRequestModel.getEntryType())
|
||||
.fileId(fileId)
|
||||
.legalBasis(addGroupAnnotationRequestModel.getLegalBasis())
|
||||
.typeId(addGroupAnnotationRequestModel.getType())
|
||||
.value(addGroupAnnotationRequestModel.getValue())
|
||||
.positionsOnPage(positionOnPageEntity)
|
||||
.requestDate(OffsetDateTime.now())
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.build();
|
||||
|
||||
positionOnPageEntity.setGroupAnnotation(textGroupEntity);
|
||||
|
||||
return groupAnnotationRepository.saveAndFlush(textGroupEntity);
|
||||
}
|
||||
|
||||
|
||||
public AreaGroupEntity addAreaGroupEntity(String fileId, AddAreaGroupAnnotationRequestModel addAreaGroupAnnotationRequestModel) {
|
||||
|
||||
PositionOnPageEntity positionOnPageEntity = GroupAnnotationMapper.toPositionOnPageEntity(addAreaGroupAnnotationRequestModel.getPositionOnPage());
|
||||
|
||||
AreaGroupEntity areaGroupEntity = AreaGroupEntity.builder()
|
||||
.groupId(UUID.randomUUID().toString())
|
||||
.entryType(addAreaGroupAnnotationRequestModel.getEntryType())
|
||||
.fileId(fileId)
|
||||
.legalBasis(addAreaGroupAnnotationRequestModel.getLegalBasis())
|
||||
.typeId(addAreaGroupAnnotationRequestModel.getType())
|
||||
.value(addAreaGroupAnnotationRequestModel.getValue())
|
||||
.positionsOnPage(positionOnPageEntity)
|
||||
.requestDate(OffsetDateTime.now())
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.section(addAreaGroupAnnotationRequestModel.getSection())
|
||||
.build();
|
||||
|
||||
|
||||
positionOnPageEntity.setGroupAnnotation(areaGroupEntity);
|
||||
|
||||
List<PageRangeEntity> pageRanges = new ArrayList<>();
|
||||
addAreaGroupAnnotationRequestModel.getPageRanges().forEach(pageRange -> {
|
||||
PageRangeEntity pageRangeEntity = GroupAnnotationMapper.toPageRangeEntity(pageRange);
|
||||
pageRangeEntity.setAreaGroup(areaGroupEntity);
|
||||
pageRanges.add(pageRangeEntity);
|
||||
});
|
||||
|
||||
areaGroupEntity.setPageRanges(pageRanges);
|
||||
|
||||
return groupAnnotationRepository.saveAndFlush(areaGroupEntity);
|
||||
}
|
||||
|
||||
|
||||
public List<GroupAnnotationEntity> findAllGroupEntitiesForFile(String fileId, boolean includeSoftDeleted) {
|
||||
|
||||
if (includeSoftDeleted) {
|
||||
return groupAnnotationRepository.findAllByFileId(fileId);
|
||||
}
|
||||
else {
|
||||
return groupAnnotationRepository.findAllByFileIdAndNotSoftDeleted(fileId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public GroupAnnotationEntity findGroupAnnotation(String groupId) {
|
||||
|
||||
return groupAnnotationRepository.findById(groupId)
|
||||
.orElseThrow(() -> new NotFoundException(String.format("Group annotation with id %s not found.", groupId)));
|
||||
}
|
||||
|
||||
|
||||
public void markAsProcessed(String groupId) {
|
||||
|
||||
groupAnnotationRepository.markAsProcessed(groupId, OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
|
||||
}
|
||||
|
||||
|
||||
public GroupAnnotationEntity updateLegalBasis(GroupAnnotationEntity groupAnnotation, String legalBasis) {
|
||||
|
||||
groupAnnotation.setLegalBasis(legalBasis);
|
||||
return groupAnnotationRepository.saveAndFlush(groupAnnotation);
|
||||
}
|
||||
|
||||
|
||||
public GroupAnnotationEntity forceGroupAnnotation(GroupAnnotationEntity groupAnnotation) {
|
||||
|
||||
groupAnnotation.setEntryType(EntryType.ENTITY);
|
||||
return groupAnnotationRepository.saveAndFlush(groupAnnotation);
|
||||
}
|
||||
|
||||
|
||||
public GroupAnnotationEntity recategorizeGroupAnnotation(GroupAnnotationEntity groupAnnotation, String typeId) {
|
||||
|
||||
groupAnnotation.setTypeId(typeId);
|
||||
return groupAnnotationRepository.saveAndFlush(groupAnnotation);
|
||||
}
|
||||
|
||||
|
||||
public AreaGroupEntity resizeAreaGroupAnnotation(AreaGroupEntity areaGroupEntity, PositionOnPage positionOnPage) {
|
||||
|
||||
PositionOnPageEntity positionEntity = GroupAnnotationMapper.toPositionOnPageEntity(positionOnPage);
|
||||
positionEntity.setGroupAnnotation(areaGroupEntity);
|
||||
areaGroupEntity.setPositionsOnPage(positionEntity);
|
||||
|
||||
return groupAnnotationRepository.saveAndFlush(areaGroupEntity);
|
||||
}
|
||||
|
||||
|
||||
public AreaGroupEntity changeValueAreaGroupAnnotation(AreaGroupEntity areaGroupEntity, String value) {
|
||||
|
||||
areaGroupEntity.setValue(value);
|
||||
return groupAnnotationRepository.saveAndFlush(areaGroupEntity);
|
||||
}
|
||||
|
||||
|
||||
public AreaGroupEntity changePageRangesAreaGroupAnnotation(AreaGroupEntity areaGroupEntity, List<PageRange> pageRanges) {
|
||||
|
||||
List<PageRangeEntity> existingPageRanges = areaGroupEntity.getPageRanges();
|
||||
existingPageRanges.clear();
|
||||
|
||||
pageRanges.forEach(pageRange -> {
|
||||
PageRangeEntity pageRangeEntity = GroupAnnotationMapper.toPageRangeEntity(pageRange);
|
||||
pageRangeEntity.setAreaGroup(areaGroupEntity);
|
||||
existingPageRanges.add(pageRangeEntity);
|
||||
});
|
||||
|
||||
areaGroupEntity.setPageRanges(existingPageRanges);
|
||||
return groupAnnotationRepository.saveAndFlush(areaGroupEntity);
|
||||
}
|
||||
|
||||
|
||||
public GroupAnnotationEntity removeGroupAnnotation(GroupAnnotationEntity groupAnnotation) {
|
||||
|
||||
groupAnnotation.setSoftDeletedTime(OffsetDateTime.now());
|
||||
return groupAnnotationRepository.saveAndFlush(groupAnnotation);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,438 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.service.group;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.AreaGroupEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupAnnotationEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupChangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PageRangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PositionOnPageEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PropertyChangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.TextGroupEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.BadRequestException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.FileStatusService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddTextGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangePageRangeAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangeValueAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupChange;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupChangeType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.RecategorizeGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ResizeAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupAnnotation;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.UpdateLegalBasisRequestModel;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
|
||||
public class GroupAnnotationService {
|
||||
|
||||
GroupAnnotationPersistenceService groupAnnotationPersistenceService;
|
||||
GroupChangePersistenceService groupChangePersistenceService;
|
||||
FileStatusPersistenceService fileStatusPersistenceService;
|
||||
FileStatusService fileStatusService;
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupAnnotationResponse addTextGroupAnnotation(String dossierId, String fileId, List<AddTextGroupAnnotationRequestModel> addTextGroupAnnotationRequestModels) {
|
||||
|
||||
List<GroupAnnotation> groupAnnotations = new ArrayList<>();
|
||||
|
||||
addTextGroupAnnotationRequestModels.forEach(addTextGroupAnnotationRequestModel -> {
|
||||
validateAddTextGroupRequest(addTextGroupAnnotationRequestModel);
|
||||
TextGroupEntity textGroupEntity = groupAnnotationPersistenceService.addTextGroupEntity(fileId, addTextGroupAnnotationRequestModel);
|
||||
GroupAnnotation groupAnnotation = GroupAnnotationMapper.toGroupAnnotation(textGroupEntity);
|
||||
groupAnnotations.add(groupAnnotation);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupAnnotationResponse.builder().groupAnnotations(groupAnnotations).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupAnnotationResponse addAreaGroupAnnotation(String dossierId, String fileId, List<AddAreaGroupAnnotationRequestModel> addAreaGroupAnnotationRequestModels) {
|
||||
|
||||
List<GroupAnnotation> groupAnnotations = new ArrayList<>();
|
||||
|
||||
addAreaGroupAnnotationRequestModels.forEach(areaGroupAnnotationRequestModel -> {
|
||||
validateAddAreaGroupAnnotationRequest(areaGroupAnnotationRequestModel);
|
||||
AreaGroupEntity areaGroupEntity = groupAnnotationPersistenceService.addAreaGroupEntity(fileId, areaGroupAnnotationRequestModel);
|
||||
AreaGroupAnnotation areaGroupAnnotation = GroupAnnotationMapper.toAreaGroupAnnotation(areaGroupEntity);
|
||||
groupAnnotations.add(areaGroupAnnotation);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupAnnotationResponse.builder().groupAnnotations(groupAnnotations).build();
|
||||
}
|
||||
|
||||
|
||||
private void validateAddAreaGroupAnnotationRequest(AddAreaGroupAnnotationRequestModel addAreaGroupAnnotationRequestModel) {
|
||||
|
||||
if (!addAreaGroupAnnotationRequestModel.getGroupAnnotationType().equals(GroupAnnotationType.AREA)) {
|
||||
throw new BadRequestException("Area group annotation needs group annotation type to be AREA!");
|
||||
}
|
||||
|
||||
if (addAreaGroupAnnotationRequestModel.getPositionOnPage() == null) {
|
||||
throw new BadRequestException("Area group annotation requires positions on page!");
|
||||
}
|
||||
|
||||
if (addAreaGroupAnnotationRequestModel.getValue().length() > 4000) {
|
||||
throw new BadRequestException("Group annotation value can not exceed 4000 characters!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void validateAddTextGroupRequest(AddTextGroupAnnotationRequestModel addTextGroupAnnotationRequestModel) {
|
||||
|
||||
if (!addTextGroupAnnotationRequestModel.getGroupAnnotationType().equals(GroupAnnotationType.TEXT)) {
|
||||
throw new BadRequestException("Text group annotation needs group annotation type to be TEXT!");
|
||||
}
|
||||
|
||||
if (addTextGroupAnnotationRequestModel.getValue().length() > 4000) {
|
||||
throw new BadRequestException("Group annotation value can not exceed 4000 characters!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void reprocess(String dossierId, String fileId) {
|
||||
|
||||
fileStatusService.setStatusReprocessForManual(dossierId, fileId, true);
|
||||
}
|
||||
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public GroupAnnotationResponse getAllGroupAnnotations(String fileId, boolean includeSoftDeleted) {
|
||||
|
||||
GroupAnnotationResponse groupAnnotationResponse = new GroupAnnotationResponse();
|
||||
List<GroupAnnotationEntity> groupAnnotationEntities = groupAnnotationPersistenceService.findAllGroupEntitiesForFile(fileId, includeSoftDeleted);
|
||||
groupAnnotationResponse.setGroupAnnotations(groupAnnotationEntities.stream()
|
||||
.map(GroupAnnotationMapper::toGroupAnnotation)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
return groupAnnotationResponse;
|
||||
}
|
||||
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public GroupAnnotationInternalResponse getAllGroupAnnotationsInternal(String fileId, boolean includeSoftDeleted) {
|
||||
|
||||
List<TextGroupAnnotation> textGroupAnnotations = new ArrayList<>();
|
||||
List<AreaGroupAnnotation> areaGroupAnnotations = new ArrayList<>();
|
||||
List<GroupAnnotationEntity> groupAnnotationEntities = groupAnnotationPersistenceService.findAllGroupEntitiesForFile(fileId, includeSoftDeleted);
|
||||
groupAnnotationEntities.forEach(groupAnnotation -> {
|
||||
if (groupAnnotation instanceof TextGroupEntity textGroupEntity) {
|
||||
textGroupAnnotations.add(GroupAnnotationMapper.toTextGroupAnnotation(textGroupEntity));
|
||||
} else if (groupAnnotation instanceof AreaGroupEntity areaGroupEntity) {
|
||||
areaGroupAnnotations.add(GroupAnnotationMapper.toAreaGroupAnnotation(areaGroupEntity));
|
||||
}
|
||||
});
|
||||
|
||||
return GroupAnnotationInternalResponse.builder().areaGroupAnnotations(areaGroupAnnotations).textGroupAnnotations(textGroupAnnotations).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public GroupAnnotation getGroupAnnotation(String groupId) {
|
||||
|
||||
GroupAnnotationEntity groupAnnotation = groupAnnotationPersistenceService.findGroupAnnotation(groupId);
|
||||
return GroupAnnotationMapper.toGroupAnnotation(groupAnnotation);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void updateProcessedDate(Set<GroupAnnotation> groupAnnotations) {
|
||||
|
||||
if (groupAnnotations != null) {
|
||||
groupAnnotations.forEach(groupAnnotation -> {
|
||||
if (groupAnnotation.getProcessedDate() == null || groupAnnotation.getGroupChanges()
|
||||
.stream()
|
||||
.anyMatch(change -> change.getChangeDate().isAfter(groupAnnotation.getProcessedDate()))) {
|
||||
groupAnnotationPersistenceService.markAsProcessed(groupAnnotation.getGroupId());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupAnnotationResponse updateLegalBasis(String dossierId, String fileId, List<UpdateLegalBasisRequestModel> updateLegalBasisRequestModels) {
|
||||
|
||||
List<GroupAnnotation> groupAnnotations = new ArrayList<>();
|
||||
|
||||
updateLegalBasisRequestModels.forEach(updateLegalBasisRequestModel -> {
|
||||
GroupAnnotationEntity oldGroupEntity = groupAnnotationPersistenceService.findGroupAnnotation(updateLegalBasisRequestModel.getGroupId());
|
||||
String oldLegalBasis = oldGroupEntity.getLegalBasis();
|
||||
GroupAnnotationEntity newGroupEntity = groupAnnotationPersistenceService.updateLegalBasis(oldGroupEntity, updateLegalBasisRequestModel.getLegalBasis());
|
||||
GroupAnnotation groupAnnotation = GroupAnnotationMapper.toGroupAnnotation(newGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("legalBasis")
|
||||
.propertyOldValue(oldLegalBasis)
|
||||
.propertyNewValue(newGroupEntity.getLegalBasis())
|
||||
.build());
|
||||
addChange(newGroupEntity, GroupChangeType.LEGAL_BASIS_CHANGE, propertyChangeEntities, groupAnnotation);
|
||||
groupAnnotations.add(groupAnnotation);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupAnnotationResponse.builder().groupAnnotations(groupAnnotations).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupAnnotationResponse recategorizeGroupAnnotation(String dossierId, String fileId, List<RecategorizeGroupAnnotationRequestModel> groupAnnotationRequestModels) {
|
||||
|
||||
List<GroupAnnotation> groupAnnotations = new ArrayList<>();
|
||||
|
||||
groupAnnotationRequestModels.forEach(groupAnnotationRequestModel -> {
|
||||
GroupAnnotationEntity oldGroupEntity = groupAnnotationPersistenceService.findGroupAnnotation(groupAnnotationRequestModel.getGroupId());
|
||||
String oldType = oldGroupEntity.getTypeId();
|
||||
GroupAnnotationEntity newGroupEntity = groupAnnotationPersistenceService.recategorizeGroupAnnotation(oldGroupEntity, groupAnnotationRequestModel.getTypeId());
|
||||
GroupAnnotation groupAnnotation = GroupAnnotationMapper.toGroupAnnotation(newGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder().propertyName("type_id").propertyOldValue(oldType).propertyNewValue(newGroupEntity.getTypeId()).build());
|
||||
addChange(newGroupEntity, GroupChangeType.RECATEGORIZE, propertyChangeEntities, groupAnnotation);
|
||||
groupAnnotations.add(groupAnnotation);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupAnnotationResponse.builder().groupAnnotations(groupAnnotations).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupAnnotationResponse forceGroupAnnotation(String dossierId, String fileId, List<GroupAnnotationRequestModel> groupAnnotationRequestModels) {
|
||||
|
||||
List<GroupAnnotation> groupAnnotations = new ArrayList<>();
|
||||
|
||||
groupAnnotationRequestModels.forEach(groupAnnotationRequestModel -> {
|
||||
GroupAnnotationEntity oldGroupEntity = groupAnnotationPersistenceService.findGroupAnnotation(groupAnnotationRequestModel.getGroupId());
|
||||
String oldEntryType = oldGroupEntity.getEntryType().name();
|
||||
GroupAnnotationEntity newGroupEntity = groupAnnotationPersistenceService.forceGroupAnnotation(oldGroupEntity);
|
||||
GroupAnnotation groupAnnotation = GroupAnnotationMapper.toGroupAnnotation(newGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("entryType")
|
||||
.propertyOldValue(oldEntryType)
|
||||
.propertyNewValue(newGroupEntity.getEntryType().name())
|
||||
.build());
|
||||
addChange(newGroupEntity, GroupChangeType.FORCE, propertyChangeEntities, groupAnnotation);
|
||||
groupAnnotations.add(groupAnnotation);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupAnnotationResponse.builder().groupAnnotations(groupAnnotations).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupAnnotationResponse resizeAreaGroupAnnotation(String dossierId, String fileId, List<ResizeAreaGroupAnnotationRequestModel> areaGroupAnnotationRequestModels) {
|
||||
|
||||
List<GroupAnnotation> groupAnnotations = new ArrayList<>();
|
||||
|
||||
areaGroupAnnotationRequestModels.forEach(resizeAreaGroupAnnotationRequestModel -> {
|
||||
GroupAnnotationEntity oldGroupEntity = groupAnnotationPersistenceService.findGroupAnnotation(resizeAreaGroupAnnotationRequestModel.getGroupId());
|
||||
if (oldGroupEntity instanceof AreaGroupEntity oldAreaGroupEntity) {
|
||||
PositionOnPageEntity oldPositionOnPage = oldAreaGroupEntity.getPositionsOnPage();
|
||||
AreaGroupEntity newAreaGroupEntity = groupAnnotationPersistenceService.resizeAreaGroupAnnotation(oldAreaGroupEntity,
|
||||
resizeAreaGroupAnnotationRequestModel.getPositionOnPage());
|
||||
GroupAnnotation groupAnnotation = GroupAnnotationMapper.toAreaGroupAnnotation(newAreaGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("positions")
|
||||
.propertyOldValue(buildPositionOnPageString(oldPositionOnPage))
|
||||
.propertyNewValue(buildPositionOnPageString(newAreaGroupEntity.getPositionsOnPage()))
|
||||
.build());
|
||||
addChange(newAreaGroupEntity, GroupChangeType.RESIZE, propertyChangeEntities, groupAnnotation);
|
||||
groupAnnotations.add(groupAnnotation);
|
||||
} else {
|
||||
throw new BadRequestException("Can not resize TEXT group annotations!");
|
||||
}
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupAnnotationResponse.builder().groupAnnotations(groupAnnotations).build();
|
||||
}
|
||||
|
||||
|
||||
private String buildPositionOnPageString(PositionOnPageEntity positionOnPageEntity) {
|
||||
|
||||
return "["
|
||||
+ positionOnPageEntity.getX()
|
||||
+ ", "
|
||||
+ positionOnPageEntity.getY()
|
||||
+ ", "
|
||||
+ positionOnPageEntity.getWidth()
|
||||
+ ", "
|
||||
+ positionOnPageEntity.getHeight()
|
||||
+ ", "
|
||||
+ positionOnPageEntity.getPageNumber()
|
||||
+ "]";
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupAnnotationResponse removeGroupAnnotation(String dossierId, String fileId, List<GroupAnnotationRequestModel> groupAnnotationRequestModels) {
|
||||
|
||||
List<GroupAnnotation> groupAnnotations = new ArrayList<>();
|
||||
|
||||
groupAnnotationRequestModels.forEach(groupAnnotationRequestModel -> {
|
||||
GroupAnnotationEntity oldGroupEntity = groupAnnotationPersistenceService.findGroupAnnotation(groupAnnotationRequestModel.getGroupId());
|
||||
GroupAnnotationEntity newGroupEntity = groupAnnotationPersistenceService.removeGroupAnnotation(oldGroupEntity);
|
||||
GroupAnnotation groupAnnotation = GroupAnnotationMapper.toGroupAnnotation(newGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("softDeletedTime")
|
||||
.propertyOldValue(null)
|
||||
.propertyNewValue(newGroupEntity.getSoftDeletedTime().toString())
|
||||
.build());
|
||||
addChange(newGroupEntity, GroupChangeType.REMOVE, propertyChangeEntities, groupAnnotation);
|
||||
groupAnnotations.add(groupAnnotation);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupAnnotationResponse.builder().groupAnnotations(groupAnnotations).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupAnnotationResponse changeValueGroupAnnotation(String dossierId, String fileId, List<ChangeValueAreaGroupAnnotationRequestModel> annotationRequestModels) {
|
||||
|
||||
List<GroupAnnotation> groupAnnotations = new ArrayList<>();
|
||||
|
||||
annotationRequestModels.forEach(changeValueAreaGroupAnnotationRequestModel -> {
|
||||
GroupAnnotationEntity oldGroupEntity = groupAnnotationPersistenceService.findGroupAnnotation(changeValueAreaGroupAnnotationRequestModel.getGroupId());
|
||||
if (oldGroupEntity instanceof AreaGroupEntity oldAreaGroupEntity) {
|
||||
String oldValue = oldAreaGroupEntity.getValue();
|
||||
AreaGroupEntity newAreaGroupEntity = groupAnnotationPersistenceService.changeValueAreaGroupAnnotation(oldAreaGroupEntity,
|
||||
changeValueAreaGroupAnnotationRequestModel.getValue());
|
||||
GroupAnnotation groupAnnotation = GroupAnnotationMapper.toAreaGroupAnnotation(newAreaGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder().propertyName("value").propertyOldValue(oldValue).propertyNewValue(newAreaGroupEntity.getValue()).build());
|
||||
addChange(newAreaGroupEntity, GroupChangeType.VALUE_CHANGE, propertyChangeEntities, groupAnnotation);
|
||||
groupAnnotations.add(groupAnnotation);
|
||||
} else {
|
||||
throw new BadRequestException("Can not change value for TEXT group annotations!");
|
||||
}
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupAnnotationResponse.builder().groupAnnotations(groupAnnotations).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupAnnotationResponse changePageRangesGroupAnnotation(String dossierId,
|
||||
String fileId,
|
||||
List<ChangePageRangeAreaGroupAnnotationRequestModel> changePageRangeAreaGroupAnnotationRequestModels) {
|
||||
|
||||
List<GroupAnnotation> groupAnnotations = new ArrayList<>();
|
||||
|
||||
changePageRangeAreaGroupAnnotationRequestModels.forEach(changePageRangeAreaGroupAnnotationRequestModel -> {
|
||||
GroupAnnotationEntity oldGroupEntity = groupAnnotationPersistenceService.findGroupAnnotation(changePageRangeAreaGroupAnnotationRequestModel.getGroupId());
|
||||
if (oldGroupEntity instanceof AreaGroupEntity oldAreaGroupEntity) {
|
||||
List<PageRangeEntity> oldPageRanges = oldAreaGroupEntity.getPageRanges();
|
||||
validateChangePageRangeRequest(changePageRangeAreaGroupAnnotationRequestModel);
|
||||
AreaGroupEntity newAreaGroupEntity = groupAnnotationPersistenceService.changePageRangesAreaGroupAnnotation(oldAreaGroupEntity,
|
||||
changePageRangeAreaGroupAnnotationRequestModel.getPageRanges());
|
||||
AreaGroupAnnotation groupareaGroupAnnotation = GroupAnnotationMapper.toAreaGroupAnnotation(newAreaGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("pageRanges")
|
||||
.propertyOldValue(buildPageRangeString(oldPageRanges))
|
||||
.propertyNewValue(buildPageRangeString(newAreaGroupEntity.getPageRanges()))
|
||||
.build());
|
||||
addChange(newAreaGroupEntity, GroupChangeType.PAGE_RANGE_CHANGE, propertyChangeEntities, groupareaGroupAnnotation);
|
||||
groupAnnotations.add(groupareaGroupAnnotation);
|
||||
} else {
|
||||
throw new BadRequestException("Can not change page range for TEXT group annotations!");
|
||||
}
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupAnnotationResponse.builder().groupAnnotations(groupAnnotations).build();
|
||||
}
|
||||
|
||||
|
||||
private String buildPageRangeString(List<PageRangeEntity> pageRangeEntities) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int pageRangeSize = pageRangeEntities.size();
|
||||
if (pageRangeSize > 1) {
|
||||
sb.append("[");
|
||||
}
|
||||
pageRangeEntities.forEach(pageRangeEntity -> {
|
||||
sb.append("[");
|
||||
sb.append(pageRangeEntity.getStartPage());
|
||||
sb.append(", ");
|
||||
sb.append(pageRangeEntity.getEndPage());
|
||||
sb.append("]");
|
||||
});
|
||||
if (pageRangeSize > 1) {
|
||||
sb.append("[");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
private void validateChangePageRangeRequest(ChangePageRangeAreaGroupAnnotationRequestModel changePageRangeAreaGroupAnnotationRequestModel) {
|
||||
|
||||
if (changePageRangeAreaGroupAnnotationRequestModel.getPageRanges()
|
||||
.stream()
|
||||
.anyMatch(pageRange -> pageRange.getStartPage() > pageRange.getEndPage())) {
|
||||
throw new BadRequestException("Page range start can not be higher than page range end!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
private void addChange(GroupAnnotationEntity groupAnnotationEntity,
|
||||
GroupChangeType groupChangeType,
|
||||
List<PropertyChangeEntity> propertyChangeEntities,
|
||||
GroupAnnotation groupAnnotation) {
|
||||
|
||||
GroupChangeEntity groupChangeEntity = groupChangePersistenceService.addGroupChange(groupChangeType, groupAnnotationEntity, propertyChangeEntities);
|
||||
List<GroupChange> groupChanges = GroupAnnotationMapper.toGroupChanges(List.of(groupChangeEntity));
|
||||
groupAnnotation.getGroupChanges().addAll(groupChanges);
|
||||
}
|
||||
|
||||
}
|
||||
@ -7,7 +7,7 @@ import java.util.UUID;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupChangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupRedactionEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupAnnotationEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PropertyChangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.group.GroupChangeRepository;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupChangeType;
|
||||
@ -27,14 +27,14 @@ public class GroupChangePersistenceService {
|
||||
GroupChangeRepository groupChangeRepository;
|
||||
|
||||
|
||||
public GroupChangeEntity addGroupChange(GroupChangeType changeType, GroupRedactionEntity groupRedaction, List<PropertyChangeEntity> propertyChangeEntities) {
|
||||
public GroupChangeEntity addGroupChange(GroupChangeType changeType, GroupAnnotationEntity groupAnnotation, List<PropertyChangeEntity> propertyChangeEntities) {
|
||||
|
||||
GroupChangeEntity groupChange = GroupChangeEntity.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.changeDate(OffsetDateTime.now())
|
||||
.changeId(UUID.randomUUID().toString())
|
||||
.changeType(changeType)
|
||||
.group(groupRedaction)
|
||||
.group(groupAnnotation)
|
||||
.build();
|
||||
|
||||
List<PropertyChangeEntity> initializedPropertyChanges = propertyChangeEntities.stream().peek(propertyChange -> {
|
||||
|
||||
@ -1,179 +0,0 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.service.group;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.AreaGroupEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupRedactionEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PageRangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PositionOnPageEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.TextGroupEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.group.GroupRedactionRepository;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.PageRange;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntryType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.PositionOnPage;
|
||||
import com.knecon.fforesight.keycloakcommons.security.KeycloakSecurity;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
|
||||
public class GroupRedactionPersistenceService {
|
||||
|
||||
GroupRedactionRepository groupRedactionRepository;
|
||||
|
||||
|
||||
public TextGroupEntity addTextGroupEntity(String fileId, AddGroupRedactionRequestModel addGroupRedactionRequestModel) {
|
||||
|
||||
PositionOnPageEntity positionOnPageEntity = GroupRedactionMapper.toPositionOnPageEntity(addGroupRedactionRequestModel.getPositionOnPage());
|
||||
|
||||
TextGroupEntity textGroupEntity = TextGroupEntity.builder()
|
||||
.groupId(UUID.randomUUID().toString())
|
||||
.entryType(addGroupRedactionRequestModel.getEntryType())
|
||||
.fileId(fileId)
|
||||
.legalBasis(addGroupRedactionRequestModel.getLegalBasis())
|
||||
.typeId(addGroupRedactionRequestModel.getType())
|
||||
.value(addGroupRedactionRequestModel.getValue())
|
||||
.positionsOnPage(positionOnPageEntity)
|
||||
.requestDate(OffsetDateTime.now())
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.build();
|
||||
|
||||
positionOnPageEntity.setGroupRedaction(textGroupEntity);
|
||||
|
||||
return groupRedactionRepository.saveAndFlush(textGroupEntity);
|
||||
}
|
||||
|
||||
|
||||
public AreaGroupEntity addAreaGroupEntity(String fileId, AddAreaGroupRedactionRequestModel addAreaGroupRedactionRequestModel) {
|
||||
|
||||
PositionOnPageEntity positionOnPageEntity = GroupRedactionMapper.toPositionOnPageEntity(addAreaGroupRedactionRequestModel.getPositionOnPage());
|
||||
|
||||
AreaGroupEntity areaGroupEntity = AreaGroupEntity.builder()
|
||||
.groupId(UUID.randomUUID().toString())
|
||||
.entryType(addAreaGroupRedactionRequestModel.getEntryType())
|
||||
.fileId(fileId)
|
||||
.legalBasis(addAreaGroupRedactionRequestModel.getLegalBasis())
|
||||
.typeId(addAreaGroupRedactionRequestModel.getType())
|
||||
.value(addAreaGroupRedactionRequestModel.getValue())
|
||||
.positionsOnPage(positionOnPageEntity)
|
||||
.requestDate(OffsetDateTime.now())
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.section(addAreaGroupRedactionRequestModel.getSection())
|
||||
.build();
|
||||
|
||||
|
||||
positionOnPageEntity.setGroupRedaction(areaGroupEntity);
|
||||
|
||||
List<PageRangeEntity> pageRanges = new ArrayList<>();
|
||||
addAreaGroupRedactionRequestModel.getPageRanges().forEach(pageRange -> {
|
||||
PageRangeEntity pageRangeEntity = GroupRedactionMapper.toPageRangeEntity(pageRange);
|
||||
pageRangeEntity.setAreaGroup(areaGroupEntity);
|
||||
pageRanges.add(pageRangeEntity);
|
||||
});
|
||||
|
||||
areaGroupEntity.setPageRanges(pageRanges);
|
||||
|
||||
return groupRedactionRepository.saveAndFlush(areaGroupEntity);
|
||||
}
|
||||
|
||||
|
||||
public List<GroupRedactionEntity> findAllGroupEntitiesForFile(String fileId, boolean includeSoftDeleted) {
|
||||
|
||||
if (includeSoftDeleted) {
|
||||
return groupRedactionRepository.findAllByFileId(fileId);
|
||||
}
|
||||
else {
|
||||
return groupRedactionRepository.findAllByFileIdAndNotSoftDeleted(fileId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public GroupRedactionEntity findGroupRedaction(String groupId) {
|
||||
|
||||
return groupRedactionRepository.findById(groupId)
|
||||
.orElseThrow(() -> new NotFoundException(String.format("Group redaction with id %s not found.", groupId)));
|
||||
}
|
||||
|
||||
|
||||
public void markAsProcessed(String groupId) {
|
||||
|
||||
groupRedactionRepository.markAsProcessed(groupId, OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
|
||||
}
|
||||
|
||||
|
||||
public GroupRedactionEntity updateLegalBasis(GroupRedactionEntity groupRedaction, String legalBasis) {
|
||||
|
||||
groupRedaction.setLegalBasis(legalBasis);
|
||||
return groupRedactionRepository.saveAndFlush(groupRedaction);
|
||||
}
|
||||
|
||||
|
||||
public GroupRedactionEntity forceGroupRedaction(GroupRedactionEntity groupRedaction) {
|
||||
|
||||
groupRedaction.setEntryType(EntryType.ENTITY);
|
||||
return groupRedactionRepository.saveAndFlush(groupRedaction);
|
||||
}
|
||||
|
||||
|
||||
public GroupRedactionEntity recategorizeGroupRedaction(GroupRedactionEntity groupRedaction, String typeId) {
|
||||
|
||||
groupRedaction.setTypeId(typeId);
|
||||
return groupRedactionRepository.saveAndFlush(groupRedaction);
|
||||
}
|
||||
|
||||
|
||||
public AreaGroupEntity resizeAreaGroupRedaction(AreaGroupEntity areaGroupEntity, PositionOnPage positionOnPage) {
|
||||
|
||||
PositionOnPageEntity positionEntity = GroupRedactionMapper.toPositionOnPageEntity(positionOnPage);
|
||||
positionEntity.setGroupRedaction(areaGroupEntity);
|
||||
areaGroupEntity.setPositionsOnPage(positionEntity);
|
||||
|
||||
return groupRedactionRepository.saveAndFlush(areaGroupEntity);
|
||||
}
|
||||
|
||||
|
||||
public AreaGroupEntity changeValueAreaGroupRedaction(AreaGroupEntity areaGroupEntity, String value) {
|
||||
|
||||
areaGroupEntity.setValue(value);
|
||||
return groupRedactionRepository.saveAndFlush(areaGroupEntity);
|
||||
}
|
||||
|
||||
|
||||
public AreaGroupEntity changePageRangesAreaGroupRedaction(AreaGroupEntity areaGroupEntity, List<PageRange> pageRanges) {
|
||||
|
||||
List<PageRangeEntity> existingPageRanges = areaGroupEntity.getPageRanges();
|
||||
existingPageRanges.clear();
|
||||
|
||||
pageRanges.forEach(pageRange -> {
|
||||
PageRangeEntity pageRangeEntity = GroupRedactionMapper.toPageRangeEntity(pageRange);
|
||||
pageRangeEntity.setAreaGroup(areaGroupEntity);
|
||||
existingPageRanges.add(pageRangeEntity);
|
||||
});
|
||||
|
||||
areaGroupEntity.setPageRanges(existingPageRanges);
|
||||
return groupRedactionRepository.saveAndFlush(areaGroupEntity);
|
||||
}
|
||||
|
||||
|
||||
public GroupRedactionEntity removeGroupRedaction(GroupRedactionEntity groupRedaction) {
|
||||
|
||||
groupRedaction.setSoftDeletedTime(OffsetDateTime.now());
|
||||
return groupRedactionRepository.saveAndFlush(groupRedaction);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,442 +0,0 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.service.group;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.AreaGroupEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupChangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupRedactionEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PageRangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PositionOnPageEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PropertyChangeEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.TextGroupEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.BadRequestException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.FileStatusService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddTextGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AreaGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangePageRangeAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangeValueAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupChange;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupChangeType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionInternalResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionResponse;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.RecategorizeGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ResizeAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.TextGroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.UpdateLegalBasisRequestModel;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
|
||||
public class GroupRedactionService {
|
||||
|
||||
GroupRedactionPersistenceService groupRedactionPersistenceService;
|
||||
GroupChangePersistenceService groupChangePersistenceService;
|
||||
FileStatusPersistenceService fileStatusPersistenceService;
|
||||
FileStatusService fileStatusService;
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupRedactionResponse addTextGroupRedaction(String dossierId, String fileId, List<AddTextGroupRedactionRequestModel> addRedactionRequests) {
|
||||
|
||||
List<GroupRedaction> groupRedactions = new ArrayList<>();
|
||||
|
||||
addRedactionRequests.forEach(addGroupRedactionRequestModel -> {
|
||||
validateAddTextGroupRequest(addGroupRedactionRequestModel);
|
||||
TextGroupEntity textGroupEntity = groupRedactionPersistenceService.addTextGroupEntity(fileId, addGroupRedactionRequestModel);
|
||||
GroupRedaction groupRedaction = GroupRedactionMapper.toGroupRedaction(textGroupEntity);
|
||||
groupRedactions.add(groupRedaction);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupRedactionResponse.builder().groupRedactions(groupRedactions).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupRedactionResponse addAreaGroupRedaction(String dossierId, String fileId, List<AddAreaGroupRedactionRequestModel> addRedactionRequests) {
|
||||
|
||||
List<GroupRedaction> groupRedactions = new ArrayList<>();
|
||||
|
||||
addRedactionRequests.forEach(addGroupRedactionRequestModel -> {
|
||||
validateAddAreaGroupRedactionRequest(addGroupRedactionRequestModel);
|
||||
AreaGroupEntity areaGroupEntity = groupRedactionPersistenceService.addAreaGroupEntity(fileId, addGroupRedactionRequestModel);
|
||||
AreaGroupRedaction areaGroupRedaction = GroupRedactionMapper.toAreaGroupRedaction(areaGroupEntity);
|
||||
groupRedactions.add(areaGroupRedaction);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupRedactionResponse.builder().groupRedactions(groupRedactions).build();
|
||||
}
|
||||
|
||||
|
||||
private void validateAddAreaGroupRedactionRequest(AddAreaGroupRedactionRequestModel addAreaGroupRedactionRequestModel) {
|
||||
|
||||
if (!addAreaGroupRedactionRequestModel.getGroupRedactionType().equals(GroupRedactionType.AREA)) {
|
||||
throw new BadRequestException("Area group redaction needs group redaction type to be AREA!");
|
||||
}
|
||||
|
||||
if (addAreaGroupRedactionRequestModel.getPositionOnPage() == null) {
|
||||
throw new BadRequestException("Area group redaction requires positions on page!");
|
||||
}
|
||||
|
||||
if (addAreaGroupRedactionRequestModel.getValue().length() > 4000) {
|
||||
throw new BadRequestException("Group redaction value can not exceed 4000 characters!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void validateAddTextGroupRequest(AddTextGroupRedactionRequestModel addTextGroupRedactionRequestModel) {
|
||||
|
||||
if (!addTextGroupRedactionRequestModel.getGroupRedactionType().equals(GroupRedactionType.TEXT)) {
|
||||
throw new BadRequestException("Text group redaction needs group redaction type to be TEXT!");
|
||||
}
|
||||
|
||||
if (addTextGroupRedactionRequestModel.getValue().length() > 4000) {
|
||||
throw new BadRequestException("Group redaction value can not exceed 4000 characters!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void reprocess(String dossierId, String fileId) {
|
||||
|
||||
fileStatusService.setStatusReprocessForManual(dossierId, fileId, true);
|
||||
}
|
||||
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public GroupRedactionResponse getAllGroupRedactions(String fileId, boolean includeSoftDeleted) {
|
||||
|
||||
GroupRedactionResponse groupRedactionResponse = new GroupRedactionResponse();
|
||||
List<GroupRedactionEntity> groupRedactionEntities = groupRedactionPersistenceService.findAllGroupEntitiesForFile(fileId, includeSoftDeleted);
|
||||
groupRedactionResponse.setGroupRedactions(groupRedactionEntities.stream()
|
||||
.map(GroupRedactionMapper::toGroupRedaction)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
return groupRedactionResponse;
|
||||
}
|
||||
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public GroupRedactionInternalResponse getAllGroupRedactionsInternal(String fileId, boolean includeSoftDeleted) {
|
||||
|
||||
List<TextGroupRedaction> textGroupRedactions = new ArrayList<>();
|
||||
List<AreaGroupRedaction> areaGroupRedactions = new ArrayList<>();
|
||||
List<GroupRedactionEntity> groupRedactionEntities = groupRedactionPersistenceService.findAllGroupEntitiesForFile(fileId, includeSoftDeleted);
|
||||
groupRedactionEntities.forEach(groupRedaction -> {
|
||||
if (groupRedaction instanceof TextGroupEntity textGroupEntity) {
|
||||
textGroupRedactions.add(GroupRedactionMapper.toTextGroupRedaction(textGroupEntity));
|
||||
} else if (groupRedaction instanceof AreaGroupEntity areaGroupEntity) {
|
||||
areaGroupRedactions.add(GroupRedactionMapper.toAreaGroupRedaction(areaGroupEntity));
|
||||
}
|
||||
});
|
||||
|
||||
return GroupRedactionInternalResponse.builder().areaGroupRedactions(areaGroupRedactions).textGroupRedactions(textGroupRedactions).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public GroupRedaction getGroupRedaction(String groupId) {
|
||||
|
||||
GroupRedactionEntity groupRedactionEn = groupRedactionPersistenceService.findGroupRedaction(groupId);
|
||||
return GroupRedactionMapper.toGroupRedaction(groupRedactionEn);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void updateProcessedDate(Set<GroupRedaction> groupRedactions) {
|
||||
|
||||
if (groupRedactions != null) {
|
||||
groupRedactions.forEach(groupRedaction -> {
|
||||
if (groupRedaction.getProcessedDate() == null || groupRedaction.getGroupChanges()
|
||||
.stream()
|
||||
.anyMatch(change -> change.getChangeDate().isAfter(groupRedaction.getProcessedDate()))) {
|
||||
groupRedactionPersistenceService.markAsProcessed(groupRedaction.getGroupId());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupRedactionResponse updateLegalBasis(String dossierId, String fileId, List<UpdateLegalBasisRequestModel> updateLegalBasisRequestModels) {
|
||||
|
||||
List<GroupRedaction> groupRedactions = new ArrayList<>();
|
||||
|
||||
updateLegalBasisRequestModels.forEach(updateLegalBasisRequestModel -> {
|
||||
GroupRedactionEntity oldGroupEntity = groupRedactionPersistenceService.findGroupRedaction(updateLegalBasisRequestModel.getGroupId());
|
||||
String oldLegalBasis = oldGroupEntity.getLegalBasis();
|
||||
GroupRedactionEntity newGroupEntity = groupRedactionPersistenceService.updateLegalBasis(oldGroupEntity, updateLegalBasisRequestModel.getLegalBasis());
|
||||
GroupRedaction groupRedaction = GroupRedactionMapper.toGroupRedaction(newGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("legalBasis")
|
||||
.propertyOldValue(oldLegalBasis)
|
||||
.propertyNewValue(newGroupEntity.getLegalBasis())
|
||||
.build());
|
||||
addChange(newGroupEntity, GroupChangeType.LEGAL_BASIS_CHANGE, propertyChangeEntities, groupRedaction);
|
||||
groupRedactions.add(groupRedaction);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupRedactionResponse.builder().groupRedactions(groupRedactions).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupRedactionResponse recategorizeGroupRedaction(String dossierId, String fileId, List<RecategorizeGroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
|
||||
List<GroupRedaction> groupRedactions = new ArrayList<>();
|
||||
|
||||
groupRedactionRequestModels.forEach(groupRedactionRequestModel -> {
|
||||
GroupRedactionEntity oldGroupEntity = groupRedactionPersistenceService.findGroupRedaction(groupRedactionRequestModel.getGroupId());
|
||||
String oldType = oldGroupEntity.getTypeId();
|
||||
GroupRedactionEntity newGroupEntity = groupRedactionPersistenceService.recategorizeGroupRedaction(oldGroupEntity, groupRedactionRequestModel.getTypeId());
|
||||
GroupRedaction groupRedaction = GroupRedactionMapper.toGroupRedaction(newGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("type_id")
|
||||
.propertyOldValue(oldType)
|
||||
.propertyNewValue(newGroupEntity.getTypeId())
|
||||
.build());
|
||||
addChange(newGroupEntity, GroupChangeType.RECATEGORIZE, propertyChangeEntities, groupRedaction);
|
||||
groupRedactions.add(groupRedaction);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupRedactionResponse.builder().groupRedactions(groupRedactions).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupRedactionResponse forceGroupRedaction(String dossierId, String fileId, List<GroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
|
||||
List<GroupRedaction> groupRedactions = new ArrayList<>();
|
||||
|
||||
groupRedactionRequestModels.forEach(groupRedactionRequestModel -> {
|
||||
GroupRedactionEntity oldGroupEntity = groupRedactionPersistenceService.findGroupRedaction(groupRedactionRequestModel.getGroupId());
|
||||
String oldEntryType = oldGroupEntity.getEntryType().name();
|
||||
GroupRedactionEntity newGroupEntity = groupRedactionPersistenceService.forceGroupRedaction(oldGroupEntity);
|
||||
GroupRedaction groupRedaction = GroupRedactionMapper.toGroupRedaction(newGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("entryType")
|
||||
.propertyOldValue(oldEntryType)
|
||||
.propertyNewValue(newGroupEntity.getEntryType().name())
|
||||
.build());
|
||||
addChange(newGroupEntity, GroupChangeType.FORCE, propertyChangeEntities, groupRedaction);
|
||||
groupRedactions.add(groupRedaction);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupRedactionResponse.builder().groupRedactions(groupRedactions).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupRedactionResponse resizeAreaGroupRedaction(String dossierId, String fileId, List<ResizeAreaGroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
|
||||
List<GroupRedaction> groupRedactions = new ArrayList<>();
|
||||
|
||||
groupRedactionRequestModels.forEach(groupRedactionRequestModel -> {
|
||||
GroupRedactionEntity oldGroupEntity = groupRedactionPersistenceService.findGroupRedaction(groupRedactionRequestModel.getGroupId());
|
||||
if (oldGroupEntity instanceof AreaGroupEntity oldAreaGroupEntity) {
|
||||
PositionOnPageEntity oldPositionOnPage = oldAreaGroupEntity.getPositionsOnPage();
|
||||
AreaGroupEntity newAreaGroupEntity = groupRedactionPersistenceService.resizeAreaGroupRedaction(oldAreaGroupEntity, groupRedactionRequestModel.getPositionOnPage());
|
||||
GroupRedaction groupRedaction = GroupRedactionMapper.toAreaGroupRedaction(newAreaGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("positions")
|
||||
.propertyOldValue(buildPositionOnPageString(oldPositionOnPage))
|
||||
.propertyNewValue(buildPositionOnPageString(newAreaGroupEntity.getPositionsOnPage()))
|
||||
.build());
|
||||
addChange(newAreaGroupEntity, GroupChangeType.RESIZE, propertyChangeEntities, groupRedaction);
|
||||
groupRedactions.add(groupRedaction);
|
||||
} else {
|
||||
throw new BadRequestException("Can not resize TEXT group redactions!");
|
||||
}
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupRedactionResponse.builder().groupRedactions(groupRedactions).build();
|
||||
}
|
||||
|
||||
|
||||
private String buildPositionOnPageString(PositionOnPageEntity positionOnPageEntity) {
|
||||
|
||||
return "["
|
||||
+ positionOnPageEntity.getX()
|
||||
+ ", "
|
||||
+ positionOnPageEntity.getY()
|
||||
+ ", "
|
||||
+ positionOnPageEntity.getWidth()
|
||||
+ ", "
|
||||
+ positionOnPageEntity.getHeight()
|
||||
+ ", "
|
||||
+ positionOnPageEntity.getPageNumber()
|
||||
+ "]";
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupRedactionResponse removeGroupRedaction(String dossierId, String fileId, List<GroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
|
||||
List<GroupRedaction> groupRedactions = new ArrayList<>();
|
||||
|
||||
groupRedactionRequestModels.forEach(groupRedactionRequestModel -> {
|
||||
GroupRedactionEntity oldGroupEntity = groupRedactionPersistenceService.findGroupRedaction(groupRedactionRequestModel.getGroupId());
|
||||
GroupRedactionEntity newGroupEntity = groupRedactionPersistenceService.removeGroupRedaction(oldGroupEntity);
|
||||
GroupRedaction groupRedaction = GroupRedactionMapper.toGroupRedaction(newGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("softDeletedTime")
|
||||
.propertyOldValue(null)
|
||||
.propertyNewValue(newGroupEntity.getSoftDeletedTime().toString())
|
||||
.build());
|
||||
addChange(newGroupEntity, GroupChangeType.REMOVE, propertyChangeEntities, groupRedaction);
|
||||
groupRedactions.add(groupRedaction);
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupRedactionResponse.builder().groupRedactions(groupRedactions).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupRedactionResponse changeValueGroupRedaction(String dossierId, String fileId, List<ChangeValueAreaGroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
|
||||
List<GroupRedaction> groupRedactions = new ArrayList<>();
|
||||
|
||||
groupRedactionRequestModels.forEach(groupRedactionRequestModel -> {
|
||||
GroupRedactionEntity oldGroupEntity = groupRedactionPersistenceService.findGroupRedaction(groupRedactionRequestModel.getGroupId());
|
||||
if (oldGroupEntity instanceof AreaGroupEntity oldAreaGroupEntity) {
|
||||
String oldValue = oldAreaGroupEntity.getValue();
|
||||
AreaGroupEntity newAreaGroupEntity = groupRedactionPersistenceService.changeValueAreaGroupRedaction(oldAreaGroupEntity, groupRedactionRequestModel.getValue());
|
||||
GroupRedaction groupRedaction = GroupRedactionMapper.toAreaGroupRedaction(newAreaGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("value")
|
||||
.propertyOldValue(oldValue)
|
||||
.propertyNewValue(newAreaGroupEntity.getValue())
|
||||
.build());
|
||||
addChange(newAreaGroupEntity, GroupChangeType.VALUE_CHANGE, propertyChangeEntities, groupRedaction);
|
||||
groupRedactions.add(groupRedaction);
|
||||
} else {
|
||||
throw new BadRequestException("Can not change value for TEXT group redactions!");
|
||||
}
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupRedactionResponse.builder().groupRedactions(groupRedactions).build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public GroupRedactionResponse changePageRangesGroupRedaction(String dossierId, String fileId, List<ChangePageRangeAreaGroupRedactionRequestModel> groupRedactionRequestModels) {
|
||||
|
||||
List<GroupRedaction> groupRedactions = new ArrayList<>();
|
||||
|
||||
groupRedactionRequestModels.forEach(groupRedactionRequestModel -> {
|
||||
GroupRedactionEntity oldGroupEntity = groupRedactionPersistenceService.findGroupRedaction(groupRedactionRequestModel.getGroupId());
|
||||
if (oldGroupEntity instanceof AreaGroupEntity oldAreaGroupEntity) {
|
||||
List<PageRangeEntity> oldPageRanges = oldAreaGroupEntity.getPageRanges();
|
||||
validateChangePageRangeRequest(groupRedactionRequestModel);
|
||||
AreaGroupEntity newAreaGroupEntity = groupRedactionPersistenceService.changePageRangesAreaGroupRedaction(oldAreaGroupEntity,
|
||||
groupRedactionRequestModel.getPageRanges());
|
||||
AreaGroupRedaction groupRedaction = GroupRedactionMapper.toAreaGroupRedaction(newAreaGroupEntity);
|
||||
List<PropertyChangeEntity> propertyChangeEntities = new ArrayList<>();
|
||||
propertyChangeEntities.add(PropertyChangeEntity.builder()
|
||||
.propertyName("pageRanges")
|
||||
.propertyOldValue(buildPageRangeString(oldPageRanges))
|
||||
.propertyNewValue(buildPageRangeString(newAreaGroupEntity.getPageRanges()))
|
||||
.build());
|
||||
addChange(newAreaGroupEntity, GroupChangeType.PAGE_RANGE_CHANGE, propertyChangeEntities, groupRedaction);
|
||||
groupRedactions.add(groupRedaction);
|
||||
} else {
|
||||
throw new BadRequestException("Can not change page range for TEXT group redactions!");
|
||||
}
|
||||
});
|
||||
|
||||
reprocess(dossierId, fileId);
|
||||
fileStatusPersistenceService.setLastManualChangeDate(fileId, OffsetDateTime.now());
|
||||
|
||||
return GroupRedactionResponse.builder().groupRedactions(groupRedactions).build();
|
||||
}
|
||||
|
||||
|
||||
private String buildPageRangeString(List<PageRangeEntity> pageRangeEntities) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int pageRangeSize = pageRangeEntities.size();
|
||||
if (pageRangeSize > 1) {
|
||||
sb.append("[");
|
||||
}
|
||||
pageRangeEntities.forEach(pageRangeEntity -> {
|
||||
sb.append("[");
|
||||
sb.append(pageRangeEntity.getStartPage());
|
||||
sb.append(", ");
|
||||
sb.append(pageRangeEntity.getEndPage());
|
||||
sb.append("]");
|
||||
});
|
||||
if (pageRangeSize > 1) {
|
||||
sb.append("[");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
private void validateChangePageRangeRequest(ChangePageRangeAreaGroupRedactionRequestModel changePageRangeAreaGroupRedactionRequestModel) {
|
||||
|
||||
if (changePageRangeAreaGroupRedactionRequestModel.getPageRanges()
|
||||
.stream()
|
||||
.anyMatch(pageRange -> pageRange.getStartPage() > pageRange.getEndPage())) {
|
||||
throw new BadRequestException("Page range start can not be higher than page range end!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
private void addChange(GroupRedactionEntity groupRedactionEntity,
|
||||
GroupChangeType groupChangeType,
|
||||
List<PropertyChangeEntity> propertyChangeEntities,
|
||||
GroupRedaction groupRedaction) {
|
||||
|
||||
GroupChangeEntity groupChangeEntity = groupChangePersistenceService.addGroupChange(groupChangeType, groupRedactionEntity, propertyChangeEntities);
|
||||
List<GroupChange> groupChanges = GroupRedactionMapper.toGroupChanges(List.of(groupChangeEntity));
|
||||
groupRedaction.getGroupChanges().addAll(groupChanges);
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,7 +10,7 @@ import java.util.UUID;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.AreaGroupEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupRedactionEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupAnnotationEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.PositionOnPageEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.TextGroupEntity;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Engine;
|
||||
@ -19,23 +19,23 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Position;
|
||||
|
||||
@Service
|
||||
public class PendingGroupRedactionFactory {
|
||||
public class PendingGroupAnnotationFactory {
|
||||
|
||||
public EntityLogEntry buildGroupRedactionEntry(GroupRedactionEntity groupRedactionEntity) {
|
||||
public EntityLogEntry buildGroupAnnotationEntry(GroupAnnotationEntity groupAnnotationEntity) {
|
||||
|
||||
String reason = String.format("%s has been added as a group redaction", shortenValueIfNecessary(groupRedactionEntity.getValue()));
|
||||
String reason = String.format("%s has been added as a group annotation", shortenValueIfNecessary(groupAnnotationEntity.getValue()));
|
||||
|
||||
if (groupRedactionEntity instanceof TextGroupEntity textGroupEntity) {
|
||||
return buildTextGroupRedactionEntry(textGroupEntity, reason);
|
||||
} else if (groupRedactionEntity instanceof AreaGroupEntity areaGroupEntity) {
|
||||
return buildAreaGroupRedactionEntry(areaGroupEntity, reason);
|
||||
if (groupAnnotationEntity instanceof TextGroupEntity textGroupEntity) {
|
||||
return buildTextGroupAnnotationEntry(textGroupEntity, reason);
|
||||
} else if (groupAnnotationEntity instanceof AreaGroupEntity areaGroupEntity) {
|
||||
return buildAreaGroupAnnotationEntry(areaGroupEntity, reason);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private EntityLogEntry buildAreaGroupRedactionEntry(AreaGroupEntity areaGroupEntity, String reason) {
|
||||
private EntityLogEntry buildAreaGroupAnnotationEntry(AreaGroupEntity areaGroupEntity, String reason) {
|
||||
|
||||
return EntityLogEntry.builder()
|
||||
.id(UUID.randomUUID().toString())
|
||||
@ -66,7 +66,7 @@ public class PendingGroupRedactionFactory {
|
||||
}
|
||||
|
||||
|
||||
private EntityLogEntry buildTextGroupRedactionEntry(TextGroupEntity textGroupEntity, String reason) {
|
||||
private EntityLogEntry buildTextGroupAnnotationEntry(TextGroupEntity textGroupEntity, String reason) {
|
||||
|
||||
return EntityLogEntry.builder()
|
||||
.id(UUID.randomUUID().toString())
|
||||
@ -8,27 +8,27 @@ import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupRedactionEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.group.GroupAnnotationEntity;
|
||||
|
||||
public interface GroupRedactionRepository extends JpaRepository<GroupRedactionEntity, String> {
|
||||
public interface GroupAnnotationRepository extends JpaRepository<GroupAnnotationEntity, String> {
|
||||
|
||||
List<GroupRedactionEntity> findAllByFileId(String fileId);
|
||||
List<GroupAnnotationEntity> findAllByFileId(String fileId);
|
||||
|
||||
|
||||
@Query("select g from GroupRedactionEntity g where g.fileId = :fileId and g.softDeletedTime is null")
|
||||
List<GroupRedactionEntity> findAllByFileIdAndNotSoftDeleted(@Param("fileId") String fileId);
|
||||
@Query("select g from GroupAnnotationEntity g where g.fileId = :fileId and g.softDeletedTime is null")
|
||||
List<GroupAnnotationEntity> findAllByFileIdAndNotSoftDeleted(@Param("fileId") String fileId);
|
||||
|
||||
|
||||
@Modifying
|
||||
@Query("update GroupRedactionEntity t set t.processedDate = :processedDate where t.id = :groupId")
|
||||
@Query("update GroupAnnotationEntity t set t.processedDate = :processedDate where t.id = :groupId")
|
||||
void markAsProcessed(@Param("groupId") String groupId, @Param("processedDate") OffsetDateTime processedDate);
|
||||
|
||||
|
||||
@Query("select g from GroupRedactionEntity g "
|
||||
@Query("select g from GroupAnnotationEntity g "
|
||||
+ "where g.fileId = :fileId "
|
||||
+ "and g.softDeletedTime is null "
|
||||
+ "and (g.processedDate is null "
|
||||
+ "or exists (select gc from g.groupChanges gc where gc.changeDate > g.processedDate))")
|
||||
List<GroupRedactionEntity> findAllUnprocessedGroupRedactions(@Param("fileId") String fileId);
|
||||
List<GroupAnnotationEntity> findAllUnprocessedGroupAnnotations(@Param("fileId") String fileId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.iqser.red.service.peristence.v1.server.integration.client;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.external.resource.GroupAnnotationResource;
|
||||
|
||||
@FeignClient(name = "GroupAnnotationExternalClient", url = "http://localhost:${server.port}", configuration = FeignSupportConfig.class)
|
||||
public interface GroupAnnotationExternalClient extends GroupAnnotationResource {
|
||||
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package com.iqser.red.service.peristence.v1.server.integration.client;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.external.resource.GroupRedactionResource;
|
||||
|
||||
@FeignClient(name = "GroupRedactionExternalClient", url = "http://localhost:${server.port}", configuration = FeignSupportConfig.class)
|
||||
public interface GroupRedactionExternalClient extends GroupRedactionResource {
|
||||
|
||||
}
|
||||
@ -28,7 +28,6 @@ import com.iqser.red.service.peristence.v1.server.integration.service.DossierTes
|
||||
import com.iqser.red.service.peristence.v1.server.integration.service.TypeProvider;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.utils.AbstractPersistenceServerServiceTest;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.DossierManagementService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupRedactionService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.DossierRequest;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.DossierStatusRequest;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.WatermarkModel;
|
||||
|
||||
@ -33,10 +33,10 @@ import com.iqser.red.service.persistence.management.v1.processor.service.Dossier
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.EntityLogMergeService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.FileManagementStorageService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.FileStatusService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupRedactionPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupAnnotationPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.manualredactions.ManualRedactionProviderService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.manualredactions.PendingDictionaryEntryFactory;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.manualredactions.PendingGroupRedactionFactory;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.manualredactions.PendingGroupAnnotationFactory;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.DictionaryPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.DossierTemplatePersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
||||
@ -97,7 +97,7 @@ public class EntityLogMergeTest {
|
||||
private EntityLogMongoService entityLogMongoService;
|
||||
|
||||
@MockBean
|
||||
private GroupRedactionPersistenceService groupRedactionPersistenceService;
|
||||
private GroupAnnotationPersistenceService groupAnnotationPersistenceService;
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<AnalyzeRequest> captor;
|
||||
@ -108,7 +108,7 @@ public class EntityLogMergeTest {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
|
||||
entityLogMergeService = new EntityLogMergeService(dictionaryPersistenceService, new PendingDictionaryEntryFactory(), entityLogMongoService, new PendingGroupRedactionFactory());
|
||||
entityLogMergeService = new EntityLogMergeService(dictionaryPersistenceService, new PendingDictionaryEntryFactory(), entityLogMongoService, new PendingGroupAnnotationFactory());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -12,27 +12,27 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.GroupRedactionExternalClient;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.GroupAnnotationExternalClient;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.service.DossierTemplateTesterAndProvider;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.service.DossierTesterAndProvider;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.service.FileTesterAndProvider;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.utils.AbstractPersistenceServerServiceTest;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.PageRange;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntryType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddTextGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangePageRangeAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangeValueAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedactionType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.AddTextGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangePageRangeAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ChangeValueAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotationType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.PositionOnPage;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.RecategorizeGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ResizeAreaGroupRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.RecategorizeGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.ResizeAreaGroupAnnotationRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.UpdateLegalBasisRequestModel;
|
||||
|
||||
import feign.FeignException;
|
||||
|
||||
public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
public class GroupAnnotationTest extends AbstractPersistenceServerServiceTest {
|
||||
|
||||
@Autowired
|
||||
private DossierTemplateTesterAndProvider dossierTemplateTesterAndProvider;
|
||||
@ -44,7 +44,7 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
private FileTesterAndProvider fileTesterAndProvider;
|
||||
|
||||
@Autowired
|
||||
private GroupRedactionExternalClient groupRedactionExternalClient;
|
||||
private GroupAnnotationExternalClient groupRedactionExternalClient;
|
||||
|
||||
|
||||
@Test
|
||||
@ -54,25 +54,25 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
List<AddTextGroupRedactionRequestModel> addTextGroupRedactionRequestModels = getAddTextGroupRedactionRequestModels();
|
||||
var response = groupRedactionExternalClient.addTextGroupRedaction(dossier.getId(), file.getFileId(), addTextGroupRedactionRequestModels);
|
||||
List<AddTextGroupAnnotationRequestModel> addTextGroupRedactionRequestModels = getAddTextGroupRedactionRequestModels();
|
||||
var response = groupRedactionExternalClient.addTextGroupAnnotation(dossier.getId(), file.getFileId(), addTextGroupRedactionRequestModels);
|
||||
|
||||
assertNotNull(response);
|
||||
assertEquals(response.getGroupRedactions().size(), 1);
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations().size(), 1);
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getValue(), "value");
|
||||
}
|
||||
|
||||
|
||||
private static @NotNull List<AddTextGroupRedactionRequestModel> getAddTextGroupRedactionRequestModels() {
|
||||
private static @NotNull List<AddTextGroupAnnotationRequestModel> getAddTextGroupRedactionRequestModels() {
|
||||
|
||||
List<AddTextGroupRedactionRequestModel> addTextGroupRedactionRequestModels = new ArrayList<>();
|
||||
addTextGroupRedactionRequestModels.add(new AddTextGroupRedactionRequestModel("CBI_author",
|
||||
"value",
|
||||
"legalBasis",
|
||||
EntryType.ENTITY,
|
||||
PositionOnPage.builder().height(1).width(1).x(1).y(1).build(),
|
||||
GroupRedactionType.TEXT));
|
||||
List<AddTextGroupAnnotationRequestModel> addTextGroupRedactionRequestModels = new ArrayList<>();
|
||||
addTextGroupRedactionRequestModels.add(new AddTextGroupAnnotationRequestModel("CBI_author",
|
||||
"value",
|
||||
"legalBasis",
|
||||
EntryType.ENTITY,
|
||||
PositionOnPage.builder().height(1).width(1).x(1).y(1).build(),
|
||||
GroupAnnotationType.TEXT));
|
||||
return addTextGroupRedactionRequestModels;
|
||||
}
|
||||
|
||||
@ -84,12 +84,12 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
List<AddAreaGroupRedactionRequestModel> addAreaGroupRedactionRequestModels = getAddAreaGroupRedactionRequestModels();
|
||||
var response = groupRedactionExternalClient.addAreaGroupRedaction(dossier.getId(), file.getFileId(), addAreaGroupRedactionRequestModels);
|
||||
List<AddAreaGroupAnnotationRequestModel> addAreaGroupRedactionRequestModels = getAddAreaGroupRedactionRequestModels();
|
||||
var response = groupRedactionExternalClient.addAreaGroupAnnotation(dossier.getId(), file.getFileId(), addAreaGroupRedactionRequestModels);
|
||||
|
||||
assertNotNull(response);
|
||||
assertEquals(response.getGroupRedactions().size(), 1);
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations().size(), 1);
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getValue(), "value");
|
||||
}
|
||||
|
||||
@ -101,42 +101,42 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
List<AddTextGroupRedactionRequestModel> addTextGroupRedactionRequestModels = getAddTextGroupRedactionRequestModels();
|
||||
groupRedactionExternalClient.addTextGroupRedaction(dossier.getId(), file.getFileId(), addTextGroupRedactionRequestModels);
|
||||
List<AddTextGroupAnnotationRequestModel> addTextGroupRedactionRequestModels = getAddTextGroupRedactionRequestModels();
|
||||
groupRedactionExternalClient.addTextGroupAnnotation(dossier.getId(), file.getFileId(), addTextGroupRedactionRequestModels);
|
||||
|
||||
List<AddAreaGroupRedactionRequestModel> addAreaGroupRedactionRequestModels = getAddAreaGroupRedactionRequestModels();
|
||||
var area = groupRedactionExternalClient.addAreaGroupRedaction(dossier.getId(), file.getFileId(), addAreaGroupRedactionRequestModels);
|
||||
List<AddAreaGroupAnnotationRequestModel> addAreaGroupRedactionRequestModels = getAddAreaGroupRedactionRequestModels();
|
||||
var area = groupRedactionExternalClient.addAreaGroupAnnotation(dossier.getId(), file.getFileId(), addAreaGroupRedactionRequestModels);
|
||||
|
||||
var response = groupRedactionExternalClient.getGroupRedactions(dossier.getId(), file.getFileId(), false);
|
||||
assertEquals(response.getGroupRedactions().size(), 2);
|
||||
var response = groupRedactionExternalClient.getGroupAnnotations(dossier.getId(), file.getFileId(), false);
|
||||
assertEquals(response.getGroupAnnotations().size(), 2);
|
||||
|
||||
groupRedactionExternalClient.removeGroupRedaction(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(GroupRedactionRequestModel.builder()
|
||||
.groupId(area.getGroupRedactions()
|
||||
groupRedactionExternalClient.removeGroupAnnotation(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(GroupAnnotationRequestModel.builder()
|
||||
.groupId(area.getGroupAnnotations()
|
||||
.get(0).getGroupId())
|
||||
.build()));
|
||||
|
||||
response = groupRedactionExternalClient.getGroupRedactions(dossier.getId(), file.getFileId(), false);
|
||||
assertEquals(response.getGroupRedactions().size(), 1);
|
||||
response = groupRedactionExternalClient.getGroupAnnotations(dossier.getId(), file.getFileId(), false);
|
||||
assertEquals(response.getGroupAnnotations().size(), 1);
|
||||
|
||||
response = groupRedactionExternalClient.getGroupRedactions(dossier.getId(), file.getFileId(), true);
|
||||
assertEquals(response.getGroupRedactions().size(), 2);
|
||||
response = groupRedactionExternalClient.getGroupAnnotations(dossier.getId(), file.getFileId(), true);
|
||||
assertEquals(response.getGroupAnnotations().size(), 2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static @NotNull List<AddAreaGroupRedactionRequestModel> getAddAreaGroupRedactionRequestModels() {
|
||||
private static @NotNull List<AddAreaGroupAnnotationRequestModel> getAddAreaGroupRedactionRequestModels() {
|
||||
|
||||
List<AddAreaGroupRedactionRequestModel> addAreaGroupRedactionRequestModels = new ArrayList<>();
|
||||
addAreaGroupRedactionRequestModels.add(new AddAreaGroupRedactionRequestModel("CBI_author",
|
||||
"value",
|
||||
"legalBasis",
|
||||
EntryType.ENTITY,
|
||||
GroupRedactionType.AREA,
|
||||
PositionOnPage.builder().height(1).width(1).x(1).y(1).build(),
|
||||
List.of(PageRange.builder().startPage(1).endPage(2).build()),
|
||||
"section"));
|
||||
List<AddAreaGroupAnnotationRequestModel> addAreaGroupRedactionRequestModels = new ArrayList<>();
|
||||
addAreaGroupRedactionRequestModels.add(new AddAreaGroupAnnotationRequestModel("CBI_author",
|
||||
"value",
|
||||
"legalBasis",
|
||||
EntryType.ENTITY,
|
||||
GroupAnnotationType.AREA,
|
||||
PositionOnPage.builder().height(1).width(1).x(1).y(1).build(),
|
||||
List.of(PageRange.builder().startPage(1).endPage(2).build()),
|
||||
"section"));
|
||||
return addAreaGroupRedactionRequestModels;
|
||||
}
|
||||
|
||||
@ -148,18 +148,18 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
List<AddTextGroupRedactionRequestModel> addTextGroupRedactionRequestModels = getAddTextGroupRedactionRequestModels();
|
||||
var text = groupRedactionExternalClient.addTextGroupRedaction(dossier.getId(), file.getFileId(), addTextGroupRedactionRequestModels);
|
||||
List<AddTextGroupAnnotationRequestModel> addTextGroupRedactionRequestModels = getAddTextGroupRedactionRequestModels();
|
||||
var text = groupRedactionExternalClient.addTextGroupAnnotation(dossier.getId(), file.getFileId(), addTextGroupRedactionRequestModels);
|
||||
|
||||
var response = groupRedactionExternalClient.updateLegalBasis(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(UpdateLegalBasisRequestModel.builder()
|
||||
.groupId(text.getGroupRedactions()
|
||||
.groupId(text.getGroupAnnotations()
|
||||
.get(0).getGroupId())
|
||||
.legalBasis("new legal basis")
|
||||
.build()));
|
||||
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getLegalBasis(), "new legal basis");
|
||||
}
|
||||
|
||||
@ -171,18 +171,18 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
List<AddTextGroupRedactionRequestModel> addTextGroupRedactionRequestModels = getAddTextGroupRedactionRequestModels();
|
||||
var text = groupRedactionExternalClient.addTextGroupRedaction(dossier.getId(), file.getFileId(), addTextGroupRedactionRequestModels);
|
||||
List<AddTextGroupAnnotationRequestModel> addTextGroupRedactionRequestModels = getAddTextGroupRedactionRequestModels();
|
||||
var text = groupRedactionExternalClient.addTextGroupAnnotation(dossier.getId(), file.getFileId(), addTextGroupRedactionRequestModels);
|
||||
|
||||
var response = groupRedactionExternalClient.recategorizeGroupRedaction(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(RecategorizeGroupRedactionRequestModel.builder()
|
||||
.groupId(text.getGroupRedactions()
|
||||
var response = groupRedactionExternalClient.recategorizeGroupAnnotation(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(RecategorizeGroupAnnotationRequestModel.builder()
|
||||
.groupId(text.getGroupAnnotations()
|
||||
.get(0).getGroupId())
|
||||
.typeId("PII")
|
||||
.build()));
|
||||
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getTypeId(), "PII");
|
||||
}
|
||||
|
||||
@ -194,13 +194,13 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
List<AddAreaGroupRedactionRequestModel> addAreaGroupRedactionRequestModels = getAddAreaGroupRedactionRequestModels();
|
||||
var area = groupRedactionExternalClient.addAreaGroupRedaction(dossier.getId(), file.getFileId(), addAreaGroupRedactionRequestModels);
|
||||
List<AddAreaGroupAnnotationRequestModel> addAreaGroupRedactionRequestModels = getAddAreaGroupRedactionRequestModels();
|
||||
var area = groupRedactionExternalClient.addAreaGroupAnnotation(dossier.getId(), file.getFileId(), addAreaGroupRedactionRequestModels);
|
||||
|
||||
var response = groupRedactionExternalClient.resizeGroupRedaction(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(ResizeAreaGroupRedactionRequestModel.builder()
|
||||
.groupId(area.getGroupRedactions()
|
||||
var response = groupRedactionExternalClient.resizeGroupAnnotation(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(ResizeAreaGroupAnnotationRequestModel.builder()
|
||||
.groupId(area.getGroupAnnotations()
|
||||
.get(0).getGroupId())
|
||||
.positionOnPage(PositionOnPage.builder()
|
||||
.pageNumber(1)
|
||||
@ -211,15 +211,15 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
.build())
|
||||
.build()));
|
||||
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getPositionOnPage().getPageNumber(), 1);
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getPositionOnPage().getHeight(), 3);
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getPositionOnPage().getWidth(), 2);
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getPositionOnPage().getX(), 4);
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getPositionOnPage().getY(), 5);
|
||||
|
||||
}
|
||||
@ -232,23 +232,23 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
List<AddTextGroupRedactionRequestModel> addTextGroupRedactionRequestModels = new ArrayList<>();
|
||||
addTextGroupRedactionRequestModels.add(new AddTextGroupRedactionRequestModel("CBI_author",
|
||||
"value",
|
||||
"legalBasis",
|
||||
EntryType.HINT,
|
||||
PositionOnPage.builder().height(1).width(1).x(1).y(1).build(),
|
||||
GroupRedactionType.TEXT));
|
||||
var text = groupRedactionExternalClient.addTextGroupRedaction(dossier.getId(), file.getFileId(), addTextGroupRedactionRequestModels);
|
||||
List<AddTextGroupAnnotationRequestModel> addTextGroupRedactionRequestModels = new ArrayList<>();
|
||||
addTextGroupRedactionRequestModels.add(new AddTextGroupAnnotationRequestModel("CBI_author",
|
||||
"value",
|
||||
"legalBasis",
|
||||
EntryType.HINT,
|
||||
PositionOnPage.builder().height(1).width(1).x(1).y(1).build(),
|
||||
GroupAnnotationType.TEXT));
|
||||
var text = groupRedactionExternalClient.addTextGroupAnnotation(dossier.getId(), file.getFileId(), addTextGroupRedactionRequestModels);
|
||||
|
||||
var response = groupRedactionExternalClient.forceGroupRedaction(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(GroupRedactionRequestModel.builder()
|
||||
.groupId(text.getGroupRedactions()
|
||||
var response = groupRedactionExternalClient.forceGroupAnnotation(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(GroupAnnotationRequestModel.builder()
|
||||
.groupId(text.getGroupAnnotations()
|
||||
.get(0).getGroupId())
|
||||
.build()));
|
||||
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getEntryType(), EntryType.ENTITY);
|
||||
}
|
||||
|
||||
@ -260,18 +260,18 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
List<AddAreaGroupRedactionRequestModel> addAreaGroupRedactionRequestModels = getAddAreaGroupRedactionRequestModels();
|
||||
var area = groupRedactionExternalClient.addAreaGroupRedaction(dossier.getId(), file.getFileId(), addAreaGroupRedactionRequestModels);
|
||||
List<AddAreaGroupAnnotationRequestModel> addAreaGroupRedactionRequestModels = getAddAreaGroupRedactionRequestModels();
|
||||
var area = groupRedactionExternalClient.addAreaGroupAnnotation(dossier.getId(), file.getFileId(), addAreaGroupRedactionRequestModels);
|
||||
|
||||
var response = groupRedactionExternalClient.changeValueGroupRedaction(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(ChangeValueAreaGroupRedactionRequestModel.builder()
|
||||
.groupId(area.getGroupRedactions()
|
||||
var response = groupRedactionExternalClient.changeValueGroupAnnotation(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(ChangeValueAreaGroupAnnotationRequestModel.builder()
|
||||
.groupId(area.getGroupAnnotations()
|
||||
.get(0).getGroupId())
|
||||
.value("new value")
|
||||
.build()));
|
||||
|
||||
assertEquals(response.getGroupRedactions()
|
||||
assertEquals(response.getGroupAnnotations()
|
||||
.get(0).getValue(), "new value");
|
||||
|
||||
}
|
||||
@ -284,14 +284,14 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
List<AddAreaGroupRedactionRequestModel> addAreaGroupRedactionRequestModels = getAddAreaGroupRedactionRequestModels();
|
||||
var area = groupRedactionExternalClient.addAreaGroupRedaction(dossier.getId(), file.getFileId(), addAreaGroupRedactionRequestModels);
|
||||
List<AddAreaGroupAnnotationRequestModel> addAreaGroupRedactionRequestModels = getAddAreaGroupRedactionRequestModels();
|
||||
var area = groupRedactionExternalClient.addAreaGroupAnnotation(dossier.getId(), file.getFileId(), addAreaGroupRedactionRequestModels);
|
||||
|
||||
var error = assertThrows(FeignException.class,
|
||||
() -> groupRedactionExternalClient.changePageRangeGroupRedaction(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(ChangePageRangeAreaGroupRedactionRequestModel.builder()
|
||||
.groupId(area.getGroupRedactions()
|
||||
() -> groupRedactionExternalClient.changePageRangeGroupAnnotation(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(ChangePageRangeAreaGroupAnnotationRequestModel.builder()
|
||||
.groupId(area.getGroupAnnotations()
|
||||
.get(0).getGroupId())
|
||||
.pageRanges(List.of(PageRange.builder()
|
||||
.startPage(20)
|
||||
@ -300,16 +300,16 @@ public class GroupRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
.build())));
|
||||
assertTrue(error.getMessage().contains("Page range start can not be higher than page range end!"));
|
||||
|
||||
var response = groupRedactionExternalClient.changePageRangeGroupRedaction(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(ChangePageRangeAreaGroupRedactionRequestModel.builder()
|
||||
.groupId(area.getGroupRedactions()
|
||||
var response = groupRedactionExternalClient.changePageRangeGroupAnnotation(dossier.getId(),
|
||||
file.getFileId(),
|
||||
List.of(ChangePageRangeAreaGroupAnnotationRequestModel.builder()
|
||||
.groupId(area.getGroupAnnotations()
|
||||
.get(0).getGroupId())
|
||||
.pageRanges(List.of(PageRange.builder().startPage(10).endPage(20).build()))
|
||||
.build()));
|
||||
|
||||
assertEquals("[10, 20]",
|
||||
response.getGroupRedactions()
|
||||
response.getGroupAnnotations()
|
||||
.get(0).getGroupChanges()
|
||||
.get(0).getPropertyChanges()
|
||||
.get(0).getPropertyNewValue());
|
||||
@ -70,7 +70,7 @@ import com.iqser.red.service.persistence.management.v1.processor.roles.Applicati
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.ApplicationConfigService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.EntityLogService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.FileManagementStorageService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupRedactionService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.group.GroupAnnotationService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.ApplicationConfigRepository;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.AuditRepository;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.CommentRepository;
|
||||
@ -103,7 +103,7 @@ import com.iqser.red.service.persistence.management.v1.processor.service.persist
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.dictionaryentry.EntryRepository;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.dictionaryentry.FalsePositiveEntryRepository;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.dictionaryentry.FalseRecommendationEntryRepository;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.group.GroupRedactionRepository;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.group.GroupAnnotationRepository;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.users.UserService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.configuration.ApplicationConfig;
|
||||
@ -239,7 +239,7 @@ public abstract class AbstractPersistenceServerServiceTest {
|
||||
@Autowired
|
||||
protected ApplicationConfigRepository applicationConfigRepository;
|
||||
@Autowired
|
||||
protected GroupRedactionRepository groupRedactionRepository;
|
||||
protected GroupAnnotationRepository groupAnnotationRepository;
|
||||
@MockBean
|
||||
protected RedactionClient redactionClient;
|
||||
@Autowired
|
||||
@ -273,7 +273,7 @@ public abstract class AbstractPersistenceServerServiceTest {
|
||||
@Autowired
|
||||
protected ResizeRedactionRepository resizeRedactionRepository;
|
||||
@Autowired
|
||||
protected GroupRedactionService groupRedactionService;
|
||||
protected GroupAnnotationService groupAnnotationService;
|
||||
@MockBean
|
||||
protected TenantAuthenticationManagerResolver tenantAuthenticationManagerResolver;
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import java.util.Set;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.ManualRedactions;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.component.ComponentMappingMetadata;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupRedaction;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.group.GroupAnnotation;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@ -38,7 +38,7 @@ public class AnalyzeResult {
|
||||
|
||||
private ManualRedactions manualRedactions;
|
||||
|
||||
private Set<GroupRedaction> groupRedactions;
|
||||
private Set<GroupAnnotation> groupAnnotations;
|
||||
|
||||
private Set<FileAttribute> addedFileAttributes;
|
||||
|
||||
|
||||
@ -16,24 +16,24 @@ import lombok.NoArgsConstructor;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AddAreaGroupRedactionRequestModel extends AddGroupRedactionRequestModel {
|
||||
public class AddAreaGroupAnnotationRequestModel extends AddGroupAnnotationRequestModel {
|
||||
|
||||
public AddAreaGroupRedactionRequestModel(String type,
|
||||
String value,
|
||||
String legalBasis,
|
||||
EntryType entryType,
|
||||
@NotNull(message = "GroupRedactionType is required") GroupRedactionType groupRedactionType,
|
||||
PositionOnPage positionsOnPage,
|
||||
List<PageRange> pageRanges,
|
||||
String section) {
|
||||
public AddAreaGroupAnnotationRequestModel(String type,
|
||||
String value,
|
||||
String legalBasis,
|
||||
EntryType entryType,
|
||||
@NotNull(message = "GroupAnnotationType is required") GroupAnnotationType groupAnnotationType,
|
||||
PositionOnPage positionsOnPage,
|
||||
List<PageRange> pageRanges,
|
||||
String section) {
|
||||
|
||||
super(type, value, legalBasis, entryType, positionsOnPage, groupRedactionType);
|
||||
super(type, value, legalBasis, entryType, positionsOnPage, groupAnnotationType);
|
||||
this.pageRanges = pageRanges;
|
||||
this.section = section;
|
||||
}
|
||||
|
||||
|
||||
@NotEmpty(message = "Page ranges are required for AREA group redaction")
|
||||
@NotEmpty(message = "Page ranges are required for AREA group annotation")
|
||||
private List<PageRange> pageRanges;
|
||||
|
||||
private String section;
|
||||
@ -14,9 +14,9 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "groupRedactionType", visible = true)
|
||||
@JsonSubTypes({@JsonSubTypes.Type(value = AddTextGroupRedactionRequestModel.class, name = "TEXT"), @JsonSubTypes.Type(value = AddAreaGroupRedactionRequestModel.class, name = "AREA")})
|
||||
public class AddGroupRedactionRequestModel {
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "groupAnnotationType", visible = true)
|
||||
@JsonSubTypes({@JsonSubTypes.Type(value = AddTextGroupAnnotationRequestModel.class, name = "TEXT"), @JsonSubTypes.Type(value = AddAreaGroupAnnotationRequestModel.class, name = "AREA")})
|
||||
public class AddGroupAnnotationRequestModel {
|
||||
|
||||
private String type;
|
||||
|
||||
@ -28,7 +28,7 @@ public class AddGroupRedactionRequestModel {
|
||||
|
||||
private PositionOnPage positionOnPage;
|
||||
|
||||
@NotNull(message = "GroupRedactionType is required")
|
||||
private GroupRedactionType groupRedactionType;
|
||||
@NotNull(message = "GroupAnnotationType is required")
|
||||
private GroupAnnotationType groupAnnotationType;
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.shared.model.group;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntryType;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AllArgsConstructor
|
||||
@ToString(callSuper = true)
|
||||
public class AddTextGroupAnnotationRequestModel extends AddGroupAnnotationRequestModel {
|
||||
|
||||
public AddTextGroupAnnotationRequestModel(String type,
|
||||
String value,
|
||||
String legalBasis,
|
||||
EntryType entryType,
|
||||
PositionOnPage positionOnPage,
|
||||
@NotNull(message = "GroupAnnotationType is required") GroupAnnotationType groupAnnotationType) {
|
||||
|
||||
super(type, value, legalBasis, entryType, positionOnPage, groupAnnotationType);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.shared.model.group;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntryType;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AllArgsConstructor
|
||||
@ToString(callSuper = true)
|
||||
public class AddTextGroupRedactionRequestModel extends AddGroupRedactionRequestModel {
|
||||
|
||||
public AddTextGroupRedactionRequestModel(String type,
|
||||
String value,
|
||||
String legalBasis,
|
||||
EntryType entryType,
|
||||
PositionOnPage positionOnPage,
|
||||
@NotNull(message = "GroupRedactionType is required") GroupRedactionType groupRedactionType) {
|
||||
|
||||
super(type, value, legalBasis, entryType, positionOnPage, groupRedactionType);
|
||||
}
|
||||
|
||||
}
|
||||
@ -15,7 +15,7 @@ import lombok.experimental.SuperBuilder;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AreaGroupRedaction extends GroupRedaction {
|
||||
public class AreaGroupAnnotation extends GroupAnnotation {
|
||||
|
||||
private List<PageRange> pageRanges;
|
||||
|
||||
@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ChangePageRangeAreaGroupRedactionRequestModel {
|
||||
public class ChangePageRangeAreaGroupAnnotationRequestModel {
|
||||
|
||||
private String groupId;
|
||||
|
||||
@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ChangeValueAreaGroupRedactionRequestModel {
|
||||
public class ChangeValueAreaGroupAnnotationRequestModel {
|
||||
|
||||
private String groupId;
|
||||
|
||||
@ -18,7 +18,7 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GroupRedaction {
|
||||
public class GroupAnnotation {
|
||||
|
||||
private String groupId;
|
||||
|
||||
@ -34,7 +34,7 @@ public class GroupRedaction {
|
||||
|
||||
private EntryType entryType;
|
||||
|
||||
private GroupRedactionType groupRedactionType;
|
||||
private GroupAnnotationType groupAnnotationType;
|
||||
|
||||
private OffsetDateTime requestDate;
|
||||
|
||||
@ -12,9 +12,9 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GroupRedactionInternalResponse {
|
||||
public class GroupAnnotationInternalResponse {
|
||||
|
||||
List<TextGroupRedaction> textGroupRedactions = new ArrayList<>();
|
||||
List<TextGroupAnnotation> textGroupAnnotations = new ArrayList<>();
|
||||
|
||||
List<AreaGroupRedaction> areaGroupRedactions = new ArrayList<>();
|
||||
List<AreaGroupAnnotation> areaGroupAnnotations = new ArrayList<>();
|
||||
}
|
||||
@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GroupRedactionRequestModel {
|
||||
public class GroupAnnotationRequestModel {
|
||||
|
||||
private String groupId;
|
||||
}
|
||||
@ -1,9 +1,7 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.shared.model.group;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@ -14,8 +12,8 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GroupRedactionResponse {
|
||||
public class GroupAnnotationResponse {
|
||||
|
||||
List<GroupRedaction> groupRedactions = new ArrayList<>();
|
||||
List<GroupAnnotation> groupAnnotations = new ArrayList<>();
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.shared.model.group;
|
||||
|
||||
public enum GroupRedactionType {
|
||||
public enum GroupAnnotationType {
|
||||
|
||||
TEXT,
|
||||
AREA
|
||||
@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RecategorizeGroupRedactionRequestModel {
|
||||
public class RecategorizeGroupAnnotationRequestModel {
|
||||
|
||||
private String groupId;
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.shared.model.group;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@ -11,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ResizeAreaGroupRedactionRequestModel {
|
||||
public class ResizeAreaGroupAnnotationRequestModel {
|
||||
|
||||
private String groupId;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.shared.model.group;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
@ -10,6 +9,6 @@ import lombok.experimental.SuperBuilder;
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TextGroupRedaction extends GroupRedaction {
|
||||
public class TextGroupAnnotation extends GroupAnnotation {
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user