branch develop updated (f88c42c -> 62ee1a4)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git from f88c42c [PS] Saisie des échantillons de cible : modification de la gestion des types de taille (Fixes #8390) Merge branch 'feature/8390' into develop new 62ee1a4 [PS] Unicité des enregistrements des rejets de thons à modifier (Fixes #7510) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 62ee1a4186b50a71d3d1d8b7dc94479d708ec639 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Nov 2 11:28:38 2016 +0100 [PS] Unicité des enregistrements des rejets de thons à modifier (Fixes #7510) Summary of changes: ...-ui-update-targetDiscarded-error-validation.xml | 2 +- .../application-swing-validation_en_GB.properties | 2 +- .../application-swing-validation_es_ES.properties | 2 +- .../application-swing-validation_fr_FR.properties | 2 +- .../impl/seine/TargetDiscardCatchUIHandler.java | 123 +++++++-------------- 5 files changed, 42 insertions(+), 89 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git commit 62ee1a4186b50a71d3d1d8b7dc94479d708ec639 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Nov 2 11:28:38 2016 +0100 [PS] Unicité des enregistrements des rejets de thons à modifier (Fixes #7510) --- ...-ui-update-targetDiscarded-error-validation.xml | 2 +- .../application-swing-validation_en_GB.properties | 2 +- .../application-swing-validation_es_ES.properties | 2 +- .../application-swing-validation_fr_FR.properties | 2 +- .../impl/seine/TargetDiscardCatchUIHandler.java | 123 +++++++-------------- 5 files changed, 42 insertions(+), 89 deletions(-) diff --git a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-ui-update-targetDiscarded-error-validation.xml b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-ui-update-targetDiscarded-error-validation.xml index 8104a32..f9b6295 100644 --- a/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-ui-update-targetDiscarded-error-validation.xml +++ b/application-swing-validation/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-ui-update-targetDiscarded-error-validation.xml @@ -32,7 +32,7 @@ <field-validator type="collectionFieldExpression"> <param name="mode">UNIQUE_KEY</param> - <param name="keys">weightCategory.id,reasonForDiscard.id</param> + <param name="keys">weightCategory.id,reasonForDiscard.id,broughtOnDeck</param> <message>validator.ui.targetDiscarded.uniqueKey</message> </field-validator> diff --git a/application-swing-validation/src/main/resources/i18n/application-swing-validation_en_GB.properties b/application-swing-validation/src/main/resources/i18n/application-swing-validation_en_GB.properties index 3e9eca9..2d02105 100644 --- a/application-swing-validation/src/main/resources/i18n/application-swing-validation_en_GB.properties +++ b/application-swing-validation/src/main/resources/i18n/application-swing-validation_en_GB.properties @@ -531,7 +531,7 @@ validator.ui.targetDiscarded.required.reasonForDiscard=Reason for discard must b validator.ui.targetDiscarded.required.species=Species must be filled. validator.ui.targetDiscarded.required.weight=Weight must be filled. validator.ui.targetDiscarded.required.weightCategory=Weight category must be filled. -validator.ui.targetDiscarded.uniqueKey=Tuple (category - reasonForDiscard) must be unique. +validator.ui.targetDiscarded.uniqueKey=Tuple (category - reasonForDiscard - brought on deck) must be unique. validator.ui.targetLength.bound.length=Length must be bound between %s and %s. validator.ui.targetLength.bound.weight=Weight must be bound between %s and %s. validator.ui.targetLength.desactivated.sizeMeasureType=Selected size measure type is disabled. diff --git a/application-swing-validation/src/main/resources/i18n/application-swing-validation_es_ES.properties b/application-swing-validation/src/main/resources/i18n/application-swing-validation_es_ES.properties index 64dd001..864e086 100644 --- a/application-swing-validation/src/main/resources/i18n/application-swing-validation_es_ES.properties +++ b/application-swing-validation/src/main/resources/i18n/application-swing-validation_es_ES.properties @@ -531,7 +531,7 @@ validator.ui.targetDiscarded.required.reasonForDiscard=Es obligatoria selecciona validator.ui.targetDiscarded.required.species=Es obligatorio seleccionar una especie de atún. validator.ui.targetDiscarded.required.weight=El peso es obligatorio. validator.ui.targetDiscarded.required.weightCategory=Es obligatorio seleccionar una categoría de peso. -validator.ui.targetDiscarded.uniqueKey=El par (categoria - causa del descarte) debe ser única. +validator.ui.targetDiscarded.uniqueKey=El par (categoria - causa del descarte - izado a bordo) debe ser única. validator.ui.targetLength.bound.length=La talla para esta especie debe estar comprendida entre %1$s y %2$s. validator.ui.targetLength.bound.weight=La peso para esta especie debe estar comprendida entre %1$s y %2$s. validator.ui.targetLength.desactivated.sizeMeasureType=Selected size mesure type is disabled. \#TODO diff --git a/application-swing-validation/src/main/resources/i18n/application-swing-validation_fr_FR.properties b/application-swing-validation/src/main/resources/i18n/application-swing-validation_fr_FR.properties index c090076..c382b79 100644 --- a/application-swing-validation/src/main/resources/i18n/application-swing-validation_fr_FR.properties +++ b/application-swing-validation/src/main/resources/i18n/application-swing-validation_fr_FR.properties @@ -531,7 +531,7 @@ validator.ui.targetDiscarded.required.reasonForDiscard=La sélection d'une raiso validator.ui.targetDiscarded.required.species=La sélection d'une espèce de thon est obligatoire. validator.ui.targetDiscarded.required.weight=Le poids est obligatoire. validator.ui.targetDiscarded.required.weightCategory=La sélection d'une catégorie poids est obligatoire. -validator.ui.targetDiscarded.uniqueKey=Le couple (catégorie - raison rejet) doit être unique. +validator.ui.targetDiscarded.uniqueKey=Le couple (catégorie - raison rejet - monté sur le pont) doit être unique. validator.ui.targetLength.bound.length=La longueur pour cette espèce doit être comprise entre %1$s et %2$s. validator.ui.targetLength.bound.weight=Le poids individuel de l'échantillon doit être compris entre %1$s et %2$s. validator.ui.targetLength.desactivated.sizeMeasureType=Le type de mesure sélectionné est désactivé. diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java index 31415da..bf23f7f 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java @@ -22,10 +22,12 @@ package fr.ird.observe.application.swing.ui.content.table.impl.seine; import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; import com.google.common.collect.Sets; import fr.ird.observe.application.swing.ObserveSwingApplicationContext; import fr.ird.observe.application.swing.db.constants.DataContextType; +import fr.ird.observe.application.swing.ui.UIHelper; +import fr.ird.observe.application.swing.ui.content.table.ContentTableModel; +import fr.ird.observe.application.swing.ui.content.table.ContentTableUIHandler; import fr.ird.observe.services.dto.Form; import fr.ird.observe.services.dto.referential.ReferentialDto; import fr.ird.observe.services.dto.referential.ReferentialReference; @@ -42,9 +44,6 @@ import fr.ird.observe.services.dto.seine.TargetCatchDto; import fr.ird.observe.services.dto.seine.TargetCatchHelper; import fr.ird.observe.services.service.seine.TargetCatchService; import fr.ird.observe.services.service.seine.TripSeineService; -import fr.ird.observe.application.swing.ui.UIHelper; -import fr.ird.observe.application.swing.ui.content.table.ContentTableModel; -import fr.ird.observe.application.swing.ui.content.table.ContentTableUIHandler; import jaxx.runtime.swing.editor.bean.BeanComboBox; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -54,6 +53,7 @@ import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.LinkedList; @@ -76,31 +76,31 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT public TargetDiscardCatchUIHandler(TargetDiscardCatchUI ui) { super(ui, DataContextType.SetSeine); } - - protected static Collection<ReferentialReference<WeightCategoryDto>> getWeightCategoryUsed( - ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model) { - - List<ReferentialReference<WeightCategoryDto>> list = model.getColumnValues(1); - Collection<ReferentialReference<WeightCategoryDto>> set = Sets.newHashSet(list); - list.clear(); - return set; - } - - protected static Collection<ReferentialReference<ReasonForDiscardDto>> getReasonForDiscardUsed( - ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model, - ReferentialReference<WeightCategoryDto> weightCategory) { - - Collection<ReferentialReference<ReasonForDiscardDto>> set = Sets.newHashSet(); - if (weightCategory != null) { - for (int i = 0; i < model.getRowCount(); i++) { - TargetCatchDto c = model.getValueAt(i); - if (c != null && weightCategory.equals(c.getWeightCategory()) && c.getReasonForDiscard() != null) { - set.add(c.getReasonForDiscard()); - } - } - } - return set; - } +// +// protected static Collection<ReferentialReference<WeightCategoryDto>> getWeightCategoryUsed( +// ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model) { +// +// List<ReferentialReference<WeightCategoryDto>> list = model.getColumnValues(1); +// Collection<ReferentialReference<WeightCategoryDto>> set = Sets.newHashSet(list); +// list.clear(); +// return set; +// } +// +// protected static Collection<ReferentialReference<ReasonForDiscardDto>> getReasonForDiscardUsed( +// ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model, +// ReferentialReference<WeightCategoryDto> weightCategory) { +// +// Collection<ReferentialReference<ReasonForDiscardDto>> set = Sets.newHashSet(); +// if (weightCategory != null) { +// for (int i = 0; i < model.getRowCount(); i++) { +// TargetCatchDto c = model.getValueAt(i); +// if (c != null && weightCategory.equals(c.getWeightCategory()) && c.getReasonForDiscard() != null) { +// set.add(c.getReasonForDiscard()); +// } +// } +// } +// return set; +// } @Override public TargetDiscardCatchUI getUi() { @@ -258,7 +258,7 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT } // on recalcule la liste des speciess disponibles - List<ReferentialReference<SpeciesDto>> availableSpecies = buildSpeciesList(species, weightCategory); + List<ReferentialReference<SpeciesDto>> availableSpecies = buildSpeciesList(weightCategory); ui.getSpecies().setData(availableSpecies); // on reinitilise toujours l'species (pour reinitialiser la liste des categories) @@ -368,12 +368,11 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT } else { - // un categorie est selectionne, on met a jour la liste des raisons - // rejet disponible pour cette categorie + // un categorie est selectionne, on met a jour la liste des raisons rejet disponible pour cette categorie reasonForDiscard = bean.getReasonForDiscard(); - List<ReferentialReference<ReasonForDiscardDto>> reasonForDiscardList = buildReasonFordiscardList(weightCategory, reasonForDiscard); + List<ReferentialReference<ReasonForDiscardDto>> reasonForDiscardList = buildReasonFordiscardList(); if (log.isDebugEnabled()) { log.debug("new reasonForDiscard list " + reasonForDiscardList); @@ -381,10 +380,6 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT data = reasonForDiscardList; - if (reasonForDiscard != null && !reasonForDiscardList.contains(reasonForDiscard)) { - // on sélectionne la première raison rejet disponible - reasonForDiscard = null; - } } BeanComboBox<ReferentialReference<ReasonForDiscardDto>> combo = ui.getReasonForDiscard(); @@ -396,13 +391,10 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT combo.setSelectedItem(reasonForDiscard); } - protected List<ReferentialReference<SpeciesDto>> buildSpeciesList(ReferentialReference<SpeciesDto> species, - ReferentialReference<WeightCategoryDto> weightCategory) { + protected List<ReferentialReference<SpeciesDto>> buildSpeciesList(ReferentialReference<WeightCategoryDto> weightCategory) { List<ReferentialReference<WeightCategoryDto>> weightCategoryList = getAllWeightCategories(); - removeFullyUsedWeightCategories(weightCategoryList); - if (weightCategory != null) { weightCategoryList.add(weightCategory); } @@ -418,7 +410,7 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT } - List<ReferentialReference<SpeciesDto>> result = Lists.newArrayList(usedSpecies); + List<ReferentialReference<SpeciesDto>> result = new ArrayList<>(usedSpecies); weightCategoryList.clear(); usedSpecies.clear(); return result; @@ -428,62 +420,23 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT protected List<ReferentialReference<WeightCategoryDto>> buildWeightCategoryList(ReferentialReference<SpeciesDto> species) { Set<ReferentialReference<WeightCategoryDto>> allCategories = getModel().getReferentialReferences(TargetCatchDto.PROPERTY_WEIGHT_CATEGORY); - List<ReferentialReference<WeightCategoryDto>> weightCategoryList = WeightCategoryHelper.filterSpeciesWeightCategories(allCategories, species.getId()); - - // on filtre toutes les categories qui ont deja references sur toutes les raisons de rejet - removeFullyUsedWeightCategories(weightCategoryList); + return WeightCategoryHelper.filterSpeciesWeightCategories(allCategories, species.getId()); - return weightCategoryList; } @SuppressWarnings("unchecked") - protected List<ReferentialReference<ReasonForDiscardDto>> buildReasonFordiscardList(ReferentialReference<WeightCategoryDto> weightCategory, - ReferentialReference<ReasonForDiscardDto> reasonForDiscard) { + protected List<ReferentialReference<ReasonForDiscardDto>> buildReasonFordiscardList() { - ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model = getTableModel(); Set<ReferentialReference<ReasonForDiscardDto>> reasonForDiscardSet = getModel().getReferentialReferences(TargetCatchDto.PROPERTY_REASON_FOR_DISCARD); + return new ArrayList<>(reasonForDiscardSet); - List<ReferentialReference<ReasonForDiscardDto>> reasonForDiscardList = Lists.newArrayList(reasonForDiscardSet); - - // on filtre les raison rejet sur la categorie - for (int i = 0; i < model.getRowCount(); i++) { - TargetCatchDto c = model.getValueAt(i); - - if (model.getSelectedRow() != i - && c != null - && c.getReasonForDiscard() != null - && (reasonForDiscard == null || !reasonForDiscard.equals(c.getReasonForDiscard())) - && weightCategory.equals(c.getWeightCategory())) { - reasonForDiscardList.remove(c.getReasonForDiscard()); - } - } - - return reasonForDiscardList; } protected List<ReferentialReference<WeightCategoryDto>> getAllWeightCategories() { Set<ReferentialReference<WeightCategoryDto>> weightCategorySet = getModel().getReferentialReferences(TargetCatchDto.PROPERTY_WEIGHT_CATEGORY); - return Lists.newArrayList(weightCategorySet); - - } - - protected void removeFullyUsedWeightCategories(List<ReferentialReference<WeightCategoryDto>> weightCategoryAvaillables) { - - ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model = getTableModel(); - - Set<ReferentialReference<ReasonForDiscardDto>> reasonForDiscardSet = getModel().getReferentialReferences(TargetCatchDto.PROPERTY_REASON_FOR_DISCARD); - - int nbReasonForDiscard = reasonForDiscardSet.size(); + return new ArrayList<>(weightCategorySet); - // on filtre toutes les weightCategory qui ont deja references toutes les raisons rejets - for (ReferentialReference<WeightCategoryDto> c : getWeightCategoryUsed(model)) { - Collection<ReferentialReference<ReasonForDiscardDto>> raisonUsed = getReasonForDiscardUsed(model, c); - if (raisonUsed.size() == nbReasonForDiscard) { - // toutes les raison de rejet epuisé pour cette categorie - weightCategoryAvaillables.remove(c); - } - } } @Override -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm