RED-8702: Explore document databases to store entityLog

* refactoring
This commit is contained in:
maverickstuder 2024-03-19 15:30:32 +01:00
parent 4bdbb61aa1
commit 24ef24c5c9
2 changed files with 7 additions and 32 deletions

View File

@ -9,6 +9,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
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.EntityLogLegalBasis;
import com.knecon.fforesight.databasetenantcommons.providers.utils.MagicConverter;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
@ -50,19 +51,13 @@ public class EntityLogDocument {
public EntityLogDocument(String dossierId, String fileId, EntityLog entityLog) {
MagicConverter.copyAllFields(entityLog, this);
this.id = getDocumentId(dossierId, fileId);
this.dossierId = dossierId;
this.fileId = fileId;
this.analysisVersion = entityLog.getAnalysisVersion();
this.analysisNumber = entityLog.getAnalysisNumber();
this.entityLogEntryDocument = new ArrayList<>(entityLog.getEntityLogEntry()
.stream()
.map(entityLogEntry -> new EntityLogEntryDocument(this.id, entityLogEntry)).toList());
this.legalBasis = entityLog.getLegalBasis();
this.dictionaryVersion = entityLog.getDictionaryVersion();
this.dossierDictionaryVersion = entityLog.getDossierDictionaryVersion();
this.rulesVersion = entityLog.getRulesVersion();
this.legalBasisVersion = entityLog.getLegalBasisVersion();
}

View File

@ -8,6 +8,7 @@ import java.util.Set;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import com.fasterxml.jackson.databind.ObjectMapper;
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.Engine;
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLogEntry;
@ -15,6 +16,7 @@ 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.EntryType;
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.ManualChange;
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Position;
import com.knecon.fforesight.databasetenantcommons.providers.utils.MagicConverter;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
@ -81,34 +83,12 @@ public class EntityLogEntryDocument {
public EntityLogEntryDocument(String entityLogId, EntityLogEntry entityLogEntry) {
MagicConverter.copyAllFields(entityLogEntry, this);
this.id = entityLogId + "/" + entityLogEntry.getId();
this.entryId = entityLogEntry.getId();
this.entityLogId = entityLogId;
this.type = entityLogEntry.getType();
this.entryType = entityLogEntry.getEntryType();
this.state = entityLogEntry.getState();
this.value = entityLogEntry.getValue();
this.reason = entityLogEntry.getReason();
this.matchedRule = entityLogEntry.getMatchedRule();
this.legalBasis = entityLogEntry.getLegalBasis();
this.containingNodeId = new ArrayList<>(entityLogEntry.getContainingNodeId());
this.closestHeadline = entityLogEntry.getClosestHeadline();
this.section = entityLogEntry.getSection();
this.positions = new ArrayList<>(entityLogEntry.getPositions());
this.textBefore = entityLogEntry.getTextBefore();
this.textAfter = entityLogEntry.getTextAfter();
this.startOffset = entityLogEntry.getStartOffset();
this.endOffset = entityLogEntry.getEndOffset();
this.imageHasTransparency = entityLogEntry.isImageHasTransparency();
this.dictionaryEntry = entityLogEntry.isDictionaryEntry();
this.dossierDictionaryEntry = entityLogEntry.isDossierDictionaryEntry();
this.excluded = entityLogEntry.isExcluded();
this.changes = new ArrayList<>(entityLogEntry.getChanges());
this.manualChanges = new ArrayList<>(entityLogEntry.getManualChanges());
this.engines = new HashSet<>(entityLogEntry.getEngines());
this.reference = new HashSet<>(entityLogEntry.getReference());
this.importedRedactionIntersections = new HashSet<>(entityLogEntry.getImportedRedactionIntersections());
this.numberOfComments = entityLogEntry.getNumberOfComments();
}
}