diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/metadata/location/MobileMarineLocation.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/metadata/location/MobileMarineLocation.java index 8902c562..4d78caf4 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/metadata/location/MobileMarineLocation.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/metadata/location/MobileMarineLocation.java @@ -1,6 +1,9 @@ package edu.colorado.cires.pace.data.object.dataset.base.metadata.location; import jakarta.validation.constraints.NotBlank; +import java.nio.file.Path; +import java.util.List; + import lombok.Builder; import lombok.Data; import lombok.extern.jackson.Jacksonized; @@ -15,7 +18,8 @@ public class MobileMarineLocation implements MarineLocation { private final String vessel; @NotBlank private final String locationDerivationDescription; - + + private final List fileList; // TODO: Add file list (List) @Override diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/metadata/location/translator/MobileMarineLocationTranslator.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/metadata/location/translator/MobileMarineLocationTranslator.java index 3337c0c5..375763cf 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/metadata/location/translator/MobileMarineLocationTranslator.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/metadata/location/translator/MobileMarineLocationTranslator.java @@ -12,6 +12,7 @@ public class MobileMarineLocationTranslator implements LocationDetailTranslator private final String seaArea; private final String vessel; private final String locationDerivationDescription; + private final String singleStringFiles; // TODO: Add file list mapping (String, value is semi-colon delimited): file-1.txt;file-2.txt;file-3.txt } diff --git a/pace-translator/src/main/java/edu/colorado/cires/pace/translator/converter/ConversionUtils.java b/pace-translator/src/main/java/edu/colorado/cires/pace/translator/converter/ConversionUtils.java index 4129ec57..9de28e3a 100644 --- a/pace-translator/src/main/java/edu/colorado/cires/pace/translator/converter/ConversionUtils.java +++ b/pace-translator/src/main/java/edu/colorado/cires/pace/translator/converter/ConversionUtils.java @@ -239,6 +239,12 @@ public static String stringFromMap(Map properties propertyFromMap(properties, propertyName) ); } + + public static String pathListFromMap(Map properties, String propertyName) { + return stringFromProperty( + propertyFromMap(properties, propertyName) + ); + } public static String stringFromProperty(ValueWithColumnNumber value) { return value.value() @@ -246,6 +252,16 @@ public static String stringFromProperty(ValueWithColumnNumber value) { .orElse(null); } + public static List pathListFromString(String string) { + if (string == null) + return null; + List strings = Arrays.asList(string.split(";")); + List paths = strings.stream() + .map(o -> Paths.get(o)) + .toList(); + return paths; + } + public static Double latitudeFromMap(Map properties, String propertyName, int row, RuntimeException runtimeException) { String latitudeString = stringFromMap(properties, propertyName); diff --git a/pace-translator/src/main/java/edu/colorado/cires/pace/translator/converter/PackageConverter.java b/pace-translator/src/main/java/edu/colorado/cires/pace/translator/converter/PackageConverter.java index e4fa46dc..2aafaef4 100644 --- a/pace-translator/src/main/java/edu/colorado/cires/pace/translator/converter/PackageConverter.java +++ b/pace-translator/src/main/java/edu/colorado/cires/pace/translator/converter/PackageConverter.java @@ -12,6 +12,7 @@ import static edu.colorado.cires.pace.translator.converter.ConversionUtils.stringFromProperty; import static edu.colorado.cires.pace.translator.converter.ConversionUtils.stringListFromMap; import static edu.colorado.cires.pace.translator.converter.ConversionUtils.uuidFromMap; +import static edu.colorado.cires.pace.translator.converter.ConversionUtils.pathListFromString; import edu.colorado.cires.pace.data.object.dataset.audio.AudioPackage; import edu.colorado.cires.pace.data.object.dataset.audio.CPODPackage; @@ -335,6 +336,7 @@ private static MobileMarineLocation mobileMarineLocationFromMap(MobileMarineLoca .locationDerivationDescription(stringFromMap(properties, mobileMarineLocationTranslator.getLocationDerivationDescription())) .vessel(stringFromMap(properties, mobileMarineLocationTranslator.getVessel())) .seaArea(stringFromMap(properties, mobileMarineLocationTranslator.getSeaArea())) + .fileList(pathListFromString(stringFromMap(properties, mobileMarineLocationTranslator.getSingleStringFiles()))) // TODO handle file lists here (split by ;) .build(); }