This is an automated email from the git hooks/post-receive script. New commit to branch feature/7605_raison_rejet_perdue in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git commit 05db94f07af9b087ec9fac0b7c228e449b776196 Author: Samuel Maisonneuve <maisonneuve@codelutin.com> Date: Mon Aug 8 13:20:40 2016 +0200 Corrige la perte de valeur de la raison du rejet lorsque l'on change de ligne refs #7605 --- .../observe/services/dto/seine/TargetCatchDtos.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/TargetCatchDtos.java b/observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/TargetCatchDtos.java index e20c7d4..29b4139 100644 --- a/observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/TargetCatchDtos.java +++ b/observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/TargetCatchDtos.java @@ -22,6 +22,9 @@ package fr.ird.observe.services.dto.seine; * #L% */ +import fr.ird.observe.services.dto.referential.ReferentialReference; +import fr.ird.observe.services.dto.referential.seine.ReasonForDiscardDto; + import java.util.Collection; import java.util.List; import java.util.stream.Collectors; @@ -34,4 +37,21 @@ public class TargetCatchDtos extends AbstractTargetCatchDtos { .collect(Collectors.toList()); return target; } + + public static <BeanType extends TargetCatchDto> void copyTargetCatchDto(BeanType source, BeanType target) { + // The reasonForDiscard has to be the last property to be set : + // Setting species and categoryWeight properties will fire event that might end up + // in resetting the reasonForDiscard to null into the bean. + // + // This is a side effect from the ui (TargetDiscarCatchUi) : changing the selected species reinitializes weightCategory and reasonForDiscard to null + // This works with events and these events are also unfortunately triggered when selecting a new row in a table + // and thus changing te value of the TargetCatchDto bean + // + // To avoid being trapped with this mechanism we need to ensure that the reasonDorDiscard will be set at the end. + // If not, you will probably end up with an empty value in the reasonForDiscard field within the ui when you select another row + // in the table. + ReferentialReference<ReasonForDiscardDto> reasonForDiscard = source.reasonForDiscard; + AbstractTargetCatchDtos.copyTargetCatchDto(source, target); + target.setReasonForDiscard(reasonForDiscard); + } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.