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

Commits:

10 changed files:

Changes:

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/localmarket/TripBatchUIModelStates.java
    ... ... @@ -36,7 +36,6 @@ import fr.ird.observe.dto.data.ps.localmarket.consolidate.BatchConsolidateReques
    36 36
     import fr.ird.observe.dto.data.ps.localmarket.consolidate.BatchConsolidateResult;
    
    37 37
     import fr.ird.observe.dto.form.Form;
    
    38 38
     import fr.ird.observe.dto.reference.DataDtoReferenceSet;
    
    39
    -import fr.ird.observe.dto.reference.DtoReferenceCollection;
    
    40 39
     import fr.ird.observe.dto.referential.ps.localmarket.PackagingReference;
    
    41 40
     import fr.ird.observe.navigation.id.Project;
    
    42 41
     import fr.ird.observe.services.ObserveServicesProvider;
    
    ... ... @@ -47,8 +46,8 @@ import org.apache.logging.log4j.Logger;
    47 46
     
    
    48 47
     import java.beans.PropertyChangeEvent;
    
    49 48
     import java.util.LinkedHashSet;
    
    50
    -import java.util.LinkedList;
    
    51 49
     import java.util.Set;
    
    50
    +import java.util.stream.Collectors;
    
    52 51
     
    
    53 52
     @GenerateJavaBeanDefinition
    
    54 53
     public class TripBatchUIModelStates extends GeneratedTripBatchUIModelStates {
    
    ... ... @@ -124,15 +123,15 @@ public class TripBatchUIModelStates extends GeneratedTripBatchUIModelStates {
    124 123
     
    
    125 124
         @Override
    
    126 125
         protected void loadReferentialCacheOnOpenForm(Form<TripBatchDto> form) {
    
    127
    -        if (getReferenceCache().isHideDisabledReferential()) {
    
    128
    -            form.getObject().setAvailablePackagings(new LinkedHashSet<>(DtoReferenceCollection.filterEnabled(form.getObject().getAvailablePackagings())));
    
    129
    -        }
    
    130 126
             getReferenceCache().setDataReferenceSet(BatchDto.PROPERTY_SURVEY, DataDtoReferenceSet.of(SurveyReference.class, form.getObject().getLocalmarketSurvey(), null));
    
    131 127
             super.loadReferentialCacheOnOpenForm(form);
    
    132 128
         }
    
    133 129
     
    
    134 130
         protected ReferencesFilter<PackagingReference> newPackagingList() {
    
    135
    -        return (dto, incomingReferences) -> new LinkedList<>(((TripBatchDto) dto).getAvailablePackagings());
    
    131
    +        return (dto, incomingReferences) -> {
    
    132
    +            LinkedHashSet<String> availablePackagingIds = ((TripBatchDto) dto).getAvailablePackagingIds();
    
    133
    +            return incomingReferences.stream().filter(e -> availablePackagingIds.contains(e.getId())).collect(Collectors.toList());
    
    134
    +        };
    
    136 135
         }
    
    137 136
     
    
    138 137
     }

  • core/api/validation/src/main/filtered-resources/META-INF/validators/validation.json
    ... ... @@ -9398,69 +9398,29 @@
    9398 9398
         "scope": "ERROR",
    
    9399 9399
         "context": "create",
    
    9400 9400
         "fields": [
    
    9401
    -      {
    
    9402
    -        "name": "availablePackagings",
    
    9403
    -        "comments": [
    
    9404
    -          "check if referential availablePackagings is disabled (only if validation is strong)"
    
    9405
    -        ]
    
    9406
    -      },
    
    9407 9401
           {
    
    9408 9402
             "name": "comment",
    
    9409 9403
             "comments": [
    
    9410 9404
               "comment (if not null) is not a blank string",
    
    9411
    -          "comment is required if one of the selected referential requires it (availablePackagings)",
    
    9412 9405
               "comment length <= 8192"
    
    9413 9406
             ]
    
    9414 9407
           }
    
    9415 9408
         ]
    
    9416 9409
       },
    
    9417
    -  {
    
    9418
    -    "type": "fr.ird.observe.dto.data.ps.localmarket.TripBatchDto",
    
    9419
    -    "scope": "WARNING",
    
    9420
    -    "context": "create",
    
    9421
    -    "fields": [
    
    9422
    -      {
    
    9423
    -        "name": "availablePackagings",
    
    9424
    -        "comments": [
    
    9425
    -          "check if referential availablePackagings is disabled (only if validation is not strong)"
    
    9426
    -        ]
    
    9427
    -      }
    
    9428
    -    ]
    
    9429
    -  },
    
    9430 9410
       {
    
    9431 9411
         "type": "fr.ird.observe.dto.data.ps.localmarket.TripBatchDto",
    
    9432 9412
         "scope": "ERROR",
    
    9433 9413
         "context": "update",
    
    9434 9414
         "fields": [
    
    9435
    -      {
    
    9436
    -        "name": "availablePackagings",
    
    9437
    -        "comments": [
    
    9438
    -          "check if referential availablePackagings is disabled (only if validation is strong)"
    
    9439
    -        ]
    
    9440
    -      },
    
    9441 9415
           {
    
    9442 9416
             "name": "comment",
    
    9443 9417
             "comments": [
    
    9444 9418
               "comment (if not null) is not a blank string",
    
    9445
    -          "comment is required if one of the selected referential requires it (availablePackagings)",
    
    9446 9419
               "comment length <= 8192"
    
    9447 9420
             ]
    
    9448 9421
           }
    
    9449 9422
         ]
    
    9450 9423
       },
    
    9451
    -  {
    
    9452
    -    "type": "fr.ird.observe.dto.data.ps.localmarket.TripBatchDto",
    
    9453
    -    "scope": "WARNING",
    
    9454
    -    "context": "update",
    
    9455
    -    "fields": [
    
    9456
    -      {
    
    9457
    -        "name": "availablePackagings",
    
    9458
    -        "comments": [
    
    9459
    -          "check if referential availablePackagings is disabled (only if validation is not strong)"
    
    9460
    -        ]
    
    9461
    -      }
    
    9462
    -    ]
    
    9463
    -  },
    
    9464 9424
       {
    
    9465 9425
         "type": "fr.ird.observe.dto.data.ps.localmarket.WellIdDto",
    
    9466 9426
         "scope": "ERROR",
    

  • core/api/validation/src/main/resources/fr/ird/observe/dto/data/ps/localmarket/TripBatchDto-create-error-validation.xml
    ... ... @@ -24,13 +24,6 @@
    24 24
         "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
    
    25 25
     <validators>
    
    26 26
     
    
    27
    -  <field name="availablePackagings">
    
    28
    -    <!-- check if referential availablePackagings is disabled (only if validation is strong) -->
    
    29
    -    <field-validator type="checkDisabledReferentialOnErrorScope">
    
    30
    -      <message/>
    
    31
    -    </field-validator>
    
    32
    -  </field>
    
    33
    -
    
    34 27
       <field name="comment">
    
    35 28
         <!-- comment (if not null) is not a blank string -->
    
    36 29
         <field-validator type="notBlankString" short-circuit="true">
    
    ... ... @@ -42,12 +35,6 @@
    42 35
           <param name="maxLength">8192</param>
    
    43 36
           <message/>
    
    44 37
         </field-validator>
    
    45
    -
    
    46
    -    <!-- comment is required if one of the selected referential requires it (availablePackagings) -->
    
    47
    -    <field-validator type="commentNeeded">
    
    48
    -      <param name="propertyNames">availablePackagings</param>
    
    49
    -      <message/>
    
    50
    -    </field-validator>
    
    51 38
       </field>
    
    52 39
     
    
    53 40
     </validators>

  • core/api/validation/src/main/resources/fr/ird/observe/dto/data/ps/localmarket/TripBatchDto-create-warning-validation.xml deleted
    1
    -<!--
    
    2
    -  #%L
    
    3
    -  ObServe Core :: API :: Validation
    
    4
    -  %%
    
    5
    -  Copyright (C) 2008 - 2023 IRD, Ultreia.io
    
    6
    -  %%
    
    7
    -  This program is free software: you can redistribute it and/or modify
    
    8
    -  it under the terms of the GNU General Public License as
    
    9
    -  published by the Free Software Foundation, either version 3 of the
    
    10
    -  License, or (at your option) any later version.
    
    11
    -
    
    12
    -  This program is distributed in the hope that it will be useful,
    
    13
    -  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    -  GNU General Public License for more details.
    
    16
    -
    
    17
    -  You should have received a copy of the GNU General Public
    
    18
    -  License along with this program.  If not, see
    
    19
    -  <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    -  #L%
    
    21
    -  -->
    
    22
    -<!DOCTYPE validators PUBLIC
    
    23
    -    "-//Apache Struts//XWork Validator 1.0.3//EN"
    
    24
    -    "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
    
    25
    -<validators>
    
    26
    -
    
    27
    -  <field name="availablePackagings">
    
    28
    -    <!-- check if referential availablePackagings is disabled (only if validation is not strong) -->
    
    29
    -    <field-validator type="checkDisabledReferentialOnWarningScope">
    
    30
    -      <message/>
    
    31
    -    </field-validator>
    
    32
    -  </field>
    
    33
    -
    
    34
    -</validators>

  • core/api/validation/src/main/resources/fr/ird/observe/dto/data/ps/localmarket/TripBatchDto-update-error-validation.xml
    ... ... @@ -24,13 +24,6 @@
    24 24
         "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
    
    25 25
     <validators>
    
    26 26
     
    
    27
    -  <field name="availablePackagings">
    
    28
    -    <!-- check if referential availablePackagings is disabled (only if validation is strong) -->
    
    29
    -    <field-validator type="checkDisabledReferentialOnErrorScope">
    
    30
    -      <message/>
    
    31
    -    </field-validator>
    
    32
    -  </field>
    
    33
    -
    
    34 27
       <field name="comment">
    
    35 28
         <!-- comment (if not null) is not a blank string -->
    
    36 29
         <field-validator type="notBlankString" short-circuit="true">
    
    ... ... @@ -42,12 +35,6 @@
    42 35
           <param name="maxLength">8192</param>
    
    43 36
           <message/>
    
    44 37
         </field-validator>
    
    45
    -
    
    46
    -    <!-- comment is required if one of the selected referential requires it (availablePackagings) -->
    
    47
    -    <field-validator type="commentNeeded">
    
    48
    -      <param name="propertyNames">availablePackagings</param>
    
    49
    -      <message/>
    
    50
    -    </field-validator>
    
    51 38
       </field>
    
    52 39
     
    
    53 40
     </validators>

  • core/api/validation/src/main/resources/fr/ird/observe/dto/data/ps/localmarket/TripBatchDto-update-warning-validation.xml deleted
    1
    -<!--
    
    2
    -  #%L
    
    3
    -  ObServe Core :: API :: Validation
    
    4
    -  %%
    
    5
    -  Copyright (C) 2008 - 2023 IRD, Ultreia.io
    
    6
    -  %%
    
    7
    -  This program is free software: you can redistribute it and/or modify
    
    8
    -  it under the terms of the GNU General Public License as
    
    9
    -  published by the Free Software Foundation, either version 3 of the
    
    10
    -  License, or (at your option) any later version.
    
    11
    -
    
    12
    -  This program is distributed in the hope that it will be useful,
    
    13
    -  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    -  GNU General Public License for more details.
    
    16
    -
    
    17
    -  You should have received a copy of the GNU General Public
    
    18
    -  License along with this program.  If not, see
    
    19
    -  <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    -  #L%
    
    21
    -  -->
    
    22
    -<!DOCTYPE validators PUBLIC
    
    23
    -    "-//Apache Struts//XWork Validator 1.0.3//EN"
    
    24
    -    "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
    
    25
    -<validators>
    
    26
    -
    
    27
    -  <field name="availablePackagings">
    
    28
    -    <!-- check if referential availablePackagings is disabled (only if validation is not strong) -->
    
    29
    -    <field-validator type="checkDisabledReferentialOnWarningScope">
    
    30
    -      <message/>
    
    31
    -    </field-validator>
    
    32
    -  </field>
    
    33
    -
    
    34
    -</validators>

  • core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripBatchSpi.java
    ... ... @@ -25,7 +25,6 @@ package fr.ird.observe.entities.data.ps.common;
    25 25
     import fr.ird.observe.dto.data.ps.localmarket.TripBatchDto;
    
    26 26
     import fr.ird.observe.dto.form.Form;
    
    27 27
     import fr.ird.observe.dto.referential.ReferentialLocale;
    
    28
    -import fr.ird.observe.dto.referential.ps.localmarket.PackagingReference;
    
    29 28
     import fr.ird.observe.entities.referential.common.Harbour;
    
    30 29
     import fr.ird.observe.entities.referential.ps.localmarket.Packaging;
    
    31 30
     import fr.ird.observe.spi.service.ServiceContext;
    
    ... ... @@ -39,8 +38,8 @@ public class TripBatchSpi extends GeneratedTripBatchSpi {
    39 38
     
    
    40 39
         @Override
    
    41 40
         public void loadForm(ServiceContext context, String id, Trip parent, Form<TripBatchDto> form) {
    
    42
    -        LinkedHashSet<PackagingReference> availablePackaging = getPackaging(context, parent);
    
    43
    -        form.getObject().setAvailablePackagings(availablePackaging);
    
    41
    +        LinkedHashSet<String> availablePackagingIds = getAvailablePackagingIds(context, parent);
    
    42
    +        form.getObject().setAvailablePackagingIds(availablePackagingIds);
    
    44 43
         }
    
    45 44
     
    
    46 45
         @Override
    
    ... ... @@ -55,14 +54,14 @@ public class TripBatchSpi extends GeneratedTripBatchSpi {
    55 54
             entity.setLogbookComment(dto.getComment());
    
    56 55
         }
    
    57 56
     
    
    58
    -    protected LinkedHashSet<PackagingReference> getPackaging(ServiceContext context, Trip trip) {
    
    57
    +    protected LinkedHashSet<String> getAvailablePackagingIds(ServiceContext context, Trip trip) {
    
    59 58
             Harbour landingHarbour = trip.getLandingHarbour();
    
    60 59
             Date date = trip.getEndDate();
    
    61 60
             try (Stream<Packaging> stream = Packaging.getDao(context).streamAll()) {
    
    62
    -            return Packaging.toReferenceSet(context.getReferentialLocale(),
    
    63
    -                                            stream.filter(p -> p.acceptHarbour(landingHarbour) && p.acceptDate(date)),
    
    64
    -                                            null,
    
    65
    -                                            null).stream().collect(Collectors.toCollection(LinkedHashSet::new));
    
    61
    +            return stream
    
    62
    +                    .filter(p -> p.acceptHarbour(landingHarbour) && p.acceptDate(date))
    
    63
    +                    .map(Packaging::getTopiaId)
    
    64
    +                    .collect(Collectors.toCollection(LinkedHashSet::new));
    
    66 65
             }
    
    67 66
         }
    
    68 67
     
    

  • model/src/main/models/Observe/dto/23-data-ps-localmarket.model
    ... ... @@ -48,7 +48,7 @@ species {*:*} referential.common.SpeciesReference
    48 48
     data.ps.localmarket.TripBatch > data.Container >> data.SkipSimpleMove
    
    49 49
     localmarketBatch + {*} data.ps.localmarket.Batch
    
    50 50
     localmarketSurvey + {*} data.ps.localmarket.SurveyReference
    
    51
    -availablePackagings + {*} referential.ps.localmarket.PackagingReference
    
    51
    +availablePackagingIds + {*} String
    
    52 52
     
    
    53 53
     data.ps.localmarket.WellId > Business >> data.InlineDataDto data.NotEntityDto data.WellIdAware
    
    54 54
     well String

  • model/src/main/models/Observe/dto/attribute/ordered.properties
    ... ... @@ -42,7 +42,7 @@ data.ps.localmarket.SampleSpecies.attribute.sampleSpeciesMeasure=true
    42 42
     data.ps.localmarket.Survey.attribute.availableBatches=true
    
    43 43
     data.ps.localmarket.Survey.attribute.batches=true
    
    44 44
     data.ps.localmarket.Survey.attribute.surveyPart=true
    
    45
    -data.ps.localmarket.TripBatch.attribute.availablePackagings=true
    
    45
    +data.ps.localmarket.TripBatch.attribute.availablePackagingIds=true
    
    46 46
     data.ps.localmarket.TripBatch.attribute.localmarketBatch=true
    
    47 47
     data.ps.localmarket.TripBatch.attribute.localmarketSurvey=true
    
    48 48
     data.ps.logbook.ActivityCatch.attribute.catches=true
    

  • model/src/main/models/Observe/dto/attribute/unique.properties
    ... ... @@ -32,7 +32,7 @@ data.ps.common.Trip.attribute.localmarketSurvey=true
    32 32
     data.ps.common.Trip.attribute.routeLogbook=true
    
    33 33
     data.ps.common.Trip.attribute.routeObs=true
    
    34 34
     data.ps.localmarket.Sample.attribute.well=true
    
    35
    -data.ps.localmarket.TripBatch.attribute.availablePackagings=true
    
    35
    +data.ps.localmarket.TripBatch.attribute.availablePackagingIds=true
    
    36 36
     data.ps.localmarket.TripBatch.attribute.localmarketSurvey=true
    
    37 37
     data.ps.logbook.Route.attribute.activity=true
    
    38 38
     data.ps.observation.Activity.attribute.nonTargetCatchSpecies=true