Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

10 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -21,13 +21,13 @@ image: registry.gitlab.com/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}/docker:lat
    21 21
       services:
    
    22 22
         - docker:dind
    
    23 23
       script:
    
    24
    -    - if [ -n "${CREATE_DOCKER}" ]; then ultreiaio-docker-generate-image-11 gitlab-ci-token $CI_BUILD_TOKEN; fi
    
    24
    +    - if [ -n "${CREATE_DOCKER}" ]; then ultreiaio-docker-generate-image-11-experimental gitlab-ci-token $CI_BUILD_TOKEN; fi
    
    25 25
     
    
    26 26
     .build-for-release: &build-for-release
    
    27 27
       environment:
    
    28 28
         name: test
    
    29 29
       script:
    
    30
    -    - if [ -n "${BUILD_FOR_RELEASE}" ]; then ultreiaio-maven-execute 'clean verify -U -DperformRelease -Dmaven.javadoc.skip'; fi
    
    30
    +    - if [ -n "${BUILD_FOR_RELEASE}" ]; then export MAVEN_OPTS="-Xmx2048m" ; ultreiaio-maven-execute 'clean verify -U -DperformRelease -Dmaven.javadoc.skip'; fi
    
    31 31
     
    
    32 32
     .publish-site: &publish-site
    
    33 33
       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 {
    271 271
                     now,
    
    272 272
                     getIdPrefix(),
    
    273 273
                     getProgram().getTopiaId(),
    
    274
    -                getOcean().getCode(),
    
    274
    +                getOcean().getTopiaId(),
    
    275 275
                     referentialLocale,
    
    276 276
                     temporaryDirectory,
    
    277 277
                     false,
    

  • models/dto/java/src/main/java/fr/ird/observe/dto/migration/avdth/AvdthDataImportConfiguration.java
    ... ... @@ -45,13 +45,13 @@ public class AvdthDataImportConfiguration implements ObserveDto {
    45 45
          */
    
    46 46
         private final String idPrefix;
    
    47 47
         /**
    
    48
    -     * Program code where to attach imported trip.
    
    48
    +     * Program id where to attach imported trip.
    
    49 49
          */
    
    50
    -    private final String programCode;
    
    50
    +    private final String programId;
    
    51 51
         /**
    
    52
    -     * Ocean code where to attach imported trip.
    
    52
    +     * Ocean id where to attach imported trip.
    
    53 53
          */
    
    54
    -    private final String oceanCode;
    
    54
    +    private final String oceanId;
    
    55 55
         /**
    
    56 56
          * Referential locale used.
    
    57 57
          */
    
    ... ... @@ -84,8 +84,8 @@ public class AvdthDataImportConfiguration implements ObserveDto {
    84 84
     
    
    85 85
         public AvdthDataImportConfiguration(Date now,
    
    86 86
                                             String idPrefix,
    
    87
    -                                        String programCode,
    
    88
    -                                        String oceanCode,
    
    87
    +                                        String programId,
    
    88
    +                                        String oceanId,
    
    89 89
                                             ReferentialLocale referentialLocale,
    
    90 90
                                             Path scriptTemporaryDirectory,
    
    91 91
                                             boolean forceImport,
    
    ... ... @@ -95,8 +95,8 @@ public class AvdthDataImportConfiguration implements ObserveDto {
    95 95
                                             ProgressionModel progressionModel) {
    
    96 96
             this.now = now;
    
    97 97
             this.idPrefix = idPrefix;
    
    98
    -        this.programCode = programCode;
    
    99
    -        this.oceanCode = oceanCode;
    
    98
    +        this.programId = programId;
    
    99
    +        this.oceanId = oceanId;
    
    100 100
             this.referentialLocale = referentialLocale;
    
    101 101
             this.scriptTemporaryDirectory = scriptTemporaryDirectory;
    
    102 102
             this.forceImport = forceImport;
    
    ... ... @@ -142,12 +142,12 @@ public class AvdthDataImportConfiguration implements ObserveDto {
    142 142
             return idPrefix;
    
    143 143
         }
    
    144 144
     
    
    145
    -    public String getProgramCode() {
    
    146
    -        return programCode;
    
    145
    +    public String getProgramId() {
    
    146
    +        return programId;
    
    147 147
         }
    
    148 148
     
    
    149
    -    public String getOceanCode() {
    
    150
    -        return oceanCode;
    
    149
    +    public String getOceanId() {
    
    150
    +        return oceanId;
    
    151 151
         }
    
    152 152
     
    
    153 153
         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> {
    53 53
     
    
    54 54
         private ImmutableMap<String, Ocean> ocean;
    
    55 55
         private ImmutableMap<String, Program> program;
    
    56
    -    private ImmutableMap<String, Program> programById;
    
    57 56
         private ImmutableMap<String, Harbour> harbour;
    
    58 57
         private ImmutableMap<String, Vessel> vessel;
    
    59 58
         private ImmutableMap<String, WellContentStatus> wellContentStatus;
    
    ... ... @@ -66,9 +65,8 @@ public class TripInterceptor extends DataInterceptor<Trip> {
    66 65
     
    
    67 66
         @Override
    
    68 67
         public void prepare(AvdthReferentialImportResult referential) {
    
    69
    -        ocean = Maps.uniqueIndex(referential.getOcean(), Ocean::getCode);
    
    70
    -        program = Maps.uniqueIndex(referential.getProgram().stream().filter(p -> p.getCode() != null && !Objects.equals(p.getCode(), "0")).collect(Collectors.toList()), Program::getCode);
    
    71
    -        programById = Maps.uniqueIndex(referential.getProgram(), Program::getId);
    
    68
    +        ocean = Maps.uniqueIndex(referential.getOcean(), Ocean::getId);
    
    69
    +        program = Maps.uniqueIndex(referential.getProgram(), Program::getId);
    
    72 70
             harbour = Maps.uniqueIndex(referential.getHarbour(), Harbour::getCode);
    
    73 71
             vessel = Maps.uniqueIndex(referential.getVessel(), Vessel::getCode);
    
    74 72
             wellContentStatus = Maps.uniqueIndex(referential.getWellContentStatus(), WellContentStatus::getCode);
    
    ... ... @@ -88,15 +86,12 @@ public class TripInterceptor extends DataInterceptor<Trip> {
    88 86
             entity.setLocalMarketSurveySamplingAcquisitionStatus(notFilledAcquisitionStatus);
    
    89 87
             entity.setAdvancedSamplingAcquisitionStatus(notFilledAcquisitionStatus);
    
    90 88
             entity.setHistoricalData(false);
    
    91
    -        String programCode = getContext().getProgramCode();
    
    92
    -        Program program = this.program.get(programCode);
    
    93
    -        if (program==null) {
    
    94
    -            program = this.programById.get(programCode);
    
    95
    -        }
    
    96
    -        entity.setProgram(Objects.requireNonNull(program, String.format("Can't find program with code or id: %s", programCode)));
    
    97
    -        String oceanCode = getContext().getOceanCode();
    
    98
    -        Ocean ocean = this.ocean.get(oceanCode);
    
    99
    -        entity.setOcean(Objects.requireNonNull(ocean, String.format("Can't find ocean with code : %s", oceanCode)));
    
    89
    +        String programId = getContext().getProgramId();
    
    90
    +        Program program = this.program.get(programId);
    
    91
    +        entity.setProgram(Objects.requireNonNull(program, String.format("Can't find program with id: %s", programId)));
    
    92
    +        String oceanId = getContext().getOceanId();
    
    93
    +        Ocean ocean = this.ocean.get(oceanId);
    
    94
    +        entity.setOcean(Objects.requireNonNull(ocean, String.format("Can't find ocean with id: %s", oceanId)));
    
    100 95
             String vesselCode = resultSet.getString(1);
    
    101 96
             Vessel vessel = this.vessel.get(vesselCode);
    
    102 97
             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
    106 106
     
    
    107 107
         protected abstract Path getRootPath();
    
    108 108
     
    
    109
    -    protected abstract String getOceanCode();
    
    109
    +    protected abstract String getOceanId();
    
    110 110
     
    
    111 111
         @CopyDatabaseConfiguration
    
    112 112
         @Test
    
    ... ... @@ -119,8 +119,8 @@ public abstract class AvdthDataBuilderTestSupport extends PersistenceTestSupport
    119 119
             AvdthDataImportConfiguration configuration = new AvdthDataImportConfiguration(
    
    120 120
                     ObserveFixtures.DATE,
    
    121 121
                     "20200601",
    
    122
    -                "9",
    
    123
    -                getOceanCode(),
    
    122
    +                "fr.ird.referential.common.Program#1239832686262#0.42751447061198444",
    
    123
    +                getOceanId(),
    
    124 124
                     ReferentialLocale.FR,
    
    125 125
                     scriptTemporaryDirectory, forceImport(), true, avdthFile, scriptPath, new ProgressionModel());
    
    126 126
     
    

  • models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/atlantic/AvdthAtlanticDataBuilderAllTest.java
    ... ... @@ -48,8 +48,8 @@ public class AvdthAtlanticDataBuilderAllTest extends AvdthDataBuilderTestSupport
    48 48
         }
    
    49 49
     
    
    50 50
         @Override
    
    51
    -    protected String getOceanCode() {
    
    52
    -        return "1";
    
    51
    +    protected String getOceanId() {
    
    52
    +        return "fr.ird.referential.common.Ocean#1239832686151#0.17595105505051245";
    
    53 53
         }
    
    54 54
     
    
    55 55
     }

  • models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/atlantic/AvdthAtlanticDataBuilderByYearTest.java
    ... ... @@ -48,7 +48,7 @@ public class AvdthAtlanticDataBuilderByYearTest extends AvdthDataBuilderTestSupp
    48 48
         }
    
    49 49
     
    
    50 50
         @Override
    
    51
    -    protected String getOceanCode() {
    
    52
    -        return "1";
    
    51
    +    protected String getOceanId() {
    
    52
    +        return "fr.ird.referential.common.Ocean#1239832686151#0.17595105505051245";
    
    53 53
         }
    
    54 54
     }

  • models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/indian/AvdthIndianDataBuilderAllTest.java
    ... ... @@ -57,7 +57,7 @@ public class AvdthIndianDataBuilderAllTest extends AvdthDataBuilderTestSupport {
    57 57
         }
    
    58 58
     
    
    59 59
         @Override
    
    60
    -    protected String getOceanCode() {
    
    61
    -        return "2";
    
    60
    +    protected String getOceanId() {
    
    61
    +        return "fr.ird.referential.common.Ocean#1239832686152#0.8325731048817705";
    
    62 62
         }
    
    63 63
     }

  • models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/indian/AvdthIndianDataBuilderByYearTest.java
    ... ... @@ -57,7 +57,7 @@ public class AvdthIndianDataBuilderByYearTest extends AvdthDataBuilderTestSuppor
    57 57
         }
    
    58 58
     
    
    59 59
         @Override
    
    60
    -    protected String getOceanCode() {
    
    61
    -        return "2";
    
    60
    +    protected String getOceanId() {
    
    61
    +        return "fr.ird.referential.common.Ocean#1239832686152#0.8325731048817705";
    
    62 62
         }
    
    63 63
     }

  • pom.xml
    ... ... @@ -136,7 +136,6 @@
    136 136
         <java.version>11</java.version>
    
    137 137
     
    
    138 138
         <major>9.x</major>
    
    139
    -    <maven.version>3.8.1</maven.version>
    
    140 139
     
    
    141 140
         <!-- dev version -->
    
    142 141
         <devMode>true</devMode>