From a3defc575390610bb0607efeb969440ad937b49d Mon Sep 17 00:00:00 2001 From: paytoncain Date: Fri, 2 Aug 2024 10:11:30 -0600 Subject: [PATCH] Add data collection name as additional unique value for packages --- .../dataset/AudioPackageCommandTest.java | 5 +- .../command/dataset/PackageCommandTest.java | 62 ++++-- .../translator/AudioPackageTranslator.java | 1 + .../translator/CPODPackageTranslator.java | 1 + .../data/object/dataset/base/BasePackage.java | 16 +- .../data/object/dataset/base/Package.java | 4 +- .../base/translator/PackageTranslator.java | 1 + .../DetectionsPackageTranslator.java | 1 + .../SoundClipsPackageTranslator.java | 1 + .../SoundLevelMetricsPackageTranslator.java | 1 + ...undPropagationModelsPackageTranslator.java | 1 + .../validation/ValidPackageIdentifiers.java | 58 +++++ .../ValidPackageIdentifiersValidatorTest.java | 206 ++++++++++++++++++ .../cires/pace/packaging/PackageInflator.java | 6 + .../pace/packaging/PackageInflatorTest.java | 12 + .../repository/PackageRepositoryTest.java | 14 +- .../converter/PackageConverter.java | 6 + .../converter/PackageConverterTest.java | 20 +- 18 files changed, 381 insertions(+), 35 deletions(-) create mode 100644 pace-data/src/main/java/edu/colorado/cires/pace/data/validation/ValidPackageIdentifiers.java create mode 100644 pace-data/src/test/java/edu/colorado/cires/pace/data/validation/ValidPackageIdentifiersValidatorTest.java diff --git a/pace-cli/src/test/java/edu/colorado/cires/pace/cli/command/dataset/AudioPackageCommandTest.java b/pace-cli/src/test/java/edu/colorado/cires/pace/cli/command/dataset/AudioPackageCommandTest.java index 6fc4da2f..126b86e4 100644 --- a/pace-cli/src/test/java/edu/colorado/cires/pace/cli/command/dataset/AudioPackageCommandTest.java +++ b/pace-cli/src/test/java/edu/colorado/cires/pace/cli/command/dataset/AudioPackageCommandTest.java @@ -508,8 +508,9 @@ public AudioPackage createObject(String uniqueField, boolean withUUID) { .calibrationDocumentsPath(testPath.resolve("calibrationDocumentsPath").toAbsolutePath()) .navigationPath(testPath.resolve("navigationPath").toAbsolutePath()) .sourcePath(testPath.resolve("sourcePath").toAbsolutePath()) - .siteOrCruiseName("siteOrCruiseName") + .siteOrCruiseName(uniqueField) .deploymentId(uniqueField) + .dataCollectionName(uniqueField) .datasetPackager(datasetPackager.getName()) .projects(List.of(project.getName())) .publicReleaseDate(LocalDate.of(2020, 1,1)) @@ -606,6 +607,8 @@ public AudioPackage createObject(String uniqueField, boolean withUUID) { protected AudioPackage updateObject(AudioPackage original, String uniqueField) { return original.toBuilder() .deploymentId(uniqueField) + .siteOrCruiseName(uniqueField) + .dataCollectionName(uniqueField) .build(); } } diff --git a/pace-cli/src/test/java/edu/colorado/cires/pace/cli/command/dataset/PackageCommandTest.java b/pace-cli/src/test/java/edu/colorado/cires/pace/cli/command/dataset/PackageCommandTest.java index 044adc1f..f1a51149 100644 --- a/pace-cli/src/test/java/edu/colorado/cires/pace/cli/command/dataset/PackageCommandTest.java +++ b/pace-cli/src/test/java/edu/colorado/cires/pace/cli/command/dataset/PackageCommandTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; @@ -66,6 +67,7 @@ protected String getUniqueFieldCommandSuffix() { protected String[] getTranslatorFields() { List fields = new ArrayList<>(List.of( "UUID", + "dataCollectionName", "timeZone", "temperaturePath", "biologicalPath", @@ -105,6 +107,7 @@ protected T createTranslator(String name) { PackageTranslator packageTranslator = PackageTranslator.builder() .name(name) .packageUUID("UUID") + .dataCollectionName("dataCollectionName") .temperaturePath("temperaturePath") .biologicalPath("biologicalPath") .otherPath("otherPath") @@ -156,6 +159,7 @@ protected T createTranslator(String name) { protected String[] objectToRow(P object) { List fields = new ArrayList<>(List.of( object.getUuid() == null ? "" : object.getUuid().toString(), + object.getDataCollectionName(), "UTC", object.getTemperaturePath().toString(), object.getBiologicalPath().toString(), @@ -237,6 +241,7 @@ protected void assertObjectsEqual(P expected, P actual, boolean checkUUID) throw assertEquals(expected.getSiteOrCruiseName(), actual.getSiteOrCruiseName()); assertEquals(expected.getDeploymentId(), actual.getDeploymentId()); assertEquals(expected.getDatasetPackager(), actual.getDatasetPackager()); + assertEquals(expected.getDataCollectionName(), actual.getDataCollectionName()); for (int i = 0; i < expected.getProjects().size(); i++) { assertEquals( @@ -326,22 +331,22 @@ void testPackage(boolean useSavedObject) throws IOException { execute("package", "process", packageFile.toString(), outputDirectory.toString()); Set expectedPaths = Set.of( - "target/test-dir/output/project 1_siteOrCruiseName_test/bagit.txt", - "target/test-dir/output/project 1_siteOrCruiseName_test/bag-info.txt", - "target/test-dir/output/project 1_siteOrCruiseName_test/process.log", - "target/test-dir/output/project 1_siteOrCruiseName_test/tagmanifest-sha256.txt", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/nav_files/navigationPath.txt", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/calibration/calibrationDocumentsPath.txt", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/project 1_siteOrCruiseName_test.json", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/other/otherPath.txt", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/organizations.json", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/docs/documentsPath.txt", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/projects.json", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/acoustic_files/sourcePath.txt", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/biological/biologicalPath.txt", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/people.json", - "target/test-dir/output/project 1_siteOrCruiseName_test/data/temperature/temperaturePath.txt", - "target/test-dir/output/project 1_siteOrCruiseName_test/manifest-sha256.txt" + "target/test-dir/output/test/bagit.txt", + "target/test-dir/output/test/bag-info.txt", + "target/test-dir/output/test/process.log", + "target/test-dir/output/test/tagmanifest-sha256.txt", + "target/test-dir/output/test/data/nav_files/navigationPath.txt", + "target/test-dir/output/test/data/calibration/calibrationDocumentsPath.txt", + "target/test-dir/output/test/data/test.json", + "target/test-dir/output/test/data/other/otherPath.txt", + "target/test-dir/output/test/data/organizations.json", + "target/test-dir/output/test/data/docs/documentsPath.txt", + "target/test-dir/output/test/data/projects.json", + "target/test-dir/output/test/data/acoustic_files/sourcePath.txt", + "target/test-dir/output/test/data/biological/biologicalPath.txt", + "target/test-dir/output/test/data/people.json", + "target/test-dir/output/test/data/temperature/temperaturePath.txt", + "target/test-dir/output/test/manifest-sha256.txt" ); Set actualPaths = Files.walk(outputDirectory.toPath()) @@ -411,9 +416,26 @@ void testCreateValidationException() throws IOException { ), exception.message()); ArrayList detail = (ArrayList) exception.detail(); - assertEquals(1, detail.size()); - Map map = (Map) detail.get(0); - assertEquals("deploymentId", map.get("field")); - assertEquals("must not be blank", map.get("message")); + assertEquals(3, detail.size()); + + Map map = detail.stream() + .map(o -> (Map) o) + .collect(Collectors.toMap( + d -> (String) d.get("field"), + d -> (String) d.get("message") + )); + + assertEquals(3, map.keySet().size()); + + assertEquals( + Set.of("deploymentId","siteOrCruiseName","dataCollectionName"), + map.keySet() + ); + + assertTrue( + map.values().stream().allMatch( + v -> v.equals("at least dataCollectionName, siteOrCruiseName, or deploymentId required") + ) + ); } } \ No newline at end of file diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/audio/translator/AudioPackageTranslator.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/audio/translator/AudioPackageTranslator.java index b6cd9692..566a6473 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/audio/translator/AudioPackageTranslator.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/audio/translator/AudioPackageTranslator.java @@ -16,6 +16,7 @@ public class AudioPackageTranslator extends AudioDataPackageTranslator { return AudioPackageTranslator .builder() .uuid(packageTranslator.getUuid()) + .dataCollectionName(packageTranslator.getDataCollectionName()) .name(packageTranslator.getName()) .packageUUID(packageTranslator.getPackageUUID()) .temperaturePath(packageTranslator.getTemperaturePath()) diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/audio/translator/CPODPackageTranslator.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/audio/translator/CPODPackageTranslator.java index a0a5f071..531e0fc1 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/audio/translator/CPODPackageTranslator.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/audio/translator/CPODPackageTranslator.java @@ -15,6 +15,7 @@ public class CPODPackageTranslator extends AudioDataPackageTranslator { public static CPODPackageTranslatorBuilder toBuilder(PackageTranslator packageTranslator) { return CPODPackageTranslator.builder() .uuid(packageTranslator.getUuid()) + .dataCollectionName(packageTranslator.getDataCollectionName()) .name(packageTranslator.getName()) .packageUUID(packageTranslator.getPackageUUID()) .temperaturePath(packageTranslator.getTemperaturePath()) diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/BasePackage.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/BasePackage.java index 96153a11..806966bb 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/BasePackage.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/BasePackage.java @@ -19,6 +19,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.SuperBuilder; +import org.apache.commons.lang3.StringUtils; @Data @EqualsAndHashCode @@ -38,10 +39,12 @@ public abstract class BasePackage implements AbstractObject, TimeRange, Calib @NotNull private final Path sourcePath; - @NotBlank + private final String dataCollectionName; private final String siteOrCruiseName; - @NotBlank private final String deploymentId; + @NotNull + protected abstract List<@NotNull @Valid T> getProjects(); + @NotNull private final LocalDate publicReleaseDate; @NotNull @Valid @@ -67,9 +70,6 @@ public abstract class BasePackage implements AbstractObject, TimeRange, Calib @NotNull @NotEmpty protected abstract List<@NotNull @Valid T> getScientists(); - @NotNull - @NotEmpty - protected abstract List<@NotNull @Valid T> getProjects(); @NotNull @NotEmpty protected abstract List<@NotNull @Valid T> getSponsors(); @NotNull @NotEmpty @@ -89,6 +89,10 @@ public String getUniqueField() { @JsonIgnore public String getPackageId() { + if (StringUtils.isNotBlank(dataCollectionName)) { + return dataCollectionName; + } + String packageId = null; List projects = getProjects() == null ? Collections.emptyList() : getProjectNames(); @@ -117,7 +121,7 @@ public String getPackageId() { ); } } - + return packageId; } diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/Package.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/Package.java index e54a48ef..c510b033 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/Package.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/Package.java @@ -12,6 +12,7 @@ import edu.colorado.cires.pace.data.object.dataset.soundClips.SoundClipsPackage; import edu.colorado.cires.pace.data.object.dataset.soundLevelMetrics.SoundLevelMetricsPackage; import edu.colorado.cires.pace.data.object.dataset.soundPropagationModels.SoundPropagationModelsPackage; +import edu.colorado.cires.pace.data.validation.ValidPackageIdentifiers; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; @@ -33,12 +34,13 @@ @Data @EqualsAndHashCode(callSuper = true) @SuperBuilder(toBuilder = true) +@ValidPackageIdentifiers public abstract class Package extends BasePackage { @NotBlank private final String datasetPackager; @NotEmpty @NotNull private final List<@NotBlank String> scientists; - @NotNull @NotEmpty + @NotNull private final List<@NotBlank String> projects; @NotNull @NotEmpty private final List<@NotBlank String> sponsors; diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/translator/PackageTranslator.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/translator/PackageTranslator.java index 1e814bd0..a5547ecf 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/translator/PackageTranslator.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/base/translator/PackageTranslator.java @@ -15,6 +15,7 @@ @SuperBuilder(toBuilder = true) public class PackageTranslator extends Translator { private final String packageUUID; + private final String dataCollectionName; private final String temperaturePath; private final String biologicalPath; private final String otherPath; diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/detections/translator/DetectionsPackageTranslator.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/detections/translator/DetectionsPackageTranslator.java index 00ada091..a72b32c7 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/detections/translator/DetectionsPackageTranslator.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/detections/translator/DetectionsPackageTranslator.java @@ -21,6 +21,7 @@ public class DetectionsPackageTranslator extends SoundAnalysisPackageTranslator public static DetectionsPackageTranslatorBuilder toBuilder(PackageTranslator packageTranslator) { return DetectionsPackageTranslator.builder() .uuid(packageTranslator.getUuid()) + .dataCollectionName(packageTranslator.getDataCollectionName()) .name(packageTranslator.getName()) .packageUUID(packageTranslator.getPackageUUID()) .temperaturePath(packageTranslator.getTemperaturePath()) diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundClips/translator/SoundClipsPackageTranslator.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundClips/translator/SoundClipsPackageTranslator.java index 88e1bbae..2276c2ba 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundClips/translator/SoundClipsPackageTranslator.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundClips/translator/SoundClipsPackageTranslator.java @@ -16,6 +16,7 @@ public class SoundClipsPackageTranslator extends SoftwareDependentPackageTransla public static SoundClipsPackageTranslatorBuilder toBuilder(PackageTranslator packageTranslator) { return SoundClipsPackageTranslator.builder() .uuid(packageTranslator.getUuid()) + .dataCollectionName(packageTranslator.getDataCollectionName()) .name(packageTranslator.getName()) .packageUUID(packageTranslator.getPackageUUID()) .temperaturePath(packageTranslator.getTemperaturePath()) diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundLevelMetrics/translator/SoundLevelMetricsPackageTranslator.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundLevelMetrics/translator/SoundLevelMetricsPackageTranslator.java index fd66e60a..081ea504 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundLevelMetrics/translator/SoundLevelMetricsPackageTranslator.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundLevelMetrics/translator/SoundLevelMetricsPackageTranslator.java @@ -23,6 +23,7 @@ public class SoundLevelMetricsPackageTranslator extends SoundAnalysisPackageTran public static SoundLevelMetricsPackageTranslatorBuilder toBuilder(PackageTranslator packageTranslator) { return SoundLevelMetricsPackageTranslator.builder() .uuid(packageTranslator.getUuid()) + .dataCollectionName(packageTranslator.getDataCollectionName()) .name(packageTranslator.getName()) .packageUUID(packageTranslator.getPackageUUID()) .temperaturePath(packageTranslator.getTemperaturePath()) diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundPropagationModels/translator/SoundPropagationModelsPackageTranslator.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundPropagationModels/translator/SoundPropagationModelsPackageTranslator.java index ab67d534..ac287b2d 100644 --- a/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundPropagationModels/translator/SoundPropagationModelsPackageTranslator.java +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/object/dataset/soundPropagationModels/translator/SoundPropagationModelsPackageTranslator.java @@ -22,6 +22,7 @@ public class SoundPropagationModelsPackageTranslator extends SoftwareDependentPa public static SoundPropagationModelsPackageTranslatorBuilder toBuilder(PackageTranslator packageTranslator) { return SoundPropagationModelsPackageTranslator.builder() .uuid(packageTranslator.getUuid()) + .dataCollectionName(packageTranslator.getDataCollectionName()) .name(packageTranslator.getName()) .packageUUID(packageTranslator.getPackageUUID()) .temperaturePath(packageTranslator.getTemperaturePath()) diff --git a/pace-data/src/main/java/edu/colorado/cires/pace/data/validation/ValidPackageIdentifiers.java b/pace-data/src/main/java/edu/colorado/cires/pace/data/validation/ValidPackageIdentifiers.java new file mode 100644 index 00000000..97d87d81 --- /dev/null +++ b/pace-data/src/main/java/edu/colorado/cires/pace/data/validation/ValidPackageIdentifiers.java @@ -0,0 +1,58 @@ +package edu.colorado.cires.pace.data.validation; + +import edu.colorado.cires.pace.data.object.dataset.base.Package; +import edu.colorado.cires.pace.data.validation.ValidPackageIdentifiers.ValidPackageIdentifiersValidator; +import jakarta.validation.Constraint; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; +import jakarta.validation.Payload; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.apache.commons.lang3.StringUtils; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Constraint(validatedBy = ValidPackageIdentifiersValidator.class) +@Documented +public @interface ValidPackageIdentifiers { + + String message() default "at least dataCollectionName, siteOrCruiseName, or deploymentId required"; + Class[] groups() default {}; + Class[] payload() default {}; + + class ValidPackageIdentifiersValidator implements ConstraintValidator { + + @Override + public boolean isValid(Package aPackage, ConstraintValidatorContext context) { + String dataCollectionName = aPackage.getDataCollectionName(); + String siteOrCruiseName = aPackage.getSiteOrCruiseName(); + String deploymentId = aPackage.getDeploymentId(); + + if ( + StringUtils.isBlank(dataCollectionName) && + StringUtils.isBlank(siteOrCruiseName) && + StringUtils.isBlank(deploymentId) + ) { + context.disableDefaultConstraintViolation(); + String message = "at least dataCollectionName, siteOrCruiseName, or deploymentId required"; + context.buildConstraintViolationWithTemplate(message) + .addPropertyNode("dataCollectionName") + .addConstraintViolation(); + context.buildConstraintViolationWithTemplate(message) + .addPropertyNode("siteOrCruiseName") + .addConstraintViolation(); + context.buildConstraintViolationWithTemplate(message) + .addPropertyNode("deploymentId") + .addConstraintViolation(); + + return false; + } + + return true; + } + } + +} diff --git a/pace-data/src/test/java/edu/colorado/cires/pace/data/validation/ValidPackageIdentifiersValidatorTest.java b/pace-data/src/test/java/edu/colorado/cires/pace/data/validation/ValidPackageIdentifiersValidatorTest.java new file mode 100644 index 00000000..64c47912 --- /dev/null +++ b/pace-data/src/test/java/edu/colorado/cires/pace/data/validation/ValidPackageIdentifiersValidatorTest.java @@ -0,0 +1,206 @@ +package edu.colorado.cires.pace.data.validation; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import edu.colorado.cires.pace.data.object.dataset.audio.AudioPackage; +import edu.colorado.cires.pace.data.object.dataset.audio.metadata.Channel; +import edu.colorado.cires.pace.data.object.dataset.audio.metadata.DutyCycle; +import edu.colorado.cires.pace.data.object.dataset.audio.metadata.Gain; +import edu.colorado.cires.pace.data.object.dataset.audio.metadata.SampleRate; +import edu.colorado.cires.pace.data.object.dataset.base.metadata.PackageSensor; +import edu.colorado.cires.pace.data.object.dataset.base.metadata.QualityLevel; +import edu.colorado.cires.pace.data.object.dataset.base.metadata.location.MarineInstrumentLocation; +import edu.colorado.cires.pace.data.object.dataset.base.metadata.location.StationaryMarineLocation; +import edu.colorado.cires.pace.data.object.dataset.base.metadata.translator.DataQualityEntry; +import edu.colorado.cires.pace.data.object.position.Position; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Path; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import java.nio.file.Paths; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; + +public class ValidPackageIdentifiersValidatorTest { + @ParameterizedTest + @CsvSource({ + "deploymentId,siteOrCruiseName,dataCollectionName,true", + "deploymentId,,,true", + ",siteOrCruiseName,,true", + ",,dataCollectionName,true", + "deploymentId,siteOrCruiseName,,true", + "deploymentId,,dataCollectionName,true", + ",siteOrCruiseName,dataCollectionName,true", + ",,,false", + }) + void testNoDeploymentId(String deploymentId, String siteOrCruiseName, String dataCollectionName, boolean expectedPass) { + Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); + + AudioPackage audioPackage = createAudio(UUID.randomUUID()).toBuilder() + .deploymentId(deploymentId) + .siteOrCruiseName(siteOrCruiseName) + .dataCollectionName(dataCollectionName) + .build(); + Set> constraintViolations = validator.validate(audioPackage); + + if (expectedPass) { + assertEquals(0, constraintViolations.size()); + } else { + assertEquals(3, constraintViolations.size()); + + assertTrue( + constraintViolations.stream() + .allMatch(constraintViolation -> constraintViolation.getMessage() + .equals("at least dataCollectionName, siteOrCruiseName, or deploymentId required")) + ); + + assertEquals( + Set.of("deploymentId","siteOrCruiseName","dataCollectionName"), + constraintViolations.stream() + .map(ConstraintViolation::getPropertyPath) + .map(Path::toString).collect(Collectors.toSet()) + ); + } + } + + private AudioPackage createAudio(UUID uuid) { + return AudioPackage.builder() + .uuid(uuid) + .sourcePath(Paths.get("sourcePath")) + .temperaturePath(Paths.get("temperaturePath")) + .otherPath(Paths.get("otherPath")) + .navigationPath(Paths.get("navigationPath")) + .documentsPath(Paths.get("documentsPath")) + .calibrationDocumentsPath(Paths.get("calibrationDocumentsPath")) + .biologicalPath(Paths.get("biologicalPath")) + .siteOrCruiseName("siteOrCruiseName") + .deploymentId("deploymentId") + .datasetPackager("dataset-packager") + .projects(List.of( + "project-name-1", "project-name-2" + )).publicReleaseDate(LocalDate.of(2024, 7, 29).plusDays(1)) + .scientists(List.of( + "scientist-1", "scientist-2" + )).sponsors(List.of( + "organization-1", "organization-2" + )).funders(List.of( + "organization-3", "organization-4" + )).platform( + "platform" + ).instrument("instrument") + .instrumentId("instrumentId") + .startTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(1)) + .endTime(LocalDateTime.of(2024, 7, 29, 12, 1)) + .preDeploymentCalibrationDate(LocalDate.of(2024, 7, 29).minusDays(1)) + .postDeploymentCalibrationDate(LocalDate.of(2024, 7, 29).plusDays(1)) + .calibrationDescription("calibration-description") + .hydrophoneSensitivity(10f) + .frequencyRange(5f) + .gain(1f) + .deploymentTitle("deployment-title") + .deploymentPurpose("deployment-purpose") + .deploymentDescription("deployment-description") + .alternateSiteName("alternate-site-name") + .alternateDeploymentName("alternate-deployment-name") + .qualityAnalyst("qualityAnalyst") + .qualityAnalysisObjectives("quality-analyst-objectives") + .qualityAnalysisMethod("quality-analysis-method") + .qualityAssessmentDescription("quality-assessment-description") + .qualityEntries(List.of( + DataQualityEntry.builder() + .comments("comment-1") + .qualityLevel(QualityLevel.good) + .maxFrequency(10f) + .minFrequency(5f) + .startTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(10)) + .endTime(LocalDateTime.of(2024, 7, 29, 12, 1)) + .build(), + DataQualityEntry.builder() + .comments("comment-2") + .qualityLevel(QualityLevel.unusable) + .maxFrequency(10f) + .minFrequency(5f) + .startTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(20)) + .endTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(10)) + .build() + )).deploymentTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusDays(4)) + .recoveryTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusDays(1)) + .comments("deployment-comments") + .sensors(List.of( + PackageSensor.builder() + .sensor("audio-sensor") + .position(Position.builder() + .x(1f) + .y(2f) + .z(3f) + .build()) + .build(), + PackageSensor.builder() + .sensor("depth-sensor") + .position(Position.builder() + .x(4f) + .y(5f) + .z(6f) + .build()) + .build() + )).channels(List.of( + Channel.builder() + .sensor(PackageSensor.builder() + .sensor("audioSensor") + .position(Position.builder() + .x(7f) + .y(8f) + .z(9f) + .build()) + .build()) + .startTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(2)) + .endTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(1)) + .sampleRates(List.of( + SampleRate.builder() + .startTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(1)) + .endTime(LocalDateTime.of(2024, 7, 29, 12, 1)) + .sampleBits(10) + .sampleRate(10f) + .build() + )).dutyCycles(List.of( + DutyCycle.builder() + .duration(100f) + .interval(100f) + .startTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(10)) + .endTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(5)) + .build() + )).gains(List.of( + Gain.builder() + .startTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(20)) + .endTime(LocalDateTime.of(2024, 7, 29, 12, 1).minusMinutes(5)) + .gain(1000f) + .build() + )) + .build() + )).locationDetail(StationaryMarineLocation.builder() + .seaArea("seaArea") + .deploymentLocation(MarineInstrumentLocation.builder() + .instrumentDepth(-10f) + .seaFloorDepth(-100f) + .longitude(10d) + .latitude(10d) + .build()) + .recoveryLocation(MarineInstrumentLocation.builder() + .instrumentDepth(-20f) + .seaFloorDepth(-110f) + .longitude(15d) + .latitude(15d) + .build()) + .build()) + .build(); + } + +} diff --git a/pace-packaging/src/main/java/edu/colorado/cires/pace/packaging/PackageInflator.java b/pace-packaging/src/main/java/edu/colorado/cires/pace/packaging/PackageInflator.java index f78ca54f..a5cef498 100644 --- a/pace-packaging/src/main/java/edu/colorado/cires/pace/packaging/PackageInflator.java +++ b/pace-packaging/src/main/java/edu/colorado/cires/pace/packaging/PackageInflator.java @@ -83,6 +83,7 @@ private DetailedAudioPackage process(AudioPackage audioPackage) throws NotFoundE .calibrationDocumentsPath(audioPackage.getCalibrationDocumentsPath()) .navigationPath(audioPackage.getNavigationPath()) .sourcePath(audioPackage.getSourcePath()) + .dataCollectionName(audioPackage.getDataCollectionName()) .siteOrCruiseName(audioPackage.getSiteOrCruiseName()) .deploymentId(audioPackage.getDeploymentId()) .publicReleaseDate(audioPackage.getPublicReleaseDate()) @@ -132,6 +133,7 @@ private DetailedCPODPackage process(CPODPackage cpodPackage) throws NotFoundExce .calibrationDocumentsPath(cpodPackage.getCalibrationDocumentsPath()) .navigationPath(cpodPackage.getNavigationPath()) .sourcePath(cpodPackage.getSourcePath()) + .dataCollectionName(cpodPackage.getDataCollectionName()) .siteOrCruiseName(cpodPackage.getSiteOrCruiseName()) .deploymentId(cpodPackage.getDeploymentId()) .publicReleaseDate(cpodPackage.getPublicReleaseDate()) @@ -181,6 +183,7 @@ private DetailedDetectionsPackage process(DetectionsPackage detectionsPackage) t .calibrationDocumentsPath(detectionsPackage.getCalibrationDocumentsPath()) .navigationPath(detectionsPackage.getNavigationPath()) .sourcePath(detectionsPackage.getSourcePath()) + .dataCollectionName(detectionsPackage.getDataCollectionName()) .siteOrCruiseName(detectionsPackage.getSiteOrCruiseName()) .deploymentId(detectionsPackage.getDeploymentId()) .publicReleaseDate(detectionsPackage.getPublicReleaseDate()) @@ -232,6 +235,7 @@ private DetailedSoundClipsPackage process(SoundClipsPackage soundClipsPackage) t .calibrationDocumentsPath(soundClipsPackage.getCalibrationDocumentsPath()) .navigationPath(soundClipsPackage.getNavigationPath()) .sourcePath(soundClipsPackage.getSourcePath()) + .dataCollectionName(soundClipsPackage.getDataCollectionName()) .siteOrCruiseName(soundClipsPackage.getSiteOrCruiseName()) .deploymentId(soundClipsPackage.getDeploymentId()) .publicReleaseDate(soundClipsPackage.getPublicReleaseDate()) @@ -272,6 +276,7 @@ private DetailedSoundLevelMetricsPackage process(SoundLevelMetricsPackage soundL .calibrationDocumentsPath(soundLevelMetricsPackage.getCalibrationDocumentsPath()) .navigationPath(soundLevelMetricsPackage.getNavigationPath()) .sourcePath(soundLevelMetricsPackage.getSourcePath()) + .dataCollectionName(soundLevelMetricsPackage.getDataCollectionName()) .siteOrCruiseName(soundLevelMetricsPackage.getSiteOrCruiseName()) .deploymentId(soundLevelMetricsPackage.getDeploymentId()) .publicReleaseDate(soundLevelMetricsPackage.getPublicReleaseDate()) @@ -325,6 +330,7 @@ private DetailedSoundPropagationModelsPackage process(SoundPropagationModelsPack .calibrationDocumentsPath(soundPropagationModelsPackage.getCalibrationDocumentsPath()) .navigationPath(soundPropagationModelsPackage.getNavigationPath()) .sourcePath(soundPropagationModelsPackage.getSourcePath()) + .dataCollectionName(soundPropagationModelsPackage.getDataCollectionName()) .siteOrCruiseName(soundPropagationModelsPackage.getSiteOrCruiseName()) .deploymentId(soundPropagationModelsPackage.getDeploymentId()) .publicReleaseDate(soundPropagationModelsPackage.getPublicReleaseDate()) diff --git a/pace-packaging/src/test/java/edu/colorado/cires/pace/packaging/PackageInflatorTest.java b/pace-packaging/src/test/java/edu/colorado/cires/pace/packaging/PackageInflatorTest.java index 2ea4a4ab..8fd1148d 100644 --- a/pace-packaging/src/test/java/edu/colorado/cires/pace/packaging/PackageInflatorTest.java +++ b/pace-packaging/src/test/java/edu/colorado/cires/pace/packaging/PackageInflatorTest.java @@ -136,6 +136,7 @@ private AudioPackage createAudio(UUID uuid) { return AudioPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -268,6 +269,7 @@ private DetailedAudioPackage createDetailedAudio(UUID uuid) throws NotFoundExcep DetailedAudioPackage detailedPackage = DetailedAudioPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -481,6 +483,7 @@ private CPODPackage createCPOD(UUID uuid) { return CPODPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -613,6 +616,7 @@ private DetailedCPODPackage createDetailedCPOD(UUID uuid) throws NotFoundExcepti DetailedCPODPackage detailedPackage = DetailedCPODPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -826,6 +830,7 @@ private DetectionsPackage createDetections(UUID uuid) { return DetectionsPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -911,6 +916,7 @@ private DetailedDetectionsPackage createDetailedDetections(UUID uuid) throws Not DetailedDetectionsPackage detailedPackage = DetailedDetectionsPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -1068,6 +1074,7 @@ private SoundClipsPackage createSoundClips(UUID uuid) { return SoundClipsPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -1126,6 +1133,7 @@ private DetailedSoundClipsPackage createDetailedSoundCLips(UUID uuid) throws Not DetailedSoundClipsPackage detailedPackage = DetailedSoundClipsPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -1244,6 +1252,7 @@ private SoundLevelMetricsPackage createSoundLevelMetrics(UUID uuid) { return SoundLevelMetricsPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -1330,6 +1339,7 @@ private DetailedSoundLevelMetricsPackage createDetailedSoundLevelMetrics(UUID uu DetailedSoundLevelMetricsPackage detailedPackage = DetailedSoundLevelMetricsPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -1480,6 +1490,7 @@ private SoundPropagationModelsPackage createSoundPropagationModels(UUID uuid) { return SoundPropagationModelsPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) @@ -1541,6 +1552,7 @@ private DetailedSoundPropagationModelsPackage createDetailedSoundPropagationMode DetailedSoundPropagationModelsPackage detailedPackage = DetailedSoundPropagationModelsPackage.builder() .uuid(uuid) .sourcePath(Paths.get("sourcePath")) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperaturePath")) .otherPath(Paths.get("otherPath")) .navigationPath(Paths.get("navigationPath")) diff --git a/pace-repository/src/test/java/edu/colorado/cires/pace/repository/PackageRepositoryTest.java b/pace-repository/src/test/java/edu/colorado/cires/pace/repository/PackageRepositoryTest.java index de313d20..9954d45f 100644 --- a/pace-repository/src/test/java/edu/colorado/cires/pace/repository/PackageRepositoryTest.java +++ b/pace-repository/src/test/java/edu/colorado/cires/pace/repository/PackageRepositoryTest.java @@ -242,16 +242,18 @@ void testCreateConstrainViolation() { ), exception.getMessage()); Set> constraintViolations = exception.getConstraintViolations(); - assertEquals(3, constraintViolations.size()); + assertEquals(4, constraintViolations.size()); List> constraintViolation = constraintViolations.stream() .sorted((Comparator.comparing(o -> o.getPropertyPath().toString()))) .toList(); - assertEquals("deploymentId", constraintViolation.get(0).getPropertyPath().toString()); - assertEquals("must not be blank", constraintViolation.get(0).getMessage()); - assertEquals("projects[0].", constraintViolation.get(1).getPropertyPath().toString()); - assertEquals("must not be blank", constraintViolation.get(1).getMessage()); - assertEquals("siteOrCruiseName", constraintViolation.get(2).getPropertyPath().toString()); + assertEquals("dataCollectionName", constraintViolation.get(0).getPropertyPath().toString()); + assertEquals("at least dataCollectionName, siteOrCruiseName, or deploymentId required", constraintViolation.get(0).getMessage()); + assertEquals("deploymentId", constraintViolation.get(1).getPropertyPath().toString()); + assertEquals("at least dataCollectionName, siteOrCruiseName, or deploymentId required", constraintViolation.get(1).getMessage()); + assertEquals("projects[0].", constraintViolation.get(2).getPropertyPath().toString()); assertEquals("must not be blank", constraintViolation.get(2).getMessage()); + assertEquals("siteOrCruiseName", constraintViolation.get(3).getPropertyPath().toString()); + assertEquals("at least dataCollectionName, siteOrCruiseName, or deploymentId required", constraintViolation.get(3).getMessage()); } @Test 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 bc0a57a6..b1e0b58b 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 @@ -100,6 +100,7 @@ private static CPODPackage cpodPackageFromMap(CPODPackageTranslator cpodPackageT QualityControlDetailTranslator qualityControlDetailTranslator = cpodPackageTranslator.getQualityControlDetailTranslator(); return CPODPackage.builder() .uuid(uuidFromMap(properties, "UUID", cpodPackageTranslator.getPackageUUID(), row, runtimeException)) + .dataCollectionName(stringFromMap(properties, cpodPackageTranslator.getDataCollectionName())) .temperaturePath(pathFromMap(properties, "Temperature Path", cpodPackageTranslator.getTemperaturePath(), row, runtimeException)) .biologicalPath(pathFromMap(properties, "Biological Path", cpodPackageTranslator.getBiologicalPath(), row, runtimeException)) .otherPath(pathFromMap(properties, "Other Path", cpodPackageTranslator.getOtherPath(), row, runtimeException)) @@ -173,6 +174,7 @@ private static AudioPackage audioPackageFromMap(AudioPackageTranslator audioPack return AudioPackage.builder() .uuid(uuidFromMap(properties, "UUID", audioPackageTranslator.getPackageUUID(), row, runtimeException)) + .dataCollectionName(stringFromMap(properties, audioPackageTranslator.getDataCollectionName())) .temperaturePath(pathFromMap(properties, "Temperature Path", audioPackageTranslator.getTemperaturePath(), row, runtimeException)) .biologicalPath(pathFromMap(properties, "Biological Path", audioPackageTranslator.getBiologicalPath(), row, runtimeException)) .otherPath(pathFromMap(properties, "Other Path", audioPackageTranslator.getOtherPath(), row, runtimeException)) @@ -226,6 +228,7 @@ private static DetectionsPackage detectionsPackageFromMap(DetectionsPackageTrans QualityControlDetailTranslator qualityControlDetailTranslator = detectionsPackageTranslator.getQualityControlDetailTranslator(); return DetectionsPackage.builder() .uuid(uuidFromMap(properties, "UUID", detectionsPackageTranslator.getPackageUUID(), row, runtimeException)) + .dataCollectionName(stringFromMap(properties, detectionsPackageTranslator.getDataCollectionName())) .temperaturePath(pathFromMap(properties, "Temperature Path", detectionsPackageTranslator.getTemperaturePath(), row, runtimeException)) .biologicalPath(pathFromMap(properties, "Biological Path", detectionsPackageTranslator.getBiologicalPath(), row, runtimeException)) .otherPath(pathFromMap(properties, "Other Path", detectionsPackageTranslator.getOtherPath(), row, runtimeException)) @@ -337,6 +340,7 @@ private static SoundClipsPackage soundClipsPackageFromMap(SoundClipsPackageTrans throws TranslationException { return SoundClipsPackage.builder() .uuid(uuidFromMap(properties, "UUID", soundClipsPackageTranslator.getPackageUUID(), row, runtimeException)) + .dataCollectionName(stringFromMap(properties, soundClipsPackageTranslator.getDataCollectionName())) .temperaturePath(pathFromMap(properties, "Temperature Path", soundClipsPackageTranslator.getTemperaturePath(), row, runtimeException)) .biologicalPath(pathFromMap(properties, "Biological Path", soundClipsPackageTranslator.getBiologicalPath(), row, runtimeException)) .otherPath(pathFromMap(properties, "Other Path", soundClipsPackageTranslator.getOtherPath(), row, runtimeException)) @@ -378,6 +382,7 @@ private static SoundLevelMetricsPackage soundLevelMetricsPackageFromMap(SoundLev QualityControlDetailTranslator qualityControlDetailTranslator = soundLevelMetricsPackageTranslator.getQualityControlDetailTranslator(); return SoundLevelMetricsPackage.builder() .uuid(uuidFromMap(properties, "UUID", soundLevelMetricsPackageTranslator.getPackageUUID(), row, runtimeException)) + .dataCollectionName(stringFromMap(properties, soundLevelMetricsPackageTranslator.getDataCollectionName())) .temperaturePath(pathFromMap(properties, "Temperature Path", soundLevelMetricsPackageTranslator.getTemperaturePath(), row, runtimeException)) .biologicalPath(pathFromMap(properties, "Biological Path", soundLevelMetricsPackageTranslator.getBiologicalPath(), row, runtimeException)) .otherPath(pathFromMap(properties, "Other Path", soundLevelMetricsPackageTranslator.getOtherPath(), row, runtimeException)) @@ -430,6 +435,7 @@ private static SoundPropagationModelsPackage soundPropagationModelsPackageFromMa Map properties, int row, RuntimeException runtimeException) throws TranslationException { return SoundPropagationModelsPackage.builder() .uuid(uuidFromMap(properties, "UUID", soundPropagationModelsPackageTranslator.getPackageUUID(), row, runtimeException)) + .dataCollectionName(stringFromMap(properties, soundPropagationModelsPackageTranslator.getDataCollectionName())) .temperaturePath(pathFromMap(properties, "Temperature Path", soundPropagationModelsPackageTranslator.getTemperaturePath(), row, runtimeException)) .biologicalPath(pathFromMap(properties, "Biological Path", soundPropagationModelsPackageTranslator.getBiologicalPath(), row, runtimeException)) .otherPath(pathFromMap(properties, "Other Path", soundPropagationModelsPackageTranslator.getOtherPath(), row, runtimeException)) diff --git a/pace-translator/src/test/java/edu/colorado/cires/pace/translator/converter/PackageConverterTest.java b/pace-translator/src/test/java/edu/colorado/cires/pace/translator/converter/PackageConverterTest.java index f6f13108..d027d543 100644 --- a/pace-translator/src/test/java/edu/colorado/cires/pace/translator/converter/PackageConverterTest.java +++ b/pace-translator/src/test/java/edu/colorado/cires/pace/translator/converter/PackageConverterTest.java @@ -70,6 +70,7 @@ class PackageConverterTest { void convertAudioPackage() throws TranslationException, JsonProcessingException { AudioPackage audioPackage = AudioPackage.builder() .uuid(UUID.randomUUID()) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperature")) .biologicalPath(Paths.get("biological")) .otherPath(Paths.get("other")) @@ -270,6 +271,7 @@ void convertAudioPackage() throws TranslationException, JsonProcessingException AudioPackageTranslator audioPackageTranslator = AudioPackageTranslator.builder() .packageUUID("packageUUID") + .dataCollectionName("dataCollectionNAME") .temperaturePath("temperaturePath") .biologicalPath("biologicalPath") .otherPath("otherPath") @@ -474,6 +476,7 @@ void convertAudioPackage() throws TranslationException, JsonProcessingException Map map = new HashMap<>(0); map.put(audioPackageTranslator.getPackageUUID(), new ValueWithColumnNumber(Optional.of(audioPackage.getUuid().toString()), 1)); + map.put(audioPackageTranslator.getDataCollectionName(), new ValueWithColumnNumber(Optional.of(audioPackage.getDataCollectionName()), 1)); map.put(audioPackageTranslator.getTemperaturePath(), new ValueWithColumnNumber(Optional.of(audioPackage.getTemperaturePath().toString()), 2)); map.put(audioPackageTranslator.getBiologicalPath(), new ValueWithColumnNumber(Optional.of(audioPackage.getBiologicalPath().toString()), 3)); map.put(audioPackageTranslator.getOtherPath(), new ValueWithColumnNumber(Optional.of(audioPackage.getOtherPath().toString()), 4)); @@ -652,6 +655,7 @@ void convertAudioPackage() throws TranslationException, JsonProcessingException void convertCPODPackage() throws TranslationException, JsonProcessingException { CPODPackage cpodPackage = CPODPackage.builder() .uuid(UUID.randomUUID()) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperature")) .biologicalPath(Paths.get("biological")) .otherPath(Paths.get("other")) @@ -840,6 +844,7 @@ void convertCPODPackage() throws TranslationException, JsonProcessingException { CPODPackageTranslator cpodPackageTranslator = CPODPackageTranslator.builder() .packageUUID("packageUUID") + .dataCollectionName("dataCollectionNAME") .temperaturePath("temperaturePath") .biologicalPath("biologicalPath") .otherPath("otherPath") @@ -1140,6 +1145,7 @@ void convertCPODPackage() throws TranslationException, JsonProcessingException { Map map = new HashMap<>(0); map.put(cpodPackageTranslator.getPackageUUID(), new ValueWithColumnNumber(Optional.of(cpodPackage.getUuid().toString()), 1)); + map.put(cpodPackageTranslator.getDataCollectionName(), new ValueWithColumnNumber(Optional.of(cpodPackage.getDataCollectionName()), 1)); map.put(cpodPackageTranslator.getTemperaturePath(), new ValueWithColumnNumber(Optional.of(cpodPackage.getTemperaturePath().toString()), 2)); map.put(cpodPackageTranslator.getBiologicalPath(), new ValueWithColumnNumber(Optional.of(cpodPackage.getBiologicalPath().toString()), 3)); map.put(cpodPackageTranslator.getOtherPath(), new ValueWithColumnNumber(Optional.of(cpodPackage.getOtherPath().toString()), 4)); @@ -1307,6 +1313,7 @@ void convertCPODPackage() throws TranslationException, JsonProcessingException { void convertDetectionsPackage() throws TranslationException, JsonProcessingException { DetectionsPackage detectionsPackage = DetectionsPackage.builder() .uuid(UUID.randomUUID()) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperature")) .biologicalPath(Paths.get("biological")) .otherPath(Paths.get("other")) @@ -1385,6 +1392,7 @@ void convertDetectionsPackage() throws TranslationException, JsonProcessingExcep DetectionsPackageTranslator detectionsPackageTranslator = DetectionsPackageTranslator.builder() .packageUUID("packageUUID") +.dataCollectionName("dataCollectionNAME") .temperaturePath("temperaturePath") .biologicalPath("biologicalPath") .otherPath("otherPath") @@ -1484,6 +1492,7 @@ void convertDetectionsPackage() throws TranslationException, JsonProcessingExcep Map map = new HashMap<>(0); map.put(detectionsPackageTranslator.getPackageUUID(), new ValueWithColumnNumber(Optional.of(detectionsPackage.getUuid().toString()), 1)); + map.put(detectionsPackageTranslator.getDataCollectionName(), new ValueWithColumnNumber(Optional.of(detectionsPackage.getDataCollectionName()), 1)); map.put(detectionsPackageTranslator.getTemperaturePath(), new ValueWithColumnNumber(Optional.of(detectionsPackage.getTemperaturePath().toString()), 2)); map.put(detectionsPackageTranslator.getBiologicalPath(), new ValueWithColumnNumber(Optional.of(detectionsPackage.getBiologicalPath().toString()), 3)); map.put(detectionsPackageTranslator.getOtherPath(), new ValueWithColumnNumber(Optional.of(detectionsPackage.getOtherPath().toString()), 4)); @@ -1566,6 +1575,7 @@ void convertDetectionsPackage() throws TranslationException, JsonProcessingExcep void convertSoundClipsPackage() throws TranslationException, JsonProcessingException { SoundClipsPackage soundClipsPackage = SoundClipsPackage.builder() .uuid(UUID.randomUUID()) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperature")) .biologicalPath(Paths.get("biological")) .otherPath(Paths.get("other")) @@ -1627,6 +1637,7 @@ void convertSoundClipsPackage() throws TranslationException, JsonProcessingExcep SoundClipsPackageTranslator soundClipsPackageTranslator = SoundClipsPackageTranslator.builder() .packageUUID("packageUUID") + .dataCollectionName("dataCollectionNAME") .temperaturePath("temperaturePath") .biologicalPath("biologicalPath") .otherPath("otherPath") @@ -1695,6 +1706,7 @@ void convertSoundClipsPackage() throws TranslationException, JsonProcessingExcep Map map = new HashMap<>(0); map.put(soundClipsPackageTranslator.getPackageUUID(), new ValueWithColumnNumber(Optional.of(soundClipsPackage.getUuid().toString()), 1)); + map.put(soundClipsPackageTranslator.getDataCollectionName(), new ValueWithColumnNumber(Optional.of(soundClipsPackage.getDataCollectionName()), 1)); map.put(soundClipsPackageTranslator.getTemperaturePath(), new ValueWithColumnNumber(Optional.of(soundClipsPackage.getTemperaturePath().toString()), 2)); map.put(soundClipsPackageTranslator.getBiologicalPath(), new ValueWithColumnNumber(Optional.of(soundClipsPackage.getBiologicalPath().toString()), 3)); map.put(soundClipsPackageTranslator.getOtherPath(), new ValueWithColumnNumber(Optional.of(soundClipsPackage.getOtherPath().toString()), 4)); @@ -1758,6 +1770,7 @@ void convertSoundClipsPackage() throws TranslationException, JsonProcessingExcep void convertSoundLevelMetricsPackage() throws TranslationException, JsonProcessingException { SoundLevelMetricsPackage soundLevelMetricsPackage = SoundLevelMetricsPackage.builder() .uuid(UUID.randomUUID()) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperature")) .biologicalPath(Paths.get("biological")) .otherPath(Paths.get("other")) @@ -1848,6 +1861,7 @@ void convertSoundLevelMetricsPackage() throws TranslationException, JsonProcessi SoundLevelMetricsPackageTranslator soundLevelMetricsPackageTranslator = SoundLevelMetricsPackageTranslator.builder() .packageUUID("packageUUID") + .dataCollectionName("dataCollectionNAME") .temperaturePath("temperaturePath") .biologicalPath("biologicalPath") .otherPath("otherPath") @@ -1958,13 +1972,14 @@ void convertSoundLevelMetricsPackage() throws TranslationException, JsonProcessi .timeZone("timeZone") .build()) .audioEndTimeTranslator(DefaultTimeTranslator.builder() - .timeZone("audio-end-time") + .time("audio-end-time") .timeZone("timeZone") .build()) .build(); Map map = new HashMap<>(0); map.put(soundLevelMetricsPackageTranslator.getPackageUUID(), new ValueWithColumnNumber(Optional.of(soundLevelMetricsPackage.getUuid().toString()), 1)); + map.put(soundLevelMetricsPackageTranslator.getDataCollectionName(), new ValueWithColumnNumber(Optional.of(soundLevelMetricsPackage.getDataCollectionName()), 1)); map.put(soundLevelMetricsPackageTranslator.getTemperaturePath(), new ValueWithColumnNumber(Optional.of(soundLevelMetricsPackage.getTemperaturePath().toString()), 2)); map.put(soundLevelMetricsPackageTranslator.getBiologicalPath(), new ValueWithColumnNumber(Optional.of(soundLevelMetricsPackage.getBiologicalPath().toString()), 3)); map.put(soundLevelMetricsPackageTranslator.getOtherPath(), new ValueWithColumnNumber(Optional.of(soundLevelMetricsPackage.getOtherPath().toString()), 4)); @@ -2057,6 +2072,7 @@ void convertSoundLevelMetricsPackage() throws TranslationException, JsonProcessi void convertSoundPropagationModels() throws TranslationException, JsonProcessingException { SoundPropagationModelsPackage soundPropagationModelsPackage = SoundPropagationModelsPackage.builder() .uuid(UUID.randomUUID()) + .dataCollectionName("dataCollectionName") .temperaturePath(Paths.get("temperature")) .biologicalPath(Paths.get("biological")) .otherPath(Paths.get("other")) @@ -2119,6 +2135,7 @@ void convertSoundPropagationModels() throws TranslationException, JsonProcessing SoundPropagationModelsPackageTranslator soundPropagationModelsTranslator = SoundPropagationModelsPackageTranslator.builder() .packageUUID("packageUUID") + .dataCollectionName("dataCollectionNAME") .temperaturePath("temperaturePath") .biologicalPath("biologicalPath") .otherPath("otherPath") @@ -2194,6 +2211,7 @@ void convertSoundPropagationModels() throws TranslationException, JsonProcessing Map map = new HashMap<>(0); map.put(soundPropagationModelsTranslator.getPackageUUID(), new ValueWithColumnNumber(Optional.of(soundPropagationModelsPackage.getUuid().toString()), 1)); + map.put(soundPropagationModelsTranslator.getDataCollectionName(), new ValueWithColumnNumber(Optional.of(soundPropagationModelsPackage.getDataCollectionName()), 1)); map.put(soundPropagationModelsTranslator.getTemperaturePath(), new ValueWithColumnNumber(Optional.of(soundPropagationModelsPackage.getTemperaturePath().toString()), 2)); map.put(soundPropagationModelsTranslator.getBiologicalPath(), new ValueWithColumnNumber(Optional.of(soundPropagationModelsPackage.getBiologicalPath().toString()), 3)); map.put(soundPropagationModelsTranslator.getOtherPath(), new ValueWithColumnNumber(Optional.of(soundPropagationModelsPackage.getOtherPath().toString()), 4));