branch feature/7599 created (now 5d71046)
This is an automated email from the git hooks/post-receive script. New change to branch feature/7599 in repository observe. See http://git.codelutin.com/observe.git at 5d71046 migration de l'écran d'un object flottant (refs #7599) This branch includes the following new commits: new 5d71046 migration de l'écran d'un object flottant (refs #7599) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 5d71046cb6aab802de72494c6aff688f6ee4b97c Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Oct 15 10:25:48 2015 +0200 migration de l'écran d'un object flottant (refs #7599) -- 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/7599 in repository observe. See http://git.codelutin.com/observe.git commit 5d71046cb6aab802de72494c6aff688f6ee4b97c Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Oct 15 10:25:48 2015 +0200 migration de l'écran d'un object flottant (refs #7599) --- .../ird/observe/ui/content/ContentUIManager.java | 2 +- .../impl/seine/FloatingObjectUIHandler.java | 40 ++++------------------ .../observe-application-swing_fr_FR.properties | 2 +- .../services/dto/seine/FloatingObjectDtos.java | 26 ++++++++++++++ .../service/seine/FloatingObjectServiceTopia.java | 23 +++++++------ 5 files changed, 47 insertions(+), 46 deletions(-) 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 271376c..aeaca36 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 @@ -146,7 +146,7 @@ public class ContentUIManager { // addMapping(DATA, SetSeineDto.class, SetSeineDto.PROPERTY_NON_TARGET_SAMPLE, NonTargetSampleUI.class); addMapping(DATA, FloatingObjectDto.class, FloatingObjectUI.class); - addMapping(DATA, FloatingObjectDto.class, n("observe.tree.floatingObjectDto.unsaved"), FloatingObjectUI.class); + addMapping(DATA, FloatingObjectDto.class, n("observe.tree.floatingObject.unsaved"), FloatingObjectUI.class); addMapping(DATA, FloatingObjectDto.class, FloatingObjectDto.PROPERTY_OBJECT_OPERATION, FloatingObjectTransmittingBuoyOperationUI.class); addMapping(DATA, FloatingObjectDto.class, FloatingObjectObservedSpeciesDto.PROPERTY_OBJECT_OBSERVED_SPECIES, ObjectObservedSpeciesUI.class); addMapping(DATA, FloatingObjectDto.class, FloatingObjectSchoolEstimateDto.PROPERTY_OBJECT_SCHOOL_ESTIMATE, ObjectSchoolEstimateUI.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 4bc9749..d0178c9 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 @@ -24,8 +24,9 @@ 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.constants.DataContextType; -import fr.ird.observe.services.dto.FormDto; import fr.ird.observe.db.ObserveSwingDataSource; +import fr.ird.observe.services.dto.FormDto; +import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.seine.ActivitySeineDto; import fr.ird.observe.services.dto.seine.FloatingObjectDto; import fr.ird.observe.services.dto.seine.FloatingObjectDtos; @@ -77,7 +78,7 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto> // dcp existant - if (dataContext.isSelectedOpen(ActivitySeineDto.class)) { + if (getOpenDataManager().isOpenActivitySeine(dataContext.getSelectedActivitySeineId())) { // mode mise a jour return ContentMode.UPDATE; @@ -158,37 +159,17 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto> contentUIModel.setModified(create); } - //FIXME @Override protected boolean doSave(FloatingObjectDto bean) throws Exception { String activityId = getSelectedParentId(); - getFloatingObjectService().save(activityId, bean); + String floatingObjectId = getFloatingObjectService().save(activityId, bean); + bean.setId(floatingObjectId); return true; } - //FIXME -// @Override -// protected FloatingObject onCreate(TopiaContext tx, Object parent, FloatingObject editBean) throws TopiaException { -// ActivitySeine parentBean = (ActivitySeine) parent; -// FloatingObjectDAO dao = ObserveDAOHelper.getFloatingObjectDAO(tx); -// FloatingObject beanToSave = dao.create(); -// editBean.setTopiaId(beanToSave.getTopiaId()); -// parentBean.addFloatingObject(beanToSave); -// return beanToSave; -// } - - //FIXME -// @Override -// protected FloatingObject onUpdate(TopiaContext tx, Object parentBean, FloatingObject beanToSave) throws TopiaException { -// -// getLoadBinder().copy(getBean(), beanToSave); -// -// return beanToSave; -// } - @Override protected void afterSave(boolean refresh) { super.afterSave(refresh); @@ -205,8 +186,8 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto> // remove old node and recreate new node ObserveNode parentNode = treeHelper.removeNode(node); - //FIXME -// node = treeHelper.addFloatingObject(parentNode, bean); + ReferenceDto<FloatingObjectDto> beanRef = FloatingObjectDtos.newReferenceDto(bean); + node = treeHelper.addFloatingObject(parentNode, beanRef); stopEditUI(); if (refresh) { treeHelper.selectNode(node); @@ -233,13 +214,6 @@ public class FloatingObjectUIHandler extends ContentUIHandler<FloatingObjectDto> return true; } - //FIXME -// @Override -// protected void onDelete(TopiaContext tx, Object parent, FloatingObject beanToDelete) { -// ActivitySeine parentBean = (ActivitySeine) parent; -// parentBean.removeFloatingObject(beanToDelete); -// } - protected FloatingObjectService getFloatingObjectService() { return ObserveSwingApplicationContext.get().newService(FloatingObjectService.class); } diff --git a/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties b/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties index cd98046..cdaaeec 100644 --- a/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties +++ b/observe-application-swing/src/main/resources/i18n/observe-application-swing_fr_FR.properties @@ -2258,7 +2258,7 @@ observe.tree.country=Pays observe.tree.detectionMode=Mode détection observe.tree.encounter=Rencontres observe.tree.encounterType=Type de rencontre -observe.tree.floatingObjectDto.unsaved=Nouveau DCP +observe.tree.floatingObject.unsaved=Nouveau DCP observe.tree.fpaZone=Zone FPA observe.tree.gear=Équipement observe.tree.gearCaracteristic=Caractéristique d'un équipement diff --git a/observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/FloatingObjectDtos.java b/observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/FloatingObjectDtos.java new file mode 100644 index 0000000..1b01d00 --- /dev/null +++ b/observe-services-model/src/main/java/fr/ird/observe/services/dto/seine/FloatingObjectDtos.java @@ -0,0 +1,26 @@ +package fr.ird.observe.services.dto.seine; + +import com.google.common.collect.Lists; +import fr.ird.observe.services.dto.ReferenceDto; +import fr.ird.observe.services.dto.ReferenceDtos; +import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; + +public class FloatingObjectDtos extends AbstractFloatingObjectDtos { + + public static ReferenceDto<FloatingObjectDto> newReferenceDto(FloatingObjectDto floatingObjectDto) { + return newReferenceDto( + floatingObjectDto.getId(), + (String) floatingObjectDto.getObjectType().getPropertyValue(ReferentialReferenceDto.PROPERTY_LABEL)); + } + + public static ReferenceDto<FloatingObjectDto> newReferenceDto(String floatingObjectId, String objectTypeLabel) { + ReferenceDto<FloatingObjectDto> reference = ReferenceDtos.newReferenceDto(FloatingObjectDto.class, + Lists.newArrayList(FloatingObjectDto.PROPERTY_OBJECT_TYPE)); + + reference.setId(floatingObjectId); + reference.setPropertyValue(FloatingObjectDto.PROPERTY_OBJECT_TYPE, objectTypeLabel); + + return reference; + } + +} 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 0fbaea8..e46701b 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 @@ -22,7 +22,6 @@ package fr.ird.observe.services.service.seine; * #L% */ -import com.google.common.collect.Lists; import com.google.common.collect.Sets; import fr.ird.observe.entities.constants.ReferenceLocale; import fr.ird.observe.entities.seine.ActivitySeine; @@ -31,11 +30,11 @@ import fr.ird.observe.entities.seine.FloatingObjectTopiaDao; import fr.ird.observe.services.ObserveServiceTopia; import fr.ird.observe.services.dto.FormDto; 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.ReferenceSetDtos; 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.DataNotFoundException; import java.util.LinkedHashSet; @@ -54,21 +53,19 @@ public class FloatingObjectServiceTopia extends ObserveServiceTopia implements F FloatingObjectTopiaDao dao = getTopiaPersistenceContext().getFloatingObjectDao(); List<FloatingObject> allStubByActivityId = dao.findAllStubByActivityId(activitySeineId, referenceLocale); - LinkedHashSet<ReferenceDto<FloatingObjectDto>> stubs = Sets.newLinkedHashSet(); + LinkedHashSet<ReferenceDto<FloatingObjectDto>> referenceDtos = Sets.newLinkedHashSet(); for (FloatingObject floatingObject : allStubByActivityId) { - ReferenceDto<FloatingObjectDto> stub = ReferenceDtos.newReferenceDto(FloatingObjectDto.class, - Lists.newArrayList(FloatingObjectDto.PROPERTY_OBJECT_TYPE)); + ReferenceDto<FloatingObjectDto> referenceDto = FloatingObjectDtos.newReferenceDto( + floatingObject.getTopiaId(), + referenceLocale.getLabel(floatingObject.getObjectType())); - stub.setId(floatingObject.getTopiaId()); - stub.setPropertyValue(FloatingObjectDto.PROPERTY_OBJECT_TYPE, referenceLocale.getLabel(floatingObject.getObjectType())); - - stubs.add(stub); + referenceDtos.add(referenceDto); } - ReferenceSetDto<FloatingObjectDto> result = ReferenceSetDtos.newReferenceSetDto(FloatingObjectDto.class, stubs, null); + ReferenceSetDto<FloatingObjectDto> result = ReferenceSetDtos.newReferenceSetDto(FloatingObjectDto.class, referenceDtos, null); return result; } @@ -85,9 +82,13 @@ public class FloatingObjectServiceTopia extends ObserveServiceTopia implements F @Override public ReferenceDto<FloatingObjectDto> loadReferenceToRead(String floatingObjectId) { + ReferenceLocale referenceLocale = getReferenceLocale(); + FloatingObject floatingObject = loadEntity(FloatingObjectDto.class, FloatingObject.class, floatingObjectId); - ReferenceDto<FloatingObjectDto> referenceDto = entityToReferenceDto(FloatingObjectDto.class, floatingObject); + ReferenceDto<FloatingObjectDto> referenceDto = FloatingObjectDtos.newReferenceDto( + floatingObject.getTopiaId(), + referenceLocale.getLabel(floatingObject.getObjectType())); return referenceDto; } -- 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