branch develop updated (9b62f13 -> d5db9ba)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository observe. See http://git.codelutin.com/observe.git from 9b62f13 correction de la validation de l'écran activity seine (refs #7595) new 5a58912 Migration de l'écran d'opération sur l'object (refs #7600) new 563c0b7 mise en place de la validation (refs #7600) new d5db9ba Merge branch 'feature/7600' into develop The 3 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 d5db9bac75ae465738dd38beba48f8b6f87d9161 Merge: 9b62f13 563c0b7 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Oct 15 14:42:57 2015 +0200 Merge branch 'feature/7600' into develop commit 563c0b77c4d4ede024dcc2916f15d14a32a7e09d Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Oct 15 14:41:43 2015 +0200 mise en place de la validation (refs #7600) commit 5a58912739cadfd2ed9be81b37874c2c821e2dc7 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Oct 15 14:30:43 2015 +0200 Migration de l'écran d'opération sur l'object (refs #7600) Summary of changes: .../FloatingObjectTransmittingBuoyOperationUI.css | 16 +- .../FloatingObjectTransmittingBuoyOperationUI.jaxx | 9 +- ...ngObjectTransmittingBuoyOperationUIHandler.java | 167 ++++++--------------- ...tingObjectTransmittingBuoyOperationUIModel.java | 39 +---- .../loadors/FloatingObjectNodeChildLoador.java | 16 +- ...nsmittingBuoyDto-n1-update-error-validation.xml | 19 ++- .../seine/FloatingObjectTransmittingBuoyDto.java | 49 ++---- .../main/xmi/observe-services-dto-seine.properties | 1 + .../src/main/xmi/observe-services-dto-seine.zargo | Bin 60981 -> 61137 bytes .../services/builder/EntityToDtoBuilder.java | 12 ++ .../services/dto/ObserveDtosInitializer.java | 3 +- .../TransmittingBuoyOperationServiceTopia.java | 4 +- 12 files changed, 117 insertions(+), 218 deletions(-) copy observe-entities-validation/src/main/resources/fr/ird/observe/entities/seine/FloatingObject-n1-update-transmittingBuoyOperation-error-validation.xml => observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/FloatingObjectTransmittingBuoyDto-n1-update-error-validation.xml (72%) copy observe-entities/src/main/java/fr/ird/observe/entities/seine/FloatingObjectImpl.java => observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/FloatingObjectTransmittingBuoyDto.java (51%) -- 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 develop in repository observe. See http://git.codelutin.com/observe.git commit 5a58912739cadfd2ed9be81b37874c2c821e2dc7 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Oct 15 14:30:43 2015 +0200 Migration de l'écran d'opération sur l'object (refs #7600) --- .../FloatingObjectTransmittingBuoyOperationUI.css | 16 +- .../FloatingObjectTransmittingBuoyOperationUI.jaxx | 9 +- ...ngObjectTransmittingBuoyOperationUIHandler.java | 167 ++++++--------------- ...tingObjectTransmittingBuoyOperationUIModel.java | 39 +---- .../loadors/FloatingObjectNodeChildLoador.java | 16 +- .../seine/FloatingObjectTransmittingBuoyDto.java | 63 ++++++++ .../main/xmi/observe-services-dto-seine.properties | 1 + .../src/main/xmi/observe-services-dto-seine.zargo | Bin 60981 -> 61137 bytes .../services/builder/EntityToDtoBuilder.java | 12 ++ .../services/dto/ObserveDtosInitializer.java | 3 +- .../TransmittingBuoyOperationServiceTopia.java | 4 +- 11 files changed, 147 insertions(+), 183 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUI.css b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUI.css index d887732..b048673 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUI.css +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/impl/seine/FloatingObjectTransmittingBuoyOperationUI.css @@ -31,10 +31,9 @@ labelFor:{typeOperation}; } - //FIXME -//#typeOperation { -// selectedItem:{bean.getTypeTransmittingBuoyOperation()}; -//} +#typeOperation { + selectedItem:{bean.getTypeTransmittingBuoyOperation()}; +} #transmittingBuoys { visible:{typeOperation.getSelectedItem() != null}; @@ -95,11 +94,10 @@ } #country1 { - //FIXME - //property:{TransmittingBuoyDto.PROPERTY_COUNTRY}; + property:{TransmittingBuoyDto.PROPERTY_COUNTRY}; bean:{transmittingBuoy1}; showReset:true; - //selectedItem:{transmittingBuoy1.getCountry()}; + selectedItem:{transmittingBuoy1.getCountry()}; } #code1Label { @@ -161,10 +159,10 @@ } #country2 { - //property:{TransmittingBuoyDto.PROPERTY_COUNTRY}; + property:{TransmittingBuoyDto.PROPERTY_COUNTRY}; bean:{transmittingBuoy2}; showReset:true; - //selectedItem:{transmittingBuoy2.getCountry()}; + selectedItem:{transmittingBuoy2.getCountry()}; } #code2Label { 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 17116e2..fc99f0d 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 @@ -76,8 +76,7 @@ <field name="transmittingBuoyOperation" component="transmittingBuoyOperation1"/> <field name="ownership" component="ownership1"/> <field name="code" component="code1"/> - <!--FIXME--> - <!--<field name="country" component="country1"/>--> + <field name="country" component="country1"/> </BeanValidator> <BeanValidator id='validatorBalise2' @@ -89,8 +88,7 @@ <field name="transmittingBuoyOperation" component="transmittingBuoyOperation2"/> <field name="ownership" component="ownership2"/> <field name="code" component="code2"/> - <!--FIXME--> - <!--<field name="country" component="country2"/>--> + <field name="country" component="country2"/> </BeanValidator> @@ -155,7 +153,8 @@ </cell> <cell anchor='east' weightx="1" fill="both"> <BeanComboBox id='transmittingBuoyType1' constructorParams='this' - genericType='TransmittingBuoyTypeDto'/> + genericType='ReferentialReferenceDto<TransmittingBuoyTypeDto>' + _entityClass='TransmittingBuoyTypeDto.class'/> </cell> </row> <row> 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 871d86b..ca5dc47 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 @@ -21,16 +21,21 @@ */ package fr.ird.observe.ui.content.impl.seine; +import com.google.common.collect.Lists; +import fr.ird.observe.ObserveSwingApplicationContext; import fr.ird.observe.business.db.DataContext; import fr.ird.observe.business.db.constants.DataContextType; import fr.ird.observe.db.ObserveSwingDataSource; +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.FloatingObjectTransmittingBuoyDto; +import fr.ird.observe.services.dto.seine.FloatingObjectTransmittingBuoyDtos; import fr.ird.observe.services.dto.seine.TransmittingBuoyDto; +import fr.ird.observe.services.dto.seine.TransmittingBuoyDtos; import fr.ird.observe.services.service.seine.TransmittingBuoyOperationService; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; @@ -39,8 +44,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.validator.NuitonValidatorScope; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.GridLayout; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -78,7 +84,7 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH @Override protected ContentMode getContentMode(DataContext dataContext) { - if (dataContext.isSelectedOpen(ActivitySeineDto.class)) { + if (getOpenDataManager().isOpenActivitySeine(dataContext.getSelectedActivitySeineId())) { // l'activity courante est ouverte, on peut modifier return ContentMode.UPDATE; @@ -107,20 +113,31 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH FloatingObjectTransmittingBuoyDto bean = getBean(); - //FIXME -// bean.clearTransmittingBuoy(); - //FIXME: What should I do now ? bean.clearOperation(); + bean.getTransmittingBuoy().clear(); // pour etre sur que rien ne va changer pendant le chargement de l'objet. getModel().setEditing(false); - //FIXME -// getDataService().loadEditEntity(getDataSource(), dcpId, getLoadExecutor()); + FormDto<FloatingObjectTransmittingBuoyDto> formDto = getTransmittingBuoyOperationService().loadToEdit(dcpId); - //FIXME -// getUi().processDataBinding( -// FloatingObjectTransmittingBuoyOperationUI.BINDING_TYPE_OPERATION_SELECTED_ITEM); + getModel().setFormDto(formDto); + FloatingObjectTransmittingBuoyDtos.copyFloatingObjectTransmittingBuoyDto(formDto.getForm(), bean); + + if (bean.sizeTransmittingBuoy() >= 1) { + TransmittingBuoyDtos.copyTransmittingBuoyDto( + bean.getTransmittingBuoy(0), + getUi().getTransmittingBuoy1()); + + if (bean.sizeTransmittingBuoy() >= 2) { + TransmittingBuoyDtos.copyTransmittingBuoyDto( + bean.getTransmittingBuoy(1), + getUi().getTransmittingBuoy2()); + } + } + + getUi().processDataBinding( + FloatingObjectTransmittingBuoyOperationUI.BINDING_TYPE_OPERATION_SELECTED_ITEM); TypeTransmittingBuoyOperation typeOperation = getUi().getTypeOperation().getSelectedItem(); @@ -133,62 +150,12 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH } } - //FIXME -// @Override -// protected void onLoad(TopiaContext tx, FloatingObject bean) throws TopiaException { -// -// FloatingObject editBean = getBean(); -// -// // chargement du bean depuis celui qui vient de la base -// getLoadBinder().load(bean, editBean, true); -// -// editBean.clearTransmittingBuoy(); -// -// List<TransmittingBuoy> objets = bean.getTransmittingBuoy(); -// -// if (objets != null) { -// DecoratorService decoratorService = getDecoratorService(); -// Decorator<TransmittingBuoy> dB = decoratorService.getDecoratorByType(TransmittingBuoy.class); -// Decorator<TransmittingBuoyOperation> dB2 = decoratorService.getDecoratorByType(TransmittingBuoyOperation.class); -// Decorator<TransmittingBuoyType> dB3 = decoratorService.getDecoratorByType(TransmittingBuoyType.class); -// Decorator<Country> dB4 = decoratorService.getDecoratorByType(Country.class); -// for (TransmittingBuoy transmittingBuoy : objets) { -// String s = dB.toString(transmittingBuoy); -// if (log.isDebugEnabled()) { -// log.debug("use balise lue : " + s); -// } -// TransmittingBuoyOperation objectOperation = transmittingBuoy.getTransmittingBuoyOperation(); -// if (objectOperation != null) { -// s = dB2.toString(objectOperation); -// if (log.isDebugEnabled()) { -// log.debug("use objectOperation balise : " + s); -// } -// } -// TransmittingBuoyType type = transmittingBuoy.getTransmittingBuoyType(); -// if (type != null) { -// s = dB3.toString(type); -// if (log.isDebugEnabled()) { -// log.debug("use type balise : " + s); -// } -// } -// Country country = transmittingBuoy.getCountry(); -// if (country != null) { -// s = dB4.toString(country); -// if (log.isDebugEnabled()) { -// log.debug("use country : " + s); -// } -// } -// editBean.addTransmittingBuoy(transmittingBuoy); -// } -// } -// } @Override public void startEditUI(String... binding) { super.startEditUI( - //FIXME -// FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_OPERATION1_SELECTED_ITEM, -// FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_OPERATION2_SELECTED_ITEM, + FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_OPERATION1_SELECTED_ITEM, + FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_OPERATION2_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_CODE1_TEXT, FloatingObjectTransmittingBuoyOperationUI.BINDING_CODE2_TEXT, FloatingObjectTransmittingBuoyOperationUI.BINDING_OWNERSHIP1_SELECTED_ITEM, @@ -196,11 +163,10 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_TYPE1_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_TYPE2_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_BRAND1_TEXT, - FloatingObjectTransmittingBuoyOperationUI.BINDING_BRAND2_TEXT - //FIXME -// FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY1_SELECTED_ITEM, -// FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY2_SELECTED_ITEM, -// FloatingObjectTransmittingBuoyOperationUI.BINDING_TYPE_OPERATION_SELECTED_ITEM + FloatingObjectTransmittingBuoyOperationUI.BINDING_BRAND2_TEXT, + FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY1_SELECTED_ITEM, + FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY2_SELECTED_ITEM, + FloatingObjectTransmittingBuoyOperationUI.BINDING_TYPE_OPERATION_SELECTED_ITEM ); FloatingObjectTransmittingBuoyOperationUI ui = getUi(); @@ -220,18 +186,16 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH UIHelper.processDataBinding( ui, - //FIXME -// FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_OPERATION1_SELECTED_ITEM, -// FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_OPERATION2_SELECTED_ITEM, + FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_OPERATION1_SELECTED_ITEM, + FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_OPERATION2_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_CODE1_TEXT, FloatingObjectTransmittingBuoyOperationUI.BINDING_CODE2_TEXT, FloatingObjectTransmittingBuoyOperationUI.BINDING_OWNERSHIP1_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_OWNERSHIP2_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_BRAND1_TEXT, FloatingObjectTransmittingBuoyOperationUI.BINDING_BRAND2_TEXT, - //FIXME -// FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY1_SELECTED_ITEM, -// FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY2_SELECTED_ITEM, + FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY1_SELECTED_ITEM, + FloatingObjectTransmittingBuoyOperationUI.BINDING_COUNTRY2_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_TYPE1_SELECTED_ITEM, FloatingObjectTransmittingBuoyOperationUI.BINDING_TRANSMITTING_BUOY_TYPE2_SELECTED_ITEM); getModel().setModified(false); @@ -245,7 +209,6 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH return operation != null && "3".equals(operation.getPropertyValue(TransmittingBuoyOperationDto.PROPERTY_CODE)); } - //FIXME @Override protected boolean doSave(FloatingObjectTransmittingBuoyDto bean) throws Exception { @@ -254,49 +217,6 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH return true; } - //FIXME -// @Override -// protected FloatingObject onUpdate(TopiaContext tx, -// Object parentBean, -// FloatingObject beanToSave) throws TopiaException { -// -// FloatingObject editBean = getBean(); -// -// List<TransmittingBuoy> objets = editBean.getTransmittingBuoy(); -// -// beanToSave.setComment(editBean.getComment()); -// -// beanToSave.clearTransmittingBuoy(); -// -// TopiaEntityBinder<TransmittingBuoy> childLoador = getModel().getChildLoador(); -// -// TopiaDAO<TransmittingBuoy> transmittingBuoyDAO = ObserveDAOHelper.getTransmittingBuoyDAO(tx); -// -// for (TransmittingBuoy transmittingBuoy : objets) { -// TransmittingBuoy newBalise; -// -// if (transmittingBuoy.getTopiaId() == null) { -// -// // creation de la balise -// -// Map<String, Object> map = childLoador.obtainProperties(transmittingBuoy); -// -// newBalise = transmittingBuoyDAO.create(map); -// -// } else { -// -// // mise a jour de la balise -// -// newBalise = transmittingBuoyDAO.findByTopiaId(transmittingBuoy.getTopiaId()); -// -// childLoador.load(transmittingBuoy, newBalise, false); -// } -// -// beanToSave.addTransmittingBuoy(newBalise); -// } -// return beanToSave; -// } - @Override protected void afterSave(boolean refresh) { // rien a rafraichir ? @@ -422,10 +342,10 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH FloatingObjectTransmittingBuoyDto bean = getBean(); -// if (bean.getTransmittingBuoy() == null) { -// bean.setTransmittingBuoy(new ArrayList<TransmittingBuoy>()); -// } -// bean.getTransmittingBuoy().add(editBean); + if (bean.getTransmittingBuoy() == null) { + bean.setTransmittingBuoy(Lists.<TransmittingBuoyDto>newArrayList()); + } + bean.getTransmittingBuoy().add(editBean); } protected ReferentialReferenceDto<TransmittingBuoyOperationDto> getObjectOperation(List<ReferentialReferenceDto<TransmittingBuoyOperationDto>> objectOperations, @@ -445,9 +365,8 @@ public class FloatingObjectTransmittingBuoyOperationUIHandler extends ContentUIH return objectOperation; } - //FIXME protected TransmittingBuoyOperationService getTransmittingBuoyOperationService() { - return null; + return ObserveSwingApplicationContext.get().newService(TransmittingBuoyOperationService.class); } } 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 815f408..0a36c46 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 @@ -37,52 +37,19 @@ public class FloatingObjectTransmittingBuoyOperationUIModel extends ContentUIMod private static final long serialVersionUID = 1L; - //FIXME -// protected TopiaEntityBinder<TransmittingBuoyDto> childLoador; - public FloatingObjectTransmittingBuoyOperationUIModel() { super(FloatingObjectTransmittingBuoyDto.class); - - String binderName = getClass().getName() + "-open"; - - //FIXME -// BinderService binderService = ObserveServiceHelper.get().getBinderService(); - -// childLoador = binderService.getTopiaBinder(TransmittingBuoyDto.class, binderName); - -// if (childLoador == null) { - -// BinderModelBuilder<TransmittingBuoy, TransmittingBuoy> builder = binderService.newBinderBuilder( -// TransmittingBuoy.class, -// TransmittingBuoy.PROPERTY_CODE, -// TransmittingBuoy.PROPERTY_OWNERSHIP, -// TransmittingBuoy.PROPERTY_TRANSMITTING_BUOY_TYPE, -// TransmittingBuoy.PROPERTY_TRANSMITTING_BUOY_OPERATION, -// TransmittingBuoy.PROPERTY_BRAND, -// TransmittingBuoy.PROPERTY_COUNTRY); - - // enregistrement du binder -// childLoador = binderService.registerTopiaBinder(TransmittingBuoy.class, builder, binderName); - - // positionnement de l'entite empty -// childLoador.setEmpty(new TransmittingBuoyImpl()); -// } - } - //FIXME -// public TopiaEntityBinder<TransmittingBuoyDto> getChildLoador() { -// return childLoador; -// } - @Override protected BinderModelBuilder<FloatingObjectTransmittingBuoyDto, FloatingObjectTransmittingBuoyDto> createOpeningBinder(BinderService binderService, String binderName) { BinderModelBuilder<FloatingObjectTransmittingBuoyDto, FloatingObjectTransmittingBuoyDto> builder = binderService.newBinderBuilder( FloatingObjectTransmittingBuoyDto.class, - FloatingObjectTransmittingBuoyDto.PROPERTY_COMMENT -// FloatingObjectTransmittingBuoyDto.PROPERTY_OBJECT_OPERATION + FloatingObjectTransmittingBuoyDto.PROPERTY_COMMENT, + FloatingObjectTransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY ); + return builder; } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/loadors/FloatingObjectNodeChildLoador.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/loadors/FloatingObjectNodeChildLoador.java index 07bfbb1..defaa57 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/loadors/FloatingObjectNodeChildLoador.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/tree/loadors/FloatingObjectNodeChildLoador.java @@ -22,10 +22,14 @@ package fr.ird.observe.ui.tree.loadors; +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.ui.tree.ObserveNode; import fr.ird.observe.ui.tree.ObserveTreeHelper; import jaxx.runtime.swing.nav.NavDataProvider; +import java.util.ArrayList; import java.util.List; import static org.nuiton.i18n.I18n.n; @@ -55,13 +59,11 @@ public class FloatingObjectNodeChildLoador extends AbstractNodeChildLoador<Strin String parentId, NavDataProvider dataService) { - //FIXME -// List<String> result = new ArrayList<String>(); -// result.add(FloatingObjectDto.PROPERTY_OBJECT_OPERATION); -// result.add(FloatingObjectSchoolEstimateDto.PROPERTY_OBJECT_SCHOOL_ESTIMATE); -// result.add(FloatingObjectObservedSpeciesDto.PROPERTY_OBJECT_OBSERVED_SPECIES); -// return result; -return null; + List<String> result = new ArrayList<String>(); + result.add(FloatingObjectDto.PROPERTY_OBJECT_OPERATION); + result.add(FloatingObjectSchoolEstimateDto.PROPERTY_OBJECT_SCHOOL_ESTIMATE); + result.add(FloatingObjectObservedSpeciesDto.PROPERTY_OBJECT_OBSERVED_SPECIES); + return result; } @Override diff --git a/observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/FloatingObjectTransmittingBuoyDto.java b/observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/FloatingObjectTransmittingBuoyDto.java new file mode 100644 index 0000000..4ae960a --- /dev/null +++ b/observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/FloatingObjectTransmittingBuoyDto.java @@ -0,0 +1,63 @@ +package fr.ird.observe.services.dto.seine; + +import com.google.common.collect.Iterables; +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 javax.annotation.Generated; + +@Generated(value = "org.nuiton.eugene.java.SimpleJavaBeanWithNoInterfaceTransformer", date = "Thu Oct 15 11:11:56 CEST 2015") +public class FloatingObjectTransmittingBuoyDto extends AbstractFloatingObjectTransmittingBuoyDto { + + private static final long serialVersionUID = 7148959059263172961L; + + /** + * Récupère le type d'objectOperation effectué sur les balises du DCP. + * + * @return l'ordinal de l'énumeration {@link TypeTransmittingBuoyOperation} + * @see TypeTransmittingBuoyOperation + */ + public TypeTransmittingBuoyOperation getTypeTransmittingBuoyOperation() { + if (isTransmittingBuoyEmpty()) { + + // pas de balise lié au dcp. + return TypeTransmittingBuoyOperation.pasDeBalise; + } + if (transmittingBuoy.size() == 1) { + + // une seule balise lue sur le DCP, on peut avoir les cas suivants : + // - visite simple + // - récuperation + // - pose d'une nouvelle balise + TransmittingBuoyDto balise = Iterables.get(transmittingBuoy, 0); + ReferentialReferenceDto<TransmittingBuoyOperationDto> objectOperation = balise.getTransmittingBuoyOperation(); + String code = (String) objectOperation.getPropertyValue(TransmittingBuoyOperationDto.PROPERTY_CODE); + switch (Integer.valueOf(code)) { + case 1: + + // visite + return TypeTransmittingBuoyOperation.visite; + case 2: + + // recuperation + return TypeTransmittingBuoyOperation.recuperation; + case 3: + + // mise a l'eau d'une nouvelle balise + return TypeTransmittingBuoyOperation.pose; + default: + throw new IllegalStateException("objectOperation must be between 1 to 3, but was " + code); + } + } + if (transmittingBuoy.size() == 2) { + + // deux balises lues pour le DCP, on peut avoir un seul cas : + // - récupération et remplacement + return TypeTransmittingBuoyOperation.recuperationEtRemplacement; + } + throw new IllegalStateException("on a dcp, can only have 0, 1 or 2 balise lues"); + + } + +} //FloatingObjectTransmittingBuoyDto diff --git a/observe-services-model/src/main/xmi/observe-services-dto-seine.properties b/observe-services-model/src/main/xmi/observe-services-dto-seine.properties index 525496d..f1a1fda 100644 --- a/observe-services-model/src/main/xmi/observe-services-dto-seine.properties +++ b/observe-services-model/src/main/xmi/observe-services-dto-seine.properties @@ -43,6 +43,7 @@ fr.ird.observe.services.dto.seine.SchoolEstimate.attribute.species.tagValue.simp fr.ird.observe.services.dto.seine.TransmittingBuoy.attribute.transmittingBuoyType.tagValue.simpleBeanWithNoInterfaceAttributeGeneric=fr.ird.observe.services.dto.referential.seine.TransmittingBuoyTypeDto fr.ird.observe.services.dto.seine.TransmittingBuoy.attribute.transmittingBuoyOperation.tagValue.simpleBeanWithNoInterfaceAttributeGeneric=fr.ird.observe.services.dto.referential.seine.TransmittingBuoyOperationDto +fr.ird.observe.services.dto.seine.TransmittingBuoy.attribute.country.tagValue.simpleBeanWithNoInterfaceAttributeGeneric=fr.ird.observe.services.dto.referential.CountryDto fr.ird.observe.services.dto.seine.TargetLength.attribute.species.tagValue.simpleBeanWithNoInterfaceAttributeGeneric=fr.ird.observe.services.dto.referential.SpeciesDto diff --git a/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo b/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo index 2c4ddf2..9370756 100644 Binary files a/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo and b/observe-services-model/src/main/xmi/observe-services-dto-seine.zargo differ diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/builder/EntityToDtoBuilder.java b/observe-services-topia/src/main/java/fr/ird/observe/services/builder/EntityToDtoBuilder.java index 14deb43..73e62f9 100644 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/builder/EntityToDtoBuilder.java +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/builder/EntityToDtoBuilder.java @@ -22,12 +22,14 @@ package fr.ird.observe.services.builder; * #L% */ +import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; import fr.ird.observe.services.dto.IdDto; import fr.ird.observe.services.dto.ObserveDtoBinders; +import fr.ird.observe.services.dto.ObserveDtosInitializer; import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.ReferenceTypeName; import fr.ird.observe.services.dto.constants.ReferentialLocale; @@ -192,6 +194,8 @@ public class EntityToDtoBuilder<E extends TopiaEntity, D extends IdDto> implemen addProperty(propertyName, propertyValue, dtoPropertiesBuilder); continue; + } else { + propertyValue = transform(propertyValue); } @@ -314,4 +318,12 @@ public class EntityToDtoBuilder<E extends TopiaEntity, D extends IdDto> implemen public void close() { } + protected static Object transform(Object propertyValue) { + Function function = ObserveDtosInitializer.ENTITY_TO_DTO_FUNCTIONS.get(propertyValue.getClass()); + if (function != null) { + propertyValue = function.apply(propertyValue); + } + return propertyValue; + } + } 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 8662fc8..1279362 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 @@ -1617,7 +1617,8 @@ public class ObserveDtosInitializer implements ObserveModelInitializer { TransmittingBuoyDto.PROPERTY_BRAND, TransmittingBuoyDto.PROPERTY_OWNERSHIP, TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OPERATION, - TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_TYPE + TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_TYPE, + TransmittingBuoyDto.PROPERTY_COUNTRY ); } 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 9503954..67fd1cb 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 @@ -26,6 +26,7 @@ import fr.ird.observe.entities.seine.FloatingObject; import fr.ird.observe.services.ObserveServiceTopia; import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.services.dto.ReferenceTypeName; +import fr.ird.observe.services.dto.referential.CountryDto; import fr.ird.observe.services.dto.referential.seine.TransmittingBuoyOperationDto; import fr.ird.observe.services.dto.referential.seine.TransmittingBuoyTypeDto; import fr.ird.observe.services.dto.seine.FloatingObjectTransmittingBuoyDto; @@ -60,7 +61,8 @@ public class TransmittingBuoyOperationServiceTopia extends ObserveServiceTopia i FloatingObject.class, floatingObject, new ReferenceTypeName(TransmittingBuoyDto.class, TransmittingBuoyOperationDto.class, TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_OPERATION), - new ReferenceTypeName(TransmittingBuoyDto.class, TransmittingBuoyTypeDto.class, TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_TYPE)); + new ReferenceTypeName(TransmittingBuoyDto.class, TransmittingBuoyTypeDto.class, TransmittingBuoyDto.PROPERTY_TRANSMITTING_BUOY_TYPE), + new ReferenceTypeName(TransmittingBuoyDto.class, CountryDto.class, TransmittingBuoyDto.PROPERTY_COUNTRY)); return form; } -- 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 develop in repository observe. See http://git.codelutin.com/observe.git commit 563c0b77c4d4ede024dcc2916f15d14a32a7e09d Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Oct 15 14:41:43 2015 +0200 mise en place de la validation (refs #7600) --- ...nsmittingBuoyDto-n1-update-error-validation.xml | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/FloatingObjectTransmittingBuoyDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/FloatingObjectTransmittingBuoyDto-n1-update-error-validation.xml new file mode 100644 index 0000000..f0004da --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/FloatingObjectTransmittingBuoyDto-n1-update-error-validation.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="comment"> + + <!-- comentaire de moins de 1024 caractères --> + <field-validator type="stringlength"> + <param name="maxLength">1024</param> + <message>validator.floatingObject.comment.tobig</message> + </field-validator> + + <!-- comment requis selon le type de la premiere balise --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ + transmittingBuoy == null + || transmittingBuoy.empty + || transmittingBuoy.get(0) == null + || transmittingBuoy.get(0).transmittingBuoyType == null + || !transmittingBuoy.get(0).transmittingBuoyType.needComment + || (comment != null && !comment.empty) + ]]> + </param> + <message>validator.floatingObject.required.comment.for.balise1</message> + </field-validator> + + <!-- comment requis selon le type de la seconde balise --> + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ + transmittingBuoy == null + || transmittingBuoy.empty + || transmittingBuoy.size() < 2 + || transmittingBuoy.get(1) == null + || transmittingBuoy.get(1).transmittingBuoyType == null + || !transmittingBuoy.get(1).transmittingBuoyType.needComment + || (comment != null && !comment.empty) + ]]> + </param> + <message>validator.floatingObject.required.comment.for.balise2</message> + </field-validator> + + </field> +</validators> -- 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 develop in repository observe. See http://git.codelutin.com/observe.git commit d5db9bac75ae465738dd38beba48f8b6f87d9161 Merge: 9b62f13 563c0b7 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Oct 15 14:42:57 2015 +0200 Merge branch 'feature/7600' into develop .../FloatingObjectTransmittingBuoyOperationUI.css | 16 +- .../FloatingObjectTransmittingBuoyOperationUI.jaxx | 9 +- ...ngObjectTransmittingBuoyOperationUIHandler.java | 167 ++++++--------------- ...tingObjectTransmittingBuoyOperationUIModel.java | 39 +---- .../loadors/FloatingObjectNodeChildLoador.java | 16 +- ...nsmittingBuoyDto-n1-update-error-validation.xml | 69 +++++++++ .../seine/FloatingObjectTransmittingBuoyDto.java | 63 ++++++++ .../main/xmi/observe-services-dto-seine.properties | 1 + .../src/main/xmi/observe-services-dto-seine.zargo | Bin 60981 -> 61137 bytes .../services/builder/EntityToDtoBuilder.java | 12 ++ .../services/dto/ObserveDtosInitializer.java | 3 +- .../TransmittingBuoyOperationServiceTopia.java | 4 +- 12 files changed, 216 insertions(+), 183 deletions(-) -- 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