From 01c90ad4d6271666858bea158967bc1f90c1ce8f Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Thu, 27 Jun 2024 11:20:02 +0300 Subject: [PATCH] migration fixes --- .../java/eu/old/eudat/migration/DatasetMigrationService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java index 81b2bb01f..0512e8020 100644 --- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java +++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java @@ -460,7 +460,10 @@ public class DatasetMigrationService { } case SELECT -> { if(!this.conventionService.isNullOrEmpty(textValue)) { - String[] valuesParsed = migrationTools.tryParseJsonAsObjectString(String[].class, textValue); + String[] valuesParsed = null; + if (propertyValue instanceof List && ((List)propertyValue).stream().allMatch(x-> x instanceof String)) valuesParsed = ((List)propertyValue).stream().map(x-> (String)x).toList().toArray(String[]::new); + if (valuesParsed == null && propertyValue instanceof String[]) valuesParsed = (String[])propertyValue; + if (valuesParsed == null) valuesParsed = migrationTools.tryParseJsonAsObjectString(String[].class, textValue); fieldEntity.setTextListValue(valuesParsed == null ? List.of(textValue) : Arrays.stream(valuesParsed).toList()); } }