From dbb3d15c06c0c806ebe5a6ae2d9c27d9524a1f00 Mon Sep 17 00:00:00 2001
From: juanf <juanf@ethz.ch>
Date: Wed, 20 Sep 2023 15:38:27 +0200
Subject: [PATCH] SSDM-13961: Allow blank versions

---
 .../server/xls/importer/helper/VocabularyImportHelper.java    | 4 ++--
 .../xls/importer/helper/VocabularyTermImportHelper.java       | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/helper/VocabularyImportHelper.java b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/helper/VocabularyImportHelper.java
index 5ac9dd9ba44..9e556c8bc2b 100644
--- a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/helper/VocabularyImportHelper.java
+++ b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/helper/VocabularyImportHelper.java
@@ -79,7 +79,7 @@ public class VocabularyImportHelper extends BasicImportHelper
         String version = getValueByColumnName(header, values, Attribute.Version);
         String code = getValueByColumnName(header, values, Attribute.Code);
 
-        if (version == null) {
+        if (version == null || version.isEmpty()) {
             return true;
         } else {
             return VersionUtils.isNewVersion(version, VersionUtils.getStoredVersion(versions, ImportTypes.VOCABULARY_TYPE.getType(), code));
@@ -91,7 +91,7 @@ public class VocabularyImportHelper extends BasicImportHelper
         String version = getValueByColumnName(header, values, Attribute.Version);
         String code = getValueByColumnName(header, values, Attribute.Code);
 
-        if (version == null) {
+        if (version == null || version.isEmpty()) {
             Integer storedVersion = VersionUtils.getStoredVersion(versions, ImportTypes.VOCABULARY_TYPE.getType(), code);
             storedVersion++;
             version = storedVersion.toString();
diff --git a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/helper/VocabularyTermImportHelper.java b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/helper/VocabularyTermImportHelper.java
index c84fd86a683..745363fea27 100644
--- a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/helper/VocabularyTermImportHelper.java
+++ b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/helper/VocabularyTermImportHelper.java
@@ -91,7 +91,7 @@ public class VocabularyTermImportHelper extends BasicImportHelper
         String version = getValueByColumnName(header, values, Attribute.Version);
         String code = getValueByColumnName(header, values, Attribute.Code);
 
-        if (version == null) {
+        if (version == null || version.isEmpty()) {
             return true;
         } else {
             return VersionUtils.isNewVersion(version,
@@ -104,7 +104,7 @@ public class VocabularyTermImportHelper extends BasicImportHelper
         String version = getValueByColumnName(header, values, Attribute.Version);
         String code = getValueByColumnName(header, values, Attribute.Code);
 
-        if (version == null) {
+        if (version == null || version.isEmpty()) {
             Integer storedVersion = VersionUtils.getStoredVersion(versions, ImportTypes.VOCABULARY_TERM.getType() + "-" + vocabularyCode, code);
             storedVersion++;
             version = storedVersion.toString();
-- 
GitLab