RED-8702: Explore document databases to store entityLog
* added experimental logic for mongodb integration
This commit is contained in:
parent
a2167b8325
commit
a6037f448d
@ -27,7 +27,6 @@ public class EntityLogDocument {
|
||||
private String id;
|
||||
|
||||
private String dossierId;
|
||||
|
||||
private String fileId;
|
||||
|
||||
private long analysisVersion;
|
||||
@ -36,10 +35,12 @@ public class EntityLogDocument {
|
||||
@DBRef
|
||||
@CascadeSave
|
||||
private List<EntityLogEntryDocument> entityLogEntryDocument = new ArrayList<>();
|
||||
|
||||
private List<EntityLogLegalBasis> legalBasis = new ArrayList<>();
|
||||
|
||||
private long dictionaryVersion = -1;
|
||||
private long dossierDictionaryVersion = -1;
|
||||
|
||||
private long rulesVersion = -1;
|
||||
private long legalBasisVersion = -1;
|
||||
|
||||
|
||||
@ -186,6 +186,29 @@ public class EntityLogMongoService {
|
||||
}
|
||||
|
||||
|
||||
public Optional<Integer> findLatestAnalysisNumber(String dossierId, String fileId) {
|
||||
|
||||
return entityLogDocumentRepository.findAnalysisNumberById(EntityLogDocument.getDocumentId(dossierId, fileId))
|
||||
.map(EntityLogDocument::getAnalysisNumber);
|
||||
}
|
||||
|
||||
|
||||
public List<EntityLogEntry> findAllEntityLogEntriesWithManualChanges(String dossierId, String fileId) {
|
||||
|
||||
return entityLogEntryDocumentRepository.findByEntityLogIdAndManualChangesNotEmpty(EntityLogDocument.getDocumentId(dossierId, fileId))
|
||||
.stream()
|
||||
.map(EntityLogMongoService::fromDocument)
|
||||
.toList();
|
||||
}
|
||||
public List<EntityLogEntry> findAllEntityLogEntriesByAnalysisNumber(String dossierId, String fileId, int analysisNumber) {
|
||||
|
||||
return entityLogEntryDocumentRepository.findByEntityLogIdAndChangesAnalysisNumber(EntityLogDocument.getDocumentId(dossierId, fileId), analysisNumber)
|
||||
.stream()
|
||||
.map(EntityLogMongoService::fromDocument)
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
private static EntityLog fromDocument(EntityLogDocument entityLogDocument) {
|
||||
|
||||
EntityLog entityLog = new EntityLog();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.iqser.red.service.redaction.v1.server.mongo;
|
||||
package com.iqser.red.service.redaction.v1.server.mongodeprecated;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@ -7,6 +7,9 @@ import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.redaction.v1.server.mongo.EntityLogDocument;
|
||||
import com.iqser.red.service.redaction.v1.server.mongo.EntityLogDocumentRepository;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
Loading…
x
Reference in New Issue
Block a user