typeId to type internal refactor
This commit is contained in:
parent
dd8a07d2ad
commit
0856c542bc
@ -20,7 +20,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.iqser.red.service</groupId>
|
<groupId>com.iqser.red.service</groupId>
|
||||||
<artifactId>persistence-service-api-v1</artifactId>
|
<artifactId>persistence-service-api-v1</artifactId>
|
||||||
<version>0.16.0</version>
|
<version>0.22.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import java.util.Set;
|
|||||||
public class RedactionLogEntry {
|
public class RedactionLogEntry {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String typeId;
|
private String type;
|
||||||
private String value;
|
private String value;
|
||||||
private String reason;
|
private String reason;
|
||||||
private int matchedRule;
|
private int matchedRule;
|
||||||
|
|||||||
@ -254,7 +254,7 @@ public class AnalyzeService {
|
|||||||
Rectangle position = entry.getPositions().get(0);
|
Rectangle position = entry.getPositions().get(0);
|
||||||
|
|
||||||
return Image.builder()
|
return Image.builder()
|
||||||
.type(entry.getTypeId().split(":")[0])
|
.type(entry.getType())
|
||||||
.position(new RedRectangle2D(position.getTopLeft().getX(), position.getTopLeft()
|
.position(new RedRectangle2D(position.getTopLeft().getX(), position.getTopLeft()
|
||||||
.getY(), position.getWidth(), position.getHeight()))
|
.getY(), position.getWidth(), position.getHeight()))
|
||||||
.sectionNumber(entry.getSectionNumber())
|
.sectionNumber(entry.getSectionNumber())
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class DictionaryService {
|
|||||||
DictionaryRepresentation dictionaryRepresentation = new DictionaryRepresentation();
|
DictionaryRepresentation dictionaryRepresentation = new DictionaryRepresentation();
|
||||||
|
|
||||||
var typeResponse = dossierId == null ? dictionaryClient.getAllTypesForDossierTemplate(dossierTemplateId) : dictionaryClient.getAllTypesForDossier(dossierId);
|
var typeResponse = dossierId == null ? dictionaryClient.getAllTypesForDossierTemplate(dossierTemplateId) : dictionaryClient.getAllTypesForDossier(dossierId);
|
||||||
if (typeResponse != null && CollectionUtils.isNotEmpty(typeResponse)) {
|
if (CollectionUtils.isNotEmpty(typeResponse)) {
|
||||||
|
|
||||||
List<DictionaryModel> dictionary = typeResponse
|
List<DictionaryModel> dictionary = typeResponse
|
||||||
.stream()
|
.stream()
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public class RedactionLogCreatorService {
|
|||||||
.id(id)
|
.id(id)
|
||||||
.color(getColor(image.getType(), dossierTemplateId, image.isRedaction()))
|
.color(getColor(image.getType(), dossierTemplateId, image.isRedaction()))
|
||||||
.isImage(true)
|
.isImage(true)
|
||||||
.typeId(IdBuilder.getTypeId(image.getType(), dossierTemplateId, null))
|
.type(image.getType())
|
||||||
.redacted(image.isRedaction())
|
.redacted(image.isRedaction())
|
||||||
.reason(image.getRedactionReason())
|
.reason(image.getRedactionReason())
|
||||||
.legalBasis(image.getLegalBasis())
|
.legalBasis(image.getLegalBasis())
|
||||||
@ -167,7 +167,7 @@ public class RedactionLogCreatorService {
|
|||||||
.reason(entity.getRedactionReason())
|
.reason(entity.getRedactionReason())
|
||||||
.legalBasis(entity.getLegalBasis())
|
.legalBasis(entity.getLegalBasis())
|
||||||
.value(entity.getWord())
|
.value(entity.getWord())
|
||||||
.typeId(IdBuilder.getTypeId(entity.getType(), dossierTemplateId, entity.isDossierDictionaryEntry() ? dossierId : null))
|
.type(entity.getType())
|
||||||
.redacted(entity.isRedaction())
|
.redacted(entity.isRedaction())
|
||||||
.isHint(isHint(entity.getType(), dossierTemplateId))
|
.isHint(isHint(entity.getType(), dossierTemplateId))
|
||||||
.isRecommendation(isRecommendation(entity.getType(), dossierTemplateId))
|
.isRecommendation(isRecommendation(entity.getType(), dossierTemplateId))
|
||||||
|
|||||||
@ -110,12 +110,12 @@ public class RedactionLogMergeService {
|
|||||||
String manualOverrideReason = null;
|
String manualOverrideReason = null;
|
||||||
if (imageRecategorization.getStatus().equals(AnnotationStatus.APPROVED)) {
|
if (imageRecategorization.getStatus().equals(AnnotationStatus.APPROVED)) {
|
||||||
redactionLogEntry.setStatus(AnnotationStatus.APPROVED);
|
redactionLogEntry.setStatus(AnnotationStatus.APPROVED);
|
||||||
redactionLogEntry.setTypeId(IdBuilder.getTypeId(imageRecategorization.getType(), dossierTemplateId, null));
|
redactionLogEntry.setType(imageRecategorization.getType());
|
||||||
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", recategorized by manual override");
|
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", recategorized by manual override");
|
||||||
} else if (imageRecategorization.getStatus().equals(AnnotationStatus.REQUESTED)) {
|
} else if (imageRecategorization.getStatus().equals(AnnotationStatus.REQUESTED)) {
|
||||||
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", requested to recategorize");
|
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", requested to recategorize");
|
||||||
redactionLogEntry.setStatus(AnnotationStatus.REQUESTED);
|
redactionLogEntry.setStatus(AnnotationStatus.REQUESTED);
|
||||||
redactionLogEntry.setColor(getColor(getTypeFromTypeId(redactionLogEntry.getTypeId()), dossierTemplateId, false, redactionLogEntry
|
redactionLogEntry.setColor(getColor(redactionLogEntry.getType(), dossierTemplateId, false, redactionLogEntry
|
||||||
.isRedacted(), false));
|
.isRedacted(), false));
|
||||||
redactionLogEntry.setRecategorizationType(imageRecategorization.getType());
|
redactionLogEntry.setRecategorizationType(imageRecategorization.getType());
|
||||||
} else {
|
} else {
|
||||||
@ -135,12 +135,12 @@ public class RedactionLogMergeService {
|
|||||||
redactionLogEntry.setRedacted(false);
|
redactionLogEntry.setRedacted(false);
|
||||||
redactionLogEntry.setStatus(AnnotationStatus.APPROVED);
|
redactionLogEntry.setStatus(AnnotationStatus.APPROVED);
|
||||||
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", removed by manual override");
|
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", removed by manual override");
|
||||||
redactionLogEntry.setColor(getColor(getTypeFromTypeId(redactionLogEntry.getTypeId()), dossierTemplateId, false, redactionLogEntry
|
redactionLogEntry.setColor(getColor(redactionLogEntry.getType(), dossierTemplateId, false, redactionLogEntry
|
||||||
.isRedacted(), true));
|
.isRedacted(), true));
|
||||||
} else if (manualRemoval.getStatus().equals(AnnotationStatus.REQUESTED)) {
|
} else if (manualRemoval.getStatus().equals(AnnotationStatus.REQUESTED)) {
|
||||||
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", requested to remove");
|
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", requested to remove");
|
||||||
redactionLogEntry.setStatus(AnnotationStatus.REQUESTED);
|
redactionLogEntry.setStatus(AnnotationStatus.REQUESTED);
|
||||||
redactionLogEntry.setColor(getColor(getTypeFromTypeId(redactionLogEntry.getTypeId()), dossierTemplateId, true, redactionLogEntry
|
redactionLogEntry.setColor(getColor(redactionLogEntry.getType(), dossierTemplateId, true, redactionLogEntry
|
||||||
.isRedacted(), false));
|
.isRedacted(), false));
|
||||||
} else {
|
} else {
|
||||||
redactionLogEntry.setStatus(AnnotationStatus.DECLINED);
|
redactionLogEntry.setStatus(AnnotationStatus.DECLINED);
|
||||||
@ -160,14 +160,14 @@ public class RedactionLogMergeService {
|
|||||||
if (manualForceRedact.getStatus().equals(AnnotationStatus.APPROVED)) {
|
if (manualForceRedact.getStatus().equals(AnnotationStatus.APPROVED)) {
|
||||||
redactionLogEntry.setRedacted(true);
|
redactionLogEntry.setRedacted(true);
|
||||||
redactionLogEntry.setStatus(AnnotationStatus.APPROVED);
|
redactionLogEntry.setStatus(AnnotationStatus.APPROVED);
|
||||||
redactionLogEntry.setColor(getColor(getTypeFromTypeId(redactionLogEntry.getTypeId()), dossierTemplateId, false, redactionLogEntry
|
redactionLogEntry.setColor(getColor(redactionLogEntry.getType(), dossierTemplateId, false, redactionLogEntry
|
||||||
.isRedacted(), false));
|
.isRedacted(), false));
|
||||||
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", forced by manual override");
|
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", forced by manual override");
|
||||||
redactionLogEntry.setLegalBasis(manualForceRedact.getLegalBasis());
|
redactionLogEntry.setLegalBasis(manualForceRedact.getLegalBasis());
|
||||||
} else if (manualForceRedact.getStatus().equals(AnnotationStatus.REQUESTED)) {
|
} else if (manualForceRedact.getStatus().equals(AnnotationStatus.REQUESTED)) {
|
||||||
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", requested to force redact");
|
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", requested to force redact");
|
||||||
redactionLogEntry.setStatus(AnnotationStatus.REQUESTED);
|
redactionLogEntry.setStatus(AnnotationStatus.REQUESTED);
|
||||||
redactionLogEntry.setColor(getColor(getTypeFromTypeId(redactionLogEntry.getTypeId()), dossierTemplateId, true, redactionLogEntry
|
redactionLogEntry.setColor(getColor(redactionLogEntry.getType(), dossierTemplateId, true, redactionLogEntry
|
||||||
.isRedacted(), false));
|
.isRedacted(), false));
|
||||||
redactionLogEntry.setLegalBasis(manualForceRedact.getLegalBasis());
|
redactionLogEntry.setLegalBasis(manualForceRedact.getLegalBasis());
|
||||||
} else {
|
} else {
|
||||||
@ -191,7 +191,7 @@ public class RedactionLogMergeService {
|
|||||||
} else if (manualLegalBasisChange.getStatus().equals(AnnotationStatus.REQUESTED)) {
|
} else if (manualLegalBasisChange.getStatus().equals(AnnotationStatus.REQUESTED)) {
|
||||||
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", legal basis change requested");
|
manualOverrideReason = mergeReasonIfNecessary(redactionLogEntry.getReason(), ", legal basis change requested");
|
||||||
redactionLogEntry.setStatus(AnnotationStatus.REQUESTED);
|
redactionLogEntry.setStatus(AnnotationStatus.REQUESTED);
|
||||||
redactionLogEntry.setColor(getColor(getTypeFromTypeId(redactionLogEntry.getTypeId()), dossierTemplateId, true, redactionLogEntry
|
redactionLogEntry.setColor(getColor(redactionLogEntry.getType(), dossierTemplateId, true, redactionLogEntry
|
||||||
.isRedacted(), false));
|
.isRedacted(), false));
|
||||||
redactionLogEntry.setLegalBasisChangeValue(manualLegalBasisChange.getLegalBasis());
|
redactionLogEntry.setLegalBasisChangeValue(manualLegalBasisChange.getLegalBasis());
|
||||||
} else {
|
} else {
|
||||||
@ -258,13 +258,13 @@ public class RedactionLogMergeService {
|
|||||||
|
|
||||||
return RedactionLogEntry.builder()
|
return RedactionLogEntry.builder()
|
||||||
.id(id)
|
.id(id)
|
||||||
.color(getColorForManualAdd(getTypeFromTypeId(manualRedactionEntry.getTypeId()), dossierTemplateId, manualRedactionEntry.getStatus()))
|
.color(getColorForManualAdd(manualRedactionEntry.getType(), dossierTemplateId, manualRedactionEntry.getStatus()))
|
||||||
.reason(manualRedactionEntry.getReason())
|
.reason(manualRedactionEntry.getReason())
|
||||||
.isDictionaryEntry(manualRedactionEntry.isAddToDictionary())
|
.isDictionaryEntry(manualRedactionEntry.isAddToDictionary())
|
||||||
.isDossierDictionaryEntry(manualRedactionEntry.isAddToDossierDictionary())
|
.isDossierDictionaryEntry(manualRedactionEntry.isAddToDossierDictionary())
|
||||||
.legalBasis(manualRedactionEntry.getLegalBasis())
|
.legalBasis(manualRedactionEntry.getLegalBasis())
|
||||||
.value(manualRedactionEntry.getValue())
|
.value(manualRedactionEntry.getValue())
|
||||||
.typeId(manualRedactionEntry.getTypeId())
|
.type(manualRedactionEntry.getType())
|
||||||
.redacted(true)
|
.redacted(true)
|
||||||
.isHint(false)
|
.isHint(false)
|
||||||
.section(null)
|
.section(null)
|
||||||
@ -324,12 +324,6 @@ public class RedactionLogMergeService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getTypeFromTypeId(String typeId){
|
|
||||||
return typeId.split(":")[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -682,12 +682,6 @@ public class RedactionIntegrationTest {
|
|||||||
var redactionLog = redactionStorageService.getRedactionLog(TEST_DOSSIER_ID, TEST_FILE_ID);
|
var redactionLog = redactionStorageService.getRedactionLog(TEST_DOSSIER_ID, TEST_FILE_ID);
|
||||||
var text = redactionStorageService.getText(TEST_DOSSIER_ID, TEST_FILE_ID);
|
var text = redactionStorageService.getText(TEST_DOSSIER_ID, TEST_FILE_ID);
|
||||||
|
|
||||||
redactionLog.getRedactionLogEntry().forEach(entry -> {
|
|
||||||
if (entry.isImage()) {
|
|
||||||
System.out.println("---->" + entry.getTypeId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
|
|
||||||
System.out.println("first analysis duration: " + (end - start));
|
System.out.println("first analysis duration: " + (end - start));
|
||||||
@ -848,7 +842,7 @@ public class RedactionIntegrationTest {
|
|||||||
manualRedactionEntry.setAnnotationId(manualAddId);
|
manualRedactionEntry.setAnnotationId(manualAddId);
|
||||||
manualRedactionEntry.setFileId("fileId");
|
manualRedactionEntry.setFileId("fileId");
|
||||||
manualRedactionEntry.setStatus(AnnotationStatus.REQUESTED);
|
manualRedactionEntry.setStatus(AnnotationStatus.REQUESTED);
|
||||||
manualRedactionEntry.setTypeId("name:" + TEST_DOSSIER_TEMPLATE_ID);
|
manualRedactionEntry.setType("name");
|
||||||
manualRedactionEntry.setValue("O'Loughlin C.K.");
|
manualRedactionEntry.setValue("O'Loughlin C.K.");
|
||||||
manualRedactionEntry.setReason("Manual Redaction");
|
manualRedactionEntry.setReason("Manual Redaction");
|
||||||
manualRedactionEntry.setPositions(List.of(Rectangle
|
manualRedactionEntry.setPositions(List.of(Rectangle
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user