RED-8702: Explore document databases to store entityLog

* pre-test eval version
This commit is contained in:
maverickstuder 2024-03-20 10:49:54 +01:00
parent f766178c6d
commit 2d283d4d12
2 changed files with 12 additions and 2 deletions

View File

@ -56,8 +56,8 @@ public class EntityLogMongoService {
EntityLogDocument newEntityLogDocument = new EntityLogDocument(dossierId, fileId, entityLog); EntityLogDocument newEntityLogDocument = new EntityLogDocument(dossierId, fileId, entityLog);
List<EntityLogEntryDocument> newEntityLogEntryDocuments = newEntityLogDocument.getEntityLogEntryDocument(); List<EntityLogEntryDocument> newEntityLogEntryDocuments = newEntityLogDocument.getEntityLogEntryDocument();
List<EntityLogEntryDocument> toUpdate = new ArrayList<>(oldEntityLogEntryDocuments); List<EntityLogEntryDocument> toUpdate = new ArrayList<>(newEntityLogEntryDocuments);
toUpdate.retainAll(newEntityLogEntryDocuments); toUpdate.retainAll(oldEntityLogEntryDocuments);
List<EntityLogEntryDocument> toRemove = new ArrayList<>(oldEntityLogEntryDocuments); List<EntityLogEntryDocument> toRemove = new ArrayList<>(oldEntityLogEntryDocuments);
toRemove.removeAll(toUpdate); toRemove.removeAll(toUpdate);
@ -201,6 +201,7 @@ public class EntityLogMongoService {
EntityLogEntry entityLogEntry = new EntityLogEntry(); EntityLogEntry entityLogEntry = new EntityLogEntry();
MagicConverter.copyAllFields(entityLogEntryDocument, entityLogEntry); MagicConverter.copyAllFields(entityLogEntryDocument, entityLogEntry);
entityLogEntry.setId(entityLogEntryDocument.getEntryId());
return entityLogEntry; return entityLogEntry;
} }

View File

@ -44,6 +44,8 @@ import com.iqser.red.service.redaction.v1.server.client.DictionaryClient;
import com.iqser.red.service.redaction.v1.server.client.LegalBasisClient; import com.iqser.red.service.redaction.v1.server.client.LegalBasisClient;
import com.iqser.red.service.redaction.v1.server.client.RulesClient; import com.iqser.red.service.redaction.v1.server.client.RulesClient;
import com.iqser.red.service.redaction.v1.server.controller.RedactionController; import com.iqser.red.service.redaction.v1.server.controller.RedactionController;
import com.iqser.red.service.redaction.v1.server.mongo.EntityLogDocumentRepository;
import com.iqser.red.service.redaction.v1.server.mongo.EntityLogEntryDocumentRepository;
import com.iqser.red.service.redaction.v1.server.service.AnalyzeService; import com.iqser.red.service.redaction.v1.server.service.AnalyzeService;
import com.iqser.red.service.redaction.v1.server.service.UnprocessedChangesService; import com.iqser.red.service.redaction.v1.server.service.UnprocessedChangesService;
import com.iqser.red.service.redaction.v1.server.storage.RedactionStorageService; import com.iqser.red.service.redaction.v1.server.storage.RedactionStorageService;
@ -138,6 +140,11 @@ public abstract class AbstractRedactionIntegrationTest {
@Autowired @Autowired
protected UnprocessedChangesService unprocessedChangesService; protected UnprocessedChangesService unprocessedChangesService;
@Autowired
protected EntityLogDocumentRepository entityLogDocumentRepository;
@Autowired
protected EntityLogEntryDocumentRepository entityLogEntryDocumentRepository;
@MockBean @MockBean
protected RabbitTemplate rabbitTemplate; protected RabbitTemplate rabbitTemplate;
@ -179,6 +186,8 @@ public abstract class AbstractRedactionIntegrationTest {
if (this.storageService instanceof FileSystemBackedStorageService) { if (this.storageService instanceof FileSystemBackedStorageService) {
((FileSystemBackedStorageService) this.storageService).clearStorage(); ((FileSystemBackedStorageService) this.storageService).clearStorage();
} }
entityLogDocumentRepository.deleteAll();
entityLogEntryDocumentRepository.deleteAll();
} }