Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 15782d42 by Tony Chemit at 2021-07-08T16:39:25+02:00 try to fix gitlab build - - - - - 04415f1b by Tony Chemit at 2021-07-08T16:39:25+02:00 Assainissement de la configuration de l'import avdth - Closes #1956 - - - - - 10 changed files: - .gitlab-ci.yml - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/avdth/ImportDialogModel.java - models/dto/java/src/main/java/fr/ird/observe/dto/migration/avdth/AvdthDataImportConfiguration.java - models/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/interceptors/TripInterceptor.java - models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/AvdthDataBuilderTestSupport.java - models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/atlantic/AvdthAtlanticDataBuilderAllTest.java - models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/atlantic/AvdthAtlanticDataBuilderByYearTest.java - models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/indian/AvdthIndianDataBuilderAllTest.java - models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/indian/AvdthIndianDataBuilderByYearTest.java - pom.xml Changes: ===================================== .gitlab-ci.yml ===================================== @@ -21,13 +21,13 @@ image: registry.gitlab.com/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/docker:lat services: - docker:dind script: - - if [ -n "${CREATE_DOCKER}" ]; then ultreiaio-docker-generate-image-11 gitlab-ci-token $CI_BUILD_TOKEN; fi + - if [ -n "${CREATE_DOCKER}" ]; then ultreiaio-docker-generate-image-11-experimental gitlab-ci-token $CI_BUILD_TOKEN; fi .build-for-release: &build-for-release environment: name: test script: - - if [ -n "${BUILD_FOR_RELEASE}" ]; then ultreiaio-maven-execute 'clean verify -U -DperformRelease -Dmaven.javadoc.skip'; fi + - if [ -n "${BUILD_FOR_RELEASE}" ]; then export MAVEN_OPTS="-Xmx2048m" ; ultreiaio-maven-execute 'clean verify -U -DperformRelease -Dmaven.javadoc.skip'; fi .publish-site: &publish-site environment: ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/avdth/ImportDialogModel.java ===================================== @@ -271,7 +271,7 @@ public class ImportDialogModel extends AbstractJavaBean { now, getIdPrefix(), getProgram().getTopiaId(), - getOcean().getCode(), + getOcean().getTopiaId(), referentialLocale, temporaryDirectory, false, ===================================== models/dto/java/src/main/java/fr/ird/observe/dto/migration/avdth/AvdthDataImportConfiguration.java ===================================== @@ -45,13 +45,13 @@ public class AvdthDataImportConfiguration implements ObserveDto { */ private final String idPrefix; /** - * Program code where to attach imported trip. + * Program id where to attach imported trip. */ - private final String programCode; + private final String programId; /** - * Ocean code where to attach imported trip. + * Ocean id where to attach imported trip. */ - private final String oceanCode; + private final String oceanId; /** * Referential locale used. */ @@ -84,8 +84,8 @@ public class AvdthDataImportConfiguration implements ObserveDto { public AvdthDataImportConfiguration(Date now, String idPrefix, - String programCode, - String oceanCode, + String programId, + String oceanId, ReferentialLocale referentialLocale, Path scriptTemporaryDirectory, boolean forceImport, @@ -95,8 +95,8 @@ public class AvdthDataImportConfiguration implements ObserveDto { ProgressionModel progressionModel) { this.now = now; this.idPrefix = idPrefix; - this.programCode = programCode; - this.oceanCode = oceanCode; + this.programId = programId; + this.oceanId = oceanId; this.referentialLocale = referentialLocale; this.scriptTemporaryDirectory = scriptTemporaryDirectory; this.forceImport = forceImport; @@ -142,12 +142,12 @@ public class AvdthDataImportConfiguration implements ObserveDto { return idPrefix; } - public String getProgramCode() { - return programCode; + public String getProgramId() { + return programId; } - public String getOceanCode() { - return oceanCode; + public String getOceanId() { + return oceanId; } public AvdthReferentialImportConfiguration toReferentialImportConfiguration() { ===================================== models/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/interceptors/TripInterceptor.java ===================================== @@ -53,7 +53,6 @@ public class TripInterceptor extends DataInterceptor<Trip> { private ImmutableMap<String, Ocean> ocean; private ImmutableMap<String, Program> program; - private ImmutableMap<String, Program> programById; private ImmutableMap<String, Harbour> harbour; private ImmutableMap<String, Vessel> vessel; private ImmutableMap<String, WellContentStatus> wellContentStatus; @@ -66,9 +65,8 @@ public class TripInterceptor extends DataInterceptor<Trip> { @Override public void prepare(AvdthReferentialImportResult referential) { - ocean = Maps.uniqueIndex(referential.getOcean(), Ocean::getCode); - program = Maps.uniqueIndex(referential.getProgram().stream().filter(p -> p.getCode() != null && !Objects.equals(p.getCode(), "0")).collect(Collectors.toList()), Program::getCode); - programById = Maps.uniqueIndex(referential.getProgram(), Program::getId); + ocean = Maps.uniqueIndex(referential.getOcean(), Ocean::getId); + program = Maps.uniqueIndex(referential.getProgram(), Program::getId); harbour = Maps.uniqueIndex(referential.getHarbour(), Harbour::getCode); vessel = Maps.uniqueIndex(referential.getVessel(), Vessel::getCode); wellContentStatus = Maps.uniqueIndex(referential.getWellContentStatus(), WellContentStatus::getCode); @@ -88,15 +86,12 @@ public class TripInterceptor extends DataInterceptor<Trip> { entity.setLocalMarketSurveySamplingAcquisitionStatus(notFilledAcquisitionStatus); entity.setAdvancedSamplingAcquisitionStatus(notFilledAcquisitionStatus); entity.setHistoricalData(false); - String programCode = getContext().getProgramCode(); - Program program = this.program.get(programCode); - if (program==null) { - program = this.programById.get(programCode); - } - entity.setProgram(Objects.requireNonNull(program, String.format("Can't find program with code or id: %s", programCode))); - String oceanCode = getContext().getOceanCode(); - Ocean ocean = this.ocean.get(oceanCode); - entity.setOcean(Objects.requireNonNull(ocean, String.format("Can't find ocean with code : %s", oceanCode))); + String programId = getContext().getProgramId(); + Program program = this.program.get(programId); + entity.setProgram(Objects.requireNonNull(program, String.format("Can't find program with id: %s", programId))); + String oceanId = getContext().getOceanId(); + Ocean ocean = this.ocean.get(oceanId); + entity.setOcean(Objects.requireNonNull(ocean, String.format("Can't find ocean with id: %s", oceanId))); String vesselCode = resultSet.getString(1); Vessel vessel = this.vessel.get(vesselCode); entity.setVessel(Objects.requireNonNull(vessel,String.format("Can't find vessel code with code: %s", vesselCode))); ===================================== models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/AvdthDataBuilderTestSupport.java ===================================== @@ -106,7 +106,7 @@ public abstract class AvdthDataBuilderTestSupport extends PersistenceTestSupport protected abstract Path getRootPath(); - protected abstract String getOceanCode(); + protected abstract String getOceanId(); @CopyDatabaseConfiguration @Test @@ -119,8 +119,8 @@ public abstract class AvdthDataBuilderTestSupport extends PersistenceTestSupport AvdthDataImportConfiguration configuration = new AvdthDataImportConfiguration( ObserveFixtures.DATE, "20200601", - "9", - getOceanCode(), + "fr.ird.referential.common.Program#1239832686262#0.42751447061198444", + getOceanId(), ReferentialLocale.FR, scriptTemporaryDirectory, forceImport(), true, avdthFile, scriptPath, new ProgressionModel()); ===================================== models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/atlantic/AvdthAtlanticDataBuilderAllTest.java ===================================== @@ -48,8 +48,8 @@ public class AvdthAtlanticDataBuilderAllTest extends AvdthDataBuilderTestSupport } @Override - protected String getOceanCode() { - return "1"; + protected String getOceanId() { + return "fr.ird.referential.common.Ocean#1239832686151#0.17595105505051245"; } } ===================================== models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/atlantic/AvdthAtlanticDataBuilderByYearTest.java ===================================== @@ -48,7 +48,7 @@ public class AvdthAtlanticDataBuilderByYearTest extends AvdthDataBuilderTestSupp } @Override - protected String getOceanCode() { - return "1"; + protected String getOceanId() { + return "fr.ird.referential.common.Ocean#1239832686151#0.17595105505051245"; } } ===================================== models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/indian/AvdthIndianDataBuilderAllTest.java ===================================== @@ -57,7 +57,7 @@ public class AvdthIndianDataBuilderAllTest extends AvdthDataBuilderTestSupport { } @Override - protected String getOceanCode() { - return "2"; + protected String getOceanId() { + return "fr.ird.referential.common.Ocean#1239832686152#0.8325731048817705"; } } ===================================== models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/indian/AvdthIndianDataBuilderByYearTest.java ===================================== @@ -57,7 +57,7 @@ public class AvdthIndianDataBuilderByYearTest extends AvdthDataBuilderTestSuppor } @Override - protected String getOceanCode() { - return "2"; + protected String getOceanId() { + return "fr.ird.referential.common.Ocean#1239832686152#0.8325731048817705"; } } ===================================== pom.xml ===================================== @@ -136,7 +136,6 @@ <java.version>11</java.version> <major>9.x</major> - <maven.version>3.8.1</maven.version> <!-- dev version --> <devMode>true</devMode> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/55e69f40fbb6ec9c7c201a8b4... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/55e69f40fbb6ec9c7c201a8b4... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT (@tchemit)