Small fix

This commit is contained in:
Thomas Georgios Giannos 2023-11-24 12:45:29 +02:00
parent e698b198e7
commit 58d224b739
1 changed files with 4 additions and 2 deletions

View File

@ -107,7 +107,7 @@ public class DmpDatasetProfileMigrationService {
DmpDescriptionTemplateEntity data = new DmpDescriptionTemplateEntity(); DmpDescriptionTemplateEntity data = new DmpDescriptionTemplateEntity();
data.setId(UUID.randomUUID()); data.setId(UUID.randomUUID());
data.setDescriptionTemplateId(item.getDatasetprofile().getId()); data.setDescriptionTemplateGroupId(item.getDatasetprofile().getId());
data.setDmpId(item.getDmp().getId()); data.setDmpId(item.getDmp().getId());
data.setCreatedAt(Instant.now()); data.setCreatedAt(Instant.now());
data.setUpdatedAt(Instant.now()); data.setUpdatedAt(Instant.now());
@ -130,8 +130,10 @@ public class DmpDatasetProfileMigrationService {
int page = 0; int page = 0;
DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class); DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class);
long total = dmpDescriptionTemplateQuery.count();
List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities; List<DmpDescriptionTemplateEntity> dmpDescriptionTemplateEntities;
do { do {
logger.debug("Checking " + page * PageSize + " of " + total);
dmpDescriptionTemplateQuery.setPage(new Paging(page * PageSize, PageSize)); dmpDescriptionTemplateQuery.setPage(new Paging(page * PageSize, PageSize));
dmpDescriptionTemplateEntities = dmpDescriptionTemplateQuery.collect(); dmpDescriptionTemplateEntities = dmpDescriptionTemplateQuery.collect();
@ -142,7 +144,7 @@ public class DmpDatasetProfileMigrationService {
continue; continue;
} }
if (currentEntity.getDmpId().equals(previousEntity.getDmpId()) if (currentEntity.getDmpId().equals(previousEntity.getDmpId())
&& currentEntity.getDescriptionTemplateId().equals(previousEntity.getDescriptionTemplateId()) && currentEntity.getDescriptionTemplateGroupId().equals(previousEntity.getDescriptionTemplateGroupId())
&& currentEntity.getSectionId().equals(previousEntity.getSectionId()) && currentEntity.getSectionId().equals(previousEntity.getSectionId())
) { ) {
logger.warn("Removing found duplicate DmpDescriptionTemplate entity ({}) after DmpDatasetProfiles migration", currentEntity.getId()); logger.warn("Removing found duplicate DmpDescriptionTemplate entity ({}) after DmpDatasetProfiles migration", currentEntity.getId());