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

Commits:

5 changed files:

Changes:

  • application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetCatchUIHandler.java
    ... ... @@ -310,6 +310,19 @@ public class NonTargetCatchUIHandler extends ContentTableUIHandler<SetSeineNonTa
    310 310
                     }
    
    311 311
                 }
    
    312 312
     
    
    313
    +            if (nonTargetCatchDto.isHasRelease()) {
    
    314
    +
    
    315
    +                ReferentialReference<SpeciesDto> species = nonTargetCatchDto.getSpecies();
    
    316
    +
    
    317
    +                Iterable<NonTargetCatchDto> currentTargetCatchSpecies = NonTargetCatchHelper.filterBySpecies(objets, species);
    
    318
    +
    
    319
    +                if (Iterables.isEmpty(currentTargetCatchSpecies)) {
    
    320
    +
    
    321
    +                    speciesToDelete.add(species);
    
    322
    +
    
    323
    +                }
    
    324
    +            }
    
    325
    +
    
    313 326
             }
    
    314 327
     
    
    315 328
             if (!speciesToDelete.isEmpty()) {
    

  • application-swing/src/main/resources/i18n/application-swing_en_GB.properties
    ... ... @@ -1039,7 +1039,7 @@ observe.content.measurement.delete.message=Delete selected measurement
    1039 1039
     observe.content.mode.create.tip=Object is in create mode
    
    1040 1040
     observe.content.mode.read.tip=Object is not editable
    
    1041 1041
     observe.content.mode.update.tip=Object is in editing mode
    
    1042
    -observe.content.nonTargetCatch.message.table.will.delete.nonTargetSample=If you confirm save, some data could be deleted\!\n\nFollowing species won't be useable in samples\:\n%1$s\nAll samples of those species will be deleted.
    
    1042
    +observe.content.nonTargetCatch.message.table.will.delete.nonTargetSample=If you confirm save, some data could be deleted\!\n\nFollowing species won't be useable in samples nor in releases \:\n%1$s\nAll samples or releases of those species will be deleted.
    
    1043 1043
     observe.content.nonTargetCatch.table.catchWeight=Weight
    
    1044 1044
     observe.content.nonTargetCatch.table.catchWeight.tip=Weight estimated (in t)
    
    1045 1045
     observe.content.nonTargetCatch.table.comment=Com
    

  • application-swing/src/main/resources/i18n/application-swing_fr_FR.properties
    ... ... @@ -1046,7 +1046,7 @@ observe.content.measurement.delete.message=Supprimer la caractéristique sélect
    1046 1046
     observe.content.mode.create.tip=L'objet est en cours de création
    
    1047 1047
     observe.content.mode.read.tip=L'objet n'est pas éditable
    
    1048 1048
     observe.content.mode.update.tip=L'objet est en cours d'édition
    
    1049
    -observe.content.nonTargetCatch.message.table.will.delete.nonTargetSample=En confirmant la sauvegarde des objets vont être supprimés\!\n\nLes espèces suivantes ne seront plus utilisables dans des échantillonages \:\n%1$s\nCela entrainera la suppression des échantillonages des ces espèces
    
    1049
    +observe.content.nonTargetCatch.message.table.will.delete.nonTargetSample=En confirmant la sauvegarde des objets vont être supprimés\!\n\nLes espèces suivantes ne seront plus utilisables dans des échantillonages ou les espèces libérées \:\n%1$s\nCela entrainera la suppression des données saisies liées à ces espèces
    
    1050 1050
     observe.content.nonTargetCatch.table.catchWeight=Poids
    
    1051 1051
     observe.content.nonTargetCatch.table.catchWeight.tip=Poids estimé (en t)
    
    1052 1052
     observe.content.nonTargetCatch.table.comment=Com
    

  • services-topia/src/main/java/fr/ird/observe/services/topia/service/data/seine/NonTargetCatchServiceTopia.java
    ... ... @@ -22,25 +22,24 @@ package fr.ird.observe.services.topia.service.data.seine;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import com.google.common.collect.Iterables;
    
    26 25
     import fr.ird.observe.entities.referentiel.Species;
    
    26
    +import fr.ird.observe.entities.seine.NonTargetCatchRelease;
    
    27 27
     import fr.ird.observe.entities.seine.NonTargetLength;
    
    28 28
     import fr.ird.observe.entities.seine.NonTargetSample;
    
    29 29
     import fr.ird.observe.entities.seine.SetSeine;
    
    30
    -import fr.ird.observe.services.service.data.seine.NonTargetCatchService;
    
    31
    -import fr.ird.observe.services.topia.ObserveServiceTopia;
    
    32
    -import fr.ird.observe.services.dto.form.Form;
    
    33 30
     import fr.ird.observe.services.ObserveFormRequests;
    
    31
    +import fr.ird.observe.services.dto.form.Form;
    
    34 32
     import fr.ird.observe.services.dto.reference.ReferentialReference;
    
    35 33
     import fr.ird.observe.services.dto.result.SaveResultDto;
    
    36 34
     import fr.ird.observe.services.dto.seine.NonTargetCatchDto;
    
    37 35
     import fr.ird.observe.services.dto.seine.SetSeineNonTargetCatchDto;
    
    38
    -import org.apache.commons.logging.Log;
    
    39
    -import org.apache.commons.logging.LogFactory;
    
    40
    -
    
    36
    +import fr.ird.observe.services.service.data.seine.NonTargetCatchService;
    
    37
    +import fr.ird.observe.services.topia.ObserveServiceTopia;
    
    41 38
     import java.util.List;
    
    42 39
     import java.util.Set;
    
    43 40
     import java.util.stream.Collectors;
    
    41
    +import org.apache.commons.logging.Log;
    
    42
    +import org.apache.commons.logging.LogFactory;
    
    44 43
     
    
    45 44
     /**
    
    46 45
      * @author Sylvain Bavencoff - bavencoff@codelutin.com
    
    ... ... @@ -68,7 +67,7 @@ public class NonTargetCatchServiceTopia extends ObserveServiceTopia implements N
    68 67
             // on cherche si il y a des échantillons sur les captures
    
    69 68
             if (setSeine.isNonTargetSampleNotEmpty()) {
    
    70 69
     
    
    71
    -            NonTargetSample nonTargetSample = Iterables.get(setSeine.getNonTargetSample(), 0);
    
    70
    +            NonTargetSample nonTargetSample = setSeine.getNonTargetSample().iterator().next();
    
    72 71
     
    
    73 72
                 Set<String> speciesSampleIds = nonTargetSample.getNonTargetLength()
    
    74 73
                                                               .stream()
    
    ... ... @@ -85,6 +84,24 @@ public class NonTargetCatchServiceTopia extends ObserveServiceTopia implements N
    85 84
     
    
    86 85
             }
    
    87 86
     
    
    87
    +        // on cherche si il y a des libérations d'espèce sensibles
    
    88
    +        if (setSeine.isNonTargetCatchReleaseNotEmpty()) {
    
    89
    +
    
    90
    +            Set<String> speciesSampleIds = setSeine.getNonTargetCatchRelease()
    
    91
    +                    .stream()
    
    92
    +                    .map(NonTargetCatchRelease::getSpecies)
    
    93
    +                    .map(Species::getTopiaId)
    
    94
    +                    .collect(Collectors.toSet());
    
    95
    +
    
    96
    +            for (NonTargetCatchDto nonTargetCatchDto : setSeineNonTargetCatchDto.getNonTargetCatch()) {
    
    97
    +
    
    98
    +                boolean hasRelease = speciesSampleIds.contains(nonTargetCatchDto.getSpecies().getId());
    
    99
    +                nonTargetCatchDto.setHasRelease(hasRelease);
    
    100
    +
    
    101
    +            }
    
    102
    +
    
    103
    +        }
    
    104
    +
    
    88 105
             return form;
    
    89 106
         }
    
    90 107
     
    

  • services/src/main/xmi/observe-services-dto-seine.zargo
    No preview for this file type