Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 1bda758d by Tony CHEMIT at 2017-06-19T08:19:51+02:00 Vérifier s'il y a des remises à l'eau avant de supprimer une capture (See #612) - - - - - 5 changed files: - application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetCatchUIHandler.java - application-swing/src/main/resources/i18n/application-swing_en_GB.properties - application-swing/src/main/resources/i18n/application-swing_fr_FR.properties - services-topia/src/main/java/fr/ird/observe/services/topia/service/data/seine/NonTargetCatchServiceTopia.java - services/src/main/xmi/observe-services-dto-seine.zargo Changes: ===================================== application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetCatchUIHandler.java ===================================== --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/NonTargetCatchUIHandler.java +++ b/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 } } + if (nonTargetCatchDto.isHasRelease()) { + + ReferentialReference<SpeciesDto> species = nonTargetCatchDto.getSpecies(); + + Iterable<NonTargetCatchDto> currentTargetCatchSpecies = NonTargetCatchHelper.filterBySpecies(objets, species); + + if (Iterables.isEmpty(currentTargetCatchSpecies)) { + + speciesToDelete.add(species); + + } + } + } if (!speciesToDelete.isEmpty()) { ===================================== application-swing/src/main/resources/i18n/application-swing_en_GB.properties ===================================== --- a/application-swing/src/main/resources/i18n/application-swing_en_GB.properties +++ b/application-swing/src/main/resources/i18n/application-swing_en_GB.properties @@ -1039,7 +1039,7 @@ observe.content.measurement.delete.message=Delete selected measurement observe.content.mode.create.tip=Object is in create mode observe.content.mode.read.tip=Object is not editable observe.content.mode.update.tip=Object is in editing mode -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. +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. observe.content.nonTargetCatch.table.catchWeight=Weight observe.content.nonTargetCatch.table.catchWeight.tip=Weight estimated (in t) observe.content.nonTargetCatch.table.comment=Com ===================================== application-swing/src/main/resources/i18n/application-swing_fr_FR.properties ===================================== --- a/application-swing/src/main/resources/i18n/application-swing_fr_FR.properties +++ b/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 observe.content.mode.create.tip=L'objet est en cours de création observe.content.mode.read.tip=L'objet n'est pas éditable observe.content.mode.update.tip=L'objet est en cours d'édition -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 +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 observe.content.nonTargetCatch.table.catchWeight=Poids observe.content.nonTargetCatch.table.catchWeight.tip=Poids estimé (en t) observe.content.nonTargetCatch.table.comment=Com ===================================== services-topia/src/main/java/fr/ird/observe/services/topia/service/data/seine/NonTargetCatchServiceTopia.java ===================================== --- a/services-topia/src/main/java/fr/ird/observe/services/topia/service/data/seine/NonTargetCatchServiceTopia.java +++ b/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; * #L% */ -import com.google.common.collect.Iterables; import fr.ird.observe.entities.referentiel.Species; +import fr.ird.observe.entities.seine.NonTargetCatchRelease; import fr.ird.observe.entities.seine.NonTargetLength; import fr.ird.observe.entities.seine.NonTargetSample; import fr.ird.observe.entities.seine.SetSeine; -import fr.ird.observe.services.service.data.seine.NonTargetCatchService; -import fr.ird.observe.services.topia.ObserveServiceTopia; -import fr.ird.observe.services.dto.form.Form; import fr.ird.observe.services.ObserveFormRequests; +import fr.ird.observe.services.dto.form.Form; import fr.ird.observe.services.dto.reference.ReferentialReference; import fr.ird.observe.services.dto.result.SaveResultDto; import fr.ird.observe.services.dto.seine.NonTargetCatchDto; import fr.ird.observe.services.dto.seine.SetSeineNonTargetCatchDto; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - +import fr.ird.observe.services.service.data.seine.NonTargetCatchService; +import fr.ird.observe.services.topia.ObserveServiceTopia; import java.util.List; import java.util.Set; import java.util.stream.Collectors; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @author Sylvain Bavencoff - bavencoff@codelutin.com @@ -68,7 +67,7 @@ public class NonTargetCatchServiceTopia extends ObserveServiceTopia implements N // on cherche si il y a des échantillons sur les captures if (setSeine.isNonTargetSampleNotEmpty()) { - NonTargetSample nonTargetSample = Iterables.get(setSeine.getNonTargetSample(), 0); + NonTargetSample nonTargetSample = setSeine.getNonTargetSample().iterator().next(); Set<String> speciesSampleIds = nonTargetSample.getNonTargetLength() .stream() @@ -85,6 +84,24 @@ public class NonTargetCatchServiceTopia extends ObserveServiceTopia implements N } + // on cherche si il y a des libérations d'espèce sensibles + if (setSeine.isNonTargetCatchReleaseNotEmpty()) { + + Set<String> speciesSampleIds = setSeine.getNonTargetCatchRelease() + .stream() + .map(NonTargetCatchRelease::getSpecies) + .map(Species::getTopiaId) + .collect(Collectors.toSet()); + + for (NonTargetCatchDto nonTargetCatchDto : setSeineNonTargetCatchDto.getNonTargetCatch()) { + + boolean hasRelease = speciesSampleIds.contains(nonTargetCatchDto.getSpecies().getId()); + nonTargetCatchDto.setHasRelease(hasRelease); + + } + + } + return form; } ===================================== services/src/main/xmi/observe-services-dto-seine.zargo ===================================== Binary files a/services/src/main/xmi/observe-services-dto-seine.zargo and b/services/src/main/xmi/observe-services-dto-seine.zargo differ View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/1bda758d9a8231b006949683b084... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/1bda758d9a8231b006949683b084... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT