This commit is contained in:
Efstratios Giannopoulos 2024-04-09 13:46:15 +03:00
parent 29836cf362
commit 74526f7927
1 changed files with 3 additions and 3 deletions

View File

@ -244,7 +244,7 @@ public class DescriptionServiceImpl implements DescriptionService {
DescriptionEntity data = this.entityManager.find(DescriptionEntity.class, model.getId());
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
//if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
DescriptionTemplateEntity oldDescriptionTemplateEntity = this.entityManager.find(DescriptionTemplateEntity.class, data.getDescriptionTemplateId());
if (oldDescriptionTemplateEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
@ -268,9 +268,9 @@ public class DescriptionServiceImpl implements DescriptionService {
data.setDescriptionTemplateId(latestVersionDescriptionTemplates.getFirst().getId());
eu.eudat.commons.types.descriptiontemplate.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(eu.eudat.commons.types.descriptiontemplate.DefinitionEntity.class, latestVersionDescriptionTemplates.getFirst().getDefinition());
PropertyDefinitionEntity propertyDefinition = this.xmlHandlingService.fromXmlSafe(PropertyDefinitionEntity.class, data.getProperties());
PropertyDefinitionEntity propertyDefinition = this.jsonHandlingService.fromJson(PropertyDefinitionEntity.class, data.getProperties());
data.setProperties(this.xmlHandlingService.toXml(this.cleanPropertyDefinitionEntity(propertyDefinition, definition)));
data.setProperties(this.jsonHandlingService.toJson(this.cleanPropertyDefinitionEntity(propertyDefinition, definition)));
data.setUpdatedAt(Instant.now());
this.entityManager.merge(data);