RED-8702
This commit is contained in:
parent
bb8649d3e8
commit
1a11d3b509
@ -0,0 +1,54 @@
|
|||||||
|
package com.iqser.red.service.redaction.v1.server.mongo;
|
||||||
|
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.mongodb.core.mapping.Document;
|
||||||
|
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Document(collection = "entity-logs")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class EntityLogDocument {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private EntityLog entityLog;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
private long analysisVersion;
|
||||||
|
private int analysisNumber;
|
||||||
|
|
||||||
|
private List<EntityLogEntry> entityLogEntry = new ArrayList<>();
|
||||||
|
private List<EntityLogLegalBasis> legalBasis = new ArrayList<>();
|
||||||
|
|
||||||
|
private long dictionaryVersion = -1;
|
||||||
|
private long dossierDictionaryVersion = -1;
|
||||||
|
private long rulesVersion = -1;
|
||||||
|
private long legalBasisVersion = -1;
|
||||||
|
|
||||||
|
|
||||||
|
public EntityLogDocument(String id, EntityLog entityLog) {
|
||||||
|
|
||||||
|
this.id = id;
|
||||||
|
|
||||||
|
this.analysisVersion = entityLog.getAnalysisVersion();
|
||||||
|
this.analysisNumber = entityLog.getAnalysisNumber();
|
||||||
|
this.entityLogEntry = entityLog.getEntityLogEntry();
|
||||||
|
this.legalBasis = entityLog.getLegalBasis();
|
||||||
|
this.dictionaryVersion = entityLog.getDictionaryVersion();
|
||||||
|
this.dossierDictionaryVersion = entityLog.getDossierDictionaryVersion();
|
||||||
|
this.rulesVersion = entityLog.getRulesVersion();
|
||||||
|
this.legalBasisVersion = entityLog.getLegalBasisVersion();
|
||||||
|
|
||||||
|
} **/
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.iqser.red.service.redaction.v1.server.mongo;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.experimental.FieldDefaults;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class EntityLogDocumentService {
|
||||||
|
|
||||||
|
private final EntityLogDocumentRepository entityLogDocumentRepository;
|
||||||
|
|
||||||
|
|
||||||
|
public EntityLogDocumentService(EntityLogDocumentRepository entityLogDocumentRepository) {this.entityLogDocumentRepository = entityLogDocumentRepository;}
|
||||||
|
|
||||||
|
|
||||||
|
public EntityLogDocument saveEntityLogDocument(EntityLogDocument entityLogDocument) {
|
||||||
|
return entityLogDocumentRepository.save(entityLogDocument);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<EntityLogDocument> findEntityLogDocumentById(String id) {
|
||||||
|
return entityLogDocumentRepository.findById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean entityLogDocumentExists(String id) {
|
||||||
|
return entityLogDocumentRepository.existsById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.iqser.red.service.redaction.v1.server.mongo;
|
||||||
|
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.experimental.FieldDefaults;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class _EntityLogDocumentRepository {
|
||||||
|
|
||||||
|
MongoTemplate mongoTemplate;
|
||||||
|
|
||||||
|
public EntityLogDocument saveEntityLogDocument(EntityLogDocument entityLogDocument) {
|
||||||
|
return mongoTemplate.save(entityLogDocument);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityLogDocument findEntityLogDocumentById(String id) {
|
||||||
|
return mongoTemplate.findById(id, EntityLogDocument.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -39,6 +39,8 @@ import com.iqser.red.service.redaction.v1.server.model.dictionary.DictionaryIncr
|
|||||||
import com.iqser.red.service.redaction.v1.server.model.dictionary.DictionaryVersion;
|
import com.iqser.red.service.redaction.v1.server.model.dictionary.DictionaryVersion;
|
||||||
import com.iqser.red.service.redaction.v1.server.model.document.nodes.Document;
|
import com.iqser.red.service.redaction.v1.server.model.document.nodes.Document;
|
||||||
import com.iqser.red.service.redaction.v1.server.model.document.nodes.SemanticNode;
|
import com.iqser.red.service.redaction.v1.server.model.document.nodes.SemanticNode;
|
||||||
|
import com.iqser.red.service.redaction.v1.server.mongo.EntityLogDocument;
|
||||||
|
import com.iqser.red.service.redaction.v1.server.mongo.EntityLogDocumentService;
|
||||||
import com.iqser.red.service.redaction.v1.server.service.document.DocumentGraphMapper;
|
import com.iqser.red.service.redaction.v1.server.service.document.DocumentGraphMapper;
|
||||||
import com.iqser.red.service.redaction.v1.server.service.document.ImportedRedactionEntryService;
|
import com.iqser.red.service.redaction.v1.server.service.document.ImportedRedactionEntryService;
|
||||||
import com.iqser.red.service.redaction.v1.server.service.document.ManualRedactionEntryService;
|
import com.iqser.red.service.redaction.v1.server.service.document.ManualRedactionEntryService;
|
||||||
@ -79,6 +81,7 @@ public class AnalyzeService {
|
|||||||
ImportedRedactionEntryService importedRedactionEntryService;
|
ImportedRedactionEntryService importedRedactionEntryService;
|
||||||
ObservedStorageService observedStorageService;
|
ObservedStorageService observedStorageService;
|
||||||
FunctionTimerValues redactmanagerAnalyzePagewiseValues;
|
FunctionTimerValues redactmanagerAnalyzePagewiseValues;
|
||||||
|
EntityLogDocumentService entityLogDocumentService;
|
||||||
|
|
||||||
|
|
||||||
@Timed("redactmanager_reanalyze")
|
@Timed("redactmanager_reanalyze")
|
||||||
@ -255,8 +258,8 @@ public class AnalyzeService {
|
|||||||
Set<FileAttribute> addedFileAttributes) {
|
Set<FileAttribute> addedFileAttributes) {
|
||||||
|
|
||||||
EntityLog entityLog = entityLogChanges.getEntityLog();
|
EntityLog entityLog = entityLogChanges.getEntityLog();
|
||||||
|
entityLogDocumentService.saveEntityLogDocument(new EntityLogDocument(analyzeRequest.getFileId(), entityLog));
|
||||||
//redactionStorageService.storeObject(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), FileType.ENTITY_LOG, entityLogChanges.getEntityLog());
|
//redactionStorageService.storeObject(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), FileType.ENTITY_LOG, entityLogChanges.getEntityLog());
|
||||||
redactionStorageService.saveEntityLog(analyzeRequest.getDossierId(), analyzeRequest.getFileId(), entityLogChanges.getEntityLog());
|
|
||||||
|
|
||||||
log.info("Created entity log for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
log.info("Created entity log for file {} in dossier {}", analyzeRequest.getFileId(), analyzeRequest.getDossierId());
|
||||||
if (entityLogChanges.isHasChanges() || !isReanalysis) {
|
if (entityLogChanges.isHasChanges() || !isReanalysis) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user