branch feature/7531 updated (3f97619 -> f12b43c)
This is an automated email from the git hooks/post-receive script. New change to branch feature/7531 in repository observe. See http://git.codelutin.com/observe.git from 3f97619 Fix merge new e6cec26 début d'utilisation des services dans doSave et doDelete (refs #7531) new a74653a utilisation des services dans doSave et doDelete new eefe001 Merge branch 'feature/7531' of https://git.codelutin.com/observe into feature/7531 new f0f27e6 appel des services pour le load et precreate (refs #7531) new 71a5e4e appel de services dans dopersist (refs #7531) new f12b43c suppression des fixme (refs #7531) The 6 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 f12b43c0d2e1337379f129ce8c29174a57ddc7a3 Author: Kevin Morin <morin@codelutin.com> Date: Mon Sep 28 16:27:01 2015 +0200 suppression des fixme (refs #7531) commit 71a5e4e4fa2cdbcf01bbe3a09a18ad240b1ee573 Author: Kevin Morin <morin@codelutin.com> Date: Fri Sep 25 17:03:15 2015 +0200 appel de services dans dopersist (refs #7531) commit f0f27e64c97571bc91576c4958f5e406ad3b7263 Author: Kevin Morin <morin@codelutin.com> Date: Fri Sep 25 11:32:25 2015 +0200 appel des services pour le load et precreate (refs #7531) commit eefe00196889adb745c6adbef684867164ecfaee Merge: a74653a 3f97619 Author: Kevin Morin <morin@codelutin.com> Date: Fri Sep 25 10:34:07 2015 +0200 Merge branch 'feature/7531' of https://git.codelutin.com/observe into feature/7531 Conflicts: observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectUIHandler.java observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/SetSeineUIHandler.java observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java commit a74653a8c1dc87f17f2295a626c2f14c1a38b325 Author: Kevin Morin <morin@codelutin.com> Date: Thu Sep 24 18:15:26 2015 +0200 utilisation des services dans doSave et doDelete commit e6cec26969eaef71c1e463b17a0d4638e410ce40 Author: Kevin Morin <morin@codelutin.com> Date: Thu Sep 24 17:08:04 2015 +0200 début d'utilisation des services dans doSave et doDelete (refs #7531) Summary of changes: .../main/java/fr/ird/observe/ObserveCLAction.java | 3 +- .../java/fr/ird/observe/ObserveServiceHelper.java | 14 +- .../java/fr/ird/observe/ui/DecoratorService.java | 49 +---- .../fr/ird/observe/ui/ObserveMainUIHandler.java | 9 +- .../src/main/java/fr/ird/observe/ui/UIHelper.java | 48 +++-- .../fr/ird/observe/ui/admin/AdminTabUIHandler.java | 12 -- .../ird/observe/ui/content/ContentUIHandler.java | 93 +--------- .../observe/ui/content/ContentUIInitializer.java | 202 ++++++++------------- .../ird/observe/ui/content/ContentUIManager.java | 64 ++++--- .../impl/longline/SetLonglineUIHandler.java | 41 ++--- .../ActivitySeineObservedSystemUIHandler.java | 32 ++-- ...ngObjectTransmittingBuoyOperationUIHandler.java | 12 -- .../impl/seine/FloatingObjectUIHandler.java | 34 ++-- .../ui/content/impl/seine/SetSeineUIHandler.java | 62 ++++--- .../impl/longline/ActivityLonglineUIHandler.java | 37 ++-- .../open/impl/longline/TripLonglineUIHandler.java | 30 +-- .../open/impl/seine/ActivitySeineUIHandler.java | 40 ++-- .../ui/content/open/impl/seine/RouteUIHandler.java | 41 ++--- .../open/impl/seine/TripSeineUIHandler.java | 58 +++--- .../ui/content/ref/ContentReferenceUIHandler.java | 64 +++---- .../ui/content/table/ContentTableUIHandler.java | 40 ++-- .../ui/content/table/ContentTableUIModel.java | 19 +- .../impl/longline/BaitsCompositionUIHandler.java | 20 ++ .../longline/BranchlinesCompositionUIHandler.java | 26 ++- .../impl/longline/CatchLonglineUIHandler.java | 30 ++- .../table/impl/longline/EncounterUIHandler.java | 24 ++- .../longline/FloatlinesCompositionUIHandler.java | 26 ++- .../longline/GearUseFeaturesLonglineUIHandler.java | 29 ++- .../impl/longline/HooksCompositionUIHandler.java | 26 ++- .../table/impl/longline/SensorUsedUIHandler.java | 21 ++- .../content/table/impl/longline/TdrUIHandler.java | 21 ++- .../impl/longline/WeightMeasuresTableModel.java | 5 +- .../impl/seine/GearUseFeaturesSeineUIHandler.java | 29 ++- .../table/impl/seine/NonTargetCatchUIHandler.java | 20 ++ .../table/impl/seine/NonTargetSampleUIHandler.java | 20 ++ .../impl/seine/ObjectObservedSpeciesUIHandler.java | 21 ++- .../impl/seine/ObjectSchoolEstimateUIHandler.java | 20 ++ .../table/impl/seine/SchoolEstimateUIHandler.java | 20 ++ .../table/impl/seine/TargetCatchUIHandler.java | 20 ++ .../impl/seine/TargetDiscardCatchUIHandler.java | 24 ++- .../table/impl/seine/TargetSampleUIHandler.java | 22 +++ .../fr/ird/observe/ui/tree/DtoNodeSupport.java | 11 -- .../fr/ird/observe/ui/tree/ObserveTreeHelper.java | 12 -- .../EditableTableWithCacheTableModelSupport.java | 24 +-- .../observe/ui/util/tripMap/TripMapUIHandler.java | 5 +- ...tivitySeineObservedSystemServiceController.java | 4 +- .../v1/seine/NonTargetSampleServiceController.java | 4 +- .../v1/seine/TargetSampleServiceController.java | 4 +- .../seine/ActivitySeineObservedSystemService.java | 2 +- .../service/seine/NonTargetSampleService.java | 2 +- .../service/seine/TargetSampleService.java | 2 +- .../main/xmi/observe-services-dto-common.zargo~ | Bin 0 -> 35328 bytes .../service/seine/TripSeineServiceRestTest.java | 2 +- .../ActivitySeineObservedSystemServiceTopia.java | 4 +- .../service/seine/NonTargetSampleServiceTopia.java | 4 +- .../service/seine/TargetSampleServiceTopia.java | 4 +- .../fr/ird/observe/services/service/RigthTest.java | 2 +- .../service/seine/TripSeineServiceTopiaTest.java | 6 +- 58 files changed, 801 insertions(+), 719 deletions(-) create mode 100644 observe-services-model/src/main/xmi/observe-services-dto-common.zargo~ -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7531 in repository observe. See http://git.codelutin.com/observe.git commit e6cec26969eaef71c1e463b17a0d4638e410ce40 Author: Kevin Morin <morin@codelutin.com> Date: Thu Sep 24 17:08:04 2015 +0200 début d'utilisation des services dans doSave et doDelete (refs #7531) --- .../ird/observe/ui/content/ContentUIHandler.java | 5 +- .../content/impl/longline/BranchlineUIHandler.java | 29 ++-- .../FloatingObjectTransmittingBuoyOperationUI.jaxx | 6 +- ...ngObjectTransmittingBuoyOperationUIHandler.java | 127 +++++++------- ...tingObjectTransmittingBuoyOperationUIModel.java | 16 +- .../impl/seine/FloatingObjectUIHandler.java | 31 ++-- .../impl/longline/ActivityLonglineUIHandler.java | 145 +++++++--------- .../open/impl/seine/ActivitySeineUIHandler.java | 98 +++++------ .../ui/content/ref/ContentReferenceUIHandler.java | 185 ++++++++++----------- .../ui/content/table/ContentTableUIHandler.java | 64 ++++--- .../v1/ReferentialServiceController.java | 4 +- .../ActivityLonglineServiceController.java | 9 +- .../v1/seine/ActivitySeineServiceController.java | 4 +- .../v1/seine/FloatingObjectServiceController.java | 4 +- ...TransmittingBuoyOperationServiceController.java | 4 +- .../services/service/ReferentialService.java | 2 +- .../service/longline/ActivityLonglineService.java | 8 +- .../service/seine/ActivitySeineService.java | 2 +- .../service/seine/FloatingObjectService.java | 2 +- .../seine/TransmittingBuoyOperationService.java | 2 +- .../src/main/xmi/observe-services-dto-common.zargo | Bin 35328 -> 36919 bytes ...on.zargo => observe-services-dto-common.zargo~} | Bin .../services/service/ReferentialServiceTopia.java | 6 +- .../longline/ActivityLonglineServiceTopia.java | 24 ++- .../service/seine/ActivitySeineServiceTopia.java | 4 +- .../service/seine/FloatingObjectServiceTopia.java | 4 +- .../TransmittingBuoyOperationServiceTopia.java | 4 +- 27 files changed, 381 insertions(+), 408 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java index a6bb8ba..0406b97 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java @@ -442,9 +442,9 @@ public abstract class ContentUIHandler<E extends IdDto> { public final void saveUI(boolean refresh) { boolean ok = false; - //FIXME try { ok = doSave(getBean()); + } catch (Exception e) { ErrorDialogUI.showError(e); if (log.isErrorEnabled()) { @@ -457,7 +457,6 @@ public abstract class ContentUIHandler<E extends IdDto> { } } -//FIXME protected boolean doSave(E bean) throws Exception { return false; } @@ -504,8 +503,10 @@ public abstract class ContentUIHandler<E extends IdDto> { boolean ok = false; ui.stopEdit(); removeAllMessages(ui); + try { ok = doDelete(getBean()); + } catch (Exception e) { ErrorDialogUI.showError(e); if (log.isErrorEnabled()) { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/BranchlineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/BranchlineUIHandler.java index 04ab5e2..9a828bc 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/BranchlineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/longline/BranchlineUIHandler.java @@ -219,23 +219,20 @@ public class BranchlineUIHandler extends ContentUIHandler<BranchlineDto> { } - //FIXME -// @Override -// protected boolean doSave(BranchlineDto bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<BranchlineDto> binder) throws Exception { -// -// // bind back to model branchline -// BranchlineDto beanToSave = getModel().getBranchline(); + @Override + protected boolean doSave(BranchlineDto bean) throws Exception { + + // bind back to model branchline + BranchlineDto beanToSave = getModel().getBranchline(); + //FIXME // binder.copy(bean, beanToSave); -// -// // for external models -// getModel().fireSaved(); -// -// return true; -// -// } + + // for external models + getModel().fireSaved(); + + return true; + + } @Override public void resetEditUI() { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUI.jaxx index fef4675..17116e2 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUI.jaxx @@ -20,12 +20,12 @@ #L% --> -<fr.ird.observe.ui.content.ContentUI superGenericType='FloatingObjectDto' +<fr.ird.observe.ui.content.ContentUI superGenericType='FloatingObjectTransmittingBuoyDto' contentTitle='{n("observe.floatingObjectTransmittingBuoyOperation.title")}'> <import> fr.ird.observe.services.dto.ReferenceDto - fr.ird.observe.services.dto.seine.FloatingObjectDto + fr.ird.observe.services.dto.seine.FloatingObjectTransmittingBuoyDto fr.ird.observe.services.dto.seine.TransmittingBuoyDto fr.ird.observe.services.dto.constants.seine.Ownership fr.ird.observe.services.dto.constants.seine.TypeTransmittingBuoyOperation @@ -51,7 +51,7 @@ <FloatingObjectTransmittingBuoyOperationUIModel id='model'/> <!-- edit bean --> - <FloatingObjectDto id='bean'/> + <FloatingObjectTransmittingBuoyDto id='bean'/> <!-- transmittingBuoy1 edit bean --> <TransmittingBuoyDto id='transmittingBuoy1' initializer='new TransmittingBuoyDto()'/> 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 5e24206..d461585 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 @@ -31,7 +31,9 @@ import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.services.dto.referential.seine.TransmittingBuoyOperationDto; import fr.ird.observe.services.dto.seine.ActivitySeineDto; import fr.ird.observe.services.dto.seine.FloatingObjectDto; +import fr.ird.observe.services.dto.seine.FloatingObjectTransmittingBuoyDto; import fr.ird.observe.services.dto.seine.TransmittingBuoyDto; +import fr.ird.observe.services.service.seine.TransmittingBuoyOperationService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; @@ -41,6 +43,8 @@ import org.nuiton.validator.NuitonValidatorScope; import javax.swing.*; import java.awt.*; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; import static org.nuiton.i18n.I18n.t; @@ -49,7 +53,7 @@ import static org.nuiton.i18n.I18n.t; * @author Tony Chemit - chemit@codelutin.com * @since 1.0 */ -public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIHandler<FloatingObjectDto> { +public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIHandler<FloatingObjectTransmittingBuoyDto> { /** Logger */ static private Log log = LogFactory.getLog(FloatingObjectTransmittingBuoyOperationUIHandler.class); @@ -103,7 +107,7 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH log.info("dcpId = " + dcpId); } - FloatingObjectDto bean = getBean(); + FloatingObjectTransmittingBuoyDto bean = getBean(); //FIXME // bean.clearTransmittingBuoy(); @@ -204,17 +208,18 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH FloatingObjectTransmittingBuoyOperationUI ui = getUi(); addInfoMessage(t("observe.message.updating.floatingObject")); - //FIXME -// List<TransmittingBuoyDto> balises = getBean().getTransmittingBuoy(); -// if (balises != null && !balises.isEmpty()) { -// TransmittingBuoyDto transmittingBuoy1 = ui.getTransmittingBuoy1(); -// ui.getValidatorBalise1().setBean(transmittingBuoy1); -// -// if (balises.size() == 2) { -// TransmittingBuoyDto transmittingBuoy2 = ui.getTransmittingBuoy2(); -// ui.getValidatorBalise2().setBean(transmittingBuoy2); -// } -// } + + Collection<TransmittingBuoyDto> balises = getBean().getTransmittingBuoy(); + if (balises != null && !balises.isEmpty()) { + TransmittingBuoyDto transmittingBuoy1 = ui.getTransmittingBuoy1(); + ui.getValidatorBalise1().setBean(transmittingBuoy1); + + if (balises.size() == 2) { + TransmittingBuoyDto transmittingBuoy2 = ui.getTransmittingBuoy2(); + ui.getValidatorBalise2().setBean(transmittingBuoy2); + } + } + UIHelper.processDataBinding( ui, //FIXME @@ -243,16 +248,13 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH } //FIXME -// @Override -// protected boolean doSave(FloatingObject bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<FloatingObject> binder) throws Exception { -// -// dataService.update(dataSource, null, bean, getUpdateExecutor()); -// //FIXME, il faut declancher un evenement dans le cache du storage pour pouvoir redessiner le noeud -// return true; -// } + @Override + protected boolean doSave(FloatingObjectTransmittingBuoyDto bean) throws Exception { + + getTransmittingBuoyOperationService().save(bean); + //FIXME, il faut declancher un evenement dans le cache du storage pour pouvoir redessiner le noeud + return true; + } //FIXME // @Override @@ -304,12 +306,12 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH } @Override - protected FormDto<FloatingObjectDto> loadToEdit(String id) { + protected FormDto<FloatingObjectTransmittingBuoyDto> loadToEdit(String id) { return null; } @Override - protected FormDto<FloatingObjectDto> loadToReadDto(String id) { + protected FormDto<FloatingObjectTransmittingBuoyDto> loadToReadDto(String id) { return null; } @@ -322,22 +324,21 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH } int nbBalises = typeOperation.getNbBalises(); - FloatingObjectDto bean = getBean(); + FloatingObjectTransmittingBuoyDto bean = getBean(); - //FIXME -// boolean hasBalise = !bean.isTransmittingBuoyEmpty(); -// -// List<TransmittingBuoyDto> objets = new ArrayList<TransmittingBuoyDto>(); -// if (!reset) { -// if (hasBalise) { -// objets.addAll(bean.getTransmittingBuoy()); -// } -// } -// -// if (hasBalise) { -// // always reset balise lues of editBean to avoid side-effects -// bean.getTransmittingBuoy().clear(); -// } + boolean hasBalise = !bean.isTransmittingBuoyEmpty(); + + List<TransmittingBuoyDto> objets = new ArrayList<TransmittingBuoyDto>(); + if (!reset) { + if (hasBalise) { + objets.addAll(bean.getTransmittingBuoy()); + } + } + + if (hasBalise) { + // always reset balise lues of editBean to avoid side-effects + bean.getTransmittingBuoy().clear(); + } // clean container JPanel editorPanel = ui.getTransmittingBuoys(); @@ -348,7 +349,7 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH ui.getTransmittingBuoyOperation1().getData(); TransmittingBuoyDto transmittingBuoy; - TransmittingBuoyOperationDto objectOperation; + ReferentialReferenceDto<TransmittingBuoyOperationDto> objectOperation; switch (nbBalises) { case 0: // no balise @@ -363,10 +364,10 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH case 1: //FIXME -// transmittingBuoy = reset ? null : objets.get(0); -// -// objectOperation = reset ? getObjectOperation(operations, codeOperations[0]) : null; -// bindEditBalise(ui.getTransmittingBuoy1(), objectOperation, transmittingBuoy); + transmittingBuoy = reset ? null : objets.get(0); + + objectOperation = reset ? getObjectOperation(operations, codeOperations[0]) : null; + bindEditBalise(ui.getTransmittingBuoy1(), objectOperation, transmittingBuoy); editorPanel.setLayout(new GridLayout(1, 0)); editorPanel.add(ui.getTransmittingBuoy1Editor()); @@ -378,13 +379,13 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH case 2: //FIXME -// transmittingBuoy = reset ? null : objets.get(0); -// objectOperation = reset ? getObjectOperation(operations, codeOperations[0]) : null; -// bindEditBalise(ui.getTransmittingBuoy1(), objectOperation, transmittingBuoy); -// -// transmittingBuoy = reset ? null : objets.get(1); -// objectOperation = reset ? getObjectOperation(operations, codeOperations[1]) : null; -// bindEditBalise(ui.getTransmittingBuoy2(), objectOperation, transmittingBuoy); + transmittingBuoy = reset ? null : objets.get(0); + objectOperation = reset ? getObjectOperation(operations, codeOperations[0]) : null; + bindEditBalise(ui.getTransmittingBuoy1(), objectOperation, transmittingBuoy); + + transmittingBuoy = reset ? null : objets.get(1); + objectOperation = reset ? getObjectOperation(operations, codeOperations[1]) : null; + bindEditBalise(ui.getTransmittingBuoy2(), objectOperation, transmittingBuoy); editorPanel.setLayout(new GridLayout(2, 0)); editorPanel.add(ui.getTransmittingBuoy1Editor()); @@ -408,7 +409,7 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH } protected void bindEditBalise(TransmittingBuoyDto editBean, - TransmittingBuoyOperationDto transmittingBuoyOperation, + ReferentialReferenceDto<TransmittingBuoyOperationDto> transmittingBuoyOperation, TransmittingBuoyDto transmittingBuoy) { //FIXME @@ -416,12 +417,11 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH if (transmittingBuoy == null) { - //FIXME -// editBean.setTransmittingBuoyOperation(transmittingBuoyOperation); + editBean.setTransmittingBuoyOperation(transmittingBuoyOperation); if (log.isDebugEnabled()) { log.debug("Reuse an empty balise lue for objectOperation " + - transmittingBuoyOperation.getLabel1()); + transmittingBuoyOperation.getPropertyValue(TransmittingBuoyOperationDto.PROPERTY_LABEL1)); } if (isBalisePose(transmittingBuoyOperation)) { @@ -432,7 +432,7 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH } } - FloatingObjectDto bean = getBean(); + FloatingObjectTransmittingBuoyDto bean = getBean(); // if (bean.getTransmittingBuoy() == null) { // bean.setTransmittingBuoy(new ArrayList<TransmittingBuoy>()); @@ -440,11 +440,11 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH // bean.getTransmittingBuoy().add(editBean); } - protected TransmittingBuoyOperationDto getObjectOperation(List<TransmittingBuoyOperationDto> objectOperations, + protected ReferentialReferenceDto<TransmittingBuoyOperationDto> getObjectOperation(List<ReferentialReferenceDto<TransmittingBuoyOperationDto>> objectOperations, String codeOperation) { - TransmittingBuoyOperationDto objectOperation = null; - for (TransmittingBuoyOperationDto op : objectOperations) { - if (codeOperation.equals(op.getCode())) { + ReferentialReferenceDto<TransmittingBuoyOperationDto> objectOperation = null; + for (ReferentialReferenceDto<TransmittingBuoyOperationDto> op : objectOperations) { + if (codeOperation.equals(op.getPropertyValue(TransmittingBuoyOperationDto.PROPERTY_CODE))) { objectOperation = op; break; } @@ -457,4 +457,9 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH return objectOperation; } + //FIXME + protected TransmittingBuoyOperationService getTransmittingBuoyOperationService() { + return null; + } + } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUIModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUIModel.java index 70dab24..815f408 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUIModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUIModel.java @@ -23,7 +23,7 @@ package fr.ird.observe.ui.content.impl.seine; */ import fr.ird.observe.business.BinderService; -import fr.ird.observe.services.dto.seine.FloatingObjectDto; +import fr.ird.observe.services.dto.seine.FloatingObjectTransmittingBuoyDto; import fr.ird.observe.ui.content.ContentUIModel; import org.nuiton.util.beans.BinderModelBuilder; @@ -33,7 +33,7 @@ import org.nuiton.util.beans.BinderModelBuilder; * @author Tony Chemit - chemit@codelutin.com * @since XXX */ -public class FloatingObjectTransmittingBuoyOperationUIModel extends ContentUIModel<FloatingObjectDto> { +public class FloatingObjectTransmittingBuoyOperationUIModel extends ContentUIModel<FloatingObjectTransmittingBuoyDto> { private static final long serialVersionUID = 1L; @@ -41,7 +41,7 @@ public class FloatingObjectTransmittingBuoyOperationUIModel extends ContentUIMod // protected TopiaEntityBinder<TransmittingBuoyDto> childLoador; public FloatingObjectTransmittingBuoyOperationUIModel() { - super(FloatingObjectDto.class); + super(FloatingObjectTransmittingBuoyDto.class); String binderName = getClass().getName() + "-open"; @@ -76,12 +76,12 @@ public class FloatingObjectTransmittingBuoyOperationUIModel extends ContentUIMod // } @Override - protected BinderModelBuilder<FloatingObjectDto, FloatingObjectDto> createOpeningBinder(BinderService binderService, String binderName) { + protected BinderModelBuilder<FloatingObjectTransmittingBuoyDto, FloatingObjectTransmittingBuoyDto> createOpeningBinder(BinderService binderService, String binderName) { - BinderModelBuilder<FloatingObjectDto, FloatingObjectDto> builder = binderService.newBinderBuilder( - FloatingObjectDto.class, - FloatingObjectDto.PROPERTY_COMMENT, - FloatingObjectDto.PROPERTY_OBJECT_OPERATION + BinderModelBuilder<FloatingObjectTransmittingBuoyDto, FloatingObjectTransmittingBuoyDto> builder = binderService.newBinderBuilder( + FloatingObjectTransmittingBuoyDto.class, + FloatingObjectTransmittingBuoyDto.PROPERTY_COMMENT +// FloatingObjectTransmittingBuoyDto.PROPERTY_OBJECT_OPERATION ); return builder; 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 dd172d4..32f9577 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 @@ -27,6 +27,7 @@ import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.seine.ActivitySeineDto; import fr.ird.observe.services.dto.seine.FloatingObjectDto; +import fr.ird.observe.services.service.seine.FloatingObjectService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; import fr.ird.observe.ui.content.ContentUIModel; @@ -154,23 +155,15 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto> } //FIXME -// @Override -// protected boolean doSave(FloatingObject bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<FloatingObject> binder) throws Exception { -// -// String activityId = getSelectedParentId(); -// -// if (bean.getTopiaId() == null) { -// -// dataService.create(dataSource, activityId, bean, binder, getCreateExecutor()); -// } else { -// -// dataService.update(dataSource, null, bean, getUpdateExecutor()); -// } -// return true; -// } + @Override + protected boolean doSave(FloatingObjectDto bean) throws Exception { + + String activityId = getSelectedParentId(); + + getFloatingObjectService().save(activityId, bean); + + return true; + } //FIXME // @Override @@ -257,4 +250,8 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto> // parentBean.removeFloatingObject(beanToDelete); // } + //FIXME + protected FloatingObjectService getFloatingObjectService() { + return null; + } } 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 4af6b58..7b21fd9 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 @@ -22,13 +22,13 @@ package fr.ird.observe.ui.content.open.impl.longline; * #L% */ -import fr.ird.observe.business.ObserveTechnicalException; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; -import fr.ird.observe.business.db.DataSourceException; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.dto.result.TripChildSaveResultDto; +import fr.ird.observe.services.service.longline.ActivityLonglineService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIModel; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; @@ -38,9 +38,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.validator.NuitonValidatorScope; -import java.util.Calendar; -import java.util.Date; - import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; @@ -271,36 +268,27 @@ public class ActivityLonglineUIHandler extends ContentOpenableUIHandler<Activity model.setModified(create); } - //FIXME -// @Override -// protected boolean doSave(ActivityLongline bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<ActivityLongline> binder) throws Exception { -// -// if (log.isDebugEnabled()) { -// log.debug(" long - lat = " + bean.getLongitude() + " - " + bean.getLatitude()); -// } -// boolean create = bean.getTopiaId() == null; -// -// String tripId = getSelectedParentId(); -// -// bean.setOpen(true); -// -// if (create) { -// bean = dataService.create(dataSource, tripId, bean, binder, getCreateExecutor()); -// -// } else { -// -// dataService.update(dataSource, tripId, bean, getUpdateExecutor()); -// } -// -// updateTripEndDate(tripId); -// -// obtainChildPosition(bean, dataService, dataSource); -// -// return true; -// } + @Override + protected boolean doSave(ActivityLonglineDto bean) throws Exception { + + if (log.isDebugEnabled()) { + log.debug(" long - lat = " + bean.getLongitude() + " - " + bean.getLatitude()); + } + + String tripId = getSelectedParentId(); + + bean.setOpen(true); + + TripChildSaveResultDto saveResult = getActivityLonglineService().save(tripId, getModel().getBean()); + bean.setId(saveResult.getId()); + + setUpdateMareeNodeTag(saveResult.isTripEndDateUpdated()); + + //FIXME quand on gèrera l'arbre +// obtainChildPosition(bean); + + return true; + } //FIXME // @Override @@ -332,30 +320,26 @@ public class ActivityLonglineUIHandler extends ContentOpenableUIHandler<Activity // return beanToSave; // } - //FIXME -// @Override -// protected boolean doDelete(ActivityLongline bean, -// DataService dataService, -// DataSource dataSource, -// TopiaExecutor2<? extends TopiaEntity, ActivityLongline> deletor) throws Exception { -// -// if (askToDelete(bean)) { -// return false; -// } -// if (log.isInfoEnabled()) { -// log.info("Will delete Activity " + bean.getTopiaId()); -// } -// -// String tripId = getSelectedParentId(); -// dataService.delete(dataSource, tripId, bean, deletor); -// if (log.isInfoEnabled()) { -// log.info("Delete done for Activity " + bean.getTopiaId()); -// } -// -// updateTripEndDate(tripId); -// return true; -// -// } + @Override + protected boolean doDelete(ActivityLonglineDto bean) throws Exception { + + if (askToDelete(bean)) { + return false; + } + if (log.isInfoEnabled()) { + log.info("Will delete Activity " + bean.getId()); + } + + String tripId = getSelectedParentId(); + boolean wasTripEndDateUpdated = getActivityLonglineService().delete(tripId, bean.getId()); + if (log.isInfoEnabled()) { + log.info("Delete done for Activity " + bean.getId()); + } + + setUpdateMareeNodeTag(wasTripEndDateUpdated); + return true; + + } //FIXME // @Override @@ -392,31 +376,20 @@ public class ActivityLonglineUIHandler extends ContentOpenableUIHandler<Activity public static final String UPDATE_MAREE_NODE = "updateTripNode"; - //FIXME -// protected void updateTripEndDate(String tripId) { -// -// boolean wasUpdated; -// -// // on met a jour si necessaire la date de fin de la maree -// try { -// wasUpdated = getDataService().updateEndDate(getDataSource(), tripId); -// -// } catch (DataSourceException e) { -// throw new ObserveTechnicalException("Could not update end date", e); -// } -// -// if (wasUpdated) { -// -// // la date de fin a ete modifiee, il faut : redessiner le noeud de la maree le repositionner -// getUi().setContextValue(Boolean.TRUE, UPDATE_MAREE_NODE); -// -// } else { -// -// getUi().removeContextValue(Boolean.class, UPDATE_MAREE_NODE); -// -// } -// -// } + protected void setUpdateMareeNodeTag(boolean wasUpdated) { + + if (wasUpdated) { + + // la date de fin a ete modifiee, il faut : redessiner le noeud de la maree le repositionner + getUi().setContextValue(Boolean.TRUE, UPDATE_MAREE_NODE); + + } else { + + getUi().removeContextValue(Boolean.class, UPDATE_MAREE_NODE); + + } + + } protected void repaintTripNode() { @@ -437,4 +410,8 @@ public class ActivityLonglineUIHandler extends ContentOpenableUIHandler<Activity } + //FIXME + protected ActivityLonglineService getActivityLonglineService() { + return null; + } } 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 60ff366..23e0109 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 @@ -23,27 +23,23 @@ package fr.ird.observe.ui.content.open.impl.seine; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; -import fr.ird.observe.business.db.DataSourceException; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.services.dto.seine.ActivitySeineDto; import fr.ird.observe.services.dto.seine.RouteDto; import fr.ird.observe.services.dto.seine.TripSeineDto; +import fr.ird.observe.services.service.seine.ActivitySeineService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIModel; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; -import jaxx.runtime.swing.ErrorDialogUI; import jaxx.runtime.validator.swing.SwingValidatorMessage; import jaxx.runtime.validator.swing.SwingValidatorMessageTableModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.util.DateUtil; import org.nuiton.validator.NuitonValidatorScope; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; -import java.util.Date; import java.util.HashSet; -import java.util.List; import java.util.Set; import static org.nuiton.i18n.I18n.n; @@ -314,34 +310,25 @@ public class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySei model.setModified(create); } - //FIXME -// @Override -// protected boolean doSave(ActivitySeine bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<ActivitySeine> binder) throws Exception { -// -// if (log.isDebugEnabled()) { -// log.debug(" long - lat = " + bean.getLongitude() + " - " + bean.getLatitude()); -// } -// boolean create = bean.getTopiaId() == null; -// -// String routeId = getSelectedParentId(); -// -// bean.setOpen(true); -// -// if (create) { -// bean = dataService.create(dataSource, routeId, bean, binder, getCreateExecutor()); -// -// } else { -// -// dataService.update(dataSource, routeId, bean, getUpdateExecutor()); -// } -// -// obtainChildPosition(bean, dataService, dataSource); -// -// return true; -// } + @Override + protected boolean doSave(ActivitySeineDto bean) throws Exception { + + if (log.isDebugEnabled()) { + log.debug(" long - lat = " + bean.getLongitude() + " - " + bean.getLatitude()); + } + + String routeId = getSelectedParentId(); + + bean.setOpen(true); + + String beanId = getActivitySeineService().save(routeId, getModel().getBean()); + bean.setId(beanId); + + //FIXME quand on gèrera l'arbre +// obtainChildPosition(bean); + + return true; + } //FIXME // @Override @@ -378,27 +365,24 @@ public class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySei // return beanToSave; // } - //FIXME -// @Override -// protected boolean doDelete(ActivitySeine bean, -// DataService dataService, -// DataSource dataSource, -// TopiaExecutor2<? extends TopiaEntity, ActivitySeine> deletor) throws Exception { -// -// if (askToDelete(bean)) { -// return false; -// } -// if (log.isInfoEnabled()) { -// log.info("Will delete Activity " + bean.getTopiaId()); -// } -// -// String routeId = getSelectedParentId(); -// dataService.delete(dataSource, routeId, bean, deletor); -// if (log.isInfoEnabled()) { -// log.info("Delete done for Activity " + bean.getTopiaId()); -// } -// return true; -// } + @Override + protected boolean doDelete(ActivitySeineDto bean) throws Exception { + + if (askToDelete(bean)) { + return false; + } + if (log.isInfoEnabled()) { + log.info("Will delete Activity " + bean.getId()); + } + + String routeId = getSelectedParentId(); + getActivitySeineService().delete(routeId, bean.getId()); + + if (log.isInfoEnabled()) { + log.info("Delete done for Activity " + bean.getId()); + } + return true; + } //FIXME @@ -460,4 +444,10 @@ public class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySei } + + //FIXME + protected ActivitySeineService getActivitySeineService() { + return null; + } + } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java index ddfd2b5..b560617 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java @@ -29,8 +29,10 @@ import fr.ird.observe.business.validation.ValidationContext; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.IdDto; import fr.ird.observe.services.dto.ReferenceDto; +import fr.ird.observe.services.dto.constants.ReferenceStatus; import fr.ird.observe.services.dto.constants.ReferentialLocale; import fr.ird.observe.services.dto.referential.I18nReferentialDto; +import fr.ird.observe.services.dto.referential.ProgramDto; import fr.ird.observe.services.dto.referential.ReferentialDto; import fr.ird.observe.services.dto.referential.VesselSizeCategoryDto; import fr.ird.observe.services.service.ReferentialService; @@ -38,6 +40,7 @@ import fr.ird.observe.ui.DecoratorService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; +import fr.ird.observe.ui.tree.ObserveTreeHelper; import fr.ird.observe.ui.usage.UsagesUI; import fr.ird.observe.ui.util.SpringUtilities; import jaxx.runtime.JAXXContext; @@ -625,53 +628,47 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content } //FIXME -// @Override -// protected boolean doSave(E bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<E> binder) throws Exception { -// -// ContentReferenceUIModel<EDto> model = getModel(); -// -// if (bean.getTopiaId() == null) { -// -// if (log.isInfoEnabled()) { -// log.info("Create referentiel " + bean); -// } -// dataService.create(dataSource, -// null, -// bean, -// binder, -// getCreateExecutor() -// ); -// -// if (bean instanceof Program) { -// -// // add the program in tree -// ObserveTreeHelper treeHelper = getTreeHelper(getUi()); -// treeHelper.addProgram((Program) bean); -// } -// -// return true; -// } -// -// if (log.isInfoEnabled()) { -// log.info("Will update exisintg entity : " + bean.getTopiaId()); -// } -// // le bean original -// E oldBean = model.getSelectedBean(); -// -// if (oldBean != null && -// oldBean.getStatus() == ReferenceStatus.enabled && -// bean.getStatus() == ReferenceStatus.disabled) { -// -// // l'entite a ete desactive -// // on recherche les objets utilisant cette entitee -// // on indique a l'utilisateur ce changement -// if (log.isDebugEnabled()) { -// log.debug("entity status was desactivated, looking " + -// "for usage"); -// } + @Override + protected boolean doSave(E bean) throws Exception { + + ContentReferenceUIModel<E> model = getModel(); + + if (bean.getId() == null) { + + if (log.isInfoEnabled()) { + log.info("Create referentiel " + bean); + } + + String beanId = getReferentialService().save(bean); + bean.setId(beanId); + + if (bean instanceof ProgramDto) { + + // add the program in tree + ObserveTreeHelper treeHelper = getTreeHelper(getUi()); + treeHelper.addProgram((ProgramDto) bean); + } + + return true; + } + + if (log.isInfoEnabled()) { + log.info("Will update exisintg entity : " + bean.getId()); + } + // le bean original + E oldBean = model.getSelectedBean(); + + if (oldBean != null && + oldBean.getStatus() == ReferenceStatus.enabled && + bean.getStatus() == ReferenceStatus.disabled) { + + // l'entite a ete desactive + // on recherche les objets utilisant cette entitee + // on indique a l'utilisateur ce changement + if (log.isDebugEnabled()) { + log.debug("entity status was desactivated, looking " + + "for usage"); + } // EntityMap usages = dataService.findAllUsages(dataSource, bean); // // if (usages.isEmpty()) { @@ -690,23 +687,22 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content // return false; // } // } -// } -// // sauvegarde du bean d'edition dans le bean de la base -// bean = dataService.update(dataSource, -// null, // pas de parent a sauvegarder -// bean, -// getUpdateExecutor() -// ); -// -// if (bean instanceof Program) { -// -// // update the program in tree -// ObserveTreeHelper treeHelper = getTreeHelper(getUi()); -// treeHelper.updateProgram((Program) bean); -// } -// -// return true; -// } + } + + + // sauvegarde du bean d'edition dans le bean de la base + String beanId = getReferentialService().save(bean); + bean.setId(beanId); + + if (bean instanceof ProgramDto) { + + // update the program in tree + ObserveTreeHelper treeHelper = getTreeHelper(getUi()); + treeHelper.updateProgram((ProgramDto) bean); + } + + return true; + } //FIXME // @Override @@ -720,19 +716,16 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content //FIXME @Override -// protected boolean doDelete(E bean, -// DataService dataService, -// DataSource dataSource, -// TopiaExecutor2<? extends TopiaEntity, E> deletor) throws Exception { -// -// ContentReferenceUI<E> ui = getUi(); -// ContentReferenceUIModel<EDto> model = getModel(); -// -// if (log.isInfoEnabled()) { -// log.info("entity to be deleted, looking for usage"); -// } -// -// // recherche des utilisation du bean dans la base + protected boolean doDelete(E bean) throws Exception { + + ContentReferenceUI<E> ui = getUi(); + ContentReferenceUIModel<E> model = getModel(); + + if (log.isInfoEnabled()) { + log.info("entity to be deleted, looking for usage"); + } + + // recherche des utilisation du bean dans la base // EntityMap usages = dataService.findAllUsages(getDataSource(), bean); // // if (usages.isEmpty()) { @@ -748,22 +741,22 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content // showUsagesForDelete(ui, bean, usages); // return false; // } -// -// if (!UIHelper.confirmForEntityDelete(ui, model.getBeanType(), bean)) { -// return false; -// } -// -// String beanId = bean.getTopiaId(); -// dataService.delete(dataSource, null, bean, deletor); -// -// if (bean instanceof Program) { -// -// // remove the program in tree -// ObserveTreeHelper treeHelper = getTreeHelper(getUi()); -// treeHelper.removeProgram(beanId); -// } -// return true; -// } + + if (!UIHelper.confirmForEntityDelete(ui, model.getBeanType(), bean)) { + return false; + } + + String beanId = bean.getId(); + getReferentialService().delete(getBeanType(), beanId); + + if (bean instanceof ProgramDto) { + + // remove the program in tree + ObserveTreeHelper treeHelper = getTreeHelper(getUi()); + treeHelper.removeProgram(beanId); + } + return true; + } //FIXME // @Override @@ -872,4 +865,10 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content FormDto<E> formDto = referentialService.loadToRead(getBeanType(), id); return formDto; } + + //FIXME + protected ReferentialService getReferentialService() { + return null; + } + } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java index d0e2558..67a5e5e 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java @@ -36,6 +36,7 @@ import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; import fr.ird.observe.ui.content.ObserveContentUI; import fr.ird.observe.ui.tree.ObserveNode; +import jaxx.runtime.swing.ErrorDialogUI; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.validator.NuitonValidatorScope; @@ -346,42 +347,35 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto> ex } //FIXME -// @Override -// protected boolean doSave(E bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<E> binder) throws Exception { -// -// ObserveContentTableUI<E, D> ui = getUi(); -// -// List<D> objets = ui.getTableModel().getData(); -// -// boolean canContinue; -// try { -// canContinue = prepareSave(bean, objets); -// } catch (Exception e) { -// if (log.isErrorEnabled()) { -// log.error(e); -// } -// ErrorDialogUI.showError(e); -// canContinue = false; -// } -// if (!canContinue) { -// -// // l'utilisateur a choisi de ne pas sauvegarder -// return false; -// } -// doPersist(bean, dataService, dataSource); -// -// -// return true; -// } + @Override + protected boolean doSave(E bean) throws Exception { - //FIXME -// protected void doPersist(E bean, DataService dataService, DataSource dataSource) throws DataSourceException { -// // sauvegarde du bean en base -// dataService.update(dataSource, null, bean, getUpdateExecutor()); -// } + ObserveContentTableUI<E, D> ui = getUi(); + + List<D> objets = ui.getTableModel().getData(); + + boolean canContinue; + try { + canContinue = prepareSave(bean, objets); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error(e); + } + ErrorDialogUI.showError(e); + canContinue = false; + } + if (!canContinue) { + + // l'utilisateur a choisi de ne pas sauvegarder + return false; + } + doPersist(bean); + + + return true; + } + + protected abstract void doPersist(E bean); //FIXME // @Override diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/ReferentialServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/ReferentialServiceController.java index a917f4f..c28786d 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/ReferentialServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/ReferentialServiceController.java @@ -68,8 +68,8 @@ public class ReferentialServiceController extends ObserveAuthenticatedServiceCon } @Override - public <R extends ReferentialDto> String save(FormDto<R> form) { - return service.save(form); + public <R extends ReferentialDto> String save(R bean) { + return service.save(bean); } @Override diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/ActivityLonglineServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/ActivityLonglineServiceController.java index 88ed874..10d8c27 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/ActivityLonglineServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/ActivityLonglineServiceController.java @@ -26,6 +26,7 @@ import fr.ird.observe.application.web.controller.v1.ObserveAuthenticatedServiceC import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; import fr.ird.observe.services.dto.longline.ActivityLonglineStubDto; +import fr.ird.observe.services.dto.result.TripChildSaveResultDto; import fr.ird.observe.services.service.longline.ActivityLonglineService; import java.util.List; @@ -60,12 +61,12 @@ public class ActivityLonglineServiceController extends ObserveAuthenticatedServi } @Override - public String save(String tripLonglineId, FormDto<ActivityLonglineDto> form) { - return service.save(tripLonglineId, form); + public TripChildSaveResultDto save(String tripLonglineId, ActivityLonglineDto bean) { + return service.save(tripLonglineId, bean); } @Override - public void delete(String tripLonglineId, String activityLonglineId) { - service.delete(tripLonglineId, activityLonglineId); + public boolean delete(String tripLonglineId, String activityLonglineId) { + return service.delete(tripLonglineId, activityLonglineId); } } diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/ActivitySeineServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/ActivitySeineServiceController.java index daec866..7c0d960 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/ActivitySeineServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/ActivitySeineServiceController.java @@ -60,8 +60,8 @@ public class ActivitySeineServiceController extends ObserveAuthenticatedServiceC } @Override - public String save(String routeId, FormDto<ActivitySeineDto> form) { - return service.save(routeId, form); + public String save(String routeId, ActivitySeineDto dto) { + return service.save(routeId, dto); } @Override diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/FloatingObjectServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/FloatingObjectServiceController.java index a819989..f2b2ce4 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/FloatingObjectServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/FloatingObjectServiceController.java @@ -60,8 +60,8 @@ public class FloatingObjectServiceController extends ObserveAuthenticatedService } @Override - public String save(String activitySeineId, FormDto<FloatingObjectDto> form) { - return service.save(activitySeineId, form); + public String save(String activitySeineId, FloatingObjectDto dto) { + return service.save(activitySeineId, dto); } @Override diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TransmittingBuoyOperationServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TransmittingBuoyOperationServiceController.java index 53171fc..a291d0f 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TransmittingBuoyOperationServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TransmittingBuoyOperationServiceController.java @@ -47,7 +47,7 @@ public class TransmittingBuoyOperationServiceController extends ObserveAuthentic } @Override - public String save(FormDto<FloatingObjectTransmittingBuoyDto> form) { - return service.save(form); + public String save(FloatingObjectTransmittingBuoyDto dto) { + return service.save(dto); } } diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/ReferentialService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/ReferentialService.java index 950b4fe..9d4921f 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/ReferentialService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/ReferentialService.java @@ -60,7 +60,7 @@ public interface ReferentialService extends ObserveService { @WriteReferentialPermission @Write @PostRequest - <R extends ReferentialDto> String save(FormDto<R> form); + <R extends ReferentialDto> String save(R bean); @WriteReferentialPermission @Write diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/ActivityLonglineService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/ActivityLonglineService.java index 607a902..14812b8 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/ActivityLonglineService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/ActivityLonglineService.java @@ -26,6 +26,7 @@ import fr.ird.observe.services.ObserveService; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; import fr.ird.observe.services.dto.longline.ActivityLonglineStubDto; +import fr.ird.observe.services.dto.result.TripChildSaveResultDto; import fr.ird.observe.services.spi.DeleteRequest; import fr.ird.observe.services.spi.PostRequest; import fr.ird.observe.services.spi.ReadDataPermission; @@ -54,10 +55,13 @@ public interface ActivityLonglineService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(String tripLonglineId, FormDto<ActivityLonglineDto> form); + TripChildSaveResultDto save(String tripLonglineId, ActivityLonglineDto bean); @Write @WriteDataPermission @DeleteRequest - void delete(String tripLonglineId, String activityLonglineId); + /** + * @return true if the trip end date has been updated + */ + boolean delete(String tripLonglineId, String activityLonglineId); } diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineService.java index 161bd55..cb6549d 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineService.java @@ -54,7 +54,7 @@ public interface ActivitySeineService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(String routeId, FormDto<ActivitySeineDto> form); + String save(String routeId, ActivitySeineDto dto); @Write @WriteDataPermission diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/FloatingObjectService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/FloatingObjectService.java index 424aa7d..7a541fd 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/FloatingObjectService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/FloatingObjectService.java @@ -54,7 +54,7 @@ public interface FloatingObjectService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(String activitySeineId, FormDto<FloatingObjectDto> form); + String save(String activitySeineId, FloatingObjectDto dto); @Write @WriteDataPermission diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TransmittingBuoyOperationService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TransmittingBuoyOperationService.java index 88cf87e..72987d9 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TransmittingBuoyOperationService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TransmittingBuoyOperationService.java @@ -44,6 +44,6 @@ public interface TransmittingBuoyOperationService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(FormDto<FloatingObjectTransmittingBuoyDto> form); + String save(FloatingObjectTransmittingBuoyDto dto); } diff --git a/observe-services-model/src/main/xmi/observe-services-dto-common.zargo b/observe-services-model/src/main/xmi/observe-services-dto-common.zargo index 59c5da7..346fde6 100644 Binary files a/observe-services-model/src/main/xmi/observe-services-dto-common.zargo and b/observe-services-model/src/main/xmi/observe-services-dto-common.zargo differ diff --git a/observe-services-model/src/main/xmi/observe-services-dto-common.zargo b/observe-services-model/src/main/xmi/observe-services-dto-common.zargo~ similarity index 100% copy from observe-services-model/src/main/xmi/observe-services-dto-common.zargo copy to observe-services-model/src/main/xmi/observe-services-dto-common.zargo~ diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/ReferentialServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/ReferentialServiceTopia.java index 70b7b16..0b8c41f 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/ReferentialServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/ReferentialServiceTopia.java @@ -86,10 +86,10 @@ public class ReferentialServiceTopia extends ObserveServiceTopia implements Refe return form; } - public <D extends ReferentialDto> String save(FormDto<D> form) { - Class<D> dtoType = form.getType(); + public <D extends ReferentialDto> String save(D bean) { + Class<D> dtoType = (Class<D>) bean.getClass(); Class<TopiaEntity> entityType = getEntityType(dtoType); - TopiaEntity entity = dtoToEntity(dtoType, entityType, form.getForm()); + TopiaEntity entity = dtoToEntity(dtoType, entityType, bean); entity = saveEntity(entityType, entity); FormDto<D> model = entityToEditFormDto(dtoType, entityType, entity); return model.getForm().getId(); diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/ActivityLonglineServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/ActivityLonglineServiceTopia.java index 101dd16..b0e1928 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/ActivityLonglineServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/ActivityLonglineServiceTopia.java @@ -27,11 +27,13 @@ import com.google.common.collect.Lists; import fr.ird.observe.entities.constants.ReferenceLocale; import fr.ird.observe.entities.longline.ActivityLongline; import fr.ird.observe.entities.longline.TripLongline; +import fr.ird.observe.entities.longline.TripLonglineTopiaDao; import fr.ird.observe.services.ObserveServiceTopia; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; import fr.ird.observe.services.dto.longline.ActivityLonglineStubDto; import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.dto.result.TripChildSaveResultDto; import fr.ird.observe.services.service.DataNotFoundException; import fr.ird.type.CoordinateHelper; @@ -140,16 +142,18 @@ public class ActivityLonglineServiceTopia extends ObserveServiceTopia implements } @Override - public String save(String tripLonglineId, FormDto<ActivityLonglineDto> form) { + public TripChildSaveResultDto save(String tripLonglineId, ActivityLonglineDto activityLonglineDto) { - TripLongline tripLongline = loadEntity(TripLonglineDto.class, TripLongline.class, tripLonglineId); + TripChildSaveResultDto result = new TripChildSaveResultDto(); - ActivityLonglineDto activityLonglineDto = form.getForm(); + TripLongline tripLongline = loadEntity(TripLonglineDto.class, TripLongline.class, tripLonglineId); ActivityLongline activityLongline = dtoToEntity(ActivityLonglineDto.class, ActivityLongline.class, activityLonglineDto); activityLongline = saveEntity(ActivityLongline.class, activityLongline); + result.setId(activityLongline.getTopiaId()); + if (activityLonglineDto.isNotPersisted()) { tripLongline.addActivityLongline(activityLongline); @@ -158,12 +162,17 @@ public class ActivityLonglineServiceTopia extends ObserveServiceTopia implements } - return activityLongline.getTopiaId(); + TripLonglineTopiaDao tripLonglineTopiaDao = getTopiaPersistenceContext().getTripLonglineDao(); + boolean wasEndDateUpdated = tripLonglineTopiaDao.updateEndDate(tripLongline); + + result.setTripEndDateUpdated(wasEndDateUpdated); + + return result; } @Override - public void delete(String tripLonglineId, String activityLonglineId) { + public boolean delete(String tripLonglineId, String activityLonglineId) { TripLongline tripLongline = loadEntity(TripLonglineDto.class, TripLongline.class, tripLonglineId); @@ -177,7 +186,10 @@ public class ActivityLonglineServiceTopia extends ObserveServiceTopia implements tripLongline.removeActivityLongline(activityLongline); - } + TripLonglineTopiaDao tripLonglineTopiaDao = getTopiaPersistenceContext().getTripLonglineDao(); + boolean wasEndDateUpdated = tripLonglineTopiaDao.updateEndDate(tripLongline); + return wasEndDateUpdated; + } } diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineServiceTopia.java index 2dc4065..4c286b4 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineServiceTopia.java @@ -140,12 +140,10 @@ public class ActivitySeineServiceTopia extends ObserveServiceTopia implements Ac } @Override - public String save(String routeId, FormDto<ActivitySeineDto> form) { + public String save(String routeId, ActivitySeineDto activitySeineDto) { Route route = loadEntity(RouteDto.class, Route.class, routeId); - ActivitySeineDto activitySeineDto = form.getForm(); - ActivitySeine activitySeine = dtoToEntity(ActivitySeineDto.class, ActivitySeine.class, activitySeineDto); activitySeine = saveEntity(ActivitySeine.class, activitySeine); diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/FloatingObjectServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/FloatingObjectServiceTopia.java index de441c3..18a8b19 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/FloatingObjectServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/FloatingObjectServiceTopia.java @@ -92,12 +92,10 @@ public class FloatingObjectServiceTopia extends ObserveServiceTopia implements F } @Override - public String save(String activitySeineId, FormDto<FloatingObjectDto> form) { + public String save(String activitySeineId, FloatingObjectDto floatingObjectDto) { ActivitySeine activitySeine = loadEntity(ActivitySeineDto.class, ActivitySeine.class, activitySeineId); - FloatingObjectDto floatingObjectDto = form.getForm(); - FloatingObject floatingObject = dtoToEntity(FloatingObjectDto.class, FloatingObject.class, floatingObjectDto); floatingObject = saveEntity(FloatingObject.class, floatingObject); diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TransmittingBuoyOperationServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TransmittingBuoyOperationServiceTopia.java index b8027b9..a505456 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TransmittingBuoyOperationServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TransmittingBuoyOperationServiceTopia.java @@ -64,10 +64,10 @@ public class TransmittingBuoyOperationServiceTopia extends ObserveServiceTopia i } @Override - public String save(FormDto<FloatingObjectTransmittingBuoyDto> form) { + public String save(FloatingObjectTransmittingBuoyDto dto) { FloatingObject floatingObject = - dtoToEntity(FloatingObjectTransmittingBuoyDto.class, FloatingObject.class, form.getForm()); + dtoToEntity(FloatingObjectTransmittingBuoyDto.class, FloatingObject.class, dto); floatingObject = saveEntity(FloatingObject.class, floatingObject); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7531 in repository observe. See http://git.codelutin.com/observe.git commit a74653a8c1dc87f17f2295a626c2f14c1a38b325 Author: Kevin Morin <morin@codelutin.com> Date: Thu Sep 24 18:15:26 2015 +0200 utilisation des services dans doSave et doDelete --- .../impl/longline/SetLonglineUIHandler.java | 68 +++++------ .../impl/seine/FloatingObjectUIHandler.java | 31 ++--- .../ui/content/impl/seine/SetSeineUIHandler.java | 59 ++++----- .../open/impl/longline/TripLonglineUIHandler.java | 113 ++++++++---------- .../ui/content/open/impl/seine/RouteUIHandler.java | 132 ++++++++------------- .../open/impl/seine/TripSeineUIHandler.java | 109 ++++++++--------- .../ui/content/table/ContentTableUIHandler.java | 1 - .../impl/seine/TargetDiscardCatchUIHandler.java | 35 +++--- .../v1/longline/SetLonglineServiceController.java | 4 +- .../v1/longline/TripLonglineServiceController.java | 4 +- .../v1/seine/RouteServiceController.java | 9 +- .../v1/seine/SetSeineServiceController.java | 4 +- .../v1/seine/TripSeineServiceController.java | 4 +- .../service/longline/SetLonglineService.java | 2 +- .../service/longline/TripLonglineService.java | 2 +- .../services/service/seine/RouteService.java | 5 +- .../services/service/seine/SetSeineService.java | 2 +- .../services/service/seine/TripSeineService.java | 2 +- .../services/dto/ObserveDtosInitializer.java | 5 + .../service/longline/SetLonglineServiceTopia.java | 4 +- .../service/longline/TripLonglineServiceTopia.java | 7 +- .../services/service/seine/RouteServiceTopia.java | 36 +++++- .../service/seine/SetSeineServiceTopia.java | 5 +- .../service/seine/TripSeineServiceTopia.java | 7 +- .../fr/ird/observe/services/service/RigthTest.java | 2 +- 25 files changed, 310 insertions(+), 342 deletions(-) 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 d5ded97..456bfbf 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 @@ -28,6 +28,7 @@ import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; import fr.ird.observe.services.dto.longline.SetLonglineDto; +import fr.ird.observe.services.service.longline.SetLonglineService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; import fr.ird.observe.ui.content.ContentUIModel; @@ -399,27 +400,17 @@ public class SetLonglineUIHandler extends ContentUIHandler<SetLonglineDto> { } //FIXME -// @Override -// protected boolean doSave(SetLongline bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<SetLongline> binder) throws Exception { -// -// String activityId = getSelectedParentId(); -// -// if (bean.getTopiaId() == null) { -// -// dataService.create(dataSource, activityId, bean, binder, getCreateExecutor()); -// -// } else { -// -// dataService.update(dataSource, null, bean, getUpdateExecutor()); -// -// } -// -// return true; -// -// } + @Override + protected boolean doSave(SetLonglineDto bean) throws Exception { + + String activityId = getSelectedParentId(); + + String beanId = getSetLonglineService().save(activityId, bean); + bean.setId(beanId); + + return true; + + } //FIXME // @Override @@ -488,23 +479,19 @@ public class SetLonglineUIHandler extends ContentUIHandler<SetLonglineDto> { } - //FIXME -// @Override -// protected boolean doDelete(SetLongline bean, -// DataService dataService, -// DataSource dataSource, -// TopiaExecutor2<? extends TopiaEntity, SetLongline> deletor) throws Exception { -// -// if (askToDelete(bean)) { -// return false; -// } -// -// String activityId = getSelectedParentId(); -// dataService.delete(dataSource, activityId, bean, deletor); -// -// return true; -// -// } + @Override + protected boolean doDelete(SetLonglineDto bean) throws Exception { + + if (askToDelete(bean)) { + return false; + } + + String activityId = getSelectedParentId(); + getSetLonglineService().delete(activityId, bean.getId()); + + return true; + + } //FIXME // @Override @@ -599,4 +586,9 @@ public class SetLonglineUIHandler extends ContentUIHandler<SetLonglineDto> { } } + + //FIXME + protected SetLonglineService getSetLonglineService() { + return null; + } } 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 32f9577..5314afd 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 @@ -224,24 +224,19 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto> return null; } - //FIXME -// @Override -// protected boolean doDelete(FloatingObject bean, -// DataService dataService, -// DataSource dataSource, -// TopiaExecutor2<? extends TopiaEntity, FloatingObject> deletor) throws Exception { -// -// if (askToDelete(bean)) { -// return false; -// } -// -// if (bean.getTopiaId() != null) { -// -// String activityId = getSelectedParentId(); -// dataService.delete(dataSource, activityId, bean, deletor); -// } -// return true; -// } + protected boolean doDelete(FloatingObjectDto bean) throws Exception { + + if (askToDelete(bean)) { + return false; + } + + if (bean.getId() != null) { + + String activityId = getSelectedParentId(); + getFloatingObjectService().delete(activityId, bean.getId()); + } + return true; + } //FIXME // @Override 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 b1ce26d..3b17d4f 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 @@ -28,6 +28,7 @@ import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.constants.seine.SchoolType; import fr.ird.observe.services.dto.seine.ActivitySeineDto; import fr.ird.observe.services.dto.seine.SetSeineDto; +import fr.ird.observe.services.service.seine.SetSeineService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; import fr.ird.observe.ui.content.ContentUIModel; @@ -285,25 +286,16 @@ public class SetSeineUIHandler extends ContentUIHandler<SetSeineDto> { model.setModified(create); } - //FIXME -// @Override -// protected boolean doSave(SetSeine bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<SetSeine> binder) throws Exception { -// -// String activityId = getSelectedParentId(); -// -// if (bean.getTopiaId() == null) { -// -// dataService.create(dataSource, activityId, bean, binder, getCreateExecutor()); -// } else { -// -// dataService.update(dataSource, null, bean, getUpdateExecutor()); -// -// } -// return true; -// } + @Override + protected boolean doSave(SetSeineDto bean) throws Exception { + + String activityId = getSelectedParentId(); + + String beanId = getSetSeineService().save(activityId, bean); + bean.setId(beanId); + + return true; + } //FIXME // @Override @@ -365,21 +357,16 @@ public class SetSeineUIHandler extends ContentUIHandler<SetSeineDto> { return null; } - //FIXME -// @Override -// protected boolean doDelete(SetSeine bean, -// DataService dataService, -// DataSource dataSource, -// TopiaExecutor2<? extends TopiaEntity, SetSeine> deletor) throws Exception { -// -// if (askToDelete(bean)) { -// return false; -// } -// -// String activityId = getSelectedParentId(); -// dataService.delete(dataSource, activityId, bean, deletor); -// return true; -// } + protected boolean doDelete(SetSeineDto bean) throws Exception { + + if (askToDelete(bean)) { + return false; + } + + String activityId = getSelectedParentId(); + getSetSeineService().delete(activityId, bean.getId()); + return true; + } //FIXME // @Override @@ -442,4 +429,8 @@ public class SetSeineUIHandler extends ContentUIHandler<SetSeineDto> { } + //FIXME + protected SetSeineService getSetSeineService() { + return null; + } } 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 fb08b00..5b6fba4 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 @@ -26,8 +26,8 @@ import fr.ird.observe.ObserveConfig; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; -import fr.ird.observe.services.dto.longline.ActivityLonglineDtos; import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.service.longline.TripLonglineService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; import fr.ird.observe.ui.content.open.ContentOpenableUIModel; @@ -36,8 +36,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.DateUtil; -import javax.swing.JTabbedPane; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.util.Date; @@ -255,47 +254,36 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline model.setModified(create); } -// @Override -// protected boolean doSave(TripLongline bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<TripLongline> binder) throws Exception { -// -// String programId = getDataContext().getSelectedProgramId(); -// -// // on force toujours la date a etre sans heure, minute,... -// Date startDate = DateUtil.getDay(bean.getStartDate()); -// if (log.isDebugEnabled()) { -// log.debug("startDate = " + startDate); -// } -// bean.setStartDate(startDate); -// -// Date endDate = bean.getEndDate(); -// if (log.isDebugEnabled()) { -// log.debug("endDate = " + endDate); -// } -// -// bean.setOpen(true); -// -// if (bean.getTopiaId() == null) { -// -// dataService.create(dataSource, programId, bean, binder, getCreateExecutor()); -// -// } else { -// -// dataService.update(dataSource, null, bean, getUpdateExecutor()); -// -// } -// -// // mise a jour de la date de fin -// dataService.updateEndDate(dataSource, bean.getTopiaId()); -// -// // recuperation de la position de la maree dans le program + @Override + protected boolean doSave(TripLonglineDto bean) throws Exception { + + String programId = getDataContext().getSelectedProgramId(); + + // on force toujours la date a etre sans heure, minute,... + Date startDate = DateUtil.getDay(bean.getStartDate()); + if (log.isDebugEnabled()) { + log.debug("startDate = " + startDate); + } + bean.setStartDate(startDate); + + Date endDate = bean.getEndDate(); + if (log.isDebugEnabled()) { + log.debug("endDate = " + endDate); + } + + bean.setOpen(true); + + String beanId = getTripLonglineService().save(bean); + bean.setId(beanId); + + // recuperation de la position de la maree dans le program + //FIXME // obtainChildPosition(bean, dataService, dataSource); -// -// return true; -// } + return true; + } + +//FIXME // @Override // protected TripLongline onCreate(TopiaContext tx, Object parent, TripLongline editBean) throws TopiaException { // TripLongline beanToSave = ObserveDAOHelper.getTripLonglineDAO(tx).create(); @@ -313,25 +301,23 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline // } //FIXME -// @Override -// protected boolean doDelete(TripLongline bean, -// DataService dataService, -// DataSource dataSource, -// TopiaExecutor2<? extends TopiaEntity, TripLongline> deletor) throws Exception { -// -// if (askToDelete(bean)) { -// return false; -// } -// if (log.isInfoEnabled()) { -// log.info("Will delete Trip " + bean.getTopiaId()); -// } -// -// dataService.delete(dataSource, null, bean, deletor); -// if (log.isInfoEnabled()) { -// log.info("Delete done for Trip " + bean.getTopiaId()); -// } -// return true; -// } + @Override + protected boolean doDelete(TripLonglineDto bean) throws Exception { + + if (askToDelete(bean)) { + return false; + } + if (log.isInfoEnabled()) { + log.info("Will delete Trip " + bean.getId()); + } + + getTripLonglineService().delete(bean.getId()); + + if (log.isInfoEnabled()) { + log.info("Delete done for Trip " + bean.getId()); + } + return true; + } //FIXME // @Override @@ -348,4 +334,9 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline return !create && !dataContext.isOpenTrip(); } + + //FIXME + protected TripLonglineService getTripLonglineService() { + return null; + } } 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 d121325..ada124a 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 @@ -22,27 +22,25 @@ package fr.ird.observe.ui.content.open.impl.seine; import fr.ird.observe.ObserveContext; -import fr.ird.observe.business.ObserveTechnicalException; import fr.ird.observe.business.db.DataContext; -import fr.ird.observe.business.db.DataSource; -import fr.ird.observe.business.db.DataSourceException; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.services.dto.referential.seine.VesselActivitySeineDto; +import fr.ird.observe.services.dto.result.TripChildSaveResultDto; import fr.ird.observe.services.dto.seine.ActivitySeineDto; import fr.ird.observe.services.dto.seine.RouteDto; import fr.ird.observe.services.dto.seine.TripSeineDto; +import fr.ird.observe.services.service.seine.RouteService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; import fr.ird.observe.ui.tree.ObserveNode; import fr.ird.observe.ui.tree.ObserveTreeHelper; -import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.DateUtil; import org.nuiton.validator.NuitonValidatorScope; -import javax.swing.JOptionPane; +import javax.swing.*; import java.util.Date; import static org.nuiton.i18n.I18n.n; @@ -225,43 +223,30 @@ public class RouteUIHandler extends ContentOpenableUIHandler<RouteDto> { getModel().setModified(create); } -// @Override -// protected boolean doSave(Route bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<Route> binder) throws Exception { -// -// String tripId = getSelectedParentId(); -// -// if (log.isInfoEnabled()) { -// log.info("will save route " + bean.getTopiaId()); -// } -// -// // on sauvegarde toujours en debut de jour -// Date date = DateUtil.getDay(bean.getDate()); -// bean.setDate(date); -// bean.setOpen(true); -// -// if (bean.getTopiaId() == null) { -// -// dataService.create(dataSource, tripId, bean, binder, getCreateExecutor()); -// } else { -// -// dataService.update(dataSource, tripId, bean, getUpdateExecutor()); -// -// if( dateHasChanged) { -// -// dataService.updateDayDate(dataSource, bean.getTopiaId()); -// -// } -// } -// -// updateTripEndDate(tripId); -// + @Override + protected boolean doSave(RouteDto bean) throws Exception { + + String tripId = getSelectedParentId(); + + if (log.isInfoEnabled()) { + log.info("will save route " + bean.getId()); + } + + // on sauvegarde toujours en debut de jour + Date date = DateUtil.getDay(bean.getDate()); + bean.setDate(date); + bean.setOpen(true); + + TripChildSaveResultDto saveResult = getRouteService().save(tripId, bean); + bean.setId(saveResult.getId()); + + setUpdateMareeNodeTag(saveResult.isTripEndDateUpdated()); + + //FIXME // obtainChildPosition(bean, dataService, dataSource); -// -// return true; -// } + + return true; + } @Override protected void afterSave(boolean refresh) { @@ -295,8 +280,6 @@ public class RouteUIHandler extends ContentOpenableUIHandler<RouteDto> { // return beanToSave; // } - boolean dateHasChanged; - //FIXME // @Override // protected Route onUpdate(TopiaContext tx, Object parent, Route beanToSave) throws TopiaException { @@ -315,29 +298,27 @@ public class RouteUIHandler extends ContentOpenableUIHandler<RouteDto> { // return beanToSave; // } - //FIXME -// @Override -// protected boolean doDelete(Route bean, -// DataService dataService, -// DataSource dataSource, -// TopiaExecutor2<? extends TopiaEntity, Route> deletor) throws Exception { -// -// if (askToDelete(bean)) { -// return false; -// } -// if (log.isInfoEnabled()) { -// log.info("Will delete Route " + bean.getTopiaId()); -// } -// -// String tripId = getSelectedParentId(); -// dataService.delete(dataSource, tripId, bean, deletor); -// if (log.isInfoEnabled()) { -// log.info("Delete done for Route " + bean.getTopiaId()); -// } -// updateTripEndDate(tripId); -// -// return true; -// } + @Override + protected boolean doDelete(RouteDto bean) throws Exception { + + if (askToDelete(bean)) { + return false; + } + if (log.isInfoEnabled()) { + log.info("Will delete Route " + bean.getId()); + } + + String tripId = getSelectedParentId(); + boolean wasEndDateUpdated = getRouteService ().delete(tripId, bean.getId()); + + if (log.isInfoEnabled()) { + log.info("Delete done for Route " + bean.getId()); + } + + setUpdateMareeNodeTag(wasEndDateUpdated); + + return true; + } // @Override // protected void onDelete(TopiaContext tx, Object parent, Route beanToDelete) { @@ -525,20 +506,7 @@ public class RouteUIHandler extends ContentOpenableUIHandler<RouteDto> { // treeHelper.refreshNode(tripNode, false); } - protected void updateTripEndDate(String tripId) { - - //FIXME -// boolean wasUpdated; - boolean wasUpdated = false; - - // on met a jour si necessaire la date de fin de la maree - //FIXME -// try { -// wasUpdated = getDataService().updateEndDate(getDataSource(), tripId); -// -// } catch (DataSourceException e) { -// throw new ObserveTechnicalException("Could not update end date",e); -// } + protected void setUpdateMareeNodeTag(boolean wasUpdated) { if (wasUpdated) { @@ -553,4 +521,8 @@ public class RouteUIHandler extends ContentOpenableUIHandler<RouteDto> { } + //FIXME + protected RouteService getRouteService() { + return null; + } } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index 7c964ae..5fb0bb1 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -26,6 +26,7 @@ import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.services.dto.seine.TripSeineDto; +import fr.ird.observe.services.service.seine.TripSeineService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; import fr.ird.observe.ui.content.open.ContentOpenableUIModel; @@ -253,46 +254,34 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { } //FIXME -// @Override -// protected boolean doSave(TripSeine bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<TripSeine> binder) throws Exception { -// -// String programId = getDataContext().getSelectedProgramId(); -// -// // on force toujours la date a etre sans heure, minute,... -// Date startDate = DateUtil.getDay(bean.getStartDate()); -// if (log.isDebugEnabled()) { -// log.debug("startDate = " + startDate); -// } -// bean.setStartDate(startDate); -// -// Date endDate = bean.getEndDate(); -// if (log.isDebugEnabled()) { -// log.debug("endDate = " + endDate); -// } -// -// bean.setOpen(true); -// -// if (bean.getTopiaId() == null) { -// -// dataService.create(dataSource, programId, bean, binder, getCreateExecutor()); -// -// } else { -// -// dataService.update(dataSource, null, bean, getUpdateExecutor()); -// -// } -// -// // mise a jour de la date de fin -// dataService.updateEndDate(dataSource, bean.getTopiaId()); -// -// // recuperation de la position de la maree dans le program + @Override + protected boolean doSave(TripSeineDto bean) throws Exception { + + String programId = getDataContext().getSelectedProgramId(); + + // on force toujours la date a etre sans heure, minute,... + Date startDate = DateUtil.getDay(bean.getStartDate()); + if (log.isDebugEnabled()) { + log.debug("startDate = " + startDate); + } + bean.setStartDate(startDate); + + Date endDate = bean.getEndDate(); + if (log.isDebugEnabled()) { + log.debug("endDate = " + endDate); + } + + bean.setOpen(true); + + String beanId = getTripSeineService().save(bean); + bean.setId(beanId); + + // recuperation de la position de la maree dans le program + //FIXME // obtainChildPosition(bean, dataService, dataSource); -// -// return true; -// } + + return true; + } //FIXME // @Override @@ -311,26 +300,23 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { // return beanToSave; // } - //FIXME -// @Override -// protected boolean doDelete(TripSeine bean, -// DataService dataService, -// DataSource dataSource, -// TopiaExecutor2<? extends TopiaEntity, TripSeine> deletor) throws Exception { -// -// if (askToDelete(bean)) { -// return false; -// } -// if (log.isInfoEnabled()) { -// log.info("Will delete Trip " + bean.getTopiaId()); -// } -// -// dataService.delete(dataSource, null, bean, deletor); -// if (log.isInfoEnabled()) { -// log.info("Delete done for Trip " + bean.getTopiaId()); -// } -// return true; -// } + @Override + protected boolean doDelete(TripSeineDto bean) throws Exception { + + if (askToDelete(bean)) { + return false; + } + if (log.isInfoEnabled()) { + log.info("Will delete Trip " + bean.getId()); + } + + getTripSeineService().delete(bean.getId()); + + if (log.isInfoEnabled()) { + log.info("Delete done for Trip " + bean.getId()); + } + return true; + } //FIXME // @Override @@ -348,4 +334,9 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { } + //FIXME + protected TripSeineService getTripSeineService() { + return null; + } + } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java index 67a5e5e..e025795 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java @@ -371,7 +371,6 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto> ex } doPersist(bean); - return true; } 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 0c288a3..112e417 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 @@ -40,9 +40,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JTable; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -280,19 +278,23 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineD // } //FIXME -// @Override -// protected boolean doSave(SetSeine bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<SetSeine> binder) throws Exception { -// try { -// return super.doSave(bean, dataService, dataSource, binder); -// } finally { -// -// // toujours supprimer la référence du context, quoiqu'il arrive -// ALL_TAILLES_TO_DELETE_ENTRY.removeContextValue(getUi()); -// } -// } + @Override + protected boolean doSave(SetSeineDto bean) throws Exception { + + try { + return super.doSave(bean); + + } finally { + + // toujours supprimer la référence du context, quoiqu'il arrive + ALL_TAILLES_TO_DELETE_ENTRY.removeContextValue(getUi()); + } + } + + @Override + protected void doPersist(SetSeineDto bean) { + //FIXME quel service ? + } @Override protected boolean prepareSave(SetSeineDto bean, List<TargetCatchDto> objets) throws DataSourceException { @@ -679,4 +681,5 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineD } } } + } diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/SetLonglineServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/SetLonglineServiceController.java index e4af6ba..f79c9db 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/SetLonglineServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/SetLonglineServiceController.java @@ -52,8 +52,8 @@ public class SetLonglineServiceController extends ObserveAuthenticatedServiceCon } @Override - public String save(String activityLonglineId, FormDto<SetLonglineDto> form) { - return service.save(activityLonglineId, form); + public String save(String activityLonglineId, SetLonglineDto dto) { + return service.save(activityLonglineId, dto); } @Override diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/TripLonglineServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/TripLonglineServiceController.java index cc402c4..a3dc624 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/TripLonglineServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/TripLonglineServiceController.java @@ -60,8 +60,8 @@ public class TripLonglineServiceController extends ObserveAuthenticatedServiceCo } @Override - public String save(FormDto<TripLonglineDto> form) { - return service.save(form); + public String save(TripLonglineDto dto) { + return service.save(dto); } @Override diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/RouteServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/RouteServiceController.java index 2dee7f3..4b65180 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/RouteServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/RouteServiceController.java @@ -24,6 +24,7 @@ package fr.ird.observe.application.web.controller.v1.seine; import fr.ird.observe.application.web.controller.v1.ObserveAuthenticatedServiceControllerSupport; import fr.ird.observe.services.dto.FormDto; +import fr.ird.observe.services.dto.result.TripChildSaveResultDto; import fr.ird.observe.services.dto.seine.RouteDto; import fr.ird.observe.services.dto.seine.RouteStubDto; import fr.ird.observe.services.service.seine.RouteService; @@ -60,12 +61,12 @@ public class RouteServiceController extends ObserveAuthenticatedServiceControlle } @Override - public String save(String tripSeineId, FormDto<RouteDto> form) { - return service.save(tripSeineId, form); + public TripChildSaveResultDto save(String tripSeineId, RouteDto dto) { + return service.save(tripSeineId, dto); } @Override - public void delete(String tripSeineId, String routeId) { - service.delete(tripSeineId, routeId); + public boolean delete(String tripSeineId, String routeId) { + return service.delete(tripSeineId, routeId); } } diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/SetSeineServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/SetSeineServiceController.java index b5f6935..58ab321 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/SetSeineServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/SetSeineServiceController.java @@ -52,8 +52,8 @@ public class SetSeineServiceController extends ObserveAuthenticatedServiceContro } @Override - public String save(String activitySeineId, FormDto<SetSeineDto> form) { - return service.save(activitySeineId, form); + public String save(String activitySeineId, SetSeineDto dto) { + return service.save(activitySeineId, dto); } @Override diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TripSeineServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TripSeineServiceController.java index 864257a..e346f06 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TripSeineServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TripSeineServiceController.java @@ -60,8 +60,8 @@ public class TripSeineServiceController extends ObserveAuthenticatedServiceContr } @Override - public String save(FormDto<TripSeineDto> form) { - return service.save(form); + public String save(TripSeineDto dto) { + return service.save(dto); } @Override diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/SetLonglineService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/SetLonglineService.java index 5cd59c2..5ebc557 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/SetLonglineService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/SetLonglineService.java @@ -48,7 +48,7 @@ public interface SetLonglineService extends ObserveService { @WriteDataPermission @Write @PostRequest - String save(String activityLonglineId, FormDto<SetLonglineDto> form); + String save(String activityLonglineId, SetLonglineDto dto); @Write @WriteDataPermission diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/TripLonglineService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/TripLonglineService.java index fb6cd1f..1cf2937 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/TripLonglineService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/TripLonglineService.java @@ -54,7 +54,7 @@ public interface TripLonglineService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(FormDto<TripLonglineDto> form); + String save(TripLonglineDto dto); @Write @WriteDataPermission diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/RouteService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/RouteService.java index b18b547..0c53283 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/RouteService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/RouteService.java @@ -24,6 +24,7 @@ package fr.ird.observe.services.service.seine; import fr.ird.observe.services.ObserveService; import fr.ird.observe.services.dto.FormDto; +import fr.ird.observe.services.dto.result.TripChildSaveResultDto; import fr.ird.observe.services.dto.seine.RouteDto; import fr.ird.observe.services.dto.seine.RouteStubDto; import fr.ird.observe.services.spi.DeleteRequest; @@ -54,11 +55,11 @@ public interface RouteService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(String tripSeineId, FormDto<RouteDto> form); + TripChildSaveResultDto save(String tripSeineId, RouteDto dto); @Write @WriteDataPermission @DeleteRequest - void delete(String tripSeineId, String routeId); + boolean delete(String tripSeineId, String routeId); } diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/SetSeineService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/SetSeineService.java index 5780cde..c0df928 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/SetSeineService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/SetSeineService.java @@ -48,7 +48,7 @@ public interface SetSeineService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(String activitySeineId, FormDto<SetSeineDto> form); + String save(String activitySeineId, SetSeineDto dto); @Write @WriteDataPermission diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TripSeineService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TripSeineService.java index ccab5b1..74707e9 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TripSeineService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TripSeineService.java @@ -54,7 +54,7 @@ public interface TripSeineService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(FormDto<TripSeineDto> form); + String save(TripSeineDto dto); @Write @WriteDataPermission diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java b/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java index b914890..e65de9d 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/dto/ObserveDtosInitializer.java @@ -1270,6 +1270,11 @@ public class ObserveDtosInitializer implements ObserveModelInitializer { WindDto.PROPERTY_SPEED_RANGE); } + @Override + public void initTripChildSaveResultDto() { + // do nothing + } + // -------------------------------------------------------------------------------------------------------------- // // -- DATA SEINE ------------------------------------------------------------------------------------------------ // // -------------------------------------------------------------------------------------------------------------- // diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/SetLonglineServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/SetLonglineServiceTopia.java index 955ccec..9f8c9cd 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/SetLonglineServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/SetLonglineServiceTopia.java @@ -92,12 +92,10 @@ public class SetLonglineServiceTopia extends ObserveServiceTopia implements SetL } @Override - public String save(String activityLonglineId, FormDto<SetLonglineDto> form) { + public String save(String activityLonglineId, SetLonglineDto setLonglineDto) { ActivityLongline activityLongline = loadEntity(ActivityLonglineDto.class, ActivityLongline.class, activityLonglineId); - SetLonglineDto setLonglineDto = form.getForm(); - SetLongline setLongline = dtoToEntity(SetLonglineDto.class, SetLongline.class, setLonglineDto); setLongline = saveEntity(SetLongline.class, setLongline); diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/TripLonglineServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/TripLonglineServiceTopia.java index 975e992..23e3de1 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/TripLonglineServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/TripLonglineServiceTopia.java @@ -120,12 +120,15 @@ public class TripLonglineServiceTopia extends ObserveServiceTopia implements Tri } @Override - public String save(FormDto<TripLonglineDto> form) { + public String save(TripLonglineDto dto) { - TripLongline tripLongline = dtoToEntity(TripLonglineDto.class, TripLongline.class, form.getForm()); + TripLongline tripLongline = dtoToEntity(TripLonglineDto.class, TripLongline.class, dto); tripLongline = saveEntity(TripLongline.class, tripLongline); + TripLonglineTopiaDao dao = getTopiaPersistenceContext().getTripLonglineDao(); + dao.updateEndDate(tripLongline); + return tripLongline.getTopiaId(); } diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/RouteServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/RouteServiceTopia.java index 6a0833e..c352c86 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/RouteServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/RouteServiceTopia.java @@ -25,9 +25,12 @@ package fr.ird.observe.services.service.seine; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import fr.ird.observe.entities.seine.Route; +import fr.ird.observe.entities.seine.RouteTopiaDao; import fr.ird.observe.entities.seine.TripSeine; +import fr.ird.observe.entities.seine.TripSeineTopiaDao; import fr.ird.observe.services.ObserveServiceTopia; import fr.ird.observe.services.dto.FormDto; +import fr.ird.observe.services.dto.result.TripChildSaveResultDto; import fr.ird.observe.services.dto.seine.RouteDto; import fr.ird.observe.services.dto.seine.RouteStubDto; import fr.ird.observe.services.dto.seine.TripSeineDto; @@ -118,15 +121,18 @@ public class RouteServiceTopia extends ObserveServiceTopia implements RouteServi } @Override - public String save(String tripSeineId, FormDto<RouteDto> form) { + public TripChildSaveResultDto save(String tripSeineId, RouteDto routeDto) { - TripSeine tripSeine = loadEntity(TripSeineDto.class, TripSeine.class, tripSeineId); + TripChildSaveResultDto result = new TripChildSaveResultDto(); - RouteDto routeDto = form.getForm(); + TripSeine tripSeine = loadEntity(TripSeineDto.class, TripSeine.class, tripSeineId); + Route route = loadEntity(RouteDto.class, Route.class, routeDto.getId()); + Date oldRouteDate = route.getDate(); - Route route = dtoToEntity(RouteDto.class, Route.class, routeDto); + route = dtoToEntity(RouteDto.class, Route.class, routeDto); route = saveEntity(Route.class, route); + result.setId(route.getTopiaId()); if (routeDto.isNotPersisted()) { @@ -134,13 +140,27 @@ public class RouteServiceTopia extends ObserveServiceTopia implements RouteServi saveEntity(TripSeine.class, tripSeine); + } else { + Date oldDate = DateUtil.getDay(oldRouteDate); + // si le jour a change, il faut mettre à jour les dates des activitéset des sets + boolean dateHasChanged = !oldDate.equals(routeDto.getDate()); + + if (dateHasChanged) { + RouteTopiaDao dao = getTopiaPersistenceContext().getRouteDao(); + dao.updateActivitiesDate(route.getTopiaId()); + } } - return route.getTopiaId(); + TripSeineTopiaDao tripSeineTopiaDao = getTopiaPersistenceContext().getTripSeineDao(); + boolean wasEndDateUpdated = tripSeineTopiaDao.updateEndDate(tripSeine); + + result.setTripEndDateUpdated(wasEndDateUpdated); + + return result; } @Override - public void delete(String tripSeineId, String routeId) { + public boolean delete(String tripSeineId, String routeId) { TripSeine tripSeine = loadEntity(TripSeineDto.class, TripSeine.class, tripSeineId); @@ -154,6 +174,10 @@ public class RouteServiceTopia extends ObserveServiceTopia implements RouteServi tripSeine.removeRoute(route); + TripSeineTopiaDao tripSeineTopiaDao = getTopiaPersistenceContext().getTripSeineDao(); + boolean wasEndDateUpdated = tripSeineTopiaDao.updateEndDate(tripSeine); + + return wasEndDateUpdated; } } diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/SetSeineServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/SetSeineServiceTopia.java index 204926c..319b64f 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/SetSeineServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/SetSeineServiceTopia.java @@ -100,12 +100,10 @@ public class SetSeineServiceTopia extends ObserveServiceTopia implements SetSein } @Override - public String save(String activitySeineId, FormDto<SetSeineDto> form) { + public String save(String activitySeineId, SetSeineDto setSeineDto) { ActivitySeine activitySeine = loadEntity(ActivitySeineDto.class, ActivitySeine.class, activitySeineId); - SetSeineDto setSeineDto = form.getForm(); - SetSeine setSeine = dtoToEntity(SetSeineDto.class, SetSeine.class, setSeineDto); setSeine = saveEntity(SetSeine.class, setSeine); @@ -134,5 +132,6 @@ public class SetSeineServiceTopia extends ObserveServiceTopia implements SetSein activitySeine.setSetSeine(null); + //FIXME kmorin : faudrait pas sauver quelquechose là ? parcequ'on n'a rien supprimé... } } diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TripSeineServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TripSeineServiceTopia.java index 2ae405d..525c082 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TripSeineServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TripSeineServiceTopia.java @@ -123,12 +123,15 @@ public class TripSeineServiceTopia extends ObserveServiceTopia implements TripSe } @Override - public String save(FormDto<TripSeineDto> form) { + public String save(TripSeineDto dto) { - TripSeine tripSeine = dtoToEntity(TripSeineDto.class, TripSeine.class, form.getForm()); + TripSeine tripSeine = dtoToEntity(TripSeineDto.class, TripSeine.class, dto); tripSeine = saveEntity(TripSeine.class, tripSeine); + TripSeineTopiaDao dao = getTopiaPersistenceContext().getTripSeineDao(); + dao.updateEndDate(tripSeine); + return tripSeine.getTopiaId(); } diff --git a/observe-services-topia/src/test/java/fr/ird/observe/services/service/RigthTest.java b/observe-services-topia/src/test/java/fr/ird/observe/services/service/RigthTest.java index c1fe848..1509d73 100644 --- a/observe-services-topia/src/test/java/fr/ird/observe/services/service/RigthTest.java +++ b/observe-services-topia/src/test/java/fr/ird/observe/services/service/RigthTest.java @@ -173,7 +173,7 @@ public class RigthTest { FormDto<ProgramDto> formDto = service.loadToEdit(ProgramDto.class, PROGRAM_ID); - service.save(formDto); + service.save(formDto.getForm()); } @Test -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7531 in repository observe. See http://git.codelutin.com/observe.git commit eefe00196889adb745c6adbef684867164ecfaee Merge: a74653a 3f97619 Author: Kevin Morin <morin@codelutin.com> Date: Fri Sep 25 10:34:07 2015 +0200 Merge branch 'feature/7531' of https://git.codelutin.com/observe into feature/7531 Conflicts: observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectUIHandler.java observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/SetSeineUIHandler.java observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java observe-application-swing/pom.xml | 11 + .../src/main/filters/observe-ui.properties | 1 + .../java/fr/ird/observe/ObserveActionExecutor.java | 22 +- .../main/java/fr/ird/observe/ObserveCLAction.java | 30 +- .../main/java/fr/ird/observe/ObserveConfig.java | 1004 ----- .../main/java/fr/ird/observe/ObserveContext.java | 594 --- .../fr/ird/observe/ObserveResourceManager.java | 20 +- .../main/java/fr/ird/observe/ObserveRunner.java | 74 +- .../{business => }/ObserveServiceHelper.java | 63 +- .../observe/ObserveSwingApplicationContext.java | 764 ++++ .../fr/ird/observe/business/IObserveConfig.java | 4 +- .../business/ObserveApplicationContext.java | 9 +- .../ird/observe/business/db/DataSourceConfig.java | 2 +- .../ird/observe/business/db/DataSourceFactory.java | 2 +- .../db/constants/CommonDataSourceConfigParam.java | 1 + .../business/report/model/ReportExecute.java | 15 +- .../business/validation/ObserveValidator.java | 6 +- .../validation/ValidationMessageDetector.java | 2 +- .../ObserveApplicationConfigProvider.java | 7 +- .../ObserveSwingApplicationConfig.java | 1152 +++++ .../ObserveSwingApplicationConfigOption.java} | 217 +- .../ObserveSwingApplicationConfigProvider.java | 37 + .../fr/ird/observe/db/ObserveSwingDataSource.java | 304 ++ .../constantes}/ConnexionStatus.java | 2 +- .../constants => db/constantes}/CreationMode.java | 28 +- .../db/constants => db/constantes}/DbMode.java | 7 +- .../db/event/ObserveSwingDataSourceEvent.java | 83 + .../db/event/ObserveSwingDataSourceListener.java | 75 + .../ObserveSwingDataSourceListenerAdapter.java} | 41 +- .../src/main/java/fr/ird/observe/package.html | 2 +- .../main/java/fr/ird/observe/ui/ObserveMainUI.css | 1 + .../main/java/fr/ird/observe/ui/ObserveMainUI.jaxx | 4 +- .../fr/ird/observe/ui/ObserveMainUIHandler.java | 51 +- .../java/fr/ird/observe/ui/ObserveUICallback.java | 12 +- .../src/main/java/fr/ird/observe/ui/UIHelper.java | 18 +- .../actions/ChangeApplicationLanguageAction.java | 12 +- .../observe/ui/actions/ChangeDbLanguageAction.java | 12 +- .../observe/ui/actions/ChangeStorageAction.java | 6 +- .../observe/ui/actions/CloseApplicationAction.java | 6 +- .../fr/ird/observe/ui/actions/CloseHelpAction.java | 10 +- .../ird/observe/ui/actions/CloseStorageAction.java | 21 +- .../fr/ird/observe/ui/actions/GotoSiteAction.java | 8 +- .../ui/actions/ImportStorageFromFileAction.java | 9 +- .../ird/observe/ui/actions/LaunchAdminAction.java | 4 +- .../ui/actions/ReloadApplicationAction.java | 8 +- .../actions/ReloadDefaultConfigurationAction.java | 12 +- .../observe/ui/actions/ReloadResourcesAction.java | 8 +- .../observe/ui/actions/ReloadStorageAction.java | 92 +- .../ui/actions/SaveStorageToFileAction.java | 32 +- .../ird/observe/ui/actions/ShowConfigAction.java | 128 +- .../observe/ui/actions/ShowStorageInfoAction.java | 4 +- .../observe/ui/actions/StartServerModeAction.java | 7 +- .../ui/actions/shared/CloseAndCreateUIAction.java | 6 +- .../ui/actions/shared/CloseOpenUIAction.java | 6 +- .../observe/ui/actions/shared/ReOpenUIAction.java | 5 +- .../java/fr/ird/observe/ui/admin/AdminStep.java | 2 +- .../java/fr/ird/observe/ui/admin/AdminTabUI.jaxx | 6 +- .../fr/ird/observe/ui/admin/AdminTabUIHandler.java | 33 +- .../fr/ird/observe/ui/admin/AdminUILauncher.java | 28 +- .../java/fr/ird/observe/ui/admin/AdminUIModel.java | 107 +- .../observe/ui/admin/config/ConfigUIHandler.java | 2 - .../ui/admin/consolidate/ConsolidateModel.java | 8 +- .../ui/admin/consolidate/ConsolidateUIHandler.java | 8 +- .../ird/observe/ui/admin/export/ExportModel.java | 14 +- .../observe/ui/admin/export/ExportUIHandler.java | 12 +- .../ui/admin/gps/GPSActivityTableModel.java | 4 +- .../observe/ui/admin/gps/ImportGPSConfigUI.jaxx | 6 +- .../observe/ui/admin/gps/ImportGPSUIHandler.java | 5 +- .../observe/ui/admin/report/ReportUIHandler.java | 21 +- .../observe/ui/admin/save/SaveLocalUIHandler.java | 28 +- .../ObsoleteEntityListCellRenderer.java | 4 +- .../ui/admin/synchronize/SynchronizeModel.java | 20 +- .../ui/admin/synchronize/SynchronizeUIHandler.java | 17 +- .../ui/admin/validate/ValidateConfigUI.jaxx | 6 +- .../validate/ValidateEntityListCellRenderer.java | 4 +- .../observe/ui/admin/validate/ValidateModel.java | 6 +- .../ui/admin/validate/ValidateUIHandler.java | 11 +- .../java/fr/ird/observe/ui/content/ContentUI.jaxx | 15 +- .../ird/observe/ui/content/ContentUIHandler.java | 143 +- .../observe/ui/content/ContentUIInitializer.java | 215 +- .../content/impl/longline/BranchlineUIHandler.java | 15 +- .../impl/longline/LonglineDetailCompositionUI.jaxx | 4 +- .../LonglineDetailCompositionUIHandler.java | 28 +- .../impl/longline/LonglineGlobalCompositionUI.jaxx | 14 +- .../LonglineGlobalCompositionUIHandler.java | 10 - .../impl/longline/SetLonglineUIHandler.java | 11 - .../ActivitySeineObservedSystemUIHandler.java | 11 - .../impl/seine/FloatingObjectUIHandler.java | 11 - .../ui/content/impl/seine/SetSeineUIHandler.java | 11 - .../ui/content/list/ContentListUIHandler.java | 23 +- .../ui/content/open/ContentOpenableUIHandler.java | 10 - .../open/impl/longline/TripLonglineUIHandler.java | 4 +- .../ui/content/open/impl/seine/RouteUIHandler.java | 1 + .../open/impl/seine/TripSeineUIHandler.java | 4 +- .../ui/content/ref/ContentReferenceUIHandler.java | 4 +- .../ui/content/ref/ReferenceHomeUIHandler.java | 11 - .../ui/content/ref/UniqueKeyTableModel.java | 4 +- .../ui/content/table/ContentTableUIHandler.java | 25 +- .../impl/longline/CatchLonglineUIHandler.java | 21 +- .../table/impl/longline/EncounterUIHandler.java | 6 +- .../longline/GearUseFeaturesLonglineUIHandler.java | 12 +- .../table/impl/longline/SensorUsedUIHandler.java | 9 +- .../content/table/impl/longline/TdrUIHandler.java | 16 +- .../impl/seine/GearUseFeaturesSeineUIHandler.java | 12 +- .../table/impl/seine/NonTargetCatchUIHandler.java | 18 +- .../impl/seine/ObjectObservedSpeciesUIHandler.java | 19 +- .../impl/seine/ObjectSchoolEstimateUIHandler.java | 6 +- .../table/impl/seine/SchoolEstimateUIHandler.java | 10 +- .../table/impl/seine/TargetCatchUIHandler.java | 2 +- .../impl/seine/TargetDiscardCatchUIHandler.java | 2 +- .../ird/observe/ui/storage/ObstunaAdminAction.java | 2 +- .../ird/observe/ui/storage/RemoteUILauncher.java | 3 +- .../ui/storage/StorageBackupUILauncher.java | 68 +- .../ird/observe/ui/storage/StorageUIHandler.java | 893 ++-- .../ird/observe/ui/storage/StorageUILauncher.java | 52 +- .../fr/ird/observe/ui/storage/StorageUIModel.java | 1213 +++--- .../ird/observe/ui/storage/tabs/ChooseDbModeUI.css | 13 + .../observe/ui/storage/tabs/ChooseDbModeUI.jaxx | 14 +- .../ird/observe/ui/storage/tabs/ConfigDataUI.jaxx | 2 +- .../ui/storage/tabs/ConfigReferentielUI.jaxx | 2 +- .../fr/ird/observe/ui/storage/tabs/ConfigUI.css | 26 + .../fr/ird/observe/ui/storage/tabs/ConfigUI.jaxx | 46 +- .../ui/storage/tabs}/DataSelectionModel.java | 255 +- .../ird/observe/ui/storage/tabs/SelectDataUI.jaxx | 4 +- .../ui/storage/tabs/StorageTabUIHandler.java | 67 +- .../ui/tree/AbstractObserveTreeCellRenderer.java | 23 +- .../ui/tree/DataSelectionTreeSelectionModel.java | 95 +- .../ui/tree/NavigationTreeSelectionModel.java | 4 +- .../ird/observe/ui/tree/ObserveDataProvider.java | 10 +- .../tree/ObserveNavigationTreeShowPopupAction.java | 14 +- .../fr/ird/observe/ui/tree/ObserveTreeHelper.java | 27 +- .../ui/tree/loadors/AbstractNodeChildLoador.java | 6 +- .../loadors/ActivityLonglinesNodeChildLoador.java | 4 +- .../tree/loadors/ActivitySeineNodeChildLoador.java | 4 +- .../loadors/ActivitySeinesNodeChildLoador.java | 4 +- .../loadors/ProgramLonglineNodeChildLoador.java | 4 +- .../tree/loadors/ProgramSeineNodeChildLoador.java | 4 +- .../ui/tree/loadors/RootNodeChildLoador.java | 4 +- .../ui/tree/loadors/RoutesNodeChildLoador.java | 4 +- .../java/fr/ird/observe/ui/usage/UsagesUI.jaxx | 6 +- .../fr/ird/observe/ui/usage/UsagesUIHandler.java | 4 +- ...ObserveSimpleValidatorMessageTableRenderer.java | 4 +- .../util/ObserveValidatorMessageTableRenderer.java | 4 +- .../observe/ui/util/tripMap/TripMapUIHandler.java | 12 +- .../org.nuiton.config.ApplicationConfigProvider | 2 +- .../observe-application-swing_en_GB.properties | 1823 ++++---- .../observe-application-swing_es_ES.properties | 2125 +++++----- .../observe-application-swing_fr_FR.properties | 4405 ++++++++++---------- .../src/main/resources/icons/action-db-server.png | Bin 0 -> 923 bytes .../src/main/resources/observeSwing.conf | 5 + ...glineDetailCompositionValidatorServiceTest.java | 127 +- .../DataSourceDumpProducerServiceController.java | 29 + .../controller/v1/DataSourceServiceController.java | 3 +- .../web/controller/v1/PingServiceController.java | 8 +- .../ObserveWebSecurityApplicationContext.java | 2 +- observe-entities/pom.xml | 62 +- .../src/main/xmi/observe-common.properties | 2 +- .../src/main/xmi/observe-longline.properties | 2 +- .../src/main/xmi/observe-seine.properties | 2 +- .../ird/observe/services/service/PingService.java | 2 + observe-services-configuration-api/pom.xml | 6 + .../configuration/ObserveDataSourceConnection.java | 5 + .../ObserveDataSourceConnectionSupport.java | 13 +- observe-services-configuration-rest/pom.xml | 6 + .../ObserveDataSourceConnectionRest.java | 7 +- observe-services-configuration-topia/pom.xml | 4 +- .../ObserveDataSourceConnectionTopia.java | 7 +- .../services/dto/gson/ObserveDtoGsonSupplier.java | 2 + .../observe/services/dto/gson/VersionAdapter.java | 36 + .../services/dto/referential/ProgramDtos.java | 44 + .../services/dto/referential/ReferentialDtos.java | 116 +- .../ird/observe/services/TestMethodResource.java | 2 +- .../fr/ird/observe/services/ObserveJdbcHelper.java | 35 + .../services/ObserveServiceContextTopia.java | 3 + .../EntityToReferentialReferenceDtoBuilder.java | 13 + .../services/dto/ObserveDtosInitializer.java | 284 +- .../services/service/DataSourceServiceTopia.java | 12 +- .../ObserveDataSourceConnectionTopiaTaiste.java | 3 +- ...EntityToReferentialReferenceDtoBuilderTest.java | 57 + pom.xml | 3 + 180 files changed, 10010 insertions(+), 8264 deletions(-) diff --cc observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/RouteUIHandler.java index ada124a,1847895..a0a11aa --- 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 @@@ -21,8 -21,10 +21,9 @@@ */ package fr.ird.observe.ui.content.open.impl.seine; +import fr.ird.observe.ObserveContext; + import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; -import fr.ird.observe.business.db.DataSource; -import fr.ird.observe.business.db.DataSourceException; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.services.dto.referential.seine.VesselActivitySeineDto; import fr.ird.observe.services.dto.result.TripChildSaveResultDto; -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7531 in repository observe. See http://git.codelutin.com/observe.git commit f0f27e64c97571bc91576c4958f5e406ad3b7263 Author: Kevin Morin <morin@codelutin.com> Date: Fri Sep 25 11:32:25 2015 +0200 appel des services pour le load et precreate (refs #7531) --- .../impl/longline/SetLonglineUIHandler.java | 41 +++++++------- .../impl/seine/FloatingObjectUIHandler.java | 34 ++++++------ .../ui/content/impl/seine/SetSeineUIHandler.java | 62 ++++++++++++---------- .../impl/longline/ActivityLonglineUIHandler.java | 37 ++++++------- .../open/impl/longline/TripLonglineUIHandler.java | 30 +++++------ .../open/impl/seine/ActivitySeineUIHandler.java | 40 +++++++------- .../ui/content/open/impl/seine/RouteUIHandler.java | 37 +++++++------ .../open/impl/seine/TripSeineUIHandler.java | 58 ++++++++++---------- .../ui/content/ref/ContentReferenceUIHandler.java | 18 ++----- 9 files changed, 176 insertions(+), 181 deletions(-) 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 62b2f46..f7bb1ec 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 @@ -22,11 +22,14 @@ package fr.ird.observe.ui.content.impl.longline; * #L% */ +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; import fr.ird.observe.services.dto.longline.SetLonglineDto; +import fr.ird.observe.services.dto.longline.SetLonglineDtos; import fr.ird.observe.services.service.longline.SetLonglineService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; @@ -207,28 +210,25 @@ public class SetLonglineUIHandler extends ContentUIHandler<SetLonglineDto> { } ContentMode mode = computeContentMode(); - //FIXME -// DataService dataService = getDataService(); - SetLonglineDto bean = getBean(); + FormDto<SetLonglineDto> formDto; + if (setId == null) { + + // create mode + formDto = getSetLonglineService().preCreate(activityId); + + } else { + + // update mode + formDto = getSetLonglineService().loadToEdit(setId); + + } + + getModel().setFormDto(formDto); + SetLonglineDtos.copySetLonglineDto(formDto.getForm(), bean); + //FIXME -// TopiaEntityBinder<SetLongline> binder = getLoadBinder(); -// DataSource source = getDataSource(); -// if (setId == null) { -// -// // creation mode -// dataService.preCreate(source, activityId, bean, binder, getPreCreateExecutor()); -// -// getUi().getFishingOperationTabPane().setSelectedIndex(0); -// -// } else { -// -// // update mode -// dataService.loadEditEntity(source, setId, getLoadExecutor()); -// -// } -// // passage en coordonnes absolues + utilisation du quadrant // bean.initCoordinates(); @@ -576,8 +576,7 @@ public class SetLonglineUIHandler extends ContentUIHandler<SetLonglineDto> { } - //FIXME protected SetLonglineService getSetLonglineService() { - return null; + return ObserveSwingApplicationContext.get().newService(SetLonglineService.class); } } 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 7fef2ec..bfdd365 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 @@ -21,11 +21,14 @@ */ package fr.ird.observe.ui.content.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.seine.ActivitySeineDto; import fr.ird.observe.services.dto.seine.FloatingObjectDto; +import fr.ird.observe.services.dto.seine.FloatingObjectDtos; import fr.ird.observe.services.service.seine.FloatingObjectService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; @@ -106,19 +109,21 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto> FloatingObjectDto bean = getBean(); - //FIXME -// DataService dataService = getDataService(); -// if (dcpId == null) { -// -// // creation mode -// -// dataService.preCreate(getDataSource(), activityId, bean, getLoadBinder(), getPreCreateExecutor()); -// } else { -// -// // update mode -// -// dataService.loadEditEntity(getDataSource(), dcpId, getLoadExecutor()); -// } + FormDto<FloatingObjectDto> formDto; + if (dcpId == null) { + + // create mode + formDto = getFloatingObjectService().preCreate(activityId); + + } else { + + // update mode + formDto = getFloatingObjectService().loadToEdit(dcpId); + + } + + getModel().setFormDto(formDto); + FloatingObjectDtos.copyFloatingObjectDto(formDto.getForm(), bean); // utilisation du mode requis setContentMode(mode); @@ -234,8 +239,7 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto> // parentBean.removeFloatingObject(beanToDelete); // } - //FIXME protected FloatingObjectService getFloatingObjectService() { - return null; + return ObserveSwingApplicationContext.get().newService(FloatingObjectService.class); } } 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 8dd1f8d..465474e 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 @@ -21,12 +21,17 @@ */ package fr.ird.observe.ui.content.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.constants.seine.SchoolType; import fr.ird.observe.services.dto.seine.ActivitySeineDto; +import fr.ird.observe.services.dto.seine.RouteDto; import fr.ird.observe.services.dto.seine.SetSeineDto; +import fr.ird.observe.services.dto.seine.SetSeineDtos; +import fr.ird.observe.services.service.seine.RouteService; import fr.ird.observe.services.service.seine.SetSeineService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; @@ -39,12 +44,14 @@ import jaxx.runtime.validator.swing.SwingValidatorMessageTableModel; import jaxx.runtime.validator.swing.SwingValidatorUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.util.DateUtil; import org.nuiton.validator.NuitonValidatorScope; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.Date; import java.util.HashSet; import java.util.Set; @@ -151,6 +158,7 @@ public class SetSeineUIHandler extends ContentUIHandler<SetSeineDto> { String activityId = getSelectedParentId(); String setId = getSelectedId(); + String selectedRouteId = getDataContext().getSelectedRouteId(); if (log.isInfoEnabled()) { log.info("activityId = " + activityId); @@ -158,35 +166,34 @@ public class SetSeineUIHandler extends ContentUIHandler<SetSeineDto> { } ContentMode mode = computeContentMode(); - //FIXME -// DataService dataService = getDataService(); - SetSeineDto bean = getBean(); - //FIXME -// TopiaEntityBinder<SetSeine> binder = getLoadBinder(); -// DataSource source = getDataSource(); -// if (setId == null) { -// -// // creation mode -// dataService.preCreate(source, activityId, bean, binder, getPreCreateExecutor()); -// -// } else { -// -// // update mode -// dataService.loadEditEntity(source, setId, getLoadExecutor()); -// } + FormDto<SetSeineDto> formDto; + if (setId == null) { - //FIXME -// RouteDto route = (RouteDto) getDataService().loadEntity(source, getDataContext().getSelectedRouteId(), false); -// -// Date time = bean.getStartTime(); -// -// Date date = route.getDate(); -// -// Date dateAndTime = DateUtil.getDateAndTime(date, time, false, false); -// -// getUi().getStartTime().setDate(dateAndTime); + // create mode + formDto = getSetSeineService().preCreate(selectedRouteId, activityId); + + } else { + + // update mode + formDto = getSetSeineService().loadToEdit(setId); + + } + + getModel().setFormDto(formDto); + SetSeineDtos.copySetSeineDto(formDto.getForm(), bean); + + RouteService routeService = ObserveSwingApplicationContext.get().newService(RouteService.class); + FormDto<RouteDto> route = routeService.loadToRead(selectedRouteId); + + Date time = bean.getStartTime(); + + Date date = route.getForm().getDate(); + + Date dateAndTime = DateUtil.getDateAndTime(date, time, false, false); + + getUi().getStartTime().setDate(dateAndTime); // utilisation du mode requis setContentMode(mode); @@ -418,8 +425,7 @@ public class SetSeineUIHandler extends ContentUIHandler<SetSeineDto> { } - //FIXME protected SetSeineService getSetSeineService() { - return null; + return ObserveSwingApplicationContext.get().newService(SetSeineService.class); } } 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 7b21fd9..0bd0866 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 @@ -22,10 +22,12 @@ package fr.ird.observe.ui.content.open.impl.longline; * #L% */ +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; -import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; +import fr.ird.observe.services.dto.longline.ActivityLonglineDtos; import fr.ird.observe.services.dto.longline.TripLonglineDto; import fr.ird.observe.services.dto.result.TripChildSaveResultDto; import fr.ird.observe.services.service.longline.ActivityLonglineService; @@ -150,29 +152,23 @@ public class ActivityLonglineUIHandler extends ContentOpenableUIHandler<Activity } ActivityLonglineDto bean = getBean(); - //FIXME -// DataService dataService = getDataService(); - boolean create = activityId == null; - //FIXME -// Loador<ActivityLongline> binder = getLoadBinder(); + FormDto<ActivityLonglineDto> formDto; + if (create) { - DataSource source = getDataSource(); + // create mode + formDto = getActivityLonglineService().preCreate(tripId); + } else { - //FIXME -// if (create) { -// -// // create mode -// dataService.preCreate(source, tripId, bean, binder, getPreCreateExecutor()); -// -// } else { -// -// // update mode -// dataService.loadEditEntity(source, activityId, getLoadExecutor()); -// -// } + // update mode + formDto = getActivityLonglineService().loadToEdit(activityId); + + } + + getModel().setFormDto(formDto); + ActivityLonglineDtos.copyActivityLonglineDto(formDto.getForm(), bean); if (log.isDebugEnabled()) { log.debug(" long - lat = " + bean.getLongitude() + @@ -410,8 +406,7 @@ public class ActivityLonglineUIHandler extends ContentOpenableUIHandler<Activity } - //FIXME protected ActivityLonglineService getActivityLonglineService() { - return null; + return ObserveSwingApplicationContext.get().newService(ActivityLonglineService.class); } } 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 3ed11d6..507c493 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 @@ -22,11 +22,13 @@ package fr.ird.observe.ui.content.open.impl.longline; * #L% */ -import fr.ird.observe.configuration.ObserveSwingApplicationConfig; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; -import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.configuration.ObserveSwingApplicationConfig; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.dto.longline.TripLonglineDtos; import fr.ird.observe.services.service.longline.TripLonglineService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; @@ -147,22 +149,18 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline log.info(prefix + "mode = " + mode); } - //FIXME -// DataService dataService = getDataService(); - TripLonglineDto bean = getBean(); - DataSource source = getDataSource(); boolean create = tripId == null; - if (create) { - // create mode + FormDto<TripLonglineDto> formDto; + if (create) { if (log.isInfoEnabled()) { log.info(prefix + "create a new trip"); } - //FIXME -// dataService.preCreate(source, programId, bean, getLoadBinder(), getPreCreateExecutor()); + // create mode + formDto = getTripLonglineService().preCreate(programId); } else { @@ -170,10 +168,10 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline if (log.isInfoEnabled()) { log.info(prefix + "using existing trip " + tripId); } - //FIXME -// dataService.loadEditEntity(source, tripId, getLoadExecutor()); - //FIXME + // update mode + formDto = getTripLonglineService().loadToEdit(tripId); +//FIXME // if (!bean.isActivityLonglineEmpty()) { // on force le trie des routes @@ -181,6 +179,9 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline // } } + getModel().setFormDto(formDto); + TripLonglineDtos.copyTripLonglineDto(formDto.getForm(), bean); + getUi().getTripLonglineTabPane().setSelectedIndex(0); getUi().getTripMap().getHandler().doCloseMap(); buildTripMap = true; @@ -335,8 +336,7 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline } - //FIXME protected TripLonglineService getTripLonglineService() { - return null; + return ObserveSwingApplicationContext.get().newService(TripLonglineService.class); } } 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 23e0109..c6b5f3b 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 @@ -21,10 +21,12 @@ */ package fr.ird.observe.ui.content.open.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; -import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.seine.ActivitySeineDto; +import fr.ird.observe.services.dto.seine.ActivitySeineDtos; import fr.ird.observe.services.dto.seine.RouteDto; import fr.ird.observe.services.dto.seine.TripSeineDto; import fr.ird.observe.services.service.seine.ActivitySeineService; @@ -173,28 +175,24 @@ public class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySei } ActivitySeineDto bean = getBean(); - //FIXME -// DataService dataService = getDataService(); - boolean create = activityId == null; - //FIXME -// Loador<ActivitySeine> binder = getLoadBinder(); + FormDto<ActivitySeineDto> formDto; + if (create) { - DataSource source = getDataSource(); + // create mode + formDto = getActivitySeineService().preCreate(routeId); + + } else { + + // update mode + formDto = getActivitySeineService().loadToEdit(activityId); + + } + + getModel().setFormDto(formDto); + ActivitySeineDtos.copyActivitySeineDto(formDto.getForm(), bean); - //FIXME -// if (create) { -// -// // create mode -// dataService.preCreate(source, routeId, bean, binder, getPreCreateExecutor()); -// -// } else { -// -// // update mode -// dataService.loadEditEntity(source, activityId, getLoadExecutor()); -// -// } if (log.isDebugEnabled()) { log.debug(prefix + "long - lat = " + bean.getLongitude() + " - " + bean.getLatitude()); @@ -444,10 +442,8 @@ public class ActivitySeineUIHandler extends ContentOpenableUIHandler<ActivitySei } - - //FIXME protected ActivitySeineService getActivitySeineService() { - return null; + return ObserveSwingApplicationContext.get().newService(ActivitySeineService.class); } } 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 a0a11aa..9fec73c 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 @@ -21,14 +21,15 @@ */ package fr.ird.observe.ui.content.open.impl.seine; -import fr.ird.observe.ObserveContext; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.referential.seine.VesselActivitySeineDto; import fr.ird.observe.services.dto.result.TripChildSaveResultDto; import fr.ird.observe.services.dto.seine.ActivitySeineDto; import fr.ird.observe.services.dto.seine.RouteDto; +import fr.ird.observe.services.dto.seine.RouteDtos; import fr.ird.observe.services.dto.seine.TripSeineDto; import fr.ird.observe.services.service.seine.RouteService; import fr.ird.observe.ui.UIHelper; @@ -133,23 +134,27 @@ public class RouteUIHandler extends ContentOpenableUIHandler<RouteDto> { boolean create = routeId == null; - //FIXME -// if (create) { -// -// // create mode -// dataService.preCreate(getDataSource(), tripId, editBean, getLoadBinder(), getPreCreateExecutor()); -// -// } else { -// -// // update mode -// dataService.loadEditEntity(getDataSource(), routeId, getLoadExecutor()); -// + FormDto<RouteDto> formDto; + if (create) { + + // create mode + formDto = getRouteService().preCreate(tripId); + + } else { + + // update mode + formDto = getRouteService().loadToEdit(routeId); + + //FIXME // if (!editBean.isActivitySeineEmpty()) { // // // on force le trie des activitys // ActivitySeines.sort(editBean.getActivitySeine()); // } -// } + } + + getModel().setFormDto(formDto); + RouteDtos.copyRouteDto(formDto.getForm(), editBean); finalizeOpenUI(mode, create); } @@ -442,8 +447,7 @@ public class RouteUIHandler extends ContentOpenableUIHandler<RouteDto> { treeHelper.addUnsavedNode(parentNode, ActivitySeineDto.class); // on recupère l'écran d'édition - ActivitySeineUI selectedUI = (ActivitySeineUI) - ObserveContext.get().getSelectedContentUI(); + ActivitySeineUI selectedUI = (ActivitySeineUI) ObserveSwingApplicationContext.get().getSelectedContentUI(); // on recupère l'activity de fin de veille VesselActivitySeineDto vesselActivitySeine = null; @@ -522,8 +526,7 @@ public class RouteUIHandler extends ContentOpenableUIHandler<RouteDto> { } - //FIXME protected RouteService getRouteService() { - return null; + return ObserveSwingApplicationContext.get().newService(RouteService.class); } } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index c8ec607..7de1ee5 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -21,11 +21,13 @@ */ package fr.ird.observe.ui.content.open.impl.seine; -import fr.ird.observe.configuration.ObserveSwingApplicationConfig; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; -import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.configuration.ObserveSwingApplicationConfig; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.seine.TripSeineDto; +import fr.ird.observe.services.dto.seine.TripSeineDtos; import fr.ird.observe.services.service.seine.TripSeineService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; @@ -35,8 +37,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.DateUtil; -import javax.swing.JTabbedPane; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.util.Date; @@ -148,37 +149,37 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { log.info(prefix + "mode = " + mode); } - //FIXME -// DataService dataService = getDataService(); - TripSeineDto bean = getBean(); - DataSource source = getDataSource(); boolean create = tripId == null; - //FIXME -// if (create) { -// -// // create mode -// -// if (log.isInfoEnabled()) { -// log.info(prefix + "create a new trip"); -// } -// dataService.preCreate(source, programId, bean, getLoadBinder(), getPreCreateExecutor()); -// } else { -// -// // update mode -// if (log.isInfoEnabled()) { -// log.info(prefix + "using existing trip " + tripId); -// } -// dataService.loadEditEntity(source, tripId, getLoadExecutor()); -// + + FormDto<TripSeineDto> formDto; + if (create) { + + // create mode + if (log.isInfoEnabled()) { + log.info(prefix + "create a new trip"); + } + formDto = getTripSeineService().preCreate(programId); + + } else { + + // update mode + if (log.isInfoEnabled()) { + log.info(prefix + "using existing trip " + tripId); + } + formDto = getTripSeineService().loadToEdit(tripId); + + //FIXME // if (!bean.isRouteEmpty()) { // // // on force le trie des routes // Routes.sort(bean.getRoute()); // } -// -// } + } + + getModel().setFormDto(formDto); + TripSeineDtos.copyTripSeineDto(formDto.getForm(), bean); getUi().getTripSeineTabPane().setSelectedIndex(0); getUi().getTripMap().getHandler().doCloseMap(); @@ -334,9 +335,8 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto> { } - //FIXME protected TripSeineService getTripSeineService() { - return null; + return ObserveSwingApplicationContext.get().newService(TripSeineService.class); } } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java index dfebca8..505e400 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java @@ -34,6 +34,7 @@ import fr.ird.observe.services.dto.constants.ReferentialLocale; import fr.ird.observe.services.dto.referential.I18nReferentialDto; import fr.ird.observe.services.dto.referential.ProgramDto; import fr.ird.observe.services.dto.referential.ReferentialDto; +import fr.ird.observe.services.dto.referential.ReferentialDtos; import fr.ird.observe.services.dto.referential.VesselSizeCategoryDto; import fr.ird.observe.services.service.ReferentialService; import fr.ird.observe.ui.DecoratorService; @@ -494,17 +495,9 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content addInfoMessage(t("observe.message.creating.referentiel")); // creation mode - //FIXME -// try { -// getDataService().preCreate(getDataSource(), -// null, -// bean, -// getLoadBinder(), -// getPreCreateExecutor() -// ); -// } catch (DataSourceException e) { -// ErrorDialogUI.showError(e); -// } + FormDto<E> formDto = getReferentialService().preCreate(getBeanType()); + getModel().setFormDto(formDto); + ReferentialDtos.copyReferentialDto(formDto.getForm(), bean); } else { addInfoMessage(t("observe.message.updating.referentiel")); @@ -866,9 +859,8 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content return formDto; } - //FIXME protected ReferentialService getReferentialService() { - return null; + return ObserveSwingApplicationContext.get().newService(ReferentialService.class); } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7531 in repository observe. See http://git.codelutin.com/observe.git commit 71a5e4e4fa2cdbcf01bbe3a09a18ad240b1ee573 Author: Kevin Morin <morin@codelutin.com> Date: Fri Sep 25 17:03:15 2015 +0200 appel de services dans dopersist (refs #7531) --- .../fr/ird/observe/ui/admin/AdminTabUIHandler.java | 12 ------ .../ActivitySeineObservedSystemUIHandler.java | 32 +++++++++------ ...ngObjectTransmittingBuoyOperationUIHandler.java | 12 ------ .../ui/content/ref/ContentReferenceUIHandler.java | 46 ++++++++++------------ .../ui/content/table/ContentTableUIHandler.java | 13 +++--- .../impl/longline/BaitsCompositionUIHandler.java | 20 ++++++++++ .../longline/BranchlinesCompositionUIHandler.java | 26 +++++++++--- .../impl/longline/CatchLonglineUIHandler.java | 30 ++++++++++---- .../table/impl/longline/EncounterUIHandler.java | 24 ++++++++++- .../longline/FloatlinesCompositionUIHandler.java | 26 +++++++++--- .../longline/GearUseFeaturesLonglineUIHandler.java | 29 ++++++++++---- .../impl/longline/HooksCompositionUIHandler.java | 26 +++++++++--- .../table/impl/longline/SensorUsedUIHandler.java | 21 +++++++++- .../content/table/impl/longline/TdrUIHandler.java | 21 +++++++++- .../impl/seine/GearUseFeaturesSeineUIHandler.java | 29 ++++++++++---- .../table/impl/seine/NonTargetCatchUIHandler.java | 20 ++++++++++ .../table/impl/seine/NonTargetSampleUIHandler.java | 20 ++++++++++ .../impl/seine/ObjectObservedSpeciesUIHandler.java | 21 +++++++++- .../impl/seine/ObjectSchoolEstimateUIHandler.java | 20 ++++++++++ .../table/impl/seine/SchoolEstimateUIHandler.java | 20 ++++++++++ .../table/impl/seine/TargetCatchUIHandler.java | 20 ++++++++++ .../impl/seine/TargetDiscardCatchUIHandler.java | 24 ++++++++--- .../table/impl/seine/TargetSampleUIHandler.java | 22 +++++++++++ .../fr/ird/observe/ui/tree/DtoNodeSupport.java | 11 ------ ...tivitySeineObservedSystemServiceController.java | 4 +- .../v1/seine/NonTargetSampleServiceController.java | 4 +- .../v1/seine/TargetSampleServiceController.java | 4 +- .../seine/ActivitySeineObservedSystemService.java | 2 +- .../service/seine/NonTargetSampleService.java | 2 +- .../service/seine/TargetSampleService.java | 2 +- .../service/seine/TripSeineServiceRestTest.java | 2 +- .../ActivitySeineObservedSystemServiceTopia.java | 4 +- .../service/seine/NonTargetSampleServiceTopia.java | 4 +- .../service/seine/TargetSampleServiceTopia.java | 4 +- .../fr/ird/observe/services/service/RigthTest.java | 2 +- .../service/seine/TripSeineServiceTopiaTest.java | 6 +-- 36 files changed, 434 insertions(+), 151 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminTabUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminTabUIHandler.java index eec3d9f..ebc7b42 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminTabUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/admin/AdminTabUIHandler.java @@ -106,10 +106,6 @@ public class AdminTabUIHandler implements SendMessageAble { /** Service de decoration. */ private DecoratorService decoratorService; - /** Service de manipulation de données depuis des bases. */ - //FIXME -// private DataService dataService; - /** Service de binders. */ private BinderService binderService; @@ -149,14 +145,6 @@ public class AdminTabUIHandler implements SendMessageAble { return decoratorService; } - //FIXME -// public final DataService getDataService() { -// if (dataService == null) { -// dataService = ObserveContext.get().getDataService(); -// } -// return dataService; -// } - public final BinderService getBinderService() { if (binderService == null) { binderService = ObserveSwingApplicationContext.get().getBinderService(); 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 fa39ae2..a45c705 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 @@ -21,10 +21,14 @@ */ package fr.ird.observe.ui.content.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.seine.ActivitySeineObservedSystemDto; +import fr.ird.observe.services.dto.seine.ActivitySeineObservedSystemDtos; +import fr.ird.observe.services.service.seine.ActivitySeineObservedSystemService; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.ContentUIHandler; import org.apache.commons.logging.Log; @@ -82,8 +86,9 @@ public class ActivitySeineObservedSystemUIHandler extends ContentUIHandler<Activ ContentMode mode = computeContentMode(); - //FIXME -// getDataService().loadEditEntity(getDataSource(), activityId, getLoadExecutor()); + FormDto<ActivitySeineObservedSystemDto> formDto = getActivitySeineObservedSystemService().loadToEdit(activityId); + getModel().setFormDto(formDto); + ActivitySeineObservedSystemDtos.copyActivitySeineObservedSystemDto(formDto.getForm(), getBean()); getModel().setMode(mode); @@ -98,17 +103,15 @@ public class ActivitySeineObservedSystemUIHandler extends ContentUIHandler<Activ super.startEditUI(binding); } - //FIXME -// @Override -// protected boolean doSave(ActivitySeine bean, -// DataService dataService, -// DataSource dataSource, -// TopiaEntityBinder<ActivitySeine> binder) throws Exception { -// -// // on sauvegarde l'activity (mais pas la set) -// dataService.update(dataSource, null, bean, getUpdateExecutor()); -// return true; -// } + @Override + protected boolean doSave(ActivitySeineObservedSystemDto bean) throws Exception { + + // on sauvegarde l'activity (mais pas la set) + String beanId = getActivitySeineObservedSystemService().save(bean); + bean.setId(beanId); + + return true; + } //FIXME // @Override @@ -136,4 +139,7 @@ public class ActivitySeineObservedSystemUIHandler extends ContentUIHandler<Activ // return beanToSave; // } + protected ActivitySeineObservedSystemService getActivitySeineObservedSystemService() { + return ObserveSwingApplicationContext.get().newService(ActivitySeineObservedSystemService.class); + } } 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 d461585..877afa2 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 @@ -24,13 +24,11 @@ package fr.ird.observe.ui.content.impl.seine; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; -import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.constants.seine.Ownership; import fr.ird.observe.services.dto.constants.seine.TypeTransmittingBuoyOperation; import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.services.dto.referential.seine.TransmittingBuoyOperationDto; import fr.ird.observe.services.dto.seine.ActivitySeineDto; -import fr.ird.observe.services.dto.seine.FloatingObjectDto; import fr.ird.observe.services.dto.seine.FloatingObjectTransmittingBuoyDto; import fr.ird.observe.services.dto.seine.TransmittingBuoyDto; import fr.ird.observe.services.service.seine.TransmittingBuoyOperationService; @@ -305,16 +303,6 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH resetEditUI(); } - @Override - protected FormDto<FloatingObjectTransmittingBuoyDto> loadToEdit(String id) { - return null; - } - - @Override - protected FormDto<FloatingObjectTransmittingBuoyDto> loadToReadDto(String id) { - return null; - } - protected void changeTypeOperation(TypeTransmittingBuoyOperation typeOperation, boolean reset) { FloatingObjectTransmittingBuoyOperationUI ui = getUi(); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java index 505e400..ae21928 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ref/ContentReferenceUIHandler.java @@ -107,7 +107,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content E entity, Map<Class<? extends IdDto>, List<? extends IdDto>> usages) { - DecoratorService service = ObserveContext.get().getDecoratorService(); + DecoratorService service = ObserveSwingApplicationContext.get().getDecoratorService(); Decorator<?> decorator = service.getDecoratorByType(entity.getClass()); String type = DecoratorService.getEntityLabel(entity.getClass()); type = t(type); @@ -135,7 +135,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content E entity, Map<Class<? extends IdDto>, List<? extends IdDto>> usages) { - DecoratorService service = ObserveContext.get().getDecoratorService(); + DecoratorService service = ObserveSwingApplicationContext.get().getDecoratorService(); Decorator<?> decorator = service.getDecoratorByType(entity.getClass()); String type = DecoratorService.getEntityLabel(entity.getClass()); type = t(type); @@ -178,7 +178,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content //FIXME // getLoadBinder().load(selectedBean, getBean(), true); - loadBean(selectedBean); + ReferentialDtos.copyReferentialDto(selectedBean, getBean()); //TODO update data cache @@ -330,7 +330,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content // } // return; // } - DecoratorService dService = ObserveContext.get().getDecoratorService(); + DecoratorService dService = getDecoratorService(); Decorator<?> decorator = dService.getDecoratorByType(bean.getClass()); String type = DecoratorService.getEntityLabel(bean.getClass()); type = t(type); @@ -554,9 +554,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content log.debug("Will create new entity [" + getModel().getBeanType() + "]"); } - //FIXME -// getLoadBinder().load(null, getBean(), true); - loadBean((E) null); + ReferentialDtos.copyReferentialDto(null, getBean()); // on demarre l'edition ui.startEdit(null); @@ -571,9 +569,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content model.setMode(ContentMode.UPDATE); } - //FIXME -// getLoadBinder().load(model.getSelectedBean(), getBean(), true); - loadBean(model.getSelectedBean()); + ReferentialDtos.copyReferentialDto(model.getSelectedBean(), getBean()); getUi().startEdit(null); } @@ -614,9 +610,7 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content // then resynch the selected bean to edit bean (used for // example to delete)... // repush selected bean to bean - //FIXME -// getLoadBinder().load(model.getSelectedBean(), getBean(), true); - loadBean(model.getSelectedBean()); + ReferentialDtos.copyReferentialDto(model.getSelectedBean(), getBean()); } } @@ -845,19 +839,19 @@ public class ContentReferenceUIHandler<E extends ReferentialDto> extends Content ContentReferenceUI.LIST_VIEW; } - @Override - protected FormDto<E> loadToEdit(String id) { - ReferentialService referentialService = getReferentialService(); - FormDto<E> formDto = referentialService.loadToEdit(getBeanType(), id); - return formDto; - } - - @Override - protected FormDto<E> loadToReadDto(String id) { - ReferentialService referentialService = getReferentialService(); - FormDto<E> formDto = referentialService.loadToRead(getBeanType(), id); - return formDto; - } +// @Override +// protected FormDto<E> loadToEdit(String id) { +// ReferentialService referentialService = getReferentialService(); +// FormDto<E> formDto = referentialService.loadToEdit(getBeanType(), id); +// return formDto; +// } +// +// @Override +// protected FormDto<E> loadToReadDto(String id) { +// ReferentialService referentialService = getReferentialService(); +// FormDto<E> formDto = referentialService.loadToRead(getBeanType(), id); +// return formDto; +// } protected ReferentialService getReferentialService() { return ObserveSwingApplicationContext.get().newService(ReferentialService.class); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java index b76cd00..b0016d7 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java @@ -40,12 +40,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.validator.NuitonValidatorScope; -import javax.swing.JComponent; -import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.table.DefaultTableCellRenderer; -import java.awt.Rectangle; +import java.awt.*; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -200,8 +198,8 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto> ex // preparation du bean d'édition // dataService.loadEditEntity(dataSource, id, getLoadExecutor()); - //FIXME -// loadBean(id); + loadEditBean(id); + getModel().setMode(mode); @@ -211,6 +209,8 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto> ex return editBean; } + protected abstract void loadEditBean(String beanId); + //FIXME // @Override // protected final void onLoad(TopiaContext tx, E bean) throws TopiaException { @@ -289,7 +289,6 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto> ex ui.getTableModel().dettachModel(); // chargement du bean d'édition - //FIXME loadEditBean(mode); boolean canEdit = mode == ContentMode.UPDATE; diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/BaitsCompositionUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/BaitsCompositionUIHandler.java index 9cc96bb..6f535f5 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/BaitsCompositionUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/BaitsCompositionUIHandler.java @@ -22,11 +22,15 @@ package fr.ird.observe.ui.content.table.impl.longline; * #L% */ +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.BaitsCompositionDto; import fr.ird.observe.services.dto.longline.SetLonglineDto; +import fr.ird.observe.services.dto.longline.SetLonglineDtos; import fr.ird.observe.services.dto.referential.longline.BaitSettingStatusDto; import fr.ird.observe.services.dto.referential.longline.BaitTypeDto; +import fr.ird.observe.services.service.longline.SetLonglineService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableUIHandler; import org.apache.commons.logging.Log; @@ -112,6 +116,18 @@ public class BaitsCompositionUIHandler extends ContentTableUIHandler<SetLongline return getDataContext().getSelectedSetId(); } + @Override + protected void doPersist(SetLonglineDto bean) { + getSetLonglineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<SetLonglineDto> formDto = getSetLonglineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + SetLonglineDtos.copySetLonglineDto(formDto.getForm(), getBean()); + } + //FIXME // @Override // public SetLongline onUpdate(TopiaContext tx, Object parentBean, SetLongline beanToSave) throws TopiaException { @@ -122,4 +138,8 @@ public class BaitsCompositionUIHandler extends ContentTableUIHandler<SetLongline public void afterSave(boolean refresh) { super.afterSave(refresh); } + + protected SetLonglineService getSetLonglineService() { + return ObserveSwingApplicationContext.get().newService(SetLonglineService.class); + } } \ No newline at end of file diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/BranchlinesCompositionUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/BranchlinesCompositionUIHandler.java index fa95c87..d84e7d5 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/BranchlinesCompositionUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/BranchlinesCompositionUIHandler.java @@ -22,21 +22,21 @@ package fr.ird.observe.ui.content.table.impl.longline; * #L% */ -import fr.ird.observe.business.db.DataContext; -import fr.ird.observe.business.db.DataSource; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.BranchlinesCompositionDto; import fr.ird.observe.services.dto.longline.SetLonglineDto; +import fr.ird.observe.services.dto.longline.SetLonglineDtos; import fr.ird.observe.services.dto.referential.longline.HookSizeDto; import fr.ird.observe.services.dto.referential.longline.HookTypeDto; +import fr.ird.observe.services.service.longline.SetLonglineService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableUIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.swing.JTable; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import static org.nuiton.i18n.I18n.n; @@ -122,4 +122,20 @@ public class BranchlinesCompositionUIHandler extends ContentTableUIHandler<SetLo super.afterSave(refresh); } + @Override + protected void doPersist(SetLonglineDto bean) { + getSetLonglineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<SetLonglineDto> formDto = getSetLonglineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + SetLonglineDtos.copySetLonglineDto(formDto.getForm(), getBean()); + } + + protected SetLonglineService getSetLonglineService() { + return ObserveSwingApplicationContext.get().newService(SetLonglineService.class); + } + } \ No newline at end of file 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 d4a00bb..58ba0a6 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 @@ -25,12 +25,14 @@ package fr.ird.observe.ui.content.table.impl.longline; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.longline.BasketDto; import fr.ird.observe.services.dto.longline.BranchlineDto; import fr.ird.observe.services.dto.longline.CatchLonglineDto; import fr.ird.observe.services.dto.longline.SectionDto; import fr.ird.observe.services.dto.longline.SetLonglineDto; +import fr.ird.observe.services.dto.longline.SetLonglineDtos; import fr.ird.observe.services.dto.longline.SizeMeasureDto; import fr.ird.observe.services.dto.longline.WeightMeasureDto; import fr.ird.observe.services.dto.referential.SpeciesDto; @@ -38,6 +40,7 @@ import fr.ird.observe.services.dto.referential.longline.CatchFateLonglineDto; import fr.ird.observe.services.dto.referential.longline.HealthnessDto; import fr.ird.observe.services.dto.referential.longline.SizeMeasureTypeDto; import fr.ird.observe.services.dto.referential.longline.WeightMeasureTypeDto; +import fr.ird.observe.services.service.longline.SetLonglineService; import fr.ird.observe.ui.DecoratorService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentUIInitializer; @@ -52,8 +55,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; import org.nuiton.validator.NuitonValidatorScope; -import javax.swing.JComponent; -import javax.swing.JTable; +import javax.swing.*; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableCellRenderer; @@ -191,6 +193,7 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineDto // updating mode: loading from db //FIXME + // try { // sizes = getDataService().getCatchLonglineSizeMeasures(getDataSource(), bean, sizeMeasuresTableModel.getLoader()); @@ -500,12 +503,9 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineDto } - //FIXME // @Override -// protected SetLongline loadEditBean(ContentMode mode, -// DataContext dataContext, -// DataService dataService, -// DataSource dataSource) throws DataSourceException { +// protected SetLonglineDto loadEditBean(ContentMode mode, +// DataContext dataContext) { // // SetLongline setLongline = super.loadEditBean(mode, dataContext, dataService, dataSource); // @@ -550,6 +550,18 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineDto } @Override + protected void doPersist(SetLonglineDto bean) { + getSetLonglineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<SetLonglineDto> formDto = getSetLonglineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + SetLonglineDtos.copySetLonglineDto(formDto.getForm(), getBean()); + } + + @Override protected void closeSafeUI() { if (log.isInfoEnabled()) { @@ -996,4 +1008,8 @@ public class CatchLonglineUIHandler extends ContentTableUIHandler<SetLonglineDto // return branchlineUpdateExecutor; // } + protected SetLonglineService getSetLonglineService() { + return ObserveSwingApplicationContext.get().newService(SetLonglineService.class); + } + } \ No newline at end of file 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 87a2f16..81859fb 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 @@ -22,18 +22,22 @@ package fr.ird.observe.ui.content.table.impl.longline; * #L% */ -import fr.ird.observe.configuration.ObserveSwingApplicationConfig; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.configuration.ObserveSwingApplicationConfig; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; +import fr.ird.observe.services.dto.longline.ActivityLonglineDtos; import fr.ird.observe.services.dto.longline.EncounterDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.longline.EncounterTypeDto; +import fr.ird.observe.services.service.longline.ActivityLonglineService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableUIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.swing.JTable; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import static org.nuiton.i18n.I18n.n; @@ -104,4 +108,20 @@ public class EncounterUIHandler extends ContentTableUIHandler<ActivityLonglineDt super.initUI(); } + + @Override + protected void doPersist(ActivityLonglineDto bean) { + getActivityLonglineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<ActivityLonglineDto> formDto = getActivityLonglineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + ActivityLonglineDtos.copyActivityLonglineDto(formDto.getForm(), getBean()); + } + + protected ActivityLonglineService getActivityLonglineService() { + return ObserveSwingApplicationContext.get().newService(ActivityLonglineService.class); + } } \ No newline at end of file diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/FloatlinesCompositionUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/FloatlinesCompositionUIHandler.java index 67846fa..86f49c0 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/FloatlinesCompositionUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/FloatlinesCompositionUIHandler.java @@ -22,20 +22,20 @@ package fr.ird.observe.ui.content.table.impl.longline; * #L% */ -import fr.ird.observe.business.db.DataContext; -import fr.ird.observe.business.db.DataSource; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.FloatlinesCompositionDto; import fr.ird.observe.services.dto.longline.SetLonglineDto; +import fr.ird.observe.services.dto.longline.SetLonglineDtos; import fr.ird.observe.services.dto.referential.longline.LineTypeDto; +import fr.ird.observe.services.service.longline.SetLonglineService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableUIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.swing.JTable; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import static org.nuiton.i18n.I18n.n; @@ -118,4 +118,20 @@ public class FloatlinesCompositionUIHandler extends ContentTableUIHandler<SetLon public void afterSave(boolean refresh) { super.afterSave(refresh); } + + @Override + protected void doPersist(SetLonglineDto bean) { + getSetLonglineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<SetLonglineDto> formDto = getSetLonglineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + SetLonglineDtos.copySetLonglineDto(formDto.getForm(), getBean()); + } + + protected SetLonglineService getSetLonglineService() { + return ObserveSwingApplicationContext.get().newService(SetLonglineService.class); + } } \ No newline at end of file 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 6195071..585c342 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 @@ -25,11 +25,14 @@ package fr.ird.observe.ui.content.table.impl.longline; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.GearUseFeaturesLonglineDto; import fr.ird.observe.services.dto.longline.GearUseFeaturesMeasurementLonglineDto; import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.dto.longline.TripLonglineDtos; import fr.ird.observe.services.dto.referential.GearCaracteristicDto; import fr.ird.observe.services.dto.referential.GearDto; +import fr.ird.observe.services.service.longline.TripLonglineService; import fr.ird.observe.ui.ObserveMainUI; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; @@ -46,17 +49,11 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; import org.nuiton.validator.NuitonValidatorScope; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; +import javax.swing.*; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableCellRenderer; -import java.awt.GridBagConstraints; -import java.awt.Insets; +import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.Serializable; @@ -547,6 +544,22 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip } + @Override + protected void doPersist(TripLonglineDto bean) { + getTripLonglineService().save(bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<TripLonglineDto> formDto = getTripLonglineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + TripLonglineDtos.copyTripLonglineDto(formDto.getForm(), getBean()); + } + + protected TripLonglineService getTripLonglineService() { + return ObserveSwingApplicationContext.get().newService(TripLonglineService.class); + } + static class SectionTemplatesAutotSelectRowAndShowPopupAction extends AutotSelectRowAndShowPopupActionSupport { private final GearUseFeaturesLonglineUI ui; diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/HooksCompositionUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/HooksCompositionUIHandler.java index 8af0f4e..aba9b82 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/HooksCompositionUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/HooksCompositionUIHandler.java @@ -22,21 +22,21 @@ package fr.ird.observe.ui.content.table.impl.longline; * #L% */ -import fr.ird.observe.business.db.DataContext; -import fr.ird.observe.business.db.DataSource; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.HooksCompositionDto; import fr.ird.observe.services.dto.longline.SetLonglineDto; +import fr.ird.observe.services.dto.longline.SetLonglineDtos; import fr.ird.observe.services.dto.referential.longline.HookSizeDto; import fr.ird.observe.services.dto.referential.longline.HookTypeDto; +import fr.ird.observe.services.service.longline.SetLonglineService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableUIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.swing.JTable; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import static org.nuiton.i18n.I18n.n; @@ -121,4 +121,20 @@ public class HooksCompositionUIHandler extends ContentTableUIHandler<SetLongline public void afterSave(boolean refresh) { super.afterSave(refresh); } + + @Override + protected void doPersist(SetLonglineDto bean) { + getSetLonglineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<SetLonglineDto> formDto = getSetLonglineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + SetLonglineDtos.copySetLonglineDto(formDto.getForm(), getBean()); + } + + protected SetLonglineService getSetLonglineService() { + return ObserveSwingApplicationContext.get().newService(SetLonglineService.class); + } } \ No newline at end of file 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 00813aa..c4e32fe 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 @@ -28,11 +28,14 @@ import com.google.common.io.Files; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.ObserveTechnicalException; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.ActivityLonglineDto; +import fr.ird.observe.services.dto.longline.ActivityLonglineDtos; import fr.ird.observe.services.dto.longline.SensorUsedDto; import fr.ird.observe.services.dto.referential.longline.SensorBrandDto; import fr.ird.observe.services.dto.referential.longline.SensorDataFormatDto; import fr.ird.observe.services.dto.referential.longline.SensorTypeDto; +import fr.ird.observe.services.service.longline.ActivityLonglineService; import fr.ird.observe.ui.ObserveMainUI; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableUIHandler; @@ -161,7 +164,7 @@ public class SensorUsedUIHandler extends ContentTableUIHandler<ActivityLonglineD 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; @@ -231,4 +234,20 @@ public class SensorUsedUIHandler extends ContentTableUIHandler<ActivityLonglineD } + @Override + protected void doPersist(ActivityLonglineDto bean) { + getActivityLonglineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<ActivityLonglineDto> formDto = getActivityLonglineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + ActivityLonglineDtos.copyActivityLonglineDto(formDto.getForm(), getBean()); + } + + protected ActivityLonglineService getActivityLonglineService() { + return ObserveSwingApplicationContext.get().newService(ActivityLonglineService.class); + } + } \ No newline at end of file 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 2a2bc0f..33f070a 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 @@ -29,9 +29,12 @@ import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.business.ObserveTechnicalException; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.longline.SetLonglineDto; +import fr.ird.observe.services.dto.longline.SetLonglineDtos; import fr.ird.observe.services.dto.longline.TdrDto; import fr.ird.observe.services.dto.referential.longline.SensorBrandDto; +import fr.ird.observe.services.service.longline.SetLonglineService; import fr.ird.observe.ui.ObserveMainUI; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableModel; @@ -342,7 +345,7 @@ public class TdrUIHandler extends ContentTableUIHandler<SetLonglineDto, TdrDto> t("observe.tdr.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; @@ -479,4 +482,20 @@ public class TdrUIHandler extends ContentTableUIHandler<SetLonglineDto, TdrDto> bean.setFishingEnd(timestamp); } + + @Override + protected void doPersist(SetLonglineDto bean) { + getSetLonglineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<SetLonglineDto> formDto = getSetLonglineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + SetLonglineDtos.copySetLonglineDto(formDto.getForm(), getBean()); + } + + protected SetLonglineService getSetLonglineService() { + return ObserveSwingApplicationContext.get().newService(SetLonglineService.class); + } } \ No newline at end of file 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 cf26366..93ad580 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 @@ -25,11 +25,14 @@ package fr.ird.observe.ui.content.table.impl.seine; import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.referential.GearCaracteristicDto; import fr.ird.observe.services.dto.referential.GearDto; import fr.ird.observe.services.dto.seine.GearUseFeaturesMeasurementSeineDto; import fr.ird.observe.services.dto.seine.GearUseFeaturesSeineDto; import fr.ird.observe.services.dto.seine.TripSeineDto; +import fr.ird.observe.services.dto.seine.TripSeineDtos; +import fr.ird.observe.services.service.seine.TripSeineService; import fr.ird.observe.ui.ObserveMainUI; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; @@ -44,17 +47,11 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; import org.nuiton.validator.NuitonValidatorScope; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; +import javax.swing.*; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableCellRenderer; -import java.awt.GridBagConstraints; -import java.awt.Insets; +import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.Serializable; @@ -545,6 +542,22 @@ public class GearUseFeaturesSeineUIHandler extends ContentTableUIHandler<TripSei } + @Override + protected void doPersist(TripSeineDto bean) { + getTripSeineService().save(bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<TripSeineDto> formDto = getTripSeineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + TripSeineDtos.copyTripSeineDto(formDto.getForm(), getBean()); + } + + protected TripSeineService getTripSeineService() { + return ObserveSwingApplicationContext.get().newService(TripSeineService.class); + } + static class SectionTemplatesAutotSelectRowAndShowPopupAction extends AutotSelectRowAndShowPopupActionSupport { private final GearUseFeaturesSeineUI ui; 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 65bd7ef..4c3821f 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 @@ -21,7 +21,9 @@ */ package fr.ird.observe.ui.content.table.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.constants.seine.NonTargetCatchComputedValueSource; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.seine.ReasonForDiscardDto; @@ -29,6 +31,8 @@ import fr.ird.observe.services.dto.referential.seine.SpeciesFateDto; import fr.ird.observe.services.dto.seine.NonTargetCatchDto; import fr.ird.observe.services.dto.seine.NonTargetLengthDto; import fr.ird.observe.services.dto.seine.SetSeineDto; +import fr.ird.observe.services.dto.seine.SetSeineDtos; +import fr.ird.observe.services.service.seine.SetSeineService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableModel; import fr.ird.observe.ui.content.table.ContentTableUIHandler; @@ -439,4 +443,20 @@ public class NonTargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, // echantillon.getNonTargetLength().removeAll(tailleToDelete); // } // } + + @Override + protected void doPersist(SetSeineDto bean) { + getSetSeineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<SetSeineDto> formDto = getSetSeineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + SetSeineDtos.copySetSeineDto(formDto.getForm(), getBean()); + } + + protected SetSeineService getSetSeineService() { + return ObserveSwingApplicationContext.get().newService(SetSeineService.class); + } } 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 af2a97d..47cc1c1 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 @@ -21,14 +21,18 @@ */ package fr.ird.observe.ui.content.table.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSourceException; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.referential.SexDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.seine.NonTargetLengthDto; import fr.ird.observe.services.dto.seine.NonTargetSampleDto; +import fr.ird.observe.services.dto.seine.NonTargetSampleDtos; import fr.ird.observe.services.dto.seine.SetSeineDto; +import fr.ird.observe.services.service.seine.NonTargetSampleService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.table.ContentTableModel; @@ -429,4 +433,20 @@ public class NonTargetSampleUIHandler extends ContentTableUIHandler<NonTargetSam editBean.setAcquisitionMode(newMode.ordinal()); } } + + @Override + protected void doPersist(NonTargetSampleDto bean) { + getNonTargetSampleService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<NonTargetSampleDto> formDto = getNonTargetSampleService().loadToEdit(beanId); + getModel().setFormDto(formDto); + NonTargetSampleDtos.copyNonTargetSampleDto(formDto.getForm(), getBean()); + } + + protected NonTargetSampleService getNonTargetSampleService() { + return ObserveSwingApplicationContext.get().newService(NonTargetSampleService.class); + } } 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 0215342..85e26bf 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 @@ -21,18 +21,22 @@ */ package fr.ird.observe.ui.content.table.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.seine.SpeciesStatusDto; import fr.ird.observe.services.dto.seine.FloatingObjectDto; import fr.ird.observe.services.dto.seine.ObjectObservedSpeciesDto; +import fr.ird.observe.services.dto.seine.TargetSampleDtos; +import fr.ird.observe.services.service.seine.FloatingObjectService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableUIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.swing.JTable; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import static org.nuiton.i18n.I18n.n; @@ -100,4 +104,19 @@ public class ObjectObservedSpeciesUIHandler extends ContentTableUIHandler<Floati } + @Override + protected void doPersist(FloatingObjectDto bean) { + getFloatingObjectService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<FloatingObjectDto> formDto = getFloatingObjectService().loadToEdit(beanId); + getModel().setFormDto(formDto); + TargetSampleDtos.copyCommentableDto(formDto.getForm(), getBean()); + } + + protected FloatingObjectService getFloatingObjectService() { + return ObserveSwingApplicationContext.get().newService(FloatingObjectService.class); + } } 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 61f21d8..4b8ff2c 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 @@ -21,11 +21,15 @@ */ package fr.ird.observe.ui.content.table.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.seine.FloatingObjectDto; import fr.ird.observe.services.dto.seine.ObjectSchoolEstimateDto; +import fr.ird.observe.services.dto.seine.TargetSampleDtos; +import fr.ird.observe.services.service.seine.FloatingObjectService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableUIHandler; import org.apache.commons.logging.Log; @@ -95,4 +99,20 @@ public class ObjectSchoolEstimateUIHandler extends ContentTableUIHandler<Floatin super.initUI(); } + + @Override + protected void doPersist(FloatingObjectDto bean) { + getFloatingObjectService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<FloatingObjectDto> formDto = getFloatingObjectService().loadToEdit(beanId); + getModel().setFormDto(formDto); + TargetSampleDtos.copyCommentableDto(formDto.getForm(), getBean()); + } + + protected FloatingObjectService getFloatingObjectService() { + return ObserveSwingApplicationContext.get().newService(FloatingObjectService.class); + } } 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 98b159b..a429375 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 @@ -21,10 +21,14 @@ */ package fr.ird.observe.ui.content.table.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.seine.SchoolEstimateDto; import fr.ird.observe.services.dto.seine.SetSeineDto; +import fr.ird.observe.services.dto.seine.SetSeineDtos; +import fr.ird.observe.services.service.seine.SetSeineService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableModel; import fr.ird.observe.ui.content.table.ContentTableUIHandler; @@ -169,4 +173,20 @@ public class SchoolEstimateUIHandler extends ContentTableUIHandler<SetSeineDto, return true; } + + @Override + protected void doPersist(SetSeineDto bean) { + getSetSeineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<SetSeineDto> formDto = getSetSeineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + SetSeineDtos.copySetSeineDto(formDto.getForm(), getBean()); + } + + protected SetSeineService getSetSeineService() { + return ObserveSwingApplicationContext.get().newService(SetSeineService.class); + } } 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 60001fd..354e09b 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 @@ -21,14 +21,18 @@ */ package fr.ird.observe.ui.content.table.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataSourceException; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.seine.WeightCategoryDto; import fr.ird.observe.services.dto.seine.SetSeineDto; +import fr.ird.observe.services.dto.seine.SetSeineDtos; import fr.ird.observe.services.dto.seine.TargetCatchDto; import fr.ird.observe.services.dto.seine.TargetLengthDto; +import fr.ird.observe.services.service.seine.SetSeineService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableModel; import fr.ird.observe.ui.content.table.ContentTableUIHandler; @@ -463,4 +467,20 @@ public class TargetCatchUIHandler extends ContentTableUIHandler<SetSeineDto, Tar List<ReferenceDto<WeightCategoryDto>> list = new ArrayList<>(ALL_CATEGORIES_ENTRY.getContextValue(context)); return list; } + + @Override + protected void doPersist(SetSeineDto bean) { + getSetSeineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<SetSeineDto> formDto = getSetSeineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + SetSeineDtos.copySetSeineDto(formDto.getForm(), getBean()); + } + + protected SetSeineService getSetSeineService() { + return ObserveSwingApplicationContext.get().newService(SetSeineService.class); + } } 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 ae7a6ec..441ffec 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 @@ -21,15 +21,19 @@ */ package fr.ird.observe.ui.content.table.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataSourceException; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.referential.seine.ReasonForDiscardDto; import fr.ird.observe.services.dto.referential.seine.WeightCategoryDto; import fr.ird.observe.services.dto.seine.SetSeineDto; +import fr.ird.observe.services.dto.seine.SetSeineDtos; import fr.ird.observe.services.dto.seine.TargetCatchDto; import fr.ird.observe.services.dto.seine.TargetLengthDto; +import fr.ird.observe.services.service.seine.SetSeineService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.table.ContentTableModel; import fr.ird.observe.ui.content.table.ContentTableUIHandler; @@ -292,11 +296,6 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineD } @Override - protected void doPersist(SetSeineDto bean) { - //FIXME quel service ? - } - - @Override protected boolean prepareSave(SetSeineDto bean, List<TargetCatchDto> objets) throws DataSourceException { // on recupere les speciess acceptables pour des echantillonnages @@ -682,4 +681,19 @@ public class TargetDiscardCatchUIHandler extends ContentTableUIHandler<SetSeineD } } + @Override + protected void doPersist(SetSeineDto bean) { + getSetSeineService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<SetSeineDto> formDto = getSetSeineService().loadToEdit(beanId); + getModel().setFormDto(formDto); + SetSeineDtos.copySetSeineDto(formDto.getForm(), getBean()); + } + + protected SetSeineService getSetSeineService() { + return ObserveSwingApplicationContext.get().newService(SetSeineService.class); + } } 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 95c2ae9..66da3e7 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 @@ -21,14 +21,20 @@ */ package fr.ird.observe.ui.content.table.impl.seine; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.DataSourceException; import fr.ird.observe.business.db.constants.DataContextType; +import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import fr.ird.observe.services.dto.seine.SetSeineDto; +import fr.ird.observe.services.dto.seine.SetSeineDtos; import fr.ird.observe.services.dto.seine.TargetLengthDto; import fr.ird.observe.services.dto.seine.TargetSampleDto; +import fr.ird.observe.services.dto.seine.TargetSampleDtos; +import fr.ird.observe.services.service.seine.SetSeineService; +import fr.ird.observe.services.service.seine.TargetSampleService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.table.ContentTableModel; @@ -449,4 +455,20 @@ public class TargetSampleUIHandler extends ContentTableUIHandler<TargetSampleDto editBean.setAcquisitionMode(newMode.ordinal()); } } + + @Override + protected void doPersist(TargetSampleDto bean) { + getTargetSampleService().save(getSelectedParentId(), bean); + } + + @Override + protected void loadEditBean(String beanId) { + FormDto<TargetSampleDto> formDto = getTargetSampleService().loadToEdit(beanId, discarded); + getModel().setFormDto(formDto); + TargetSampleDtos.copyTargetSampleDto(formDto.getForm(), getBean()); + } + + protected TargetSampleService getTargetSampleService() { + return ObserveSwingApplicationContext.get().newService(TargetSampleService.class); + } } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/DtoNodeSupport.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/DtoNodeSupport.java index 2a47d48..19b594a 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/DtoNodeSupport.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/DtoNodeSupport.java @@ -53,9 +53,6 @@ public abstract class DtoNodeSupport<E extends IdDto> extends ObserveNode { */ protected transient E entity; - //FIXME -// protected transient DataService dataService; - private boolean reloadEntity; //FIXME @@ -155,14 +152,6 @@ public abstract class DtoNodeSupport<E extends IdDto> extends ObserveNode { } - //FIXME -// private DataService getDataService() { -// if (dataService == null) { -// dataService = ObserveContext.get().getDataService(); -// } -// return dataService; -// } - public void setReloadEntity(boolean reloadEntity) { this.reloadEntity = reloadEntity; } diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/ActivitySeineObservedSystemServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/ActivitySeineObservedSystemServiceController.java index dda4d4e..190c0f1 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/ActivitySeineObservedSystemServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/ActivitySeineObservedSystemServiceController.java @@ -47,7 +47,7 @@ public class ActivitySeineObservedSystemServiceController extends ObserveAuthent } @Override - public String save(FormDto<ActivitySeineObservedSystemDto> form) { - return service.save(form); + public String save(ActivitySeineObservedSystemDto dto) { + return service.save(dto); } } diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/NonTargetSampleServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/NonTargetSampleServiceController.java index 7a029c3..0efcba4 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/NonTargetSampleServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/NonTargetSampleServiceController.java @@ -52,7 +52,7 @@ public class NonTargetSampleServiceController extends ObserveAuthenticatedServic } @Override - public String save(String setSeineId, FormDto<NonTargetSampleDto> form) { - return service.save(setSeineId, form); + public String save(String setSeineId, NonTargetSampleDto dto) { + return service.save(setSeineId, dto); } } diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TargetSampleServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TargetSampleServiceController.java index 73bfb35..ced9af1 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TargetSampleServiceController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/seine/TargetSampleServiceController.java @@ -52,7 +52,7 @@ public class TargetSampleServiceController extends ObserveAuthenticatedServiceCo } @Override - public String save(String setSeineId, FormDto<TargetSampleDto> form) { - return service.save(setSeineId, form); + public String save(String setSeineId, TargetSampleDto dto) { + return service.save(setSeineId, dto); } } diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineObservedSystemService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineObservedSystemService.java index 2e0ace9..7640dff 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineObservedSystemService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineObservedSystemService.java @@ -44,6 +44,6 @@ public interface ActivitySeineObservedSystemService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(FormDto<ActivitySeineObservedSystemDto> form); + String save(ActivitySeineObservedSystemDto dto); } diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/NonTargetSampleService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/NonTargetSampleService.java index 2e83c2d..68a0e73 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/NonTargetSampleService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/NonTargetSampleService.java @@ -47,6 +47,6 @@ public interface NonTargetSampleService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(String setSeineId, FormDto<NonTargetSampleDto> form); + String save(String setSeineId, NonTargetSampleDto dto); } diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TargetSampleService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TargetSampleService.java index d4c8e2b..528c66c 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TargetSampleService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/seine/TargetSampleService.java @@ -47,6 +47,6 @@ public interface TargetSampleService extends ObserveService { @Write @WriteDataPermission @PostRequest - String save(String setSeineId, FormDto<TargetSampleDto> form); + String save(String setSeineId, TargetSampleDto dto); } diff --git a/observe-services-rest/src/test/java/fr/ird/observe/services/service/seine/TripSeineServiceRestTest.java b/observe-services-rest/src/test/java/fr/ird/observe/services/service/seine/TripSeineServiceRestTest.java index b6c049f..677deef 100644 --- a/observe-services-rest/src/test/java/fr/ird/observe/services/service/seine/TripSeineServiceRestTest.java +++ b/observe-services-rest/src/test/java/fr/ird/observe/services/service/seine/TripSeineServiceRestTest.java @@ -257,7 +257,7 @@ public class TripSeineServiceRestTest extends AbstractServiceRestTest{ tripSeineDto.setComment("Un commentaire"); - service.save(formDto); + service.save(formDto.getForm()); FormDto<TripSeineDto> formDtoReload = service.loadToRead(TRIP_SEINE_ID_1); TripSeineDto tripSeineDtoReload = formDtoReload.getForm(); diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineObservedSystemServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineObservedSystemServiceTopia.java index ca266d5..4a7f416 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineObservedSystemServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/ActivitySeineObservedSystemServiceTopia.java @@ -53,9 +53,9 @@ public class ActivitySeineObservedSystemServiceTopia extends ObserveServiceTopia } @Override - public String save(FormDto<ActivitySeineObservedSystemDto> form) { + public String save(ActivitySeineObservedSystemDto dto) { - ActivitySeine activitySeine = dtoToEntity(ActivitySeineObservedSystemDto.class, ActivitySeine.class, form.getForm()); + ActivitySeine activitySeine = dtoToEntity(ActivitySeineObservedSystemDto.class, ActivitySeine.class, dto); activitySeine = saveEntity(ActivitySeine.class, activitySeine); diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/NonTargetSampleServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/NonTargetSampleServiceTopia.java index 6b3da11..0deb45c 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/NonTargetSampleServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/NonTargetSampleServiceTopia.java @@ -121,12 +121,10 @@ public class NonTargetSampleServiceTopia extends ObserveServiceTopia implements } @Override - public String save(String setSeineId, FormDto<NonTargetSampleDto> form) { + public String save(String setSeineId, NonTargetSampleDto nonTargetSampleDto) { SetSeine setSeine = loadEntity(SetSeineDto.class, SetSeine.class, setSeineId); - NonTargetSampleDto nonTargetSampleDto = form.getForm(); - NonTargetSample nonTargetSample = dtoToEntity(NonTargetSampleDto.class, NonTargetSample.class, nonTargetSampleDto); nonTargetSample = saveEntity(NonTargetSample.class, nonTargetSample); diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TargetSampleServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TargetSampleServiceTopia.java index a026ec5..8d2e108 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TargetSampleServiceTopia.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/seine/TargetSampleServiceTopia.java @@ -129,12 +129,10 @@ public class TargetSampleServiceTopia extends ObserveServiceTopia implements Tar } @Override - public String save(String setSeineId, FormDto<TargetSampleDto> form) { + public String save(String setSeineId, TargetSampleDto targetSampleDto) { SetSeine setSeine = loadEntity(SetSeineDto.class, SetSeine.class, setSeineId); - TargetSampleDto targetSampleDto = form.getForm(); - TargetSample targetSample = dtoToEntity(TargetSampleDto.class, TargetSample.class, targetSampleDto); targetSample = saveEntity(TargetSample.class, targetSample); diff --git a/observe-services-topia/src/test/java/fr/ird/observe/services/service/RigthTest.java b/observe-services-topia/src/test/java/fr/ird/observe/services/service/RigthTest.java index 1509d73..4f12763 100644 --- a/observe-services-topia/src/test/java/fr/ird/observe/services/service/RigthTest.java +++ b/observe-services-topia/src/test/java/fr/ird/observe/services/service/RigthTest.java @@ -153,7 +153,7 @@ public class RigthTest { FormDto<TripSeineDto> tripSeineDtoFormDto = service.loadToEdit(TRIP_SEINE_ID); - service.save(tripSeineDtoFormDto); + service.save(tripSeineDtoFormDto.getForm()); } protected void testReadReferential(String login) throws DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException { diff --git a/observe-services-topia/src/test/java/fr/ird/observe/services/service/seine/TripSeineServiceTopiaTest.java b/observe-services-topia/src/test/java/fr/ird/observe/services/service/seine/TripSeineServiceTopiaTest.java index a991c4c..f5f8865 100644 --- a/observe-services-topia/src/test/java/fr/ird/observe/services/service/seine/TripSeineServiceTopiaTest.java +++ b/observe-services-topia/src/test/java/fr/ird/observe/services/service/seine/TripSeineServiceTopiaTest.java @@ -275,7 +275,7 @@ public class TripSeineServiceTopiaTest extends AbstractServiceTopiaTest { Date lastUpdateBefore = getLastUpdate(TripSeine.class); - String tripSeineId = service.save(formDto); + String tripSeineId = service.save(formDto.getForm()); TripSeine tripSeine = dataSourceResource.findById(TripSeine.class, tripSeineId); @@ -331,7 +331,7 @@ public class TripSeineServiceTopiaTest extends AbstractServiceTopiaTest { Date lastUpdateBefore = getLastUpdate(TripSeine.class); - service.save(formDto); + service.save(formDto.getForm()); TripSeine tripSeine = dataSourceResource.findById(TripSeine.class, TRIP_SEINE_ID_1); @@ -381,7 +381,7 @@ public class TripSeineServiceTopiaTest extends AbstractServiceTopiaTest { calendar.add(Calendar.HOUR, - 1); tripSeineDto.setLastUpdate(calendar.getTime()); - service.save(formDto); + service.save(formDto.getForm()); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7531 in repository observe. See http://git.codelutin.com/observe.git commit f12b43c0d2e1337379f129ce8c29174a57ddc7a3 Author: Kevin Morin <morin@codelutin.com> Date: Mon Sep 28 16:27:01 2015 +0200 suppression des fixme (refs #7531) --- .../main/java/fr/ird/observe/ObserveCLAction.java | 3 +- .../java/fr/ird/observe/ObserveServiceHelper.java | 14 +- .../java/fr/ird/observe/ui/DecoratorService.java | 49 +---- .../fr/ird/observe/ui/ObserveMainUIHandler.java | 9 +- .../src/main/java/fr/ird/observe/ui/UIHelper.java | 48 +++-- .../ird/observe/ui/content/ContentUIHandler.java | 93 +--------- .../observe/ui/content/ContentUIInitializer.java | 202 ++++++++------------- .../ird/observe/ui/content/ContentUIManager.java | 64 ++++--- .../ui/content/table/ContentTableUIHandler.java | 27 ++- .../ui/content/table/ContentTableUIModel.java | 19 +- .../impl/longline/WeightMeasuresTableModel.java | 5 +- .../fr/ird/observe/ui/tree/ObserveTreeHelper.java | 12 -- .../EditableTableWithCacheTableModelSupport.java | 24 +-- .../observe/ui/util/tripMap/TripMapUIHandler.java | 5 +- 14 files changed, 191 insertions(+), 383 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ObserveCLAction.java b/observe-application-swing/src/main/java/fr/ird/observe/ObserveCLAction.java index ea491cd..a8c6130 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ObserveCLAction.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ObserveCLAction.java @@ -177,8 +177,7 @@ public class ObserveCLAction { public void useJMX() throws Exception { // just set the useJMX flag - //FIXME -// ObserveServiceHelper.setUseJMX(true); + ObserveServiceHelper.setUseJMX(true); } /** Désactiver la possiblite de lancer l'ui principale. */ diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ObserveServiceHelper.java b/observe-application-swing/src/main/java/fr/ird/observe/ObserveServiceHelper.java index e174736..beff939 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ObserveServiceHelper.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ObserveServiceHelper.java @@ -21,6 +21,7 @@ */ package fr.ird.observe; +import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.gps.GPSService; import fr.ird.observe.business.validation.ValidationContext; import fr.ird.observe.business.validation.ValidationService; @@ -125,13 +126,12 @@ public class ObserveServiceHelper { return new ValidationService(); } - //FIXME -// public static DataContext getDataContext() { -// checkInit(); -// ObserveApplicationContext context = get(); -// DataContext dataContext = context.getDataContext(); -// return dataContext; -// } + public static DataContext getDataContext() { + checkInit(); + ObserveSwingApplicationContext context = get(); + DataContext dataContext = context.getDataContext(); + return dataContext; + } public static ValidationContext getValidationContext() { checkInit(); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java index a778813..a7c3a36 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/DecoratorService.java @@ -174,10 +174,8 @@ public class DecoratorService extends DecoratorProvider { public static String getEntityLabel(String prefix, Class entityClass) { if (!AbstractObserveDto.class.isAssignableFrom(entityClass)) { throw new IllegalArgumentException( - entityClass + " is not a TopiaEntity"); + entityClass + " is not an Observe DTO"); } - //FIXME -// entityClass = ObserveDAOHelper.getContractClass(entityClass); return getPropertyLabel(prefix, entityClass.getSimpleName()); } @@ -534,9 +532,6 @@ public class DecoratorService extends DecoratorProvider { // LengthWeightParameter decorator registerDecorator(new LengthWeightParameterDecorator(libelle)); - //FIXME -// registerDecorator(new TopiaEntityRefDecorator()); - // gps decorators registerJXPathDecorator(ActivitySeineDto.class, "activity-gps", @@ -572,46 +567,4 @@ public class DecoratorService extends DecoratorProvider { registerDecorator(referenceType.getSimpleName(), new ReferenceReferentialDecorator(expression)); } - //FIXME -// public class TopiaEntityRefDecorator extends Decorator<TopiaEntityRef> { -// -// private static final long serialVersionUID = 1L; -// -// public TopiaEntityRefDecorator() throws NullPointerException { -// super(TopiaEntityRef.class); -// } -// -// @Override -// public String toString(Object bean) { -// if (bean == null) { -// return ""; -// } -// String message; -// try { -// TopiaEntityRef ref = (TopiaEntityRef) bean; -// -// TopiaEntity invoker = ref.getInvoker(); -// if (invoker == null) { -// invoker = ref.getRef(); -// } -// String invokerProperty = -// t(getPropertyLabel( -// ref.getInvokerProperty())); -// String type = t(getEntityLabel(invoker.getClass())); -// Decorator<?> decorator = -// getDecoratorByType(invoker.getClass()); -// if (invokerProperty == null) { -// message = t("observe.synchro.obsolete.entity.label", type, decorator.toString(invoker)); -// } else { -// message = t("observe.synchro.obsolete.entity.ref", type, decorator.toString(invoker), invokerProperty); -// } -// } catch (Exception e) { -// if (log.isErrorEnabled()) { -// log.error(e); -// } -// message = ""; -// } -// return message; -// } -// } } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUIHandler.java index a2f4a61..25cc31b 100755 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/ObserveMainUIHandler.java @@ -22,7 +22,6 @@ package fr.ird.observe.ui; import fr.ird.observe.ObserveSwingApplicationContext; -import fr.ird.observe.ui.DecoratorService; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.db.ObserveSwingDataSource; @@ -48,15 +47,14 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.i18n.I18n; -import javax.swing.Icon; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.event.TreeWillExpandListener; import javax.swing.tree.ExpandVetoException; import javax.swing.tree.TreePath; -import java.awt.Cursor; +import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; @@ -227,8 +225,7 @@ public class ObserveMainUIHandler { boolean open = context.getDataContext().getEnabled(); if (open) { - // FIXME - //treeHelper.createModel(source); + treeHelper.createModel(source); } else { treeHelper.createEmptyModel(); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/UIHelper.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/UIHelper.java index c9b4d70..c7bc2d1 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/UIHelper.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/UIHelper.java @@ -22,7 +22,7 @@ package fr.ird.observe.ui; import fr.ird.observe.ObserveSwingApplicationContext; -import fr.ird.observe.services.dto.AbstractObserveDto; +import fr.ird.observe.services.dto.IdDto; import fr.ird.observe.ui.util.table.ObserveBooleanTableCellRenderer; import jaxx.runtime.FileChooserUtil; import jaxx.runtime.JAXXObject; @@ -32,15 +32,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.event.HyperlinkEvent; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; -import java.awt.Component; -import java.awt.Desktop; -import java.awt.Toolkit; +import java.awt.*; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.io.File; @@ -269,7 +265,7 @@ public class UIHelper extends SwingUtil { * @return {@code true} si l'utilisateur a confitmé la suppression, * {@code false} sinon. */ - public static <E extends AbstractObserveDto> boolean confirmForEntityDelete( + public static <E extends IdDto> boolean confirmForEntityDelete( JAXXObject parent, Class<E> beanClass, E bean) { @@ -288,7 +284,7 @@ public class UIHelper extends SwingUtil { * @return {@code true} si l'utilisateur a confitmé la suppression, * {@code false} sinon. */ - public static <E extends AbstractObserveDto> boolean confirmForEntityDelete( + public static <E extends IdDto> boolean confirmForEntityDelete( JAXXObject parent, Class<E> beanClass, E bean, @@ -310,19 +306,18 @@ public class UIHelper extends SwingUtil { String type = DecoratorService.getEntityLabel(beanClass); type = t(type); - //FIXME -// if (bean == null || bean.getTopiaId() == null || decorator == null) { -// // delete new entity -// messageDelete = t("observe.message.delete.new", type); -// } else { -// try { -// // delete existing entity -// beanStr = decorator.toString(bean); -// messageDelete = t("observe.message.delete", type, beanStr); -// } catch (Exception e) { -// messageDelete = t("observe.message.delete.new", type); -// } -// } + if (bean == null || bean.getId() == null || decorator == null) { + // delete new entity + messageDelete = t("observe.message.delete.new", type); + } else { + try { + // delete existing entity + beanStr = decorator.toString(bean); + messageDelete = t("observe.message.delete", type, beanStr); + } catch (Exception e) { + messageDelete = t("observe.message.delete.new", type); + } + } if (extraMessage != null) { messageDelete += '\n' + extraMessage; @@ -398,12 +393,11 @@ public class UIHelper extends SwingUtil { }); } - public static <E extends AbstractObserveDto> E getEntity(List<E> list, E entity) { + public static <E extends IdDto> E getEntity(List<E> list, E entity) { for (E e : list) { - //FIXME -// if (e.getTopiaId().equals(entity.getTopiaId())) { -// return e; -// } + if (e.getId().equals(entity.getId())) { + return e; + } } return null; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java index dde86d0..aa2f075 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIHandler.java @@ -79,17 +79,6 @@ public abstract class ContentUIHandler<E extends IdDto> { protected final String prefix; - //FIXME -// private final TopiaExecutor<E> loadExecutor; -// -// private final TopiaExecutor2<? extends TopiaEntity, E> preCreateExecutor; -// -// private final TopiaExecutor2<? extends TopiaEntity, E> createExecutor; -// -// private final TopiaExecutor2<? extends TopiaEntity, E> updateExecutor; -// -// private final TopiaExecutor2<? extends TopiaEntity, E> deleteExecutor; - private final DataContextType parentType; private final DataContextType type; @@ -107,42 +96,6 @@ public abstract class ContentUIHandler<E extends IdDto> { if (log.isDebugEnabled()) { log.debug("New handler [" + this + "] for ui " + prefix); } - //FIXME -// loadExecutor = new TopiaExecutor<E>() { -// @Override -// public void execute(TopiaContext tx, E bean) throws TopiaException { -// onLoad(tx, bean); -// } -// }; - //FIXME -// preCreateExecutor = new TopiaExecutor2<TopiaEntity, E>() { -// @Override -// public E execute(TopiaContext tx, TopiaEntity parentBean, E bean) throws TopiaException { -// return onPreCreate(tx, parentBean, bean); -// } -// }; - //FIXME -// createExecutor = new TopiaExecutor2<TopiaEntity, E>() { -// @Override -// public E execute(TopiaContext tx, TopiaEntity parentBean, E bean) throws TopiaException { -// return onCreate(tx, parentBean, bean); -// } -// }; - //FIXME -// updateExecutor = new TopiaExecutor2<TopiaEntity, E>() { -// @Override -// public E execute(TopiaContext tx, TopiaEntity parentBean, E bean) throws TopiaException { -// return onUpdate(tx, parentBean, bean); -// } -// }; - //FIXME -// deleteExecutor = new TopiaExecutor2<TopiaEntity, E>() { -// @Override -// public E execute(TopiaContext tx, TopiaEntity parentBean, E beanToDelete) throws TopiaException { -// onDelete(tx, parentBean, beanToDelete); -// return null; -// } -// }; errorIcon = UIManager.getIcon("action.error"); } @@ -162,10 +115,6 @@ public abstract class ContentUIHandler<E extends IdDto> { } } - //FIXME -// protected static void attachTopiaContext(DataSource service, TopiaEntityAbstract entity) { -// DBHelper.attachTopiaContext(service.getRootCtxt(), entity); -// } public static ObserveTreeHelper getTreeHelper(JAXXContext context) { return context.getContextValue(ObserveTreeHelper.class); @@ -360,7 +309,6 @@ public abstract class ContentUIHandler<E extends IdDto> { public void initUI() throws Exception { ContentUIInitializer<E, ObserveContentUI<E>> uiInitializer = new ContentUIInitializer<E, ObserveContentUI<E>>(ui); - //FIXME uiInitializer.initUI(); } @@ -373,8 +321,7 @@ public abstract class ContentUIHandler<E extends IdDto> { //FIXME chemit 20100913 : il vaudrait le faire uniquement lors de l'édition // chaque arrive sur un ecran invalide le cache de validation - //FIXME -// ObserveServiceHelper.getValidationContext().cleanCache(); + ObserveServiceHelper.getValidationContext().cleanCache(); if (log.isDebugEnabled()) { log.debug("ui " + ui.getClass()); @@ -435,8 +382,7 @@ public abstract class ContentUIHandler<E extends IdDto> { } public void stopEditUI() { -//FIXME -// ObserveServiceHelper.getValidationContext().cleanCache(); + ObserveServiceHelper.getValidationContext().cleanCache(); ContentUIModel<E> model = getModel(); @@ -692,36 +638,6 @@ public abstract class ContentUIHandler<E extends IdDto> { ObserveServiceHelper.get().getValidationContext().cleanCache(); } - //FIXME -// protected final TopiaEntityBinder<E> getLoadBinder() { -// return getModel().getLoadBinder(); -// } - - //FIXME -// protected final TopiaExecutor<E> getLoadExecutor() { -// return loadExecutor; -// } - - //FIXME -// protected final TopiaExecutor2<? extends TopiaEntity, E> getPreCreateExecutor() { -// return preCreateExecutor; -// } -// - //FIXME -// protected final TopiaExecutor2<? extends TopiaEntity, E> getCreateExecutor() { -// return createExecutor; -// } -// - //FIXME -// protected final TopiaExecutor2<? extends TopiaEntity, E> getUpdateExecutor() { -// return updateExecutor; -// } -// - //FIXME -// protected final TopiaExecutor2<? extends TopiaEntity, E> getDeleteExecutor() { -// return deleteExecutor; -// } - protected final ContentMode computeContentMode() { ContentMode mode; @@ -746,11 +662,6 @@ public abstract class ContentUIHandler<E extends IdDto> { return contextName; } - //FIXME -// protected final DataService getDataService() { -// return ObserveContext.get().getDataService(); -// } - protected void updateActions() { updateToolbarActions(); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java index 1ae7eee..58d00cb 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java @@ -23,16 +23,17 @@ package fr.ird.observe.ui.content; */ import com.google.common.base.Predicate; +import com.google.common.collect.Collections2; import com.google.common.collect.Lists; import fr.ird.observe.ObserveSwingApplicationContext; -import fr.ird.observe.business.db.DataSourceException; import fr.ird.observe.business.validation.ObserveValidator; -import fr.ird.observe.services.dto.AbstractObserveDto; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.IdDto; +import fr.ird.observe.services.dto.ReferenceDto; +import fr.ird.observe.services.dto.ReferenceSetDto; import fr.ird.observe.services.dto.constants.ReferenceStatus; import fr.ird.observe.services.dto.referential.ReferentialDto; -import fr.ird.observe.ui.DecoratorService; +import fr.ird.observe.services.dto.referential.ReferentialDtos; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.actions.shared.AbstractUIAction; import fr.ird.observe.ui.util.BooleanEditor; @@ -65,25 +66,10 @@ import org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor; import org.nuiton.jaxx.widgets.select.FilterableDoubleList; import org.nuiton.util.DateUtil; -import javax.swing.AbstractButton; -import javax.swing.ActionMap; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JScrollBar; -import javax.swing.JSpinner; -import javax.swing.JTable; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.ListCellRenderer; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.border.LineBorder; import javax.swing.table.TableCellEditor; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; @@ -130,12 +116,6 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E this.ui = ui; } - //FIXME -// protected static void attachTopiaContext(DataSource service, -// TopiaEntityAbstract entity) { -// DBHelper.attachTopiaContext(service.getRootCtxt(), entity); -// } - public static TableCellEditor newFloatColumnEditor(JTable table) { NumberCellEditor<Float> editor = JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false); @@ -209,13 +189,8 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E // initialisation des éditeurs - //FIXME -// init(); - Set<String> doNotBlockComponentIds = new HashSet<String>(); - DecoratorService decoratorService = ObserveSwingApplicationContext.get().getDecoratorService(); - for (String name : ui.get$objectMap().keySet()) { Object o = ui.getObjectById(name); @@ -223,12 +198,6 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E continue; } - if (o instanceof AbstractObserveDto) { - //FIXME -// init((AbstractObserveDto) o); - continue; - } - if (o instanceof JComponent) { init((JComponent) o, doNotBlockComponentIds); @@ -360,7 +329,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E if (log.isDebugEnabled()) { log.debug("init common action " + actionId); } - //FIXME + action.initAction(null, editor); } @@ -373,16 +342,12 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E @SuppressWarnings("unchecked") protected void init(BeanComboBox beanComboBox) { - Class<ReferentialDto> klass = (Class<ReferentialDto>) - beanComboBox.getHandler().getBeanType(); if (log.isDebugEnabled()) { - log.debug("init combobox for " + klass); + log.debug("init combobox for " + beanComboBox.getBeanType()); } beanComboBox.setI18nPrefix("observe.common."); beanComboBox.setMinimumSize(new Dimension(0, 24)); - //FIXME - Class entityClass = null; - prepareBeanComboBox(entityClass, beanComboBox); + prepareBeanComboBox(beanComboBox); } @SuppressWarnings("unchecked") @@ -401,13 +366,12 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E Object init = jlist.getClientProperty("addDecorator"); if (init != null) { - Class<AbstractObserveDto> klass = (Class<AbstractObserveDto>) init; + Class<? extends IdDto> klass = (Class<? extends IdDto>) init; if (log.isDebugEnabled()) { log.debug("addDecorator to list " + jlist.getName()); } - DecoratorService decoratorService = ObserveSwingApplicationContext.get().getDecoratorService(); - Decorator<AbstractObserveDto> decorator = decoratorService.getDecoratorByType(klass); + Decorator<? extends IdDto> decorator = ObserveSwingApplicationContext.get().getDecorator(klass); jlist.putClientProperty("decorator", decorator); } @@ -430,9 +394,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E log.info("init list for " + beanList.getBeanType()); } - //FIXME - Class<? extends IdDto> entityClass = null; - prepareEntityList(entityClass, beanList); + prepareEntityList(beanList); } @@ -631,41 +593,42 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E * Remplit le modèle d'une liste graphique avec la liste des entités d'un * type donné sur un service de persistance donné. * - * @param entityClass le type de l'entité - * @param list le component graphique à initialiser - * @throws DataSourceException si un problème lors de la récupération + * @param list le component graphique à initialiser + * @si un problème lors de la récupération * des entités * @since 1.5 */ - protected <E extends AbstractObserveDto> void prepareEntityList(Class<E> entityClass, - FilterableDoubleList<E> list) { + protected <E extends IdDto> void prepareEntityList(FilterableDoubleList<ReferenceDto> list) { ObserveSwingApplicationContext tx = ObserveSwingApplicationContext.get(); + Class<E> dtoClass = (Class<E>) list.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_ENTITY_CLASS); // init list - Decorator<E> decorator = tx.getDecorator(entityClass); + Decorator<ReferenceDto> decorator = tx.getDecorator(ReferenceDto.class, dtoClass.getName()); if (log.isDebugEnabled()) { log.debug("Will use decorator " + decorator); } list.putClientProperty("decorator", decorator); - List<E> data = null; + List<ReferenceDto> data = null; - if (ReferentialDto.class.isAssignableFrom(entityClass)) { + if (ReferentialDto.class.isAssignableFrom(dtoClass)) { - Predicate<E> predicate = (Predicate<E>) list.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_LIST_PREDICATE); - //FIXME -// data = tx.getDataService().getList(storageService, entityClass, predicate); + Predicate<ReferenceDto> predicate = (Predicate<ReferenceDto>) list.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_LIST_PREDICATE); + + ReferenceSetDto<E> referenceSetDto = getFormDto().getReferenceSetDto(dtoClass); + data = new ArrayList<>(Collections2.filter(referenceSetDto.getReference(), predicate)); +// data = tx.getDataService().getList(storageService, realEntityClass, predicate); } else { - data = new ArrayList<E>(); + data = new ArrayList<>(); } // sort data from first decorator context - DecoratorUtil.sort((JXPathDecorator<E>) decorator, data, 0); + DecoratorUtil.sort((JXPathDecorator<ReferenceDto>) decorator, data, 0); // set datas to list and init renderer - list.init((JXPathDecorator<E>) decorator, data, Collections.<E>emptyList()); + list.init((JXPathDecorator<ReferenceDto>) decorator, data, Collections.<ReferenceDto>emptyList()); // get the renderer initialized ListCellRenderer renderer = list.getSelectedList().getCellRenderer(); @@ -676,10 +639,10 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E list.putClientProperty("data", data); - // listen on cache modification - EntityDoubleListPropertyChangeListener<E> listener = - new EntityDoubleListPropertyChangeListener<E>(entityClass, list); //FIXME + // listen on cache modification +// EntityDoubleListPropertyChangeListener<E> listener = +// new EntityDoubleListPropertyChangeListener<E>(entityClass, list); // DataService service = ObserveContext.get().getDataService(); // service.addReferentielPropertyChangeListener(entityClass, listener); } @@ -688,41 +651,42 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E * Remplit le modèle d'une liste graphique avec la liste des entités d'un * type donné sur un service de persistance donné. * - * @param entityClass le type de l'entité - * @param list le component graphique à initialiser - * @throws DataSourceException si un problème lors de la récupération + * @param list le component graphique à initialiser + * @si un problème lors de la récupération * des entités * @since 1.5 */ - protected <E extends AbstractObserveDto> void prepareEntityList(Class<E> entityClass, - BeanListHeader<E> list) { + protected <E extends IdDto> void prepareEntityList(Class<E> dtoClass, + BeanListHeader<ReferenceDto> list) { ObserveSwingApplicationContext tx = ObserveSwingApplicationContext.get(); // init list - Decorator<E> decorator = tx.getDecorator(entityClass); + Decorator<ReferenceDto> decorator = tx.getDecorator(ReferenceDto.class, dtoClass.getName()); if (log.isDebugEnabled()) { log.debug("Will use decorator " + decorator); } list.putClientProperty("decorator", decorator); - List<E> data = null; - if (ReferentialDto.class.isAssignableFrom(entityClass)) { + List<ReferenceDto> data; - Predicate<E> predicate = (Predicate<E>) list.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_LIST_PREDICATE); - //FIXME -// data = tx.getDataService().getList(storageService, entityClass, predicate); + if (ReferentialDto.class.isAssignableFrom(dtoClass)) { + + Predicate<ReferenceDto> predicate = (Predicate<ReferenceDto>) list.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_LIST_PREDICATE); + + ReferenceSetDto<E> referenceSetDto = getFormDto().getReferenceSetDto(dtoClass); + data = new ArrayList<>(Collections2.filter(referenceSetDto.getReference(), predicate)); } else { - data = new ArrayList<E>(); + data = new ArrayList<>(); } // sort data from first decorator context - DecoratorUtil.sort((JXPathDecorator<E>) decorator, data, 0); + DecoratorUtil.sort((JXPathDecorator<ReferenceDto>) decorator, data, 0); // set datas to list and init renderer - list.init((JXPathDecorator<E>) decorator, data); + list.init((JXPathDecorator<ReferenceDto>) decorator, data); // get the renderer initialized ListCellRenderer renderer = list.getList().getCellRenderer(); @@ -732,10 +696,10 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E list.putClientProperty("data", data); - // listen on cache modification - EntityListPropertyChangeListener<E> listener = - new EntityListPropertyChangeListener<E>(entityClass, list); //FIXME + // listen on cache modification +// EntityListPropertyChangeListener<E> listener = +// new EntityListPropertyChangeListener<E>(dtoClass, list); // DataService service = ObserveContext.get().getDataService(); // service.addReferentielPropertyChangeListener(entityClass, listener); } @@ -744,59 +708,54 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E * Prépare un component de choix d'entités pour un type d'entité donné et * pour un service de persistance donné. * - * @param <E> le type de l'entité - * @param entityClass le type de l'entité - * @param comboBox le component graphique à initialiser - * @throws DataSourceException si un pb pendant la récupération des + * @param <E> le type de l'entité + * @param comboBox le component graphique à initialiser + * @si un pb pendant la récupération des * entités */ - protected <E extends AbstractObserveDto> void prepareBeanComboBox(Class<E> entityClass, BeanComboBox<E> comboBox) { + protected <E extends IdDto> void prepareBeanComboBox(BeanComboBox<ReferenceDto> comboBox) { ObserveSwingApplicationContext context = ObserveSwingApplicationContext.get(); // init combobox - Decorator<E> decorator = context.getDecorator(entityClass); - - //FIXME -// DataService service = context.getDataService(); + Class<E> dtoClass = (Class<E>) comboBox.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_ENTITY_CLASS); + Decorator<ReferenceDto> decorator = context.getDecorator(ReferenceDto.class, dtoClass.getName()); Boolean noLoad = (Boolean) comboBox.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_LIST_NO_LOAD); - List<E> data = null; + List<ReferenceDto> data = null; if (noLoad != null && noLoad) { if (log.isInfoEnabled()) { - log.info("Skip loading of entity list [" + entityClass.getName() + "] (listNoLoad property found)"); + log.info("Skip loading of entity list [" + dtoClass.getName() + "] (listNoLoad property found)"); } data = Collections.emptyList(); } else { // get complete data list from service - Predicate<E> predicate = (Predicate<E>) comboBox.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_LIST_PREDICATE); - //FIXME -// data = service.getList(storageService, entityClass, predicate); + Predicate<ReferenceDto> predicate = (Predicate<ReferenceDto>) comboBox.getClientProperty(ObserveContentUI.CLIENT_PROPERTY_LIST_PREDICATE); - } + ReferenceSetDto<E> referenceSetDto = getFormDto().getReferenceSetDto(dtoClass); + data = new ArrayList<>(Collections2.filter(referenceSetDto.getReference(), predicate)); - boolean referenceEntity = ReferentialDto.class.isAssignableFrom(entityClass); + } - if (referenceEntity) { + boolean referentialEntity = ReferentialDto.class.isAssignableFrom(dtoClass); + if (referentialEntity) { //TC-20100208 : on ne veut pas voir les elements du referentiel non actif - //FIXME -// ReferentialDtos.filterReferentielListByStatus((List) data); + ReferentialDtos.filterReferentialListByStatus((List) data); } - if (log.isInfoEnabled()) { - log.info("entity list [" + entityClass.getName() + "] : " + data.size()); + log.info("entity list [" + dtoClass.getName() + "] : " + data.size()); } // add data list to combo box - comboBox.init((JXPathDecorator<E>) decorator, data); + comboBox.init((JXPathDecorator<ReferenceDto>) decorator, data); final ListCellRenderer renderer = comboBox.getCombobox().getRenderer(); @@ -824,25 +783,24 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E }; comboBox.getCombobox().setRenderer(toolTipRenderer); if (log.isDebugEnabled()) { - log.debug("combo list [" + entityClass.getName() + "] : " + + log.debug("combo list [" + dtoClass.getName() + "] : " + comboBox.getData().size()); } - if (referenceEntity) { + if (referentialEntity) { + //FIXME // listen on cache modification - BeanComboBoxPropertyChangeListener listener = - new BeanComboBoxPropertyChangeListener(entityClass, comboBox) { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (log.isDebugEnabled()) { - log.debug("entity list [" + evt.getPropertyName() + "]"); - } - super.propertyChange(evt); - } - }; - //FIXME +// BeanComboBoxPropertyChangeListener listener = +// new BeanComboBoxPropertyChangeListener(realEntityClass, comboBox) { +// @Override +// public void propertyChange(PropertyChangeEvent evt) { +// if (log.isDebugEnabled()) { +// log.debug("entity list [" + evt.getPropertyName() + "]"); +// } +// super.propertyChange(evt); +// } +// }; // service.addReferentielPropertyChangeListener(entityClass, listener); } @@ -856,7 +814,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E * @param <E> le type des entités */ protected static class EntityListPropertyChangeListener - <E extends AbstractObserveDto> implements PropertyChangeListener { + <E extends IdDto> implements PropertyChangeListener { /** le type des entités */ private Class<E> entityClass; @@ -904,7 +862,7 @@ public class ContentUIInitializer<E extends IdDto, UI extends ObserveContentUI<E * @param <E> le type des entités */ protected static class EntityDoubleListPropertyChangeListener - <E extends AbstractObserveDto> implements PropertyChangeListener { + <E extends IdDto> implements PropertyChangeListener { /** le type des entités */ private Class<E> entityClass; diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIManager.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIManager.java index 6ff5652..d9fcbd9 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIManager.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/ContentUIManager.java @@ -21,10 +21,26 @@ */ package fr.ird.observe.ui.content; -import fr.ird.observe.services.dto.constants.*; -import fr.ird.observe.services.dto.longline.*; -import fr.ird.observe.services.dto.referential.*; -import fr.ird.observe.services.dto.seine.*; +import fr.ird.observe.services.dto.constants.GearType; +import fr.ird.observe.services.dto.longline.ActivityLonglineDto; +import fr.ird.observe.services.dto.longline.ActivityLonglineEncouterDto; +import fr.ird.observe.services.dto.longline.ActivityLonglineSensorUsedDto; +import fr.ird.observe.services.dto.longline.SetLonglineCatchDto; +import fr.ird.observe.services.dto.longline.SetLonglineDto; +import fr.ird.observe.services.dto.longline.SetLonglineTdrDto; +import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.dto.referential.ProgramDto; +import fr.ird.observe.services.dto.seine.ActivitySeineDto; +import fr.ird.observe.services.dto.seine.ActivitySeineObservedSystemDto; +import fr.ird.observe.services.dto.seine.FloatingObjectDto; +import fr.ird.observe.services.dto.seine.FloatingObjectObservedSpeciesDto; +import fr.ird.observe.services.dto.seine.FloatingObjectSchoolEstimateDto; +import fr.ird.observe.services.dto.seine.RouteDto; +import fr.ird.observe.services.dto.seine.SetSeineDto; +import fr.ird.observe.services.dto.seine.SetSeineNonTargetCatchDto; +import fr.ird.observe.services.dto.seine.SetSeineSchoolEstimateDto; +import fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto; +import fr.ird.observe.services.dto.seine.TripSeineDto; import fr.ird.observe.ui.ObserveMainUI; import fr.ird.observe.ui.content.impl.longline.LonglineDetailCompositionUI; import fr.ird.observe.ui.content.impl.longline.LonglineGlobalCompositionUI; @@ -33,33 +49,25 @@ import fr.ird.observe.ui.content.impl.seine.ActivitySeineObservedSystemUI; import fr.ird.observe.ui.content.impl.seine.FloatingObjectTransmittingBuoyOperationUI; import fr.ird.observe.ui.content.impl.seine.FloatingObjectUI; import fr.ird.observe.ui.content.impl.seine.SetSeineUI; -import fr.ird.observe.ui.content.list.impl.longline.ActivityLonglinesUI; import fr.ird.observe.ui.content.list.impl.longline.TripLonglinesUI; -import fr.ird.observe.ui.content.list.impl.seine.ActivitySeinesUI; -import fr.ird.observe.ui.content.list.impl.seine.RoutesUI; import fr.ird.observe.ui.content.list.impl.seine.TripSeinesUI; import fr.ird.observe.ui.content.open.impl.longline.ActivityLonglineUI; import fr.ird.observe.ui.content.open.impl.longline.TripLonglineUI; import fr.ird.observe.ui.content.open.impl.seine.ActivitySeineUI; import fr.ird.observe.ui.content.open.impl.seine.RouteUI; import fr.ird.observe.ui.content.open.impl.seine.TripSeineUI; -import fr.ird.observe.ui.content.ref.ContentReferenceUI; import fr.ird.observe.ui.content.ref.ReferenceHomeUI; import fr.ird.observe.ui.content.table.impl.longline.CatchLonglineUI; import fr.ird.observe.ui.content.table.impl.longline.EncounterUI; -import fr.ird.observe.ui.content.table.impl.longline.GearUseFeaturesLonglineUI; import fr.ird.observe.ui.content.table.impl.longline.SensorUsedUI; import fr.ird.observe.ui.content.table.impl.longline.TdrUI; -import fr.ird.observe.ui.content.table.impl.seine.GearUseFeaturesSeineUI; import fr.ird.observe.ui.content.table.impl.seine.NonTargetCatchUI; -import fr.ird.observe.ui.content.table.impl.seine.NonTargetSampleUI; import fr.ird.observe.ui.content.table.impl.seine.ObjectObservedSpeciesUI; import fr.ird.observe.ui.content.table.impl.seine.ObjectSchoolEstimateUI; import fr.ird.observe.ui.content.table.impl.seine.SchoolEstimateUI; import fr.ird.observe.ui.content.table.impl.seine.TargetCatchUI; import fr.ird.observe.ui.content.table.impl.seine.TargetDiscardCatchUI; import fr.ird.observe.ui.content.table.impl.seine.TargetSampleCaptureUI; -import fr.ird.observe.ui.content.table.impl.seine.TargetSampleRejeteUI; import fr.ird.observe.ui.tree.ObserveNode; import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXInitialContext; @@ -117,25 +125,24 @@ public class ContentUIManager { addMapping(DATA, ActivitySeineDto.class, ActivitySeineUI.class); addMapping(DATA, ActivitySeineDto.class, n("observe.tree.activitySeine.unsaved"), ActivitySeineUI.class); //FIXME -// addMapping(DATA, ActivitySeineDto.class, ActivitySeineDto.PROPERTY_OBSERVED_SYSTEM, ActivitySeineObservedSystemUI.class); + addMapping(DATA, ActivitySeineDto.class, ActivitySeineObservedSystemDto.PROPERTY_OBSERVED_SYSTEM, ActivitySeineObservedSystemUI.class); addMapping(DATA, SetSeineDto.class, SetSeineUI.class); addMapping(DATA, SetSeineDto.class, n("observe.tree.setSeine.unsaved"), SetSeineUI.class); -//FIXME -// addMapping(DATA, SetSeineDto.class, SetSeineDto.PROPERTY_SCHOOL_ESTIMATE, SchoolEstimateUI.class); -// addMapping(DATA, SetSeineDto.class, SetSeineDto.PROPERTY_TARGET_CATCH, TargetCatchUI.class); + addMapping(DATA, SetSeineDto.class, SetSeineSchoolEstimateDto.PROPERTY_SCHOOL_ESTIMATE, SchoolEstimateUI.class); + addMapping(DATA, SetSeineDto.class, SetSeineTargetCatchDto.PROPERTY_TARGET_CATCH, TargetCatchUI.class); addMapping(DATA, SetSeineDto.class, SetSeineDto.PROPERTY_TARGET_DISCARDED, TargetDiscardCatchUI.class); -// addMapping(DATA, SetSeineDto.class, SetSeineDto.PROPERTY_TARGET_SAMPLE, TargetSampleRejeteUI.class); addMapping(DATA, SetSeineDto.class, SetSeineDto.PROPERTY_TARGET_SAMPLE_CAPTURE, TargetSampleCaptureUI.class); -// addMapping(DATA, SetSeineDto.class, SetSeineDto.PROPERTY_NON_TARGET_CATCH, NonTargetCatchUI.class); + addMapping(DATA, SetSeineDto.class, SetSeineNonTargetCatchDto.PROPERTY_NON_TARGET_CATCH, NonTargetCatchUI.class); +//FIXME +// addMapping(DATA, SetSeineDto.class, SetSeineDto.PROPERTY_TARGET_SAMPLE, TargetSampleRejeteUI.class); // addMapping(DATA, SetSeineDto.class, SetSeineDto.PROPERTY_NON_TARGET_SAMPLE, NonTargetSampleUI.class); addMapping(DATA, FloatingObjectDto.class, FloatingObjectUI.class); addMapping(DATA, FloatingObjectDto.class, n("observe.tree.floatingObject.unsaved"), FloatingObjectUI.class); addMapping(DATA, FloatingObjectDto.class, FloatingObjectDto.PROPERTY_OBJECT_OPERATION, FloatingObjectTransmittingBuoyOperationUI.class); -//FIXME -// addMapping(DATA, FloatingObjectDto.class, FloatingObjectDto.PROPERTY_OBJECT_OBSERVED_SPECIES, ObjectObservedSpeciesUI.class); -// addMapping(DATA, FloatingObjectDto.class, FloatingObjectDto.PROPERTY_OBJECT_SCHOOL_ESTIMATE, ObjectSchoolEstimateUI.class); + addMapping(DATA, FloatingObjectDto.class, FloatingObjectObservedSpeciesDto.PROPERTY_OBJECT_OBSERVED_SPECIES, ObjectObservedSpeciesUI.class); + addMapping(DATA, FloatingObjectDto.class, FloatingObjectSchoolEstimateDto.PROPERTY_OBJECT_SCHOOL_ESTIMATE, ObjectSchoolEstimateUI.class); // --- Longline data --- // @@ -149,19 +156,16 @@ public class ContentUIManager { addMapping(DATA, ActivityLonglineDto.class, ActivityLonglineUI.class); addMapping(DATA, ActivityLonglineDto.class, n("observe.tree.activityLongline.unsaved"), ActivityLonglineUI.class); -//FIXME -// addMapping(DATA, ActivityLonglineDto.class, ActivityLonglineDto.PROPERTY_ENCOUNTER, EncounterUI.class); -// addMapping(DATA, ActivityLonglineDto.class, ActivityLonglineDto.PROPERTY_SENSOR_USED, SensorUsedUI.class); + addMapping(DATA, ActivityLonglineDto.class, ActivityLonglineEncouterDto.PROPERTY_ENCOUNTER, EncounterUI.class); + addMapping(DATA, ActivityLonglineDto.class, ActivityLonglineSensorUsedDto.PROPERTY_SENSOR_USED, SensorUsedUI.class); addMapping(DATA, SetLonglineDto.class, SetLonglineUI.class); addMapping(DATA, SetLonglineDto.class, n("observe.tree.setLongline.unsaved"), SetLonglineUI.class); -//FIXME -// addMapping(DATA, SetLonglineDto.class, "longlineGlobalComposition", LonglineGlobalCompositionUI.class); -// addMapping(DATA, SetLonglineDto.class, "longlineDetailComposition", LonglineDetailCompositionUI.class); + addMapping(DATA, SetLonglineDto.class, "longlineGlobalComposition", LonglineGlobalCompositionUI.class); + addMapping(DATA, SetLonglineDto.class, "longlineDetailComposition", LonglineDetailCompositionUI.class); -//FIXME -// addMapping(DATA, SetLonglineDto.class, SetLonglineDto.PROPERTY_CATCH_LONGLINE, CatchLonglineUI.class); -// addMapping(DATA, SetLonglineDto.class, SetLonglineDto.PROPERTY_TDR, TdrUI.class); + addMapping(DATA, SetLonglineDto.class, SetLonglineCatchDto.PROPERTY_CATCH_LONGLINE, CatchLonglineUI.class); + addMapping(DATA, SetLonglineDto.class, SetLonglineTdrDto.PROPERTY_TDR, TdrUI.class); // --- Referential --- // diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java index b0016d7..7dd9913 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIHandler.java @@ -27,8 +27,10 @@ import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.DataSource; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.services.dto.IdDto; +import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.ReferenceDtos; -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.SpeciesListDto; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; @@ -46,6 +48,7 @@ import javax.swing.table.DefaultTableCellRenderer; import java.awt.*; import java.util.Collections; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -181,10 +184,8 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto> ex protected abstract void initTableUI(DefaultTableCellRenderer renderer); - //FIXME protected abstract String getEditBeanIdToLoad(); - //FIXME protected E loadEditBean(ContentMode mode) { String id = getEditBeanIdToLoad(); @@ -197,7 +198,6 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto> ex // preparation du bean d'édition -// dataService.loadEditEntity(dataSource, id, getLoadExecutor()); loadEditBean(id); @@ -255,12 +255,15 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto> ex } -//FIXME - protected void prepareSpeciesList(String speciesListId, JComponent speciesComponent, String errorMessage) { + public Set<String> loadSpeciesList(String speciesListId, String errorMessage) { + Set<String> speciesIds; + try { - ReferenceSetDto<SpeciesListDto> speciesList = getModel().getFormDto().getReferenceSetDto(SpeciesListDto.class); - speciesIds = new HashSet<>(Collections2.transform(speciesList.getReference(), + ReferenceDto<SpeciesListDto> speciesList = getModel().getFormDto().getReferenceById(SpeciesListDto.class, speciesListId); + LinkedHashSet<ReferentialReferenceDto<SpeciesDto>> species = + (LinkedHashSet<ReferentialReferenceDto<SpeciesDto>>) speciesList.getPropertyValue(SpeciesListDto.PROPERTY_SPECIES); + speciesIds = new HashSet<>(Collections2.transform(species, ReferenceDtos.newReferenceDtoIdFunction())); } catch (Exception e) { @@ -268,6 +271,13 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto> ex speciesIds = Collections.emptySet(); } + return speciesIds; + + } + + protected void prepareSpeciesList(String speciesListId, JComponent speciesComponent, String errorMessage) { + + Set<String> speciesIds = loadSpeciesList(speciesListId, errorMessage); speciesComponent.putClientProperty( ObserveContentUI.CLIENT_PROPERTY_LIST_PREDICATE, @@ -347,7 +357,6 @@ public abstract class ContentTableUIHandler<E extends IdDto, D extends IdDto> ex } } - //FIXME @Override protected boolean doSave(E bean) throws Exception { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIModel.java index c904691..4d4df8c 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/ContentTableUIModel.java @@ -209,15 +209,16 @@ public abstract class ContentTableUIModel<E extends IdDto, D extends IdDto> exte } public final D newTableEditBean() { - //FIXME -// try { -// Class<D> klass = -// ObserveDAOHelper.getImplementationClass(getChildType()); -// return klass.newInstance(); -// } catch (Exception ex) { -// throw new RuntimeException(ex); -// } - return null; + D result = null; + try { + result = getChildType().getConstructor().newInstance(); + + } catch (Exception ex) { + throw new RuntimeException(ex); + + } finally { + return result; + } } public boolean isCanSaveRow() { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/WeightMeasuresTableModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/WeightMeasuresTableModel.java index 1f8cf05..c315aaf 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/WeightMeasuresTableModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/WeightMeasuresTableModel.java @@ -23,6 +23,8 @@ package fr.ird.observe.ui.content.table.impl.longline; */ import fr.ird.observe.services.dto.longline.WeightMeasureDto; +import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; +import fr.ird.observe.services.dto.referential.longline.WeightMeasureTypeDto; import fr.ird.observe.ui.util.table.EditableTableWithCacheTableModelSupport; /** @@ -85,8 +87,7 @@ public class WeightMeasuresTableModel extends EditableTableWithCacheTableModelSu switch (columnIndex) { case 0: - //FIXME -// measure.setWeightMeasureType((WeightMeasureTypeDto) aValue); + measure.setWeightMeasureType((ReferentialReferenceDto<WeightMeasureTypeDto>) aValue); break; case 1: diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveTreeHelper.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveTreeHelper.java index ed629d5..776e48a 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveTreeHelper.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/ObserveTreeHelper.java @@ -78,10 +78,6 @@ public class ObserveTreeHelper extends NavTreeHelper<ObserveNode> { /** Logger. */ static private final Log log = LogFactory.getLog(ObserveTreeHelper.class); - /** le service de récupération de données. */ - //FIXME -// protected DataService dataService; - private boolean createUnsaved; public ObserveTreeHelper() { @@ -109,14 +105,6 @@ public class ObserveTreeHelper extends NavTreeHelper<ObserveNode> { } - //FIXME -// protected DataService getDataService() { -// if (dataService == null) { -// dataService = ObserveContext.get().getDataService(); -// } -// return dataService; -// } - @Override protected ObserveDataProvider getDataProvider() { ObserveDataProvider provider = (ObserveDataProvider) super.getDataProvider(); diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/table/EditableTableWithCacheTableModelSupport.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/table/EditableTableWithCacheTableModelSupport.java index 9f7b0dd..4f4573d 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/table/EditableTableWithCacheTableModelSupport.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/table/EditableTableWithCacheTableModelSupport.java @@ -24,7 +24,9 @@ package fr.ird.observe.ui.util.table; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; -import fr.ird.observe.services.dto.AbstractObserveDto; +import fr.ird.observe.services.dto.IdDto; +import org.nuiton.util.beans.Binder; +import org.nuiton.util.beans.BinderFactory; import java.util.ArrayList; import java.util.Collections; @@ -39,7 +41,7 @@ import java.util.TreeMap; * @author Tony Chemit - chemit@codelutin.com * @since 3.10 */ -public abstract class EditableTableWithCacheTableModelSupport<E extends AbstractObserveDto> extends EditableTableModelSupport<E> { +public abstract class EditableTableWithCacheTableModelSupport<E extends IdDto> extends EditableTableModelSupport<E> { private static final long serialVersionUID = 1L; @@ -50,22 +52,11 @@ public abstract class EditableTableWithCacheTableModelSupport<E extends Abstract */ protected final Map<Integer, EditableList<E>> cacheByRow; - /** - * Pour pouvoir faire des copies de chaque object. - */ - //FIXME -// protected final TopiaEntityBinder<E> loader; - protected EditableTableWithCacheTableModelSupport() { super(true); this.cacheByRow = new TreeMap<Integer, EditableList<E>>(); } - //FIXME -// public TopiaEntityBinder<E> getLoader() { -// return loader; -// } - public List<E> getCacheForRow(int rowIndex) { EditableList<E> measures = cacheByRow.get(rowIndex); return measures == null ? null : measures.getData(); @@ -148,8 +139,11 @@ public abstract class EditableTableWithCacheTableModelSupport<E extends Abstract List<E> copy = new ArrayList<E>(data.size()); for (E measure : data) { E originalMeasure = createNewRow(); - //FIXME -// loader.load(measure, originalMeasure, true); + + Class<E> sourceType = (Class<E>) originalMeasure.getClass(); + Binder<E, E> binder = BinderFactory.newBinder(sourceType); + binder.copy(measure, originalMeasure); + copy.add(originalMeasure); } return copy; diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index fa442ba..ea3216c 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -23,9 +23,8 @@ package fr.ird.observe.ui.util.tripMap; */ import fr.ird.observe.ObserveSwingApplicationContext; -import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.business.ObserveTechnicalException; -import fr.ird.observe.business.db.DataSource; +import fr.ird.observe.configuration.ObserveSwingApplicationConfig; import fr.ird.observe.entities.tripMap.TripMapPoint; import fr.ird.observe.services.dto.IdDtos; import fr.ird.observe.ui.UIHelper; @@ -107,7 +106,7 @@ public class TripMapUIHandler { //FIXME // public void doOpenMap(DataSource dataSource, DataService dataService, String tripId) { - public void doOpenMap(DataSource dataSource, Object dataService, String tripId) { + public void doOpenMap(String tripId) { try { ((CardLayout) view.getLayout()).first(view); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
participants (1)
-
codelutin.com scm