migration changes
This commit is contained in:
parent
6b4424c634
commit
8dbf275f3a
|
@ -106,10 +106,21 @@ public class DatasetMigrationService {
|
|||
|
||||
List<DmpDescriptionTemplateEntity> itemDescriptionTemplates = descriptionTemplates.stream().filter(x-> x.getDescriptionTemplateGroupId().equals(item.getProfile().getGroupId()) && x.getDmpId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId)).toList();
|
||||
if (itemDescriptionTemplates.isEmpty()) {
|
||||
|
||||
logger.error("Migrate Dataset " + item.getId() + " cannot found DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
|
||||
if (descriptionTemplates.stream().filter(x-> x.getDmpId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId)).count() > 0) continue;
|
||||
throw new MyApplicationException("Migrate Dataset " + item.getId() + " cannot found DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
|
||||
if (descriptionTemplates.stream().filter(x-> x.getDmpId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId)).count() > 0) {
|
||||
DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = new DmpDescriptionTemplateEntity();
|
||||
dmpDescriptionTemplateEntity.setId(UUID.randomUUID());
|
||||
dmpDescriptionTemplateEntity.setDescriptionTemplateGroupId(item.getProfile().getGroupId());
|
||||
dmpDescriptionTemplateEntity.setDmpId(item.getDmp().getId());
|
||||
dmpDescriptionTemplateEntity.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
|
||||
dmpDescriptionTemplateEntity.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
|
||||
dmpDescriptionTemplateEntity.setSectionId(sectionId);
|
||||
dmpDescriptionTemplateEntity.setIsActive(IsActive.Active);
|
||||
this.entityManager.persist(dmpDescriptionTemplateEntity);
|
||||
itemDescriptionTemplates = List.of(dmpDescriptionTemplateEntity);
|
||||
} else {
|
||||
throw new MyApplicationException("Migrate Dataset " + item.getId() + " cannot found DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
|
||||
}
|
||||
}
|
||||
|
||||
if (itemDescriptionTemplates.size() > 1) {
|
||||
|
|
Loading…
Reference in New Issue