This is an automated email from the git hooks/post-receive script. New commit to branch feature/refactor_reference in repository observe. See http://git.codelutin.com/observe.git commit 72354693d1f7b6dd25d302ba45b1fcdcd8e54e19 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sat Nov 21 08:27:57 2015 +0100 Impact dans les handlers dues aux renommages de l'API des services + début d'utilisation des bons objets là où il faut : si j'ai un ReferentialReference et bien je veux m'en servir; toujours être le plus précis possible) --- .../fr/ird/observe/ui/content/ContentUIModel.java | 14 +++ .../LonglineDetailCompositionUIHandler.java | 27 ++-- .../LonglineGlobalCompositionUIHandler.java | 2 +- .../impl/longline/SetLonglineUIHandler.java | 2 +- .../ActivitySeineObservedSystemUIHandler.java | 6 +- ...ngObjectTransmittingBuoyOperationUIHandler.java | 2 +- .../impl/seine/FloatingObjectUIHandler.java | 2 +- .../ui/content/impl/seine/SetSeineUIHandler.java | 6 +- .../impl/longline/ActivityLonglinesUIHandler.java | 2 +- .../list/impl/seine/ActivitySeinesUIHandler.java | 2 +- .../impl/longline/ActivityLonglineUIHandler.java | 2 +- .../open/impl/longline/TripLonglineUIHandler.java | 2 +- .../open/impl/seine/ActivitySeineUIHandler.java | 2 +- .../ui/content/open/impl/seine/RouteUIHandler.java | 2 +- .../impl/longline/CatchLonglineUIHandler.java | 4 +- .../table/impl/longline/EncounterUIHandler.java | 2 +- .../longline/GearUseFeaturesLonglineUIHandler.java | 2 +- .../table/impl/longline/SensorUsedUIHandler.java | 5 +- .../content/table/impl/longline/TdrUIHandler.java | 2 +- .../table/impl/seine/GearUseFeaturesSeineUI.jaxx | 3 +- .../impl/seine/GearUseFeaturesSeineUIHandler.java | 23 ++-- .../content/table/impl/seine/NonTargetCatchUI.jaxx | 7 +- .../table/impl/seine/NonTargetCatchUIHandler.java | 22 ++-- .../table/impl/seine/NonTargetSampleUI.jaxx | 5 +- .../table/impl/seine/NonTargetSampleUIHandler.java | 12 +- .../table/impl/seine/ObjectObservedSpeciesUI.jaxx | 5 +- .../impl/seine/ObjectObservedSpeciesUIHandler.java | 2 +- .../table/impl/seine/ObjectSchoolEstimateUI.jaxx | 3 +- .../impl/seine/ObjectSchoolEstimateUIHandler.java | 2 +- .../content/table/impl/seine/SchoolEstimateUI.jaxx | 3 +- .../table/impl/seine/SchoolEstimateUIHandler.java | 18 ++- .../ui/content/table/impl/seine/TargetCatchUI.jaxx | 7 +- .../table/impl/seine/TargetCatchUIHandler.java | 46 +++---- .../table/impl/seine/TargetDiscardCatchUI.jaxx | 9 +- .../impl/seine/TargetDiscardCatchUIHandler.java | 138 ++++++++++----------- .../content/table/impl/seine/TargetSampleUI.jaxx | 3 +- .../table/impl/seine/TargetSampleUIHandler.java | 5 +- .../fr/ird/observe/services/dto/TripMapDtos.java | 15 +++ 38 files changed, 227 insertions(+), 189 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIModel.java index 5259b99..7a7da5e 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIModel.java @@ -24,10 +24,16 @@ package fr.ird.observe.ui.content; import fr.ird.observe.ObserveSwingTechnicalException; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.IdDto; +import fr.ird.observe.services.dto.ReferenceSetDto; +import fr.ird.observe.services.dto.referential.ReferentialDto; +import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.beans.AbstractSerializableBean; +import java.util.LinkedHashSet; +import java.util.Set; + /** * Le modèle d'un écran d'édition * @@ -239,6 +245,14 @@ public abstract class ContentUIModel<E extends IdDto> extends AbstractSerializab firePropertyChange(PROPERTY_CAN_WRITE, oldValue, canWrite); } + public <D extends ReferentialDto> Set<ReferentialReferenceDto<D>> getReferentialReferences(Class<D> type, String name) { + + ReferenceSetDto<D> referenceSetDto1 = formDto.getReferenceSetDto(type, name); + LinkedHashSet<ReferentialReferenceDto<D>> reference = (LinkedHashSet)referenceSetDto1.getReference(); + return reference; + + } + protected void firePropertyChange(String propertyName, Object newValue) { firePropertyChange(propertyName, null, newValue); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/LonglineDetailCompositionUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/LonglineDetailCompositionUIHandler.java index 67b2006..1478989 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/LonglineDetailCompositionUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/LonglineDetailCompositionUIHandler.java @@ -26,8 +26,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.Sets; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.db.DataContext; -import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.db.ObserveSwingDataSource; +import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.entities.longline.SectionTemplate; import fr.ird.observe.entities.longline.SectionWithTemplate; import fr.ird.observe.entities.longline.SectionWithTemplates; @@ -82,6 +82,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong static private Log log = LogFactory.getLog(LonglineDetailCompositionUIHandler.class); private final PropertyChangeListener sectionTemplatesTableModelModified = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { Boolean newValue = (Boolean) evt.getNewValue(); @@ -90,6 +91,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong }; private final PropertyChangeListener sectionsTableModelModified = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { Boolean newValue = (Boolean) evt.getNewValue(); @@ -98,6 +100,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong }; private final TableModelListener sectionsTableModelChanged = new TableModelListener() { + @Override public void tableChanged(TableModelEvent e) { SectionsTableModel source = (SectionsTableModel) e.getSource(); @@ -106,6 +109,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong }; private final PropertyChangeListener branchlineDetailChanged = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { @@ -124,6 +128,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong }; private final PropertyChangeListener basketsTableModelModified = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { Boolean newValue = (Boolean) evt.getNewValue(); @@ -132,6 +137,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong }; private final TableModelListener basketsTableModelChanged = new TableModelListener() { + @Override public void tableChanged(TableModelEvent e) { BasketsTableModel source = (BasketsTableModel) e.getSource(); @@ -140,6 +146,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong }; private final PropertyChangeListener branchinesTableModelModified = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { onBranchlinesTableModelModified((Boolean) evt.getNewValue()); @@ -147,6 +154,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong }; private final TableModelListener branchinesTableModelChanged = new TableModelListener() { + @Override public void tableChanged(TableModelEvent e) { BranchlinesTableModel source = (BranchlinesTableModel) e.getSource(); @@ -155,6 +163,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong }; private final PropertyChangeListener selectedBranchlineChanged = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { BranchlineDto previousValue = (BranchlineDto) evt.getOldValue(); @@ -164,6 +173,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong }; private final ChangeListener tabbedPaneChanged = new ChangeListener() { + @Override public void stateChanged(ChangeEvent e) { JVetoableTabbedPane source = (JVetoableTabbedPane) e.getSource(); @@ -200,6 +210,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong private boolean sectionAdjusting; private final PropertyChangeListener modelCanGenerateChanged = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { @@ -216,6 +227,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong }; private final PropertyChangeListener selectedSectionChanged = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { @@ -238,6 +250,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong private boolean basketAdjusting; private final PropertyChangeListener selectedBasketChanged = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { @@ -262,6 +275,7 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong private boolean onOpen; private JVetoableTabbedPane.ChangeSelectedIndex tabbedPaneWillChanged = new JVetoableTabbedPane.ChangeSelectedIndex() { + @Override public boolean canChangeTab(int currentSelectedIndex, int newSelectedIndex) { return onTabWillChanged(currentSelectedIndex, newSelectedIndex); @@ -398,19 +412,14 @@ public class LonglineDetailCompositionUIHandler extends ContentUIHandler<SetLong SetLonglineDetailCompositionService setLonglineService = getSetLonglineDetailCompositionService(); - FormDto<SetLonglineDetailCompositionDto> setLonglineDtoFormDto; - if (mode == ContentMode.READ) { - setLonglineDtoFormDto = setLonglineService.loadToRead(setId); - - } else { - setLonglineDtoFormDto = setLonglineService.loadToEdit(setId); - } + FormDto<SetLonglineDetailCompositionDto> setLonglineDtoFormDto = setLonglineService.loadForm(setId); getModel().setFormDto(setLonglineDtoFormDto); SetLonglineDetailCompositionDto bean = getBean(); SetLonglineDetailCompositionDtos.copySetLonglineDetailCompositionDto(setLonglineDtoFormDto.getForm(), bean); - FormDto<BranchlineDto> branchlineDtoFormDto = FormDtos.newFormDto(BranchlineDto.class, null, setLonglineDtoFormDto.getLabels()); + //FIXME Voir comment gérer ça + FormDto<BranchlineDto> branchlineDtoFormDto = FormDtos.newFormDto(BranchlineDto.class, null, null, null); getUi().getBranchlineDetailUI().getModel().setFormDto(branchlineDtoFormDto); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/LonglineGlobalCompositionUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/LonglineGlobalCompositionUIHandler.java index 9e8ce1e..2144003 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/LonglineGlobalCompositionUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/LonglineGlobalCompositionUIHandler.java @@ -143,7 +143,7 @@ public class LonglineGlobalCompositionUIHandler extends ContentUIHandler<SetLong ContentMode mode = computeContentMode(); // update mode - FormDto<SetLonglineGlobalCompositionDto> formDto = getSetLonglineGlobalCompositionService().loadToEdit(setId); + FormDto<SetLonglineGlobalCompositionDto> formDto = getSetLonglineGlobalCompositionService().loadForm(setId); getModel().setFormDto(formDto); SetLonglineGlobalCompositionDtos.copySetLonglineGlobalCompositionDto(formDto.getForm(), getBean()); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/SetLonglineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/SetLonglineUIHandler.java index d5d88bd..1467bb2 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/SetLonglineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/SetLonglineUIHandler.java @@ -225,7 +225,7 @@ public class SetLonglineUIHandler extends ContentUIHandler<SetLonglineDto> { } else { // update mode - formDto = getSetLonglineService().loadToEdit(setId); + formDto = getSetLonglineService().loadForm(setId); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/ActivitySeineObservedSystemUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/ActivitySeineObservedSystemUIHandler.java index 2463da4..0591cab 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/ActivitySeineObservedSystemUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/ActivitySeineObservedSystemUIHandler.java @@ -87,12 +87,12 @@ public class ActivitySeineObservedSystemUIHandler extends ContentUIHandler<Activ ContentMode mode = computeContentMode(); - FormDto<ActivitySeineObservedSystemDto> formDto = getActivitySeineObservedSystemService().loadToEdit(activityId); + getModel().setMode(mode); + + FormDto<ActivitySeineObservedSystemDto> formDto = getActivitySeineObservedSystemService().loadForm(activityId); getModel().setFormDto(formDto); ActivitySeineObservedSystemDtos.copyActivitySeineObservedSystemDto(formDto.getForm(), getBean()); - getModel().setMode(mode); - if (mode == ContentMode.UPDATE) { getUi().startEdit(null); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUIHandler.java index 1b5a244..3ef90fc 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUIHandler.java @@ -119,7 +119,7 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH getModel().setEditing(false); - FormDto<FloatingObjectTransmittingBuoyDto> formDto = getTransmittingBuoyOperationService().loadToEdit(dcpId); + FormDto<FloatingObjectTransmittingBuoyDto> formDto = getTransmittingBuoyOperationService().loadForm(dcpId); getModel().setFormDto(formDto); FloatingObjectTransmittingBuoyDtos.copyFloatingObjectTransmittingBuoyDto(formDto.getForm(), bean); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectUIHandler.java index e9d4fcc..d0b926e 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectUIHandler.java @@ -119,7 +119,7 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto> } else { // update mode - formDto = getFloatingObjectService().loadToEdit(dcpId); + formDto = getFloatingObjectService().loadForm(dcpId); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/SetSeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/SetSeineUIHandler.java index 8d8c1ea..d449680 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/SetSeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/SetSeineUIHandler.java @@ -179,7 +179,7 @@ public class SetSeineUIHandler extends ContentUIHandler<SetSeineDto> { } else { // update mode - formDto = getSetSeineService().loadToEdit(setId); + formDto = getSetSeineService().loadForm(setId); } @@ -187,7 +187,9 @@ public class SetSeineUIHandler extends ContentUIHandler<SetSeineDto> { SetSeineDtos.copySetSeineDto(formDto.getForm(), bean); RouteService routeService = ObserveSwingApplicationContext.get().newService(RouteService.class); - FormDto<RouteDto> route = routeService.loadToRead(selectedRouteId); + //FIXME ! Pourquoi donc récupérer le formulaire d'une route ici ? juste remonter la donnée dont on a + //FIXME besoin depuis le service + FormDto<RouteDto> route = routeService.loadForm(selectedRouteId); Date time = bean.getStartTime(); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/longline/ActivityLonglinesUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/longline/ActivityLonglinesUIHandler.java index 620c684..d20e932 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/longline/ActivityLonglinesUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/longline/ActivityLonglinesUIHandler.java @@ -130,7 +130,7 @@ public class ActivityLonglinesUIHandler extends ContentListUIHandler<TripLonglin @Override protected void loadParentBean() { TripLonglineService service = ObserveSwingApplicationContext.get().newService(TripLonglineService.class); - FormDto<TripLonglineDto> tripLonglineDtoFormDto = service.loadToEdit(getSelectedParentId()); + FormDto<TripLonglineDto> tripLonglineDtoFormDto = service.loadForm(getSelectedParentId()); getModel().setFormDto(tripLonglineDtoFormDto); TripLonglineDtos.copyTripLonglineDto(tripLonglineDtoFormDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/seine/ActivitySeinesUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/seine/ActivitySeinesUIHandler.java index b0f1701..7adb4c1 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/seine/ActivitySeinesUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/list/impl/seine/ActivitySeinesUIHandler.java @@ -127,7 +127,7 @@ public class ActivitySeinesUIHandler extends ContentListUIHandler<RouteDto, Acti @Override protected void loadParentBean() { RouteService service = ObserveSwingApplicationContext.get().newService(RouteService.class); - FormDto<RouteDto> routeDtoFormDto = service.loadToEdit(getSelectedParentId()); + FormDto<RouteDto> routeDtoFormDto = service.loadForm(getSelectedParentId()); getModel().setFormDto(routeDtoFormDto); RouteDtos.copyRouteDto(routeDtoFormDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/ActivityLonglineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/ActivityLonglineUIHandler.java index 0b26e67..e0424d7 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/ActivityLonglineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/ActivityLonglineUIHandler.java @@ -181,7 +181,7 @@ public class ActivityLonglineUIHandler extends ContentOpenableUIHandler<Activity } else { // update mode - formDto = getActivityLonglineService().loadToEdit(activityId); + formDto = getActivityLonglineService().loadForm(activityId); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java index 695cd74..783bd67 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java @@ -192,7 +192,7 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline } // update mode - formDto = getTripLonglineService().loadToEdit(tripId); + formDto = getTripLonglineService().loadForm(tripId); } setContentMode(mode); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/ActivitySeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/ActivitySeineUIHandler.java index ba98e15..dba9572 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/ActivitySeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/ActivitySeineUIHandler.java @@ -209,7 +209,7 @@ public class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySei } else { // update mode - formDto = getActivitySeineService().loadToEdit(activityId); + formDto = getActivitySeineService().loadForm(activityId); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java index 0e043aa..bde2aca 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java @@ -142,7 +142,7 @@ public class RouteUIHandler extends ContentOpenableUIHandler<RouteDto> { } else { // update mode - formDto = getRouteService().loadToEdit(routeId); + formDto = getRouteService().loadForm(routeId); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/CatchLonglineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/CatchLonglineUIHandler.java index a4f40db..2c984f7 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/CatchLonglineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/CatchLonglineUIHandler.java @@ -511,7 +511,7 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat @Override protected void loadEditBean(String beanId) { - FormDto<SetLonglineCatchDto> formDto = getSetLonglineCatchService().loadToEdit(beanId); + FormDto<SetLonglineCatchDto> formDto = getSetLonglineCatchService().loadForm(beanId); getModel().setFormDto(formDto); LonglinePositionHelper<CatchLonglineDto> positionHelper = POSITION_HELPER_ENTRY.getContextValue(getUi()); @@ -730,7 +730,7 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineCat log.info("Use branchline: " + newValue); } - FormDto<BranchlineDto> formDto = getBranchLineService().loadToEdit(newValue.getId()); + FormDto<BranchlineDto> formDto = getBranchLineService().loadForm(newValue.getId()); BranchlineDtos.copyBranchlineDto(formDto.getForm(), branchline); if (ui.getValidator().getBean() == null) { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/EncounterUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/EncounterUIHandler.java index c873ad5..1f373fc 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/EncounterUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/EncounterUIHandler.java @@ -106,7 +106,7 @@ public class EncounterUIHandler extends ContentTableUIHandler<ActivityLonglineEn @Override protected void loadEditBean(String beanId) { - FormDto<ActivityLonglineEncouterDto> formDto = getActivityLongLineEncouterService().loadToEdit(beanId); + FormDto<ActivityLonglineEncouterDto> formDto = getActivityLongLineEncouterService().loadForm(beanId); getModel().setFormDto(formDto); ActivityLonglineEncouterDtos.copyActivityLonglineEncouterDto(formDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUIHandler.java index 9445037..b7d0938 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUIHandler.java @@ -494,7 +494,7 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip @Override protected void loadEditBean(String beanId) { - FormDto<TripLonglineGearUseDto> formDto = getTripLonglineGearUseService().loadToEdit(beanId); + FormDto<TripLonglineGearUseDto> formDto = getTripLonglineGearUseService().loadForm(beanId); getModel().setFormDto(formDto); TripLonglineGearUseDtos.copyTripLonglineGearUseDto(formDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/SensorUsedUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/SensorUsedUIHandler.java index 97224d2..b37c9a6 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/SensorUsedUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/SensorUsedUIHandler.java @@ -113,6 +113,7 @@ public class SensorUsedUIHandler extends ContentTableUIHandler<ActivityLonglineS UIHelper.setTableColumnRenderer(table, 2, UIHelper.newDecorateTableCellRenderer(renderer, ReferenceDto.class, SensorDataFormatDto.class.getSimpleName())); UIHelper.setTableColumnRenderer(table, 3, UIHelper.newStringTableCellRenderer(renderer, 10, true)); UIHelper.setTableColumnRenderer(table, 4, UIHelper.newBooleanTableCellRenderer(renderer, new Predicate<Object>() { + @Override public boolean apply(Object input) { return input != null; @@ -165,7 +166,7 @@ public class SensorUsedUIHandler extends ContentTableUIHandler<ActivityLonglineS t("observe.sensorUsed.delete.data.message"), JOptionPane.WARNING_MESSAGE, new Object[]{t("observe.choice.confirm.delete"), - t("observe.choice.cancel")}, + t("observe.choice.cancel")}, 1); boolean doDelete = response == 0; @@ -234,7 +235,7 @@ public class SensorUsedUIHandler extends ContentTableUIHandler<ActivityLonglineS @Override protected void loadEditBean(String beanId) { - FormDto<ActivityLonglineSensorUsedDto> formDto = getActivityLonglineSensorUsedService().loadToEdit(beanId); + FormDto<ActivityLonglineSensorUsedDto> formDto = getActivityLonglineSensorUsedService().loadForm(beanId); getModel().setFormDto(formDto); ActivityLonglineSensorUsedDtos.copyActivityLonglineSensorUsedDto(formDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java index 34df2b7..20625b7 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/TdrUIHandler.java @@ -465,7 +465,7 @@ public class TdrUIHandler extends ContentTableUIHandler<SetLonglineTdrDto, TdrDt @Override protected void loadEditBean(String beanId) { - FormDto<SetLonglineTdrDto> formDto = getTdrService().loadToEdit(beanId); + FormDto<SetLonglineTdrDto> formDto = getTdrService().loadForm(beanId); getModel().setFormDto(formDto); LonglinePositionHelper<TdrDto> positionHelper = POSITION_HELPER_ENTRY.getContextValue(getUi()); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesSeineUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesSeineUI.jaxx index 36c4d74..eeb8893 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesSeineUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesSeineUI.jaxx @@ -34,6 +34,7 @@ fr.ird.observe.services.dto.seine.TripSeineGearUseDto fr.ird.observe.services.dto.seine.GearUseFeaturesSeineDto fr.ird.observe.services.dto.seine.GearUseFeaturesMeasurementSeineDto + fr.ird.observe.services.dto.referential.ReferentialReferenceDto fr.ird.observe.services.dto.referential.GearDto fr.ird.observe.ui.content.table.* fr.ird.observe.ui.util.BooleanEditor @@ -100,7 +101,7 @@ <JLabel id='gearLabel'/> </cell> <cell weightx='1' anchor='east'> - <BeanComboBox id='gear' constructorParams='this' genericType='ReferenceDto<GearDto>' _entityClass='GearDto.class'/> + <BeanComboBox id='gear' constructorParams='this' genericType='ReferentialReferenceDto<GearDto>' _entityClass='GearDto.class'/> </cell> </row> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesSeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesSeineUIHandler.java index c76fbe8..b0f80b2 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesSeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesSeineUIHandler.java @@ -92,6 +92,7 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei // Compute valid state of tab from the error table protected final TableModelListener computeTabValidStateListener = new TableModelListener() { + @Override public void tableChanged(TableModelEvent e) { @@ -283,6 +284,7 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei super.initUI(); getModel().addPropertyChangeListener(GearUseFeaturesSeineUIModel.PROPERTY_EDITABLE, new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { Boolean newValue = (Boolean) evt.getNewValue(); @@ -345,7 +347,7 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei if (!selectionEmpty) { - GearUseFeaturesMeasurementSeineDto data = tableModel.getSelectedRow(); + GearUseFeaturesMeasurementSeineDto data = tableModel.getSelectedRow(); if (log.isInfoEnabled()) { log.info("Delete: " + data); @@ -467,14 +469,15 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei List<GearUseFeaturesMeasurementSeineDto> measurements = Lists.newArrayList( Iterables.transform(gearDto.getGearCaracteristic(), - new Function<ReferentialReferenceDto<GearCaracteristicDto>, GearUseFeaturesMeasurementSeineDto>() { - @Override - public GearUseFeaturesMeasurementSeineDto apply(ReferentialReferenceDto<GearCaracteristicDto> input) { - GearUseFeaturesMeasurementSeineDto measurementSeineDto = new GearUseFeaturesMeasurementSeineDto(); - measurementSeineDto.setGearCaracteristic(input); - return measurementSeineDto; - } - })); + new Function<ReferentialReferenceDto<GearCaracteristicDto>, GearUseFeaturesMeasurementSeineDto>() { + + @Override + public GearUseFeaturesMeasurementSeineDto apply(ReferentialReferenceDto<GearCaracteristicDto> input) { + GearUseFeaturesMeasurementSeineDto measurementSeineDto = new GearUseFeaturesMeasurementSeineDto(); + measurementSeineDto.setGearCaracteristic(input); + return measurementSeineDto; + } + })); return measurements; @@ -488,7 +491,7 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei @Override protected void loadEditBean(String beanId) { - FormDto<TripSeineGearUseDto> formDto = getTripSeineGearUseService().loadToEdit(beanId); + FormDto<TripSeineGearUseDto> formDto = getTripSeineGearUseService().loadForm(beanId); getModel().setFormDto(formDto); TripSeineGearUseDtos.copyTripSeineGearUseDto(formDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx index b9d95ad..471c6fe 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx @@ -35,6 +35,7 @@ fr.ird.observe.services.dto.seine.SetSeineNonTargetCatchDto fr.ird.observe.services.dto.seine.NonTargetCatchDto fr.ird.observe.services.dto.referential.seine.SpeciesFateDto + fr.ird.observe.services.dto.referential.ReferentialReferenceDto fr.ird.observe.services.dto.referential.SpeciesDto fr.ird.observe.services.dto.referential.seine.ReasonForDiscardDto fr.ird.observe.ui.content.table.* @@ -90,7 +91,7 @@ <JLabel id='speciesLabel'/> </cell> <cell weightx='1' anchor='east' columns="2"> - <BeanComboBox id='species' constructorParams='this' genericType='ReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class'/> + <BeanComboBox id='species' constructorParams='this' genericType='ReferentialReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class'/> </cell> </row> @@ -100,7 +101,7 @@ <JLabel id='speciesFateLabel'/> </cell> <cell weightx='1' anchor='east' columns="2"> - <BeanComboBox id='speciesFate' constructorParams='this' genericType='ReferenceDto<SpeciesFateDto>' _entityClass='SpeciesFateDto.class'/> + <BeanComboBox id='speciesFate' constructorParams='this' genericType='ReferentialReferenceDto<SpeciesFateDto>' _entityClass='SpeciesFateDto.class'/> </cell> </row> @@ -110,7 +111,7 @@ <JLabel id='reasonForDiscardLabel'/> </cell> <cell weightx='1' anchor='east' columns="2"> - <BeanComboBox id='reasonForDiscard' constructorParams='this' genericType='ReferenceDto<ReasonForDiscardDto>' _entityClass='ReasonForDiscardDto.class'/> + <BeanComboBox id='reasonForDiscard' constructorParams='this' genericType='ReferentialReferenceDto<ReasonForDiscardDto>' _entityClass='ReasonForDiscardDto.class'/> </cell> </row> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUIHandler.java index d039447..2e6102a 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUIHandler.java @@ -28,7 +28,6 @@ import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.ReferenceDto; -import fr.ird.observe.services.dto.ReferenceSetDto; import fr.ird.observe.services.dto.constants.seine.NonTargetCatchComputedValueSource; import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.services.dto.referential.SpeciesDto; @@ -52,6 +51,7 @@ import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -75,6 +75,7 @@ public class NonTargetCatchUIHandler extends ContentTableUIHandler<SetSeineNonTa * @since 3.0 */ protected final PropertyChangeListener totalCountChanged = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { NonTargetCatchDto source = (NonTargetCatchDto) evt.getSource(); @@ -90,6 +91,7 @@ public class NonTargetCatchUIHandler extends ContentTableUIHandler<SetSeineNonTa * @since 3.0 */ protected final PropertyChangeListener catchWeightChanged = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { NonTargetCatchDto source = (NonTargetCatchDto) evt.getSource(); @@ -105,6 +107,7 @@ public class NonTargetCatchUIHandler extends ContentTableUIHandler<SetSeineNonTa * @since 3.0 */ protected final PropertyChangeListener meanWeightChanged = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { NonTargetCatchDto source = (NonTargetCatchDto) evt.getSource(); @@ -120,6 +123,7 @@ public class NonTargetCatchUIHandler extends ContentTableUIHandler<SetSeineNonTa * @since 3.0 */ protected final PropertyChangeListener meanLengthChanged = new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { NonTargetCatchDto source = (NonTargetCatchDto) evt.getSource(); @@ -207,9 +211,7 @@ public class NonTargetCatchUIHandler extends ContentTableUIHandler<SetSeineNonTa } @Override - protected void onSelectedRowChanged(int editingRow, - NonTargetCatchDto bean, - boolean create) { + protected void onSelectedRowChanged(int editingRow, NonTargetCatchDto bean, boolean create) { NonTargetCatchUI ui = getUi(); ContentTableModel<SetSeineNonTargetCatchDto, NonTargetCatchDto> model = getTableModel(); @@ -220,18 +222,18 @@ public class NonTargetCatchUIHandler extends ContentTableUIHandler<SetSeineNonTa return; } - List<ReferenceDto<SpeciesDto>> availableEspeces; + List<ReferentialReferenceDto<SpeciesDto>> availableEspeces; JComponent requestFocus; if (create) { - ReferenceSetDto<SpeciesDto> speciesDtoReferenceSetDto = getModel().getFormDto().getReferenceSetDto(SpeciesDto.class); - Set<ReferenceDto<SpeciesDto>> speciesSet = (Set) speciesDtoReferenceSetDto.getReference(); + Set<ReferentialReferenceDto<SpeciesDto>> speciesSet = getModel().getReferentialReferences(SpeciesDto.class, NonTargetCatchDto.PROPERTY_SPECIES); availableEspeces = Lists.newArrayList(speciesSet); requestFocus = ui.getSpecies(); } else { - ReferenceDto<SpeciesDto> species = bean.getSpecies(); - availableEspeces = Lists.newArrayList(species); + ReferentialReferenceDto<SpeciesDto> species = bean.getSpecies(); + availableEspeces = new ArrayList<>(); + availableEspeces.add(species); requestFocus = ui.getTable(); } @@ -364,7 +366,7 @@ public class NonTargetCatchUIHandler extends ContentTableUIHandler<SetSeineNonTa @Override protected void loadEditBean(String beanId) { String tripSeineId = getDataContext().getSelectedTripSeineId(); - FormDto<SetSeineNonTargetCatchDto> formDto = getNonTargetCatchService().loadToEdit(beanId, tripSeineId); + FormDto<SetSeineNonTargetCatchDto> formDto = getNonTargetCatchService().loadForm(beanId, tripSeineId); getModel().setFormDto(formDto); SetSeineNonTargetCatchDtos.copySetSeineNonTargetCatchDto(formDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetSampleUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetSampleUI.jaxx index 40eeca8..b9d9ca3 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetSampleUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetSampleUI.jaxx @@ -34,6 +34,7 @@ fr.ird.observe.services.dto.CommentableDto fr.ird.observe.services.dto.referential.SexDto fr.ird.observe.services.dto.referential.SpeciesDto + fr.ird.observe.services.dto.referential.ReferentialReferenceDto fr.ird.observe.services.dto.seine.NonTargetLengthDto fr.ird.observe.services.dto.seine.NonTargetSampleDto fr.ird.observe.ui.content.table.impl.seine.ModeSaisieEchantillonEnum @@ -123,7 +124,7 @@ public String getSpeciesFauneTypeTaille(ReferenceDto<SpeciesDto> species) { <JLabel id='speciesLabel'/> </cell> <cell weightx='1' anchor='east'> - <BeanComboBox id='species' constructorParams='this' genericType='ReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class'/> + <BeanComboBox id='species' constructorParams='this' genericType='ReferentialReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class'/> </cell> </row> @@ -185,7 +186,7 @@ public String getSpeciesFauneTypeTaille(ReferenceDto<SpeciesDto> species) { <JLabel id='sexLabel'/> </cell> <cell weightx='1' anchor='east'> - <BeanComboBox id='sex' genericType='ReferenceDto<SexDto>' _entityClass='SexDto.class' constructorParams='this'/> + <BeanComboBox id='sex' genericType='ReferentialReferenceDto<SexDto>' _entityClass='SexDto.class' constructorParams='this'/> </cell> </row> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetSampleUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetSampleUIHandler.java index 7e67baa..54e7e1f 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetSampleUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetSampleUIHandler.java @@ -27,7 +27,7 @@ import fr.ird.observe.db.DataContext; import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.ReferenceDto; -import fr.ird.observe.services.dto.ReferenceSetDto; +import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.services.dto.referential.SexDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.seine.NonTargetLengthDto; @@ -129,12 +129,12 @@ public class NonTargetSampleUIHandler extends ContentTableUIHandler<NonTargetSam return; } - ReferenceDto<SpeciesDto> species = bean.getSpecies(); + ReferentialReferenceDto<SpeciesDto> species = bean.getSpecies(); NonTargetSampleUI ui = getUi(); if (log.isDebugEnabled()) { log.debug("selected species " + species); } - List<ReferenceDto<SpeciesDto>> availableEspeces; + List<ReferentialReferenceDto<SpeciesDto>> availableEspeces; JComponent requestFocus; if (create) { @@ -146,9 +146,9 @@ public class NonTargetSampleUIHandler extends ContentTableUIHandler<NonTargetSam ui.getAcquisitionModeGroup().setSelectedValue(ModeSaisieEchantillonEnum.byEffectif); } - ReferenceSetDto<SpeciesDto> speciesSetDto = getModel().getFormDto().getReferenceSetDto(SpeciesDto.class); + Set<ReferentialReferenceDto<SpeciesDto>> speciesReferences = getModel().getReferentialReferences(SpeciesDto.class, NonTargetLengthDto.PROPERTY_SPECIES); - availableEspeces = Lists.newArrayList((Set) speciesSetDto.getReference()); + availableEspeces = Lists.newArrayList(speciesReferences); requestFocus = ui.getSpecies(); } else { @@ -299,7 +299,7 @@ public class NonTargetSampleUIHandler extends ContentTableUIHandler<NonTargetSam @Override protected void loadEditBean(String beanId) { - FormDto<NonTargetSampleDto> formDto = getNonTargetSampleService().loadToEdit(beanId); + FormDto<NonTargetSampleDto> formDto = getNonTargetSampleService().loadForm(beanId); getModel().setFormDto(formDto); NonTargetSampleDtos.copyNonTargetSampleDto(formDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUI.jaxx index 4de6832..e7110c7 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUI.jaxx @@ -33,6 +33,7 @@ fr.ird.observe.services.dto.CommentableDto fr.ird.observe.services.dto.seine.FloatingObjectObservedSpeciesDto fr.ird.observe.services.dto.seine.ObjectObservedSpeciesDto + fr.ird.observe.services.dto.referential.ReferentialReferenceDto fr.ird.observe.services.dto.referential.SpeciesDto fr.ird.observe.services.dto.referential.seine.SpeciesStatusDto fr.ird.observe.ui.content.table.* @@ -84,7 +85,7 @@ </cell> <cell weightx='1' anchor='east'> <BeanComboBox id='species' constructorParams='this' - genericType='ReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class'/> + genericType='ReferentialReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class'/> </cell> </row> @@ -95,7 +96,7 @@ </cell> <cell weightx='1' anchor='east'> <BeanComboBox id='speciesStatus' constructorParams='this' - genericType='ReferenceDto<SpeciesStatusDto>' _entityClass='SpeciesStatusDto.class'/> + genericType='ReferentialReferenceDto<SpeciesStatusDto>' _entityClass='SpeciesStatusDto.class'/> </cell> </row> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUIHandler.java index 1e2daaf..37d5e2a 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectObservedSpeciesUIHandler.java @@ -99,7 +99,7 @@ public class ObjectObservedSpeciesUIHandler extends ContentTableUIHandler<Floati @Override protected void loadEditBean(String beanId) { - FormDto<FloatingObjectObservedSpeciesDto> formDto = getObjectObservedSpeciesService().loadToEdit(beanId); + FormDto<FloatingObjectObservedSpeciesDto> formDto = getObjectObservedSpeciesService().loadForm(beanId); getModel().setFormDto(formDto); FloatingObjectObservedSpeciesDtos.copyFloatingObjectObservedSpeciesDto(formDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUI.jaxx index df2d78e..6be0ca7 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUI.jaxx @@ -33,6 +33,7 @@ fr.ird.observe.services.dto.CommentableDto fr.ird.observe.services.dto.seine.FloatingObjectSchoolEstimateDto fr.ird.observe.services.dto.seine.ObjectSchoolEstimateDto + fr.ird.observe.services.dto.referential.ReferentialReferenceDto fr.ird.observe.services.dto.referential.SpeciesDto fr.ird.observe.ui.content.table.* @@ -83,7 +84,7 @@ </cell> <cell weightx='1' anchor='east'> <BeanComboBox id='species' constructorParams='this' - genericType='ReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class'/> + genericType='ReferentialReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class'/> </cell> </row> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUIHandler.java index e0acd0b..d80cebd 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/ObjectSchoolEstimateUIHandler.java @@ -95,7 +95,7 @@ public class ObjectSchoolEstimateUIHandler extends ContentTableUIHandler<Floatin @Override protected void loadEditBean(String beanId) { - FormDto<FloatingObjectSchoolEstimateDto> formDto = getObjectSchoolEstimateService().loadToEdit(beanId); + FormDto<FloatingObjectSchoolEstimateDto> formDto = getObjectSchoolEstimateService().loadForm(beanId); getModel().setFormDto(formDto); FloatingObjectSchoolEstimateDtos.copyFloatingObjectSchoolEstimateDto(formDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/SchoolEstimateUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/SchoolEstimateUI.jaxx index 685f865..59d8430 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/SchoolEstimateUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/SchoolEstimateUI.jaxx @@ -35,6 +35,7 @@ fr.ird.observe.services.dto.CommentableDto fr.ird.observe.services.dto.seine.SetSeineSchoolEstimateDto fr.ird.observe.services.dto.seine.SchoolEstimateDto + fr.ird.observe.services.dto.referential.ReferentialReferenceDto fr.ird.observe.services.dto.referential.SpeciesDto fr.ird.observe.ui.content.table.* @@ -88,7 +89,7 @@ <JLabel id='speciesLabel'/> </cell> <cell weightx='1' anchor='east'> - <BeanComboBox id='species' genericType='ReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class' + <BeanComboBox id='species' genericType='ReferentialReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class' constructorParams='this'/> </cell> </row> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/SchoolEstimateUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/SchoolEstimateUIHandler.java index f5a917f..50a9bc8 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/SchoolEstimateUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/SchoolEstimateUIHandler.java @@ -25,13 +25,11 @@ import com.google.common.base.Predicates; import com.google.common.collect.Collections2; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; -import com.google.common.collect.Sets; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.IdDtos; import fr.ird.observe.services.dto.ReferenceDto; -import fr.ird.observe.services.dto.ReferenceSetDto; import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.seine.SchoolEstimateDto; @@ -48,6 +46,7 @@ import javax.swing.JComponent; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Set; @@ -88,26 +87,25 @@ public class SchoolEstimateUIHandler extends ContentTableUIHandler<SetSeineSchoo } SchoolEstimateUI ui = getUi(); - Set<ReferenceDto<SpeciesDto>> availableEspeces; + List<ReferentialReferenceDto<SpeciesDto>> availableEspeces; JComponent requestFocus; if (create) { - ReferenceSetDto<SpeciesDto> referenceSetDto = getModel().getFormDto().getReferenceSetDto(SpeciesDto.class); - Set<ReferenceDto<SpeciesDto>> references = (Set) referenceSetDto.getReference(); + Set<ReferentialReferenceDto<SpeciesDto>> references = getModel().getReferentialReferences(SpeciesDto.class, SchoolEstimateDto.PROPERTY_SPECIES); List<ReferentialReferenceDto<SpeciesDto>> listSpeciesUsed = model.getColumnValues(0); Collection<String> listSpeciesIdUsed = Collections2.transform(listSpeciesUsed, IdDtos.getIdFunction()); - availableEspeces = Sets.newHashSet(Iterables.filter(references, Predicates.not(IdDtos.newIdsPredicate(listSpeciesIdUsed)))); + availableEspeces = Lists.newArrayList(Iterables.filter(references, Predicates.not(IdDtos.newIdsPredicate(listSpeciesIdUsed)))); requestFocus = ui.getSpecies(); } else { - ReferenceDto<SpeciesDto> species = bean.getSpecies(); - availableEspeces = Sets.newHashSet(species); + ReferentialReferenceDto<SpeciesDto> species = bean.getSpecies(); + availableEspeces = Collections.singletonList(species); requestFocus = ui.getTotalWeight(); } - ui.getSpecies().setData(Lists.newArrayList(availableEspeces)); + ui.getSpecies().setData(availableEspeces); requestFocus.requestFocus(); } @@ -137,7 +135,7 @@ public class SchoolEstimateUIHandler extends ContentTableUIHandler<SetSeineSchoo @Override protected void loadEditBean(String beanId) { String tripSeineId = getDataContext().getSelectedTripSeineId(); - FormDto<SetSeineSchoolEstimateDto> formDto = getSchoolEstimateService().loadToEdit(beanId, tripSeineId); + FormDto<SetSeineSchoolEstimateDto> formDto = getSchoolEstimateService().loadForm(beanId, tripSeineId); getModel().setFormDto(formDto); SetSeineSchoolEstimateDtos.copySetSeineSchoolEstimateDto(formDto.getForm(), getBean()); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx index 193fb48..b1018ee 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx @@ -33,8 +33,9 @@ fr.ird.observe.services.dto.CommentableDto fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto fr.ird.observe.services.dto.seine.TargetCatchDto - fr.ird.observe.services.dto.referential.seine.WeightCategoryDto + fr.ird.observe.services.dto.referential.ReferentialReferenceDto fr.ird.observe.services.dto.referential.SpeciesDto + fr.ird.observe.services.dto.referential.seine.WeightCategoryDto fr.ird.observe.ui.content.table.* jaxx.runtime.swing.editor.NumberEditor @@ -86,7 +87,7 @@ <JLabel id='speciesLabel'/> </cell> <cell weightx='1' anchor='east'> - <BeanComboBox id='species' genericType='ReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class' constructorParams='this'/> + <BeanComboBox id='species' genericType='ReferentialReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class' constructorParams='this'/> </cell> </row> @@ -97,7 +98,7 @@ <JLabel id='weightCategoryLabel'/> </cell> <cell weightx='1' anchor='east'> - <BeanComboBox id='weightCategory' genericType='ReferenceDto<WeightCategoryDto>' _entityClass='WeightCategoryDto.class' constructorParams='this'/> + <BeanComboBox id='weightCategory' genericType='ReferentialReferenceDto<WeightCategoryDto>' _entityClass='WeightCategoryDto.class' constructorParams='this'/> </cell> </row> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java index d1486ad..dc16e4e 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUIHandler.java @@ -29,7 +29,6 @@ import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.ReferenceDto; -import fr.ird.observe.services.dto.ReferenceSetDto; import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.seine.WeightCategoryDto; @@ -53,7 +52,6 @@ import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; @@ -104,7 +102,6 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineTargetCa ReferentialReferenceDto<SpeciesDto> species = (ReferentialReferenceDto<SpeciesDto>) evt.getNewValue(); - onEspeceChanged(species); } } @@ -120,7 +117,7 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineTargetCa @Override protected boolean prepareSave(SetSeineTargetCatchDto bean, List<TargetCatchDto> objets) { - //on cherche si parmis les captures supprimer certaines ont des échantillon + // on cherche si parmis les captures supprimer certaines ont des échantillons SetSeineTargetCatchDto originalSetSeineTargetCatchDto = getModel().getFormDto().getForm(); SetSeineTargetCatchDto currentSetSeineTargetCatch = getModel().getBean(); @@ -145,8 +142,7 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineTargetCa if (!speciesToDelete.isEmpty()) { - // il existe des echantillon thon a supprimer on demande une - // confirmation + // il existe des echantillons thon a supprimer on demande une confirmation StringBuilder sb = new StringBuilder(512); Decorator<ReferenceDto> decorator = getDecoratorService().getDecoratorByType(ReferenceDto.class, SpeciesDto.class.getSimpleName()); @@ -187,23 +183,21 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineTargetCa TargetCatchUI ui = getUi(); - ReferenceDto<WeightCategoryDto> beanWeightCategory = bean.getWeightCategory(); + ReferentialReferenceDto<WeightCategoryDto> beanWeightCategory = bean.getWeightCategory(); - ReferenceDto<SpeciesDto> beanSpecies = null; - if (beanWeightCategory != null) { - beanSpecies = (ReferenceDto<SpeciesDto>) beanWeightCategory.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES); + ReferentialReferenceDto<SpeciesDto> beanSpecies = null; + if (beanWeightCategory != null) { + beanSpecies = (ReferentialReferenceDto<SpeciesDto>) beanWeightCategory.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES); } JComponent requestFocus; if (create) { - // on reinitilise toujours l'species (pour reinitialiser la liste - // des categories) + // on reinitilise toujours l'espèce (pour reinitialiser la liste des categories) ui.getSpecies().setSelectedItem(null); if (!getTableModel().isCreate()) { - // on repositionne l'species (cela reconstruira la liste - // des categories) + // on repositionne l'espèce (cela reconstruira la liste des categories) ui.getSpecies().setSelectedItem(beanSpecies); // on repositionne la categorie ui.getWeightCategory().setSelectedItem(beanWeightCategory); @@ -218,8 +212,7 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineTargetCa // puisque dans ce mode, pas possibilite de modifier de cette // valeur (clef metier) ui.getSpecies().setSelectedItem(beanSpecies); - ui.getWeightCategory().setData( - Arrays.asList(beanWeightCategory)); + ui.getWeightCategory().setData(Collections.singletonList(beanWeightCategory)); ui.getWeightCategory().setSelectedItem(beanWeightCategory); requestFocus = ui.getCatchWeight(); @@ -264,35 +257,34 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineTargetCa @SuppressWarnings("unchecked") protected void onEspeceChanged(final ReferentialReferenceDto<SpeciesDto> species) { - List<ReferenceDto<WeightCategoryDto>> availableCategories; + List<ReferentialReferenceDto<WeightCategoryDto>> availableCategories; if (species == null) { - // aucune species selectionnee, on vide simplement + // aucune espèce selectionnee, on vide simplement // la liste des categories car il faut d'abord choisir une - // species puis une categorie + // espèce puis une categorie availableCategories = Collections.emptyList(); } else { // un species est selectionnee, - // on calcule les categories pour cette species + // on calcule les categories pour cette espèce - ReferenceSetDto<WeightCategoryDto> weightCategoryDtoReferenceSetDto = getModel().getFormDto().getReferenceSetDto(WeightCategoryDto.class); + Set<ReferentialReferenceDto<WeightCategoryDto>> allCategories = getModel().getReferentialReferences(WeightCategoryDto.class, TargetCatchDto.PROPERTY_SPECIES); - Set<ReferenceDto<WeightCategoryDto>> allCategories = (Set) weightCategoryDtoReferenceSetDto.getReference(); + // on ne conserve que les categories de l'espèce + availableCategories = Lists.newArrayList(Iterables.filter(allCategories, new Predicate<ReferentialReferenceDto<WeightCategoryDto>>() { - // on ne conserve que les categories de l'species - availableCategories = Lists.newArrayList(Iterables.filter(allCategories, new Predicate<ReferenceDto<WeightCategoryDto>>() { @Override - public boolean apply(ReferenceDto<WeightCategoryDto> input) { + public boolean apply(ReferentialReferenceDto<WeightCategoryDto> input) { return species.equals(input.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES)); } })); } // on met a jour la liste des categories disponibles - BeanComboBox<ReferenceDto<WeightCategoryDto>> combo = getUi().getWeightCategory(); + BeanComboBox<ReferentialReferenceDto<WeightCategoryDto>> combo = getUi().getWeightCategory(); combo.setData(availableCategories); // on reinitialise toujours la categorie selectionnee @@ -310,7 +302,7 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineTargetCa String tripSeineId = getDataContext().getSelectedTripSeineId(); - FormDto<SetSeineTargetCatchDto> formDto = getTargetCatchService().loadToEdit(beanId, false, tripSeineId); + FormDto<SetSeineTargetCatchDto> formDto = getTargetCatchService().loadForm(beanId, false, tripSeineId); getModel().setFormDto(formDto); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUI.jaxx index 8ea3383..911e664 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUI.jaxx @@ -33,9 +33,10 @@ fr.ird.observe.services.dto.CommentableDto fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto fr.ird.observe.services.dto.seine.TargetCatchDto - fr.ird.observe.services.dto.referential.seine.WeightCategoryDto + fr.ird.observe.services.dto.referential.ReferentialReferenceDto fr.ird.observe.services.dto.referential.SpeciesDto fr.ird.observe.services.dto.referential.seine.ReasonForDiscardDto + fr.ird.observe.services.dto.referential.seine.WeightCategoryDto fr.ird.observe.ui.content.table.* fr.ird.observe.ui.util.BooleanEditor @@ -87,7 +88,7 @@ <JLabel id='speciesLabel'/> </cell> <cell weightx='1' anchor='east'> - <BeanComboBox id='species' constructorParams='this' genericType='ReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class'/> + <BeanComboBox id='species' constructorParams='this' genericType='ReferentialReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class'/> </cell> </row> @@ -97,7 +98,7 @@ <JLabel id='weightCategoryLabel'/> </cell> <cell weightx='1' anchor='east'> - <BeanComboBox id='weightCategory' constructorParams='this' genericType='ReferenceDto<WeightCategoryDto>' _entityClass='WeightCategoryDto.class'/> + <BeanComboBox id='weightCategory' constructorParams='this' genericType='ReferentialReferenceDto<WeightCategoryDto>' _entityClass='WeightCategoryDto.class'/> </cell> </row> @@ -107,7 +108,7 @@ <JLabel id='reasonForDiscardLabel'/> </cell> <cell weightx='1' anchor='east'> - <BeanComboBox id='reasonForDiscard' constructorParams='this' genericType='ReferenceDto<ReasonForDiscardDto>' _entityClass='ReasonForDiscardDto.class'/> + <BeanComboBox id='reasonForDiscard' constructorParams='this' genericType='ReferentialReferenceDto<ReasonForDiscardDto>' _entityClass='ReasonForDiscardDto.class'/> </cell> </row> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java index 029018f..f56b866 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetDiscardCatchUIHandler.java @@ -28,7 +28,6 @@ import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.ReferenceDto; -import fr.ird.observe.services.dto.ReferenceSetDto; import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.seine.ReasonForDiscardDto; @@ -53,7 +52,6 @@ import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Iterator; @@ -76,20 +74,20 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT super(ui, DataContextType.SetSeine); } - protected static Collection<ReferenceDto<WeightCategoryDto>> getWeightCategoryUsed( + protected static Collection<ReferentialReferenceDto<WeightCategoryDto>> getWeightCategoryUsed( ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model) { - List<ReferenceDto<WeightCategoryDto>> list = model.getColumnValues(1); - Collection<ReferenceDto<WeightCategoryDto>> set = Sets.newHashSet(list); + List<ReferentialReferenceDto<WeightCategoryDto>> list = model.getColumnValues(1); + Collection<ReferentialReferenceDto<WeightCategoryDto>> set = Sets.newHashSet(list); list.clear(); return set; } - protected static Collection<ReferenceDto<ReasonForDiscardDto>> getReasonForDiscardUsed( + protected static Collection<ReferentialReferenceDto<ReasonForDiscardDto>> getReasonForDiscardUsed( ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model, - ReferenceDto<WeightCategoryDto> weightCategory) { + ReferentialReferenceDto<WeightCategoryDto> weightCategory) { - Collection<ReferenceDto<ReasonForDiscardDto>> set = Sets.newHashSet(); + Collection<ReferentialReferenceDto<ReasonForDiscardDto>> set = Sets.newHashSet(); if (weightCategory != null) { for (int i = 0; i < model.getRowCount(); i++) { TargetCatchDto c = model.getValueAt(i); @@ -131,10 +129,9 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT TargetCatchDto bean = model.getRowBean(); if (bean.getId() == null) { - // en mode creation , on doit recalculer la liste - // des categories + // en mode creation , on doit recalculer la liste des categories - ReferenceDto<SpeciesDto> species = (ReferenceDto<SpeciesDto>) evt.getNewValue(); + ReferentialReferenceDto<SpeciesDto> species = (ReferentialReferenceDto<SpeciesDto>) evt.getNewValue(); onEspeceChanged(bean, species); } } @@ -158,8 +155,8 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT if (bean.getId() == null) { // en mode creation , on doit recalculer la liste // des raison rejet - ReferenceDto<WeightCategoryDto> weightCategory = - (ReferenceDto<WeightCategoryDto>) evt.getNewValue(); + ReferentialReferenceDto<WeightCategoryDto> weightCategory = + (ReferentialReferenceDto<WeightCategoryDto>) evt.getNewValue(); onCategorieChanged(bean, weightCategory); } @@ -177,7 +174,7 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT @Override protected boolean prepareSave(SetSeineTargetCatchDto bean, List<TargetCatchDto> objets) { - //on cherche si parmis les captures supprimer certaines ont des échantillon + //on cherche si parmis les captures supprimer certaines ont des échantillons SetSeineTargetCatchDto originalSetSeineTargetCatchDto = getModel().getFormDto().getForm(); SetSeineTargetCatchDto currentSetSeineTargetCatch = getModel().getBean(); @@ -201,11 +198,10 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT } if (!speciesToDelete.isEmpty()) { - // il existe des echantillon thon a supprimer on demande une - // confirmation + // il existe des echantillon thon a supprimer on demande une confirmation StringBuilder sb = new StringBuilder(512); - Decorator<ReferenceDto> decorator = - getDecoratorService().getDecoratorByType(ReferenceDto.class, SpeciesDto.class.getSimpleName()); + Decorator<ReferentialReferenceDto<SpeciesDto>> decorator = + getDecoratorService().getReferenceDecorator(SpeciesDto.class); for (ReferentialReferenceDto<SpeciesDto> species : speciesToDelete) { sb.append(" - ").append(decorator.toString(species)).append('\n'); @@ -243,14 +239,14 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT protected void onSelectedRowChanged(int editingRow, TargetCatchDto bean, boolean create) { TargetDiscardCatchUI ui = getUi(); - ReferenceDto<WeightCategoryDto> beanWeightCategory = bean.getWeightCategory(); + ReferentialReferenceDto<WeightCategoryDto> beanWeightCategory = bean.getWeightCategory(); - ReferenceDto<SpeciesDto> beanSpecies = null; - if (beanWeightCategory != null) { - beanSpecies = (ReferenceDto<SpeciesDto>) beanWeightCategory.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES); + ReferentialReferenceDto<SpeciesDto> beanSpecies = null; + if (beanWeightCategory != null) { + beanSpecies = (ReferentialReferenceDto<SpeciesDto>) beanWeightCategory.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES); } - ReferenceDto<ReasonForDiscardDto> beanReasonForDiscard = bean.getReasonForDiscard(); + ReferentialReferenceDto<ReasonForDiscardDto> beanReasonForDiscard = bean.getReasonForDiscard(); if (log.isDebugEnabled()) { log.debug("selected categoriePoid " + beanWeightCategory); log.debug("selected species " + beanSpecies); @@ -262,22 +258,20 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model = getTableModel(); if (model.isCreate()) { - // par défaut, on considère que l'espèce a été monté sur le pont + // par défaut, on considère que l'espèce a été montée sur le pont // c'est le cas le plus fréquent. bean.setBroughtOnDeck(true); } // on recalcule la liste des speciess disponibles - List<ReferenceDto<SpeciesDto>> availableSpecies = buildEspeceList(beanSpecies, beanWeightCategory); + List<ReferentialReferenceDto<SpeciesDto>> availableSpecies = buildEspeceList(beanSpecies, beanWeightCategory); ui.getSpecies().setData(availableSpecies); - // on reinitilise toujours l'species (pour reinitialiser la liste - // des categories) + // on reinitilise toujours l'species (pour reinitialiser la liste des categories) ui.getSpecies().setSelectedItem(null); if (!model.isCreate()) { - // on repositionne l'species (cela reconstruira la liste - // des categories) + // on repositionne l'espèce (cela reconstruira la liste des categories) ui.getSpecies().setSelectedItem(beanSpecies); // on repositionne la categorie ui.getWeightCategory().setSelectedItem(beanWeightCategory); @@ -291,9 +285,9 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT // puisque dans ce mode, pas possibilite de modifier de cette // valeur (clef metier) ui.getSpecies().setSelectedItem(beanSpecies); - ui.getWeightCategory().setData(Arrays.asList(beanWeightCategory)); + ui.getWeightCategory().setData(Collections.singletonList(beanWeightCategory)); ui.getWeightCategory().setSelectedItem(beanWeightCategory); - ui.getReasonForDiscard().setData(Arrays.asList(beanReasonForDiscard)); + ui.getReasonForDiscard().setData(Collections.singletonList(beanReasonForDiscard)); ui.getReasonForDiscard().setSelectedItem(beanReasonForDiscard); requestFocus = ui.getCatchWeight(); @@ -332,26 +326,24 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT UIHelper.setTableColumnRenderer(table, 5, UIHelper.newStringTableCellRenderer(renderer, 10, true)); } - protected void onEspeceChanged(TargetCatchDto bean, ReferenceDto<SpeciesDto> species) { + protected void onEspeceChanged(TargetCatchDto bean, ReferentialReferenceDto<SpeciesDto> species) { - ReferenceDto<WeightCategoryDto> weightCategory = null; + ReferentialReferenceDto<WeightCategoryDto> weightCategory = null; - List<ReferenceDto<WeightCategoryDto>> data; + List<ReferentialReferenceDto<WeightCategoryDto>> data; if (species == null) { - // aucune species selectionnee, on vide simplement - // la liste des categories car il faut d'abord choisir une - // species puis une categorie + // aucune espèce selectionnee, on vide simplement + // la liste des categories car il faut d'abord choisir une espèce puis une categorie data = Collections.emptyList(); } else { // un species est selectionne, on met a jour la liste des categories - // disponibles pour cet species + // disponibles pour cette espèce - List<ReferenceDto<WeightCategoryDto>> availableCategories = buildWeightCategoryList( - species); + List<ReferentialReferenceDto<WeightCategoryDto>> availableCategories = buildWeightCategoryList(species); data = availableCategories; @@ -364,23 +356,23 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT } // on met a jour le model de la liste des categories - BeanComboBox<ReferenceDto<WeightCategoryDto>> combo = getUi().getWeightCategory(); + BeanComboBox<ReferentialReferenceDto<WeightCategoryDto>> combo = getUi().getWeightCategory(); combo.setData(data); // on selectionne la categorie retenue combo.setSelectedItem(weightCategory); } - protected void onCategorieChanged(TargetCatchDto bean, ReferenceDto<WeightCategoryDto> weightCategory) { + protected void onCategorieChanged(TargetCatchDto bean, ReferentialReferenceDto<WeightCategoryDto> weightCategory) { TargetDiscardCatchUI ui = getUi(); - ReferenceDto<ReasonForDiscardDto> reasonForDiscard = null; - List<ReferenceDto<ReasonForDiscardDto>> data; + ReferentialReferenceDto<ReasonForDiscardDto> reasonForDiscard = null; + List<ReferentialReferenceDto<ReasonForDiscardDto>> data; if (weightCategory == null) { // aucune categorie selectionnee, on vide simplement // la liste des raison rejets car il faut d'abord choisir une - // species puis une categorie, puis une raison rejet + // espèce puis une categorie, puis une raison rejet data = Collections.emptyList(); } else { @@ -390,7 +382,7 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT reasonForDiscard = bean.getReasonForDiscard(); - List<ReferenceDto<ReasonForDiscardDto>> reasonForDiscardList = buildReasonFordiscardList(weightCategory, reasonForDiscard); + List<ReferentialReferenceDto<ReasonForDiscardDto>> reasonForDiscardList = buildReasonFordiscardList(weightCategory, reasonForDiscard); if (log.isDebugEnabled()) { log.debug("new reasonForDiscard list " + reasonForDiscardList); @@ -399,7 +391,6 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT data = reasonForDiscardList; - if (reasonForDiscard != null && !reasonForDiscardList.contains(reasonForDiscard)) { // on sélectionne la première raison rejet disponible @@ -407,7 +398,7 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT } } - BeanComboBox<ReferenceDto<ReasonForDiscardDto>> combo = ui.getReasonForDiscard(); + BeanComboBox<ReferentialReferenceDto<ReasonForDiscardDto>> combo = ui.getReasonForDiscard(); // on met a jour le model de la liste des raison rejets combo.setData(data); @@ -416,9 +407,10 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT combo.setSelectedItem(reasonForDiscard); } - protected List<ReferenceDto<SpeciesDto>> buildEspeceList(ReferenceDto<SpeciesDto> species, ReferenceDto<WeightCategoryDto> weightCategory) { + protected List<ReferentialReferenceDto<SpeciesDto>> buildEspeceList(ReferentialReferenceDto<SpeciesDto> species, + ReferentialReferenceDto<WeightCategoryDto> weightCategory) { - List<ReferenceDto<WeightCategoryDto>> weightCategoryList = getAllCategories(); + List<ReferentialReferenceDto<WeightCategoryDto>> weightCategoryList = getAllCategories(); removeFullyUsedCategories(weightCategoryList); @@ -426,25 +418,25 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT weightCategoryList.add(weightCategory); } - Collection<ReferenceDto<SpeciesDto>> usedEspeces = Sets.newHashSet(); - for (ReferenceDto<WeightCategoryDto> cat : weightCategoryList) { - usedEspeces.add((ReferenceDto<SpeciesDto>) cat.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES)); + Collection<ReferentialReferenceDto<SpeciesDto>> usedEspeces = Sets.newHashSet(); + for (ReferentialReferenceDto<WeightCategoryDto> cat : weightCategoryList) { + usedEspeces.add((ReferentialReferenceDto<SpeciesDto>) cat.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES)); } - List<ReferenceDto<SpeciesDto>> result = Lists.newArrayList(usedEspeces); + List<ReferentialReferenceDto<SpeciesDto>> result = Lists.newArrayList(usedEspeces); weightCategoryList.clear(); usedEspeces.clear(); return result; } - protected List<ReferenceDto<WeightCategoryDto>> buildWeightCategoryList(ReferenceDto<SpeciesDto> species) { + protected List<ReferentialReferenceDto<WeightCategoryDto>> buildWeightCategoryList(ReferentialReferenceDto<SpeciesDto> species) { - List<ReferenceDto<WeightCategoryDto>> weightCategoryList = getAllCategories(); + List<ReferentialReferenceDto<WeightCategoryDto>> weightCategoryList = getAllCategories(); // on filtre les categories sur l'espèce donnée - for (Iterator<ReferenceDto<WeightCategoryDto>> it = weightCategoryList.iterator(); + for (Iterator<ReferentialReferenceDto<WeightCategoryDto>> it = weightCategoryList.iterator(); it.hasNext(); ) { - ReferenceDto<WeightCategoryDto> weighte = it.next(); + ReferentialReferenceDto<WeightCategoryDto> weighte = it.next(); if (!species.equals(weighte.getPropertyValue(WeightCategoryDto.PROPERTY_SPECIES))) { it.remove(); } @@ -458,20 +450,20 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT } @SuppressWarnings("unchecked") - protected List<ReferenceDto<ReasonForDiscardDto>> buildReasonFordiscardList(ReferenceDto<WeightCategoryDto> weightCategory, ReferenceDto<ReasonForDiscardDto> currentReason) { + protected List<ReferentialReferenceDto<ReasonForDiscardDto>> buildReasonFordiscardList(ReferentialReferenceDto<WeightCategoryDto> weightCategory, ReferentialReferenceDto<ReasonForDiscardDto> currentReason) { ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model = getTableModel(); - ReferenceSetDto<ReasonForDiscardDto> reasonForDiscardSetDto = getModel().getFormDto().getReferenceSetDto(ReasonForDiscardDto.class); + Set<ReferentialReferenceDto<ReasonForDiscardDto>> reasonForDiscardSetDto = getModel().getReferentialReferences(ReasonForDiscardDto.class, TargetCatchDto.PROPERTY_REASON_FOR_DISCARD); - List<ReferenceDto<ReasonForDiscardDto>> reasonForDiscardList = Lists.newArrayList((Set) reasonForDiscardSetDto.getReference()); + List<ReferentialReferenceDto<ReasonForDiscardDto>> reasonForDiscardList = Lists.newArrayList(reasonForDiscardSetDto); // on filtre les raison rejet sur la categorie for (int i = 0; i < model.getRowCount(); i++) { TargetCatchDto c = model.getValueAt(i); if (c != null - && c.getReasonForDiscard() != null - && (currentReason == null || ! currentReason.equals(c.getReasonForDiscard())) - && weightCategory.equals(c.getWeightCategory())) { + && c.getReasonForDiscard() != null + && (currentReason == null || !currentReason.equals(c.getReasonForDiscard())) + && weightCategory.equals(c.getWeightCategory())) { reasonForDiscardList.remove(c.getReasonForDiscard()); } } @@ -479,27 +471,27 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT return reasonForDiscardList; } - protected List<ReferenceDto<WeightCategoryDto>> getAllCategories() { - ReferenceSetDto<WeightCategoryDto> weightCategorySetDto = getModel().getFormDto().getReferenceSetDto(WeightCategoryDto.class); + protected List<ReferentialReferenceDto<WeightCategoryDto>> getAllCategories() { + Set<ReferentialReferenceDto<WeightCategoryDto>> weightCategorySetDto = getModel().getReferentialReferences(WeightCategoryDto.class, TargetCatchDto.PROPERTY_WEIGHT_CATEGORY); - List<ReferenceDto<WeightCategoryDto>> weightCategoryList = Lists.newArrayList((Set) weightCategorySetDto.getReference()); + List<ReferentialReferenceDto<WeightCategoryDto>> weightCategoryList = Lists.newArrayList(weightCategorySetDto); return weightCategoryList; } protected void removeFullyUsedCategories( - List<ReferenceDto<WeightCategoryDto>> weightCategoryAvaillable) { + List<ReferentialReferenceDto<WeightCategoryDto>> weightCategoryAvaillable) { ContentTableModel<SetSeineTargetCatchDto, TargetCatchDto> model = getTableModel(); - ReferenceSetDto<ReasonForDiscardDto> reasonForDiscardSetDto = getModel().getFormDto().getReferenceSetDto(ReasonForDiscardDto.class); + Set<ReferentialReferenceDto<ReasonForDiscardDto>> reasonForDiscardSetDto = getModel().getReferentialReferences(ReasonForDiscardDto.class, TargetCatchDto.PROPERTY_REASON_FOR_DISCARD); - int nbReasonForDiscard = reasonForDiscardSetDto.sizeReference(); + int nbReasonForDiscard = reasonForDiscardSetDto.size(); // on filtre toutes les weightCategory qui ont deja references toutes // les raisons rejets - for (ReferenceDto<WeightCategoryDto> c : getWeightCategoryUsed(model)) { - Collection<ReferenceDto<ReasonForDiscardDto>> raisonUsed = getReasonForDiscardUsed(model, c); + for (ReferentialReferenceDto<WeightCategoryDto> c : getWeightCategoryUsed(model)) { + Collection<ReferentialReferenceDto<ReasonForDiscardDto>> raisonUsed = getReasonForDiscardUsed(model, c); if (raisonUsed.size() == nbReasonForDiscard) { // toutes les raison de rejet epuisé pour cette categorie weightCategoryAvaillable.remove(c); @@ -519,7 +511,7 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineT String tripSeineId = getDataContext().getSelectedTripSeineId(); - FormDto<SetSeineTargetCatchDto> formDto = getTargetCatchService().loadToEdit(beanId, true, tripSeineId); + FormDto<SetSeineTargetCatchDto> formDto = getTargetCatchService().loadForm(beanId, true, tripSeineId); getModel().setFormDto(formDto); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetSampleUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetSampleUI.jaxx index 3575faf..14482d9 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetSampleUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetSampleUI.jaxx @@ -32,6 +32,7 @@ fr.ird.observe.services.dto.seine.TargetLengthDto fr.ird.observe.ui.content.table.impl.seine.CodeMesureEnum fr.ird.observe.ui.content.table.impl.seine.ModeSaisieEchantillonEnum + fr.ird.observe.services.dto.referential.ReferentialReferenceDto fr.ird.observe.services.dto.referential.SpeciesDto fr.ird.observe.ui.content.table.* @@ -123,7 +124,7 @@ public String getLengthDataTip(boolean computed) { <JLabel id='speciesLabel'/> </cell> <cell weightx='1' anchor='east'> - <BeanComboBox id='species' genericType='ReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class' constructorParams='this'/> + <BeanComboBox id='species' genericType='ReferentialReferenceDto<SpeciesDto>' _entityClass='SpeciesDto.class' constructorParams='this'/> </cell> </row> diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetSampleUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetSampleUIHandler.java index 2f90d0b..9dfab19 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetSampleUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetSampleUIHandler.java @@ -26,6 +26,7 @@ import fr.ird.observe.db.DataContext; import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.ReferenceDto; +import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.result.SaveResultDto; import fr.ird.observe.services.dto.seine.SetSeineDto; @@ -133,7 +134,7 @@ public class TargetSampleUIHandler extends ContentTableUIHandler<TargetSampleDto return; } - ReferenceDto<SpeciesDto> species = bean.getSpecies(); + ReferentialReferenceDto<SpeciesDto> species = bean.getSpecies(); JComponent requestFocus; @@ -316,7 +317,7 @@ public class TargetSampleUIHandler extends ContentTableUIHandler<TargetSampleDto @Override protected void loadEditBean(String beanId) { - FormDto<TargetSampleDto> formDto = getTargetSampleService().loadToEdit(beanId, discarded); + FormDto<TargetSampleDto> formDto = getTargetSampleService().loadForm(beanId, discarded); getModel().setFormDto(formDto); TargetSampleDtos.copyTargetSampleDto(formDto.getForm(), getBean()); } diff --git a/observe-services-model/src/main/java/fr/ird/observe/services/dto/TripMapDtos.java b/observe-services-model/src/main/java/fr/ird/observe/services/dto/TripMapDtos.java new file mode 100644 index 0000000..458275a --- /dev/null +++ b/observe-services-model/src/main/java/fr/ird/observe/services/dto/TripMapDtos.java @@ -0,0 +1,15 @@ +package fr.ird.observe.services.dto; + + +import java.util.LinkedHashSet; + +public class TripMapDtos extends AbstractTripMapDtos { + + public static TripMapDto newTripMapDto(String tripId, LinkedHashSet<TripMapPointDto> points) { + TripMapDto tripMapDto = new TripMapDto(); + tripMapDto.setId(tripId); + tripMapDto.setPoints(points); + return tripMapDto; + } +} + -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.