Merge branch 'RED-9843-master' into 'master'
Resolve RED-9843 "Master" Closes RED-9843 See merge request redactmanager/persistence-service!669
This commit is contained in:
commit
2c2347f5f0
@ -12,15 +12,15 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Setter
|
@Setter
|
||||||
@Service
|
@Service
|
||||||
public class AddTechnicalNameToJustifications20 extends Migration {
|
public class AddTechnicalNameToJustifications21 extends Migration {
|
||||||
|
|
||||||
private static final String NAME = "Migration to add a technical name to justifications";
|
private static final String NAME = "Migration to add a technical name to justifications";
|
||||||
private static final long VERSION = 20;
|
private static final long VERSION = 21;
|
||||||
@Autowired
|
@Autowired
|
||||||
private LegalBasisMigrationService legalBasisMigrationService;
|
private LegalBasisMigrationService legalBasisMigrationService;
|
||||||
|
|
||||||
|
|
||||||
public AddTechnicalNameToJustifications20() {
|
public AddTechnicalNameToJustifications21() {
|
||||||
|
|
||||||
super(NAME, VERSION);
|
super(NAME, VERSION);
|
||||||
}
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
package com.iqser.red.service.persistence.management.v1.processor.migration.migrations;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.iqser.red.service.persistence.management.v1.processor.migration.Migration;
|
||||||
|
import com.iqser.red.service.persistence.management.v1.processor.service.FileStatusService;
|
||||||
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.DossierPersistenceService;
|
||||||
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.WorkflowStatus;
|
||||||
|
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Setter
|
||||||
|
@Service
|
||||||
|
public class DocumineLayoutRewriteMigration20 extends Migration {
|
||||||
|
|
||||||
|
private static final String NAME = "Reanalyse layout for not approved Documine files";
|
||||||
|
private static final long VERSION = 20;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileStatusService fileStatusService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DossierPersistenceService dossierPersistenceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileStatusPersistenceService fileStatusPersistenceService;
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${application.type}")
|
||||||
|
private String applicationType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public DocumineLayoutRewriteMigration20() {
|
||||||
|
|
||||||
|
super(NAME, VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void migrate() {
|
||||||
|
|
||||||
|
if(!applicationType.equalsIgnoreCase("DocuMine")){
|
||||||
|
log.info("Skipping DocumineLayoutRewriteMigration20 as application type is not DocuMine!!!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dossiers = dossierPersistenceService.findAllDossiers();
|
||||||
|
dossiers.forEach(dossier -> {
|
||||||
|
if (dossier.getHardDeletedTime() == null) {
|
||||||
|
var files = fileStatusPersistenceService.getStatusesForDossier(dossier.getId());
|
||||||
|
log.info("Start migration of dossier {}", dossier.getId());
|
||||||
|
files.forEach(file -> {
|
||||||
|
if (file.getHardDeletedTime() == null && !file.getWorkflowStatus().equals(WorkflowStatus.APPROVED)) {
|
||||||
|
log.info("Set full reanalyse for file {}", file.getId());
|
||||||
|
fileStatusService.setStatusFullReprocess(dossier.getId(), file.getId(), false, true);
|
||||||
|
log.info("Finished migration of file {}", file.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
log.info("Finished migration of dossier {}", dossier.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user