Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-06-26 12:00:53 +03:00
commit 42c7712763
20 changed files with 133 additions and 50 deletions

View File

@ -5,6 +5,7 @@ import org.opencdmp.commons.validation.BaseValidator;
import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.opencdmp.model.persist.dmpproperties.DmpContactPersist;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Scope;
@ -98,7 +99,11 @@ public class DmpUserPersist {
this.spec()
.iff(() -> !this.isNull(item.getSectionId()))
.must(() -> this.isValidGuid(item.getSectionId()))
.failOn(DmpUserPersist._sectionId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserPersist._sectionId}, LocaleContextHolder.getLocale()))
.failOn(DmpUserPersist._sectionId).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpUserPersist._sectionId}, LocaleContextHolder.getLocale())),
this.spec()
.iff(() -> !this.isEmpty(item.getEmail()))
.must(() -> this.isValidEmail(item.getEmail()))
.failOn(DmpUserPersist._email).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{DmpUserPersist._email}, LocaleContextHolder.getLocale()))
);
}
}

View File

@ -75,9 +75,6 @@ public class UserInviteToTenantRequestPersist {
this.spec()
.must(() -> !this.isEmpty(item.getEmail()))
.failOn(UserInviteToTenantRequestPersist._email).failWith(messageSource.getMessage("Validation_Required", new Object[]{UserInviteToTenantRequestPersist._email}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getTenantCode()))
.failOn(UserInviteToTenantRequestPersist._tenantCode).failWith(messageSource.getMessage("Validation_Required", new Object[]{UserInviteToTenantRequestPersist._tenantCode}, LocaleContextHolder.getLocale())),
this.spec()
.iff(() -> !this.isEmpty(item.getEmail()))
.must(() -> this.isValidEmail(item.getEmail()))

View File

@ -4,6 +4,7 @@ import org.opencdmp.commons.validation.BaseValidator;
import gr.cite.tools.validation.specification.Specification;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.opencdmp.model.persist.UserInviteToTenantRequestPersist;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Scope;
@ -71,6 +72,10 @@ public class DmpContactPersist {
this.spec()
.must(() -> !this.isEmpty(item.getEmail()))
.failOn(DmpContactPersist._email).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpContactPersist._email}, LocaleContextHolder.getLocale())),
this.spec()
.iff(() -> !this.isEmpty(item.getEmail()))
.must(() -> this.isValidEmail(item.getEmail()))
.failOn(DmpContactPersist._email).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{DmpContactPersist._email}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getFirstName()))
.failOn(DmpContactPersist._firstName).failWith(messageSource.getMessage("Validation_Required", new Object[]{DmpContactPersist._firstName}, LocaleContextHolder.getLocale())),

View File

@ -923,6 +923,8 @@ public class UserServiceImpl implements UserService {
public void sendUserToTenantInvitation(UserTenantUsersInviteRequest users) throws InvalidApplicationException, JAXBException {
this.authorizationService.authorizeForce(Permission.InviteTenantUser);
this.validatorFactory.validator(UserTenantUsersInviteRequest.UserTenantUsersInviteRequestValidator.class).validateForce(users);
TenantEntity tenantEntity = null;
String tenantName = null;
String tenantCode;

View File

@ -0,0 +1,43 @@
DO $$DECLARE
this_version CONSTANT varchar := '00.02.000';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
DROP TABLE public."DatasetDataRepository";
DROP TABLE public."DatasetExternalDataset";
DROP TABLE public."DatasetRegistry";
DROP TABLE public."DatasetService";
DROP TABLE public."Dataset";
DROP TABLE public."DMPDatasetProfile";
DROP TABLE public."DMPOrganisation";
DROP TABLE public."DMPResearcher";
DROP TABLE public."UserDMP";
DROP TABLE public."Invitation";
DROP TABLE public."DMP";
DROP TABLE public."DoiFunder";
DROP TABLE public."DataRepository";
DROP TABLE public."ExternalDataset";
DROP TABLE public."Project";
DROP TABLE public."Funder";
DROP TABLE public."Grant";
DROP TABLE public."Organisation";
DROP TABLE public."Registry";
DROP TABLE public."Researcher";
DROP TABLE public."Service";
DROP TABLE public."Content";
DROP TABLE public."Credential";
DROP TABLE public."EmailConfirmation";
DROP TABLE public."FileUpload";
DROP TABLE public."NotificationLegacy";
DROP TABLE public."UserAssociation";
DROP TABLE public."UserToken";
DROP TABLE public."UserInfo";
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.02.000', '2024-06-26 12:00:00.000000+02', now(), 'Remove unused tables.');
END$$;

View File

@ -19,7 +19,7 @@ export class UserTenantUsersInviteRequestEditorModel implements UserTenantUsersI
users: this.formBuilder.array(
(this.users ?? []).map(
(item, index) => item.buildForm({
rootPath: `userInviteToTenantRequest[${index}].`,
rootPath: `users[${index}].`,
disabled: disabled
})
), context.getValidation('users').validators
@ -30,7 +30,7 @@ export class UserTenantUsersInviteRequestEditorModel implements UserTenantUsersI
createValidationContext(): ValidationContext {
const baseContext: ValidationContext = new ValidationContext();
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'users', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'userInviteToTenantRequest')] });
baseValidationArray.push({ key: 'users', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'users')] });
baseContext.validation = baseValidationArray;
return baseContext;
@ -44,7 +44,7 @@ export class UserTenantUsersInviteRequestEditorModel implements UserTenantUsersI
formArray?.controls?.forEach(
(control, index) => UserInviteToTenantRequestEditorModel.reapplyValidators({
formGroup: control as UntypedFormGroup,
rootPath: `userInviteToTenantRequest[${index}].`,
rootPath: `users[${index}].`,
validationErrorModel: validationErrorModel
})
);

View File

@ -53,7 +53,7 @@ export class UserInviteToTenantDialogComponent extends BaseComponent implements
addUser(): void {
const formArray = this.formGroup.get("users") as UntypedFormArray;
const user: UserInviteToTenantRequestEditorModel = new UserInviteToTenantRequestEditorModel(this.editorModel.validationErrorModel);
formArray.push(user.buildForm({ rootPath: "userInviteToTenantRequest[" + formArray.length + "]." }));
formArray.push(user.buildForm({ rootPath: "users[" + formArray.length + "]." }));
}
removeUser(userIndex: number): void {
@ -92,13 +92,13 @@ export class UserInviteToTenantDialogComponent extends BaseComponent implements
}
onCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('DMP-USER-INVITATION-DIALOG.SUCCESS'), SnackBarNotificationLevel.Success);
this.uiNotificationService.snackBarNotification(this.language.instant('USER-INVITE-TO-TENANT-DIALOG.SUCCESS'), SnackBarNotificationLevel.Success);
}
onCallbackError(errorResponse: HttpErrorResponse) {
this.inProgressSendButton = false;
let errorOverrides = new Map<number, string>();
errorOverrides.set(-1, this.language.instant('DMP-USER-INVITATION-DIALOG.ERROR'));
errorOverrides.set(-1, this.language.instant('USER-INVITE-TO-TENANT-DIALOG.ERROR'));
this.httpErrorHandlingService.handleBackedRequestError(errorResponse, errorOverrides, SnackBarNotificationLevel.Error);
const error: HttpError = this.httpErrorHandlingService.getError(errorResponse);

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -2110,7 +2110,9 @@
"REMOVE-USER": "Remove User",
"INVITE": "Invite"
},
"USERS-REQUIRED": "Required at leat on user"
"USERS-REQUIRED": "Required at leat on user",
"SUCCESS": "Invitation Success",
"ERROR": "Invitation Error"
},
"USER-PROFILE": {
"MERGING-EMAILS-DIALOG": {

View File

@ -102,7 +102,7 @@ public class DescriptionTemplateXmlMigrationService {
logger.error("Migrate DescriptionTemplate " + item.getId() + " failed read xml");
throw new MyApplicationException("Migrate DescriptionTemplate " + item.getId() + " failed read xml");
}
item.setDefinition(this.xmlHandlingService.toXml(this.buildDefinitionEntity(viewStyleModel, referenceTypeEntityMap, knownReferenceEntities)));
item.setDefinition(this.xmlHandlingService.toXml(this.buildDefinitionEntity(viewStyleModel, referenceTypeEntityMap, knownReferenceEntities, item.getId())));
this.entityManager.merge(item);
}
@ -118,22 +118,22 @@ public class DescriptionTemplateXmlMigrationService {
this.entityManager.flush();
}
private @NotNull DefinitionEntity buildDefinitionEntity(ViewStyleModel persist, Map<String, ReferenceTypeEntity> referenceTypeEntityMap, Map<UUID, ReferenceTypeEntity> knownReferenceEntities) throws URISyntaxException {
private @NotNull DefinitionEntity buildDefinitionEntity(ViewStyleModel persist, Map<String, ReferenceTypeEntity> referenceTypeEntityMap, Map<UUID, ReferenceTypeEntity> knownReferenceEntities, UUID descriptionTemplateId) throws URISyntaxException {
DefinitionEntity data = new DefinitionEntity();
if (persist == null)
return data;
if (!this.conventionService.isListNullOrEmpty(persist.getPages())) {
Map<String, List<Section>> sectionPerPage = mapSectionsToPage(persist);
Map<String, List<Section>> sectionPerPage = mapSectionsToPage(persist, descriptionTemplateId);
data.setPages(new ArrayList<>());
for (Page pagePersist : persist.getPages()) {
data.getPages().add(this.buildPageEntity(pagePersist, sectionPerPage.get(pagePersist.getId().trim()), referenceTypeEntityMap, knownReferenceEntities));
data.getPages().add(this.buildPageEntity(pagePersist, sectionPerPage.get(pagePersist.getId().trim()), referenceTypeEntityMap, knownReferenceEntities, descriptionTemplateId));
}
}
return data;
}
private @NotNull SectionEntity buildSectionEntity(Section persist, Map<String, ReferenceTypeEntity> referenceTypeEntityMap, Map<UUID, ReferenceTypeEntity> knownReferenceEntities) throws URISyntaxException {
private @NotNull SectionEntity buildSectionEntity(Section persist, Map<String, ReferenceTypeEntity> referenceTypeEntityMap, Map<UUID, ReferenceTypeEntity> knownReferenceEntities, UUID descriptionTemplateId) throws URISyntaxException {
SectionEntity data = new SectionEntity();
if (persist == null)
return data;
@ -147,21 +147,21 @@ public class DescriptionTemplateXmlMigrationService {
if (!this.conventionService.isListNullOrEmpty(persist.getSections())) {
data.setSections(new ArrayList<>());
for (Section sectionPersist : persist.getSections()) {
data.getSections().add(this.buildSectionEntity(sectionPersist, referenceTypeEntityMap, knownReferenceEntities));
data.getSections().add(this.buildSectionEntity(sectionPersist, referenceTypeEntityMap, knownReferenceEntities, descriptionTemplateId));
}
}
if (!this.conventionService.isListNullOrEmpty(persist.getFieldSets())) {
data.setFieldSets(new ArrayList<>());
for (FieldSet fieldSetPersist : persist.getFieldSets()) {
data.getFieldSets().add(this.buildFieldSetEntity(fieldSetPersist, referenceTypeEntityMap, knownReferenceEntities));
data.getFieldSets().add(this.buildFieldSetEntity(fieldSetPersist, referenceTypeEntityMap, knownReferenceEntities, descriptionTemplateId));
}
}
return data;
}
private @NotNull FieldSetEntity buildFieldSetEntity(FieldSet persist, Map<String, ReferenceTypeEntity> referenceTypeEntityMap, Map<UUID, ReferenceTypeEntity> knownReferenceEntities) throws URISyntaxException {
private @NotNull FieldSetEntity buildFieldSetEntity(FieldSet persist, Map<String, ReferenceTypeEntity> referenceTypeEntityMap, Map<UUID, ReferenceTypeEntity> knownReferenceEntities, UUID descriptionTemplateId) throws URISyntaxException {
FieldSetEntity data = new FieldSetEntity();
if (persist == null)
return data;
@ -180,13 +180,13 @@ public class DescriptionTemplateXmlMigrationService {
if (!this.conventionService.isListNullOrEmpty(persist.getFields())) {
data.setFields(new ArrayList<>());
for (Field fieldPersist : persist.getFields()) {
data.getFields().add(this.buildFieldEntity(fieldPersist, referenceTypeEntityMap, knownReferenceEntities));
data.getFields().add(this.buildFieldEntity(fieldPersist, referenceTypeEntityMap, knownReferenceEntities, descriptionTemplateId));
}
}
return data;
}
private @NotNull FieldEntity buildFieldEntity(Field persist, Map<String, ReferenceTypeEntity> referenceTypeEntityMap, Map<UUID, ReferenceTypeEntity> knownReferenceEntities) throws URISyntaxException {
private @NotNull FieldEntity buildFieldEntity(Field persist, Map<String, ReferenceTypeEntity> referenceTypeEntityMap, Map<UUID, ReferenceTypeEntity> knownReferenceEntities, UUID descriptionTemplateId) throws URISyntaxException {
FieldEntity data = new FieldEntity();
if (persist == null)
return data;
@ -230,7 +230,7 @@ public class DescriptionTemplateXmlMigrationService {
}
}
if (persist.getDefaultValue() != null) data.setDefaultValue(this.buildDefaultValueEntity(persist.getDefaultValue(), data.getData().getFieldType()));
if (persist.getDefaultValue() != null) data.setDefaultValue(this.buildDefaultValueEntity(persist.getDefaultValue(), data.getData().getFieldType(), descriptionTemplateId));
if (persist.getVisible() != null && !this.conventionService.isListNullOrEmpty(persist.getVisible().getRules())) {
data.setVisibilityRules(new ArrayList<>());
for (Rule fieldPersist : persist.getVisible().getRules()) {
@ -402,7 +402,7 @@ public class DescriptionTemplateXmlMigrationService {
return data;
}
private @NotNull DefaultValueEntity buildDefaultValueEntity(DefaultValue persist, FieldType fieldType) {
private @NotNull DefaultValueEntity buildDefaultValueEntity(DefaultValue persist, FieldType fieldType, UUID descriptionTemplateId) {
DefaultValueEntity data = new DefaultValueEntity();
if (persist == null)
return data;
@ -439,9 +439,9 @@ public class DescriptionTemplateXmlMigrationService {
case UPLOAD -> throw new NotSupportedException("Upload validator not supported");
case TAGS -> throw new NotSupportedException("Tags validator not supported");
case INTERNAL_ENTRIES_DMPS -> throw new NotSupportedException("INTERNAL_ENTRIES_DMPS validator not supported");
case INTERNAL_ENTRIES_DESCRIPTIONS -> throw new NotSupportedException("INTERNAL_ENTRIES_DESCRIPTIONS validator not supported");
case REFERENCE_TYPES -> throw new NotSupportedException("REFERENCE_TYPES validator not supported");
case INTERNAL_ENTRIES_DMPS -> throw new NotSupportedException("INTERNAL_ENTRIES_DMPS validator not supported for description template " + descriptionTemplateId);
case INTERNAL_ENTRIES_DESCRIPTIONS -> throw new NotSupportedException("INTERNAL_ENTRIES_DESCRIPTIONS validator not supported for description template " + descriptionTemplateId);
case REFERENCE_TYPES -> throw new NotSupportedException("REFERENCE_TYPES validator not supported for description template " + descriptionTemplateId);
default -> throw new MyApplicationException("unrecognized type " + fieldType);
}
return data;
@ -514,7 +514,7 @@ public class DescriptionTemplateXmlMigrationService {
private @NotNull PageEntity buildPageEntity(Page persist, List<Section> sections, Map<String, ReferenceTypeEntity> referenceTypeEntityMap, Map<UUID, ReferenceTypeEntity> knownReferenceEntities) throws URISyntaxException {
private @NotNull PageEntity buildPageEntity(Page persist, List<Section> sections, Map<String, ReferenceTypeEntity> referenceTypeEntityMap, Map<UUID, ReferenceTypeEntity> knownReferenceEntities, UUID descriptionTemplateId) throws URISyntaxException {
PageEntity data = new PageEntity();
if (persist == null)
return data;
@ -526,14 +526,14 @@ public class DescriptionTemplateXmlMigrationService {
if (!this.conventionService.isListNullOrEmpty(sections)) {
data.setSections(new ArrayList<>());
for (Section sectionPersist : sections) {
data.getSections().add(this.buildSectionEntity(sectionPersist, referenceTypeEntityMap, knownReferenceEntities));
data.getSections().add(this.buildSectionEntity(sectionPersist, referenceTypeEntityMap, knownReferenceEntities, descriptionTemplateId));
}
}
return data;
}
private Map<String, List<Section>> mapSectionsToPage(ViewStyleModel persist){
private Map<String, List<Section>> mapSectionsToPage(ViewStyleModel persist, UUID descriptionTemplateId){
List<String> mappedSectionsIds = new ArrayList<>();
Map<String, List<Section>> sectionPerPage = new HashMap<>();
if (persist == null || persist.getPages() == null || persist.getSections() == null) return sectionPerPage;
@ -550,7 +550,7 @@ public class DescriptionTemplateXmlMigrationService {
}
for (Section section : persist.getSections()){
if (!mappedSectionsIds.contains(section.getId().trim())) throw new MyApplicationException("Orphan section found " + section.getId().trim());
if (!mappedSectionsIds.contains(section.getId().trim())) throw new MyApplicationException("Orphan section found " + section.getId().trim() + " for description template " + descriptionTemplateId);
}
return sectionPerPage;

View File

@ -39,6 +39,9 @@ import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneOffset;
import java.time.format.DateTimeParseException;
import java.util.*;
import java.util.stream.Collectors;
@ -105,7 +108,7 @@ public class DmpMigrationService {
for (DMP item : items) {
//entityManager.detach(item);
org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definitionEntity = blueprintDefinitionMap.get(item.getId());
org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definitionEntity = blueprintDefinitionMap.get(item.getProfile().getId());
DataManagementPlan model = new DataManagementPlan();
model.fromDataModel(item);
List<DMP> itemGroupDmps = groupDmpMap.get(item.getGroupId());
@ -180,10 +183,16 @@ public class DmpMigrationService {
DmpBlueprintValueEntity valueEntity = new DmpBlueprintValueEntity();
valueEntity.setFieldId(UUID.fromString(key));
org.opencdmp.commons.types.dmpblueprint.FieldEntity fieldEntity = this.getFieldOfId(definitionEntity, valueEntity.getFieldId());
if (fieldEntity != null && fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.Extra)){
if (fieldEntity != null && val != null && fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.Extra)){
ExtraFieldEntity extraFieldEntity = (ExtraFieldEntity) fieldEntity;
switch (extraFieldEntity.getType()){
case Date -> valueEntity.setDateValue(Instant.parse((String) val));
case Date -> {
try {
valueEntity.setDateValue(Instant.parse((String) val));
} catch (DateTimeParseException ex) {
valueEntity.setDateValue(LocalDate.parse((String) val).atStartOfDay().toInstant(ZoneOffset.UTC));
}
}
case RichTex, Text -> valueEntity.setValue((String) val);
case Number -> valueEntity.setNumberValue(Double.parseDouble((String) val));
default -> throw new MyApplicationException("unrecognized type " + extraFieldEntity.getType().getValue());