branch develop updated (7b34b56 -> beec42b)
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 7b34b56 merge new beec42b migration de l'écran des équipements de palangre (refs #7590) 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 beec42b0c2cd86a2a8bbec7bdb9f3218ea8bb2ec Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Oct 14 10:08:13 2015 +0200 migration de l'écran des équipements de palangre (refs #7590) Summary of changes: .../GearUseFeaturesLonglineTableModel.java | 21 ++- .../impl/longline/GearUseFeaturesLonglineUI.css | 9 +- .../impl/longline/GearUseFeaturesLonglineUI.jaxx | 6 +- .../longline/GearUseFeaturesLonglineUIHandler.java | 175 +++++++-------------- .../longline/GearUseFeaturesLonglineUIModel.java | 48 ++---- ...rUseFeaturesMeasurementLonglinesTableModel.java | 7 +- ...GearUseFeaturesMeasurementSeinesTableModel.java | 6 +- ...turesLonglineDto-n1-update-error-validation.xml | 0 ...ineGearUseDto-n1-update-warning-validation.xml} | 4 +- .../GearUseFeaturesLonglineServiceController.java | 70 --------- .../TripLonglineGearUseServiceController.java} | 22 +-- .../longline/GearUseFeaturesLonglineService.java | 64 -------- .../TripLonglineGearUseService.java} | 12 +- .../dto/referential/GearCaracteristicTypeDtos.java | 6 +- .../xmi/observe-services-dto-longline.properties | 1 + .../main/xmi/observe-services-dto-longline.zargo | Bin 62166 -> 63036 bytes .../services/dto/ObserveDtosInitializer.java | 9 ++ .../GearUseFeaturesLonglineServiceTopia.java | 139 ---------------- .../longline/TripLonglineGearUseServiceTopia.java | 81 ++++++++++ 19 files changed, 206 insertions(+), 474 deletions(-) copy observe-entities-validation/src/main/resources/fr/ird/observe/entities/longline/GearUseFeaturesLongline-n1-update-error-validation.xml => observe-application-swing/src/main/resources/fr/ird/observe/services/dto/longline/GearUseFeaturesLonglineDto-n1-update-error-validation.xml (100%) copy observe-application-swing/src/main/resources/fr/ird/observe/services/dto/{seine/TripSeineGearUseDto-n1-update-warning-validation.xml => longline/TripLonglineGearUseDto-n1-update-warning-validation.xml} (90%) delete mode 100644 observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/GearUseFeaturesLonglineServiceController.java copy observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/{seine/TripSeineGearUseServiceController.java => longline/TripLonglineGearUseServiceController.java} (59%) delete mode 100644 observe-services-api/src/main/java/fr/ird/observe/services/service/longline/GearUseFeaturesLonglineService.java copy observe-services-api/src/main/java/fr/ird/observe/services/service/{seine/TripSeineGearUseService.java => longline/TripLonglineGearUseService.java} (77%) delete mode 100644 observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/GearUseFeaturesLonglineServiceTopia.java create mode 100644 observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/TripLonglineGearUseServiceTopia.java -- 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 beec42b0c2cd86a2a8bbec7bdb9f3218ea8bb2ec Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Oct 14 10:08:13 2015 +0200 migration de l'écran des équipements de palangre (refs #7590) --- .../GearUseFeaturesLonglineTableModel.java | 21 ++- .../impl/longline/GearUseFeaturesLonglineUI.css | 9 +- .../impl/longline/GearUseFeaturesLonglineUI.jaxx | 6 +- .../longline/GearUseFeaturesLonglineUIHandler.java | 175 +++++++-------------- .../longline/GearUseFeaturesLonglineUIModel.java | 48 ++---- ...rUseFeaturesMeasurementLonglinesTableModel.java | 7 +- ...GearUseFeaturesMeasurementSeinesTableModel.java | 6 +- ...turesLonglineDto-n1-update-error-validation.xml | 56 +++++++ ...lineGearUseDto-n1-update-warning-validation.xml | 41 +++++ .../GearUseFeaturesLonglineServiceController.java | 70 --------- .../TripLonglineGearUseServiceController.java | 54 +++++++ ...ervice.java => TripLonglineGearUseService.java} | 26 +-- .../dto/referential/GearCaracteristicTypeDtos.java | 6 +- .../xmi/observe-services-dto-longline.properties | 1 + .../main/xmi/observe-services-dto-longline.zargo | Bin 62166 -> 63036 bytes .../services/dto/ObserveDtosInitializer.java | 9 ++ .../GearUseFeaturesLonglineServiceTopia.java | 139 ---------------- .../longline/TripLonglineGearUseServiceTopia.java | 81 ++++++++++ 18 files changed, 344 insertions(+), 411 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineTableModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineTableModel.java index 51265b9..01dd915 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineTableModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineTableModel.java @@ -23,8 +23,9 @@ package fr.ird.observe.ui.content.table.impl.longline; */ import fr.ird.observe.services.dto.longline.GearUseFeaturesLonglineDto; +import fr.ird.observe.services.dto.longline.GearUseFeaturesLonglineDtos; import fr.ird.observe.services.dto.longline.GearUseFeaturesMeasurementLonglineDto; -import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.dto.longline.TripLonglineGearUseDto; import fr.ird.observe.services.dto.referential.GearDto; import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.ui.content.table.ContentTableMeta; @@ -41,13 +42,13 @@ import java.util.List; * @author Tony Chemit - chemit@codelutin.com * @since 3.16 */ -public class GearUseFeaturesLonglineTableModel extends ContentTableModel<TripLonglineDto, GearUseFeaturesLonglineDto> { +public class GearUseFeaturesLonglineTableModel extends ContentTableModel<TripLonglineGearUseDto, GearUseFeaturesLonglineDto> { private static final long serialVersionUID = 1L; private GearUseFeaturesLonglineUIHandler gearUseFeaturesLonglineUIHandler; - public GearUseFeaturesLonglineTableModel(ObserveContentTableUI<TripLonglineDto, GearUseFeaturesLonglineDto> context, + public GearUseFeaturesLonglineTableModel(ObserveContentTableUI<TripLonglineGearUseDto, GearUseFeaturesLonglineDto> context, List<ContentTableMeta<GearUseFeaturesLonglineDto>> contentTableMetas) { super(context, contentTableMetas); } @@ -121,9 +122,9 @@ public class GearUseFeaturesLonglineTableModel extends ContentTableModel<TripLon } @Override - protected void setChilds(TripLonglineDto parent, List<GearUseFeaturesLonglineDto> childs) { - // FIXME - + protected void setChilds(TripLonglineGearUseDto parent, List<GearUseFeaturesLonglineDto> childs) { + parent.getGearUseFeaturesLongline().clear(); + parent.addAllGearUseFeaturesLongline(childs); } @Override @@ -141,15 +142,13 @@ public class GearUseFeaturesLonglineTableModel extends ContentTableModel<TripLon } @Override - protected Collection<GearUseFeaturesLonglineDto> getChilds(TripLonglineDto bean) { - // FIXME - return null; + protected Collection<GearUseFeaturesLonglineDto> getChilds(TripLonglineGearUseDto bean) { + return bean.getGearUseFeaturesLongline(); } @Override protected void load(GearUseFeaturesLonglineDto source, GearUseFeaturesLonglineDto target) { - // FIXME - + GearUseFeaturesLonglineDtos.copyGearUseFeaturesLonglineDto(source, target); } @Override diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUI.css b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUI.css index 52e9d84..61d6700 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUI.css +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUI.css @@ -85,11 +85,10 @@ minimumSize:{new Dimension(10,80)}; } -//#comment2 { - //FIXME - //_tablePropertyName: {GearUseFeaturesLonglineDto.PROPERTY_COMMENT}; - //text:{getStringValue(tableEditBean.getComment())}; -//} +#comment2 { + _tablePropertyName: {GearUseFeaturesLonglineDto.PROPERTY_COMMENT}; + text:{getStringValue(tableEditBean.getComment())}; +} #deleteSelectedMeasurement { text: "observe.gearUseFeaturesLongline.action.deleteSelectedMeasurement"; diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUI.jaxx index d345f50..d12f59b 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUI.jaxx @@ -21,7 +21,7 @@ --> <fr.ird.observe.ui.content.table.ContentTableUI - superGenericType='TripLonglineDto, GearUseFeaturesLonglineDto' + superGenericType='TripLonglineGearUseDto, GearUseFeaturesLonglineDto' contentTitle='{n("observe.gearUseFeaturesLongline.title")}' saveNewEntryText='{n("observe.action.create.gearUseFeaturesLongline")}' saveNewEntryTip='{n("observe.action.create.gearUseFeaturesLongline.tip")}'> @@ -67,9 +67,9 @@ <!-- le validateur de l'écran --> <BeanValidator id='validator' - beanClass='fr.ird.observe.services.dto.longline.TripLonglineDto' + beanClass='fr.ird.observe.services.dto.longline.TripLonglineGearUseDto' errorTableModel='{getErrorTableModel()}' - context='n1-update-gearUseFeatures'/> + context='n1-update'/> <!-- le validateur d'une entrée de tableau --> <BeanValidator id='validatorTable' 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 9a6abe7..1be573b 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 @@ -22,20 +22,29 @@ package fr.ird.observe.ui.content.table.impl.longline; * #L% */ +import com.google.common.base.Function; +import com.google.common.collect.Iterables; +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.services.dto.FormDto; +import fr.ird.observe.services.dto.ReferenceDto; +import fr.ird.observe.services.dto.ReferenceSetDto; 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.longline.TripLonglineGearUseDto; +import fr.ird.observe.services.dto.longline.TripLonglineGearUseDtos; 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.services.dto.referential.ReferentialReferenceDto; +import fr.ird.observe.services.dto.result.SaveResultDto; +import fr.ird.observe.services.service.ReferentialService; +import fr.ird.observe.services.service.longline.TripLonglineGearUseService; import fr.ird.observe.ui.ObserveMainUI; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.content.ContentMode; +import fr.ird.observe.ui.content.ContentUIInitializer; import fr.ird.observe.ui.content.table.ContentTableUIHandler; import fr.ird.observe.ui.content.table.impl.seine.GearUseFeatureMeasurementCellEditor; import fr.ird.observe.ui.content.table.impl.seine.GearUseFeatureMeasurementCellRenderer; @@ -49,14 +58,21 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; import org.nuiton.validator.NuitonValidatorScope; -import javax.swing.*; +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.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableCellRenderer; -import java.awt.*; +import java.awt.GridBagConstraints; +import java.awt.Insets; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.Serializable; +import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -71,7 +87,7 @@ import static org.nuiton.i18n.I18n.t; * @author Tony Chemit - chemit@codelutin.com * @since 3.16 */ -public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<TripLonglineDto, GearUseFeaturesLonglineDto> { +public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<TripLonglineGearUseDto, GearUseFeaturesLonglineDto> { /** Logger */ static private Log log = LogFactory.getLog(GearUseFeaturesLonglineUIHandler.class); @@ -148,18 +164,8 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip } else { - // updating mode: loading from db - //FIXME -// try { -// -// measurements = getDataService().getGearUseFeaturesMeasurementLongline(getDataSource(), bean, measurementsTableModel.getLoader()); -// if (log.isInfoEnabled()) { -// log.info("Loaded measurements (" + bean.getTopiaId() + "): " + measurements.size()); -// } -// -// } catch (DataSourceException e) { -// throw new ObserveTechnicalException("Could not load measurements", e); -// } + measurements = Lists.newArrayList(bean.getGearUseFeaturesMeasurement()); + } // init measurements @@ -216,7 +222,7 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip n("observe.gearUseFeaturesLongline.table.comment"), n("observe.gearUseFeaturesLongline.table.comment.tip")); - UIHelper.setTableColumnRenderer(table, 0, UIHelper.newDecorateTableCellRenderer(renderer, GearDto.class)); + UIHelper.setTableColumnRenderer(table, 0, UIHelper.newDecorateTableCellRenderer(renderer, ReferenceDto.class, GearDto.class.getSimpleName())); UIHelper.setTableColumnRenderer(table, 1, UIHelper.newEmptyNumberTableCellRenderer(renderer)); UIHelper.setTableColumnRenderer(table, 2, UIHelper.newBooleanTableCellRenderer(renderer)); UIHelper.setTableColumnRenderer(table, 3, UIHelper.newStringTableCellRenderer(renderer, 10, true)); @@ -232,21 +238,20 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip n("observe.gearUseFeaturesLongline.table.value"), n("observe.gearUseFeaturesLongline.table.value.tip")); - UIHelper.setTableColumnRenderer(table, 0, UIHelper.newDecorateTableCellRenderer(renderer, GearCaracteristicDto.class)); + UIHelper.setTableColumnRenderer(table, 0, UIHelper.newDecorateTableCellRenderer(renderer, ReferenceDto.class, GearCaracteristicDto.class.getSimpleName())); UIHelper.setTableColumnRenderer(table, 1, new GearUseFeatureMeasurementCellRenderer(0, renderer)); table.getTableHeader().setReorderingAllowed(false); - Decorator<GearCaracteristicDto> decorator = ObserveSwingApplicationContext.get().getDecorator(GearCaracteristicDto.class); + Decorator<ReferenceDto> decorator = ObserveSwingApplicationContext.get().getDecorator(ReferenceDto.class, GearCaracteristicDto.class.getSimpleName()); + + ReferentialService referentialService = ObserveSwingApplicationContext.get().newService(ReferentialService.class); + + ReferenceSetDto<GearCaracteristicDto> gearCaracteristicDtoRefSet = referentialService.getReferentialReferenceSet(GearCaracteristicDto.class); + + ArrayList<ReferenceDto> gearCaracteristics = Lists.newArrayList(gearCaracteristicDtoRefSet.getReference()); - //FIXME -// List<GearCaracteristic> list; -// try { -// list = getDataService().getList(getDataSource(), GearCaracteristic.class); -// } catch (DataSourceException e) { -// throw new ObserveTechnicalException("Could not get gear caracteristics", e); -// } -// UIHelper.setTableColumnEditor(table, 0, ContentUIInitializer.newDataColumnEditor(list, decorator)); + UIHelper.setTableColumnEditor(table, 0, ContentUIInitializer.newDataColumnEditor(gearCaracteristics, decorator)); UIHelper.setTableColumnEditor(table, 1, new GearUseFeatureMeasurementCellEditor(0)); GearUseFeaturesMeasurementLonglinesTableModel tableModel = getModel().getMeasurementsTableModel(); @@ -295,19 +300,6 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip } - //FIXME -// @Override -// protected TripLongline loadEditBean(ContentMode mode, DataContext dataContext, DataService dataService, DataSource dataSource) { -// -// TripLongline tripLongline = super.loadEditBean(mode, dataContext, dataService, dataSource); -// -// // reset measurements -// getModel().getMeasurementsTableModel().clear(); -// -// return tripLongline; -// -// } - @Override public void openUI() throws Exception { @@ -384,65 +376,6 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip } - //FIXME -// @Override -// protected TripLongline onCreate(TopiaContext tx, Object parentBean, TripLongline editBean) throws TopiaException { -// return super.onCreate(tx, parentBean, editBean); -// } - - //FIXME -// @Override -// protected void onUpdateFinalize(TopiaContext tx, TripLongline bean, Collection<GearUseFeaturesLongline> oldChilds) throws TopiaException { -// -// List<GearUseFeaturesLongline> gearUseFeatures = bean.getGearUseFeaturesLongline(); -// -// GearUseFeaturesLonglineUIModel model = getModel(); -// { -// -// // save measurments -// -// GearUseFeaturesMeasurementLonglineDAO measureDao = ObserveDAOHelper.getGearUseFeaturesMeasurementLonglineDAO(tx); -// -// GearUseFeaturesMeasurementLonglinesTableModel measurementsTableModel = model.getMeasurementsTableModel(); -// Set<Integer> rowsChanged = measurementsTableModel.getCacheRowsChanged(); -// -// TopiaEntityBinder<GearUseFeaturesMeasurementLongline> loader = measurementsTableModel.getLoader(); -// for (Integer row : rowsChanged) { -// -// GearUseFeaturesLongline gearUseFeaturesLongline = gearUseFeatures.get(row); -// -// List<GearUseFeaturesMeasurementLongline> measurements = measurementsTableModel.getCacheForRow(row); -// List<GearUseFeaturesMeasurementLongline> measurementsToSave = new ArrayList<GearUseFeaturesMeasurementLongline>(measurements.size()); -// -// for (GearUseFeaturesMeasurementLongline measure : measurements) { -// -// if (measurementsTableModel.isRowNotEmpty(measure)) { -// -// GearUseFeaturesMeasurementLongline measureToSave; -// -// if (measure.getTopiaId() == null) { -// measureToSave = measureDao.create(measure); -// loader.load(measureToSave, measure, true); -// } else { -// measureToSave = gearUseFeaturesLongline.getGearUseFeaturesMeasurementByTopiaId(measure.getTopiaId()); -// loader.load(measure, measureToSave, true); -// } -// -// measurementsToSave.add(measureToSave); -// -// } -// -// } -// -// gearUseFeaturesLongline.clearGearUseFeaturesMeasurement(); -// gearUseFeaturesLongline.addAllGearUseFeaturesMeasurement(measurementsToSave); -// -// } -// -// } -// -// } - @Override protected void resetEditBean() { @@ -460,7 +393,7 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip String selectedTripId = dataContext.getSelectedTripId(); - if (selectedTripId.equals(dataContext.getOpenTripId())) { + if (getOpenDataManager().isOpenTripLongline(selectedTripId)) { // mode mise a jour return ContentMode.UPDATE; @@ -530,34 +463,36 @@ public class GearUseFeaturesLonglineUIHandler extends ContentTableUIHandler<Trip public List<GearUseFeaturesMeasurementLonglineDto> getDefaultGearUseFeaturesMeasurementLongline(String gearId) { - //FIXME -// try { -// List<GearUseFeaturesMeasurementLongline> measurements = getDataService().getDefaultGearUseFeaturesMeasurementLongline(getDataSource(), gearId); -// if (log.isInfoEnabled()) { -// log.info("Create mode, use default measurements: " + measurements.size()); -// } -// return measurements; -// } catch (DataSourceException e) { -// throw new ObserveTechnicalException("Could not create default measurements", e); -// } - return null; - + GearDto gearDto = getDataSource().getObserveDto(GearDto.class, gearId); + List<GearUseFeaturesMeasurementLonglineDto> measurements = Lists.newArrayList( + Iterables.transform(gearDto.getGearCaracteristic(), + new Function<ReferentialReferenceDto<GearCaracteristicDto>, GearUseFeaturesMeasurementLonglineDto>() { + @Override + public GearUseFeaturesMeasurementLonglineDto apply(ReferentialReferenceDto<GearCaracteristicDto> input) { + GearUseFeaturesMeasurementLonglineDto measurementLonglineDto = new GearUseFeaturesMeasurementLonglineDto(); + measurementLonglineDto.setGearCaracteristic(input); + return measurementLonglineDto; + } + })); + + return measurements; } @Override - protected void doPersist(TripLonglineDto bean) { - getTripLonglineService().save(bean); + protected void doPersist(TripLonglineGearUseDto bean) { + SaveResultDto saveResult = getTripLonglineGearUseService().save(bean); + bean.setLastUpdate(saveResult.getLastUpdate()); } @Override protected void loadEditBean(String beanId) { - FormDto<TripLonglineDto> formDto = getTripLonglineService().loadToEdit(beanId); + FormDto<TripLonglineGearUseDto> formDto = getTripLonglineGearUseService().loadToEdit(beanId); getModel().setFormDto(formDto); - TripLonglineDtos.copyTripLonglineDto(formDto.getForm(), getBean()); + TripLonglineGearUseDtos.copyTripLonglineGearUseDto(formDto.getForm(), getBean()); } - protected TripLonglineService getTripLonglineService() { - return ObserveSwingApplicationContext.get().newService(TripLonglineService.class); + protected TripLonglineGearUseService getTripLonglineGearUseService() { + return ObserveSwingApplicationContext.get().newService(TripLonglineGearUseService.class); } static class SectionTemplatesAutotSelectRowAndShowPopupAction extends AutotSelectRowAndShowPopupActionSupport { diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUIModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUIModel.java index e8c9c12..4b4df39 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUIModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUIModel.java @@ -25,12 +25,11 @@ package fr.ird.observe.ui.content.table.impl.longline; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import fr.ird.observe.services.dto.longline.GearUseFeaturesLonglineDto; -import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.dto.longline.TripLonglineGearUseDto; import fr.ird.observe.ui.content.table.ContentTableMeta; import fr.ird.observe.ui.content.table.ContentTableModel; import fr.ird.observe.ui.content.table.ContentTableUIModel; import fr.ird.observe.ui.content.table.ObserveContentTableUI; -import fr.ird.observe.ui.content.table.impl.longline.GearUseFeaturesLonglineUI; import java.util.List; import java.util.Set; @@ -41,7 +40,7 @@ import java.util.Set; * @author Tony Chemit - chemit@codelutin.com * @since 3.16 */ -public class GearUseFeaturesLonglineUIModel extends ContentTableUIModel<TripLonglineDto, GearUseFeaturesLonglineDto> { +public class GearUseFeaturesLonglineUIModel extends ContentTableUIModel<TripLonglineGearUseDto, GearUseFeaturesLonglineDto> { private static final long serialVersionUID = 1L; @@ -50,10 +49,8 @@ public class GearUseFeaturesLonglineUIModel extends ContentTableUIModel<TripLong public static final Set<String> GENERAL_TAB_PROPERTIES = ImmutableSet.<String>builder().add(GearUseFeaturesLonglineDto.PROPERTY_GEAR, GearUseFeaturesLonglineDto.PROPERTY_NUMBER, - GearUseFeaturesLonglineDto.PROPERTY_USED_IN_TRIP - //FIXME -// GearUseFeaturesLonglineDto.PROPERTY_COMMENT - ).build(); + GearUseFeaturesLonglineDto.PROPERTY_USED_IN_TRIP, + GearUseFeaturesLonglineDto.PROPERTY_COMMENT).build(); protected boolean generalTabValid; @@ -61,46 +58,27 @@ public class GearUseFeaturesLonglineUIModel extends ContentTableUIModel<TripLong public GearUseFeaturesLonglineUIModel(GearUseFeaturesLonglineUI ui) { - super(TripLonglineDto.class, + super(TripLonglineGearUseDto.class, GearUseFeaturesLonglineDto.class, new String[]{ - //FIXME -// TripLonglineDto.PROPERTY_GEAR_USE_FEATURES_LONGLINE + TripLonglineGearUseDto.PROPERTY_ID, + TripLonglineGearUseDto.PROPERTY_GEAR_USE_FEATURES_LONGLINE, + TripLonglineGearUseDto.PROPERTY_LAST_UPDATE, }, new String[]{ - //FIXME -// GearUseFeaturesLonglineDto.PROPERTY_COMMENT, + GearUseFeaturesLonglineDto.PROPERTY_ID, + GearUseFeaturesLonglineDto.PROPERTY_COMMENT, GearUseFeaturesLonglineDto.PROPERTY_GEAR, GearUseFeaturesLonglineDto.PROPERTY_NUMBER, GearUseFeaturesLonglineDto.PROPERTY_USED_IN_TRIP}); - //FIXME -// BinderService binderService = ObserveServiceHelper.get().getBinderService(); - - String binderName = getClass().getName() + "-open"; - - //FIXME -// TopiaEntityBinder<GearUseFeaturesMeasurementLongline> binder = binderService.getTopiaBinder(GearUseFeaturesMeasurementLongline.class, binderName); -// -// if (binder == null) { -// -// BinderModelBuilder<GearUseFeaturesMeasurementLongline, GearUseFeaturesMeasurementLongline> builder = -// binderService.newBinderBuilder(GearUseFeaturesMeasurementLongline.class, -// GearUseFeaturesMeasurementLongline.PROPERTY_GEAR_CARACTERISTIC, -// GearUseFeaturesMeasurementLongline.PROPERTY_MEASUREMENT_VALUE); -// -// binder = binderService.registerTopiaBinder(GearUseFeaturesMeasurementLongline.class, builder, binderName); -// -// } -// this.measurementsTableModel = new GearUseFeaturesMeasurementLonglinesTableModel(); List<ContentTableMeta<GearUseFeaturesLonglineDto>> metas = Lists.newArrayList( ContentTableModel.newTableMeta(GearUseFeaturesLonglineDto.class, GearUseFeaturesLonglineDto.PROPERTY_GEAR, false), ContentTableModel.newTableMeta(GearUseFeaturesLonglineDto.class, GearUseFeaturesLonglineDto.PROPERTY_NUMBER, false), - ContentTableModel.newTableMeta(GearUseFeaturesLonglineDto.class, GearUseFeaturesLonglineDto.PROPERTY_USED_IN_TRIP, false) - //FIXME -// ContentTableModel.newTableMeta(GearUseFeaturesLonglineDto.class, GearUseFeaturesLonglineDto.PROPERTY_COMMENT, false) + ContentTableModel.newTableMeta(GearUseFeaturesLonglineDto.class, GearUseFeaturesLonglineDto.PROPERTY_USED_IN_TRIP, false), + ContentTableModel.newTableMeta(GearUseFeaturesLonglineDto.class, GearUseFeaturesLonglineDto.PROPERTY_COMMENT, false) ); initModel(ui, metas); @@ -108,7 +86,7 @@ public class GearUseFeaturesLonglineUIModel extends ContentTableUIModel<TripLong } @Override - protected GearUseFeaturesLonglineTableModel createTableModel(ObserveContentTableUI<TripLonglineDto, GearUseFeaturesLonglineDto> ui, List<ContentTableMeta<GearUseFeaturesLonglineDto>> contentTableMetas) { + protected GearUseFeaturesLonglineTableModel createTableModel(ObserveContentTableUI<TripLonglineGearUseDto, GearUseFeaturesLonglineDto> ui, List<ContentTableMeta<GearUseFeaturesLonglineDto>> contentTableMetas) { return new GearUseFeaturesLonglineTableModel(ui, contentTableMetas); } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesMeasurementLonglinesTableModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesMeasurementLonglinesTableModel.java index 1a34c4c..cfb15b0 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesMeasurementLonglinesTableModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesMeasurementLonglinesTableModel.java @@ -23,6 +23,8 @@ package fr.ird.observe.ui.content.table.impl.longline; */ import fr.ird.observe.services.dto.longline.GearUseFeaturesMeasurementLonglineDto; +import fr.ird.observe.services.dto.referential.GearCaracteristicDto; +import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.ui.util.table.EditableTableWithCacheTableModelSupport; /** @@ -99,12 +101,13 @@ public class GearUseFeaturesMeasurementLonglinesTableModel extends EditableTable switch (columnIndex) { case 0: - //FIXME -// measure.setGearCaracteristic((GearCaracteristicDto) aValue); + measure.setGearCaracteristic((ReferentialReferenceDto<GearCaracteristicDto>) aValue); + break; case 1: measure.setMeasurementValue(aValue == null ? null : String.valueOf(aValue)); + break; default: diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesMeasurementSeinesTableModel.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesMeasurementSeinesTableModel.java index 3c34671..13ef817 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesMeasurementSeinesTableModel.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/GearUseFeaturesMeasurementSeinesTableModel.java @@ -22,6 +22,8 @@ package fr.ird.observe.ui.content.table.impl.seine; * #L% */ +import fr.ird.observe.services.dto.referential.GearCaracteristicDto; +import fr.ird.observe.services.dto.referential.ReferentialReferenceDto; import fr.ird.observe.services.dto.seine.GearUseFeaturesMeasurementSeineDto; import fr.ird.observe.ui.util.table.EditableTableWithCacheTableModelSupport; @@ -98,9 +100,7 @@ public class GearUseFeaturesMeasurementSeinesTableModel extends EditableTableWit GearUseFeaturesMeasurementSeineDto measure = data.get(rowIndex); switch (columnIndex) { case 0: - - //FIXME -// measure.setGearCaracteristic((GearCaracteristicDto) aValue); + measure.setGearCaracteristic((ReferentialReferenceDto<GearCaracteristicDto>) aValue); break; case 1: diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/longline/GearUseFeaturesLonglineDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/longline/GearUseFeaturesLonglineDto-n1-update-error-validation.xml new file mode 100644 index 0000000..3a51ebc --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/longline/GearUseFeaturesLonglineDto-n1-update-error-validation.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2015 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="gear"> + + <!-- pas d'équipement selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.gearUseFeature.required.gear</message> + </field-validator> + + <!-- équipement desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ gear.enabled ]]> + </param> + <message>validator.gearUseFeature.desactivated.gear</message> + </field-validator> + + </field> + + <field name="number"> + + <!-- number non saisi --> + <field-validator type="required" short-circuit="true"> + <message>validator.gearUseFeature.required.number</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/longline/TripLonglineGearUseDto-n1-update-warning-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/longline/TripLonglineGearUseDto-n1-update-warning-validation.xml new file mode 100644 index 0000000..34eae23 --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/longline/TripLonglineGearUseDto-n1-update-warning-validation.xml @@ -0,0 +1,41 @@ +<?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="gearUseFeaturesLongline"> + + <!-- pas d'équipement --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ gearUseFeaturesLongline != null && !gearUseFeaturesLongline.empty ]]> + </param> + <message>validator.trip.null.gearUseFeature</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/GearUseFeaturesLonglineServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/GearUseFeaturesLonglineServiceController.java deleted file mode 100644 index d6776d8..0000000 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/GearUseFeaturesLonglineServiceController.java +++ /dev/null @@ -1,70 +0,0 @@ -package fr.ird.observe.application.web.controller.v1.longline; - -/* - * #%L - * ObServe :: Application Web - * %% - * Copyright (C) 2008 - 2015 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% - */ - -import fr.ird.observe.application.web.controller.v1.ObserveAuthenticatedServiceControllerSupport; -import fr.ird.observe.services.dto.FormDto; -import fr.ird.observe.services.dto.longline.GearUseFeaturesLonglineDto; -import fr.ird.observe.services.service.longline.GearUseFeaturesLonglineService; - -import java.util.List; - -/** - * @author Sylvain Bavencoff - bavencoff@codelutin.com - */ -public class GearUseFeaturesLonglineServiceController extends ObserveAuthenticatedServiceControllerSupport<GearUseFeaturesLonglineService> implements GearUseFeaturesLonglineService { - - public GearUseFeaturesLonglineServiceController() { - super(GearUseFeaturesLonglineService.class); - } - - @Override - public List<GearUseFeaturesLonglineDto> getGearUseFeaturesLonglineByTripLongline(String tripLonglineId) { - return service.getGearUseFeaturesLonglineByTripLongline(tripLonglineId); - } - - @Override - public FormDto<GearUseFeaturesLonglineDto> loadToRead(String gearUseFeaturesLonglineId) { - return service.loadToRead(gearUseFeaturesLonglineId); - } - - @Override - public FormDto<GearUseFeaturesLonglineDto> loadToEdit(String gearUseFeaturesLonglineId) { - return service.loadToEdit(gearUseFeaturesLonglineId); - } - - @Override - public FormDto<GearUseFeaturesLonglineDto> preCreate() { - return service.preCreate(); - } - - @Override - public String save(String tripLonglineId, FormDto<GearUseFeaturesLonglineDto> form) { - return service.save(tripLonglineId, form); - } - - @Override - public void delete(String tripLonglineId, String gearUseFeaturesLonglineId) { - service.delete(tripLonglineId, gearUseFeaturesLonglineId); - } -} diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/TripLonglineGearUseServiceController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/TripLonglineGearUseServiceController.java new file mode 100644 index 0000000..fd8f77a --- /dev/null +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/longline/TripLonglineGearUseServiceController.java @@ -0,0 +1,54 @@ +package fr.ird.observe.application.web.controller.v1.longline; + +/* + * #%L + * ObServe :: Application Web + * %% + * Copyright (C) 2008 - 2015 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% + */ + +import fr.ird.observe.application.web.controller.v1.ObserveAuthenticatedServiceControllerSupport; +import fr.ird.observe.services.dto.FormDto; +import fr.ird.observe.services.dto.longline.TripLonglineGearUseDto; +import fr.ird.observe.services.dto.result.SaveResultDto; +import fr.ird.observe.services.service.longline.TripLonglineGearUseService; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class TripLonglineGearUseServiceController extends ObserveAuthenticatedServiceControllerSupport<TripLonglineGearUseService> implements TripLonglineGearUseService { + + public TripLonglineGearUseServiceController() { + super(TripLonglineGearUseService.class); + } + + @Override + public FormDto<TripLonglineGearUseDto> loadToRead(String tripLonglineId) { + return service.loadToRead(tripLonglineId); + } + + @Override + public FormDto<TripLonglineGearUseDto> loadToEdit(String tripLonglineId) { + return service.loadToEdit(tripLonglineId); + } + + @Override + public SaveResultDto save(TripLonglineGearUseDto dto) { + return service.save(dto); + } +} diff --git a/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/GearUseFeaturesLonglineService.java b/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/TripLonglineGearUseService.java similarity index 61% rename from observe-services-api/src/main/java/fr/ird/observe/services/service/longline/GearUseFeaturesLonglineService.java rename to observe-services-api/src/main/java/fr/ird/observe/services/service/longline/TripLonglineGearUseService.java index 7608bf4..c66a67c 100644 --- a/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/GearUseFeaturesLonglineService.java +++ b/observe-services-api/src/main/java/fr/ird/observe/services/service/longline/TripLonglineGearUseService.java @@ -24,41 +24,27 @@ package fr.ird.observe.services.service.longline; import fr.ird.observe.services.ObserveService; import fr.ird.observe.services.dto.FormDto; -import fr.ird.observe.services.dto.longline.GearUseFeaturesLonglineDto; -import fr.ird.observe.services.spi.DeleteRequest; +import fr.ird.observe.services.dto.longline.TripLonglineGearUseDto; +import fr.ird.observe.services.dto.result.SaveResultDto; import fr.ird.observe.services.spi.PostRequest; import fr.ird.observe.services.spi.ReadDataPermission; import fr.ird.observe.services.spi.Write; import fr.ird.observe.services.spi.WriteDataPermission; -import java.util.List; - /** * @author Sylvain Bavencoff - bavencoff@codelutin.com */ -public interface GearUseFeaturesLonglineService extends ObserveService { - - @ReadDataPermission - List<GearUseFeaturesLonglineDto> getGearUseFeaturesLonglineByTripLongline(String tripLonglineId); +public interface TripLonglineGearUseService extends ObserveService { @ReadDataPermission - FormDto<GearUseFeaturesLonglineDto> loadToRead(String gearUseFeaturesLonglineId); - - @WriteDataPermission - FormDto<GearUseFeaturesLonglineDto> loadToEdit(String gearUseFeaturesLonglineId); + FormDto<TripLonglineGearUseDto> loadToRead(String TripLonglineId); @WriteDataPermission - FormDto<GearUseFeaturesLonglineDto> preCreate(); + FormDto<TripLonglineGearUseDto> loadToEdit(String TripLonglineId); @Write @WriteDataPermission @PostRequest - String save(String tripLonglineId, FormDto<GearUseFeaturesLonglineDto> form); - - @Write - @WriteDataPermission - @DeleteRequest - void delete(String tripLonglineId, String gearUseFeaturesLonglineId); - + SaveResultDto save(TripLonglineGearUseDto dto); } diff --git a/observe-services-model/src/main/java/fr/ird/observe/services/dto/referential/GearCaracteristicTypeDtos.java b/observe-services-model/src/main/java/fr/ird/observe/services/dto/referential/GearCaracteristicTypeDtos.java index 6f1edb2..bf7ddc3 100644 --- a/observe-services-model/src/main/java/fr/ird/observe/services/dto/referential/GearCaracteristicTypeDtos.java +++ b/observe-services-model/src/main/java/fr/ird/observe/services/dto/referential/GearCaracteristicTypeDtos.java @@ -52,15 +52,15 @@ public class GearCaracteristicTypeDtos extends AbstractGearCaracteristicTypeDtos if (isBoolean(gearCaracteristicTypeId)) { - value = Boolean.valueOf((String) value); + value = Boolean.valueOf(value.toString()); } else if (isInteger(gearCaracteristicTypeId)) { - value = Float.valueOf((String) value).intValue(); + value = Float.valueOf(value.toString()).intValue(); } else if (isFloat(gearCaracteristicTypeId)) { - value = Float.valueOf((String) value); + value = Float.valueOf(value.toString()); } } diff --git a/observe-services-model/src/main/xmi/observe-services-dto-longline.properties b/observe-services-model/src/main/xmi/observe-services-dto-longline.properties index 523dfa2..3096cbf 100644 --- a/observe-services-model/src/main/xmi/observe-services-dto-longline.properties +++ b/observe-services-model/src/main/xmi/observe-services-dto-longline.properties @@ -105,5 +105,6 @@ fr.ird.observe.services.dto.longline.SetLonglineDetailComposition.attribute.sect fr.ird.observe.services.dto.longline.Section.attribute.basket.stereotype=unique,ordered fr.ird.observe.services.dto.longline.Basket.attribute.branchline.stereotype=unique,ordered fr.ird.observe.services.dto.longline.GearUseFeaturesLongline.attribute.gearUseFeaturesMeasurement.stereotype=unique,ordered +fr.ird.observe.services.dto.longline.TripLonglineGearUse.attribute.gearUseFeaturesLongline.stereotype=unique,ordered fr.ird.observe.services.dto.longline.TripLongline.attribute.activityLongline.stereotype=unique,ordered diff --git a/observe-services-model/src/main/xmi/observe-services-dto-longline.zargo b/observe-services-model/src/main/xmi/observe-services-dto-longline.zargo index ec4b438..ddc81be 100644 Binary files a/observe-services-model/src/main/xmi/observe-services-dto-longline.zargo and b/observe-services-model/src/main/xmi/observe-services-dto-longline.zargo differ 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 df77ad8..8662fc8 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 @@ -144,6 +144,7 @@ import fr.ird.observe.services.dto.longline.SizeMeasureDto; import fr.ird.observe.services.dto.longline.TdrDto; import fr.ird.observe.services.dto.longline.TripLonglineActivityDto; import fr.ird.observe.services.dto.longline.TripLonglineDto; +import fr.ird.observe.services.dto.longline.TripLonglineGearUseDto; import fr.ird.observe.services.dto.longline.WeightMeasureDto; import fr.ird.observe.services.dto.referential.CountryDto; import fr.ird.observe.services.dto.referential.FpaZoneDto; @@ -539,6 +540,7 @@ public class ObserveDtosInitializer implements ObserveModelInitializer { registerMainDto(GearUseFeaturesLonglineDto.class, GearUseFeaturesLongline.class, GearUseFeaturesLonglineDto.PROPERTY_NUMBER, GearUseFeaturesLonglineDto.PROPERTY_USED_IN_TRIP, + GearUseFeaturesLonglineDto.PROPERTY_COMMENT, GearUseFeaturesLonglineDto.PROPERTY_GEAR, GearUseFeaturesLonglineDto.PROPERTY_GEAR_USE_FEATURES_MEASUREMENT ); @@ -705,6 +707,13 @@ public class ObserveDtosInitializer implements ObserveModelInitializer { } @Override + public void initTripLonglineGearUseDto() { + registerDto(TripLonglineGearUseDto.class, TripLongline.class, + TripLonglineGearUseDto.PROPERTY_GEAR_USE_FEATURES_LONGLINE, + TripLonglineGearUseDto.PROPERTY_LAST_UPDATE); + } + + @Override public void initTripLonglineDto() { registerMainDto(TripLonglineDto.class, TripLongline.class, TripLonglineDto.PROPERTY_COMMENT, diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/GearUseFeaturesLonglineServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/GearUseFeaturesLonglineServiceTopia.java deleted file mode 100644 index 79a88d1..0000000 --- a/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/GearUseFeaturesLonglineServiceTopia.java +++ /dev/null @@ -1,139 +0,0 @@ -package fr.ird.observe.services.service.longline; - -/* - * #%L - * ObServe :: Services ToPIA Implementation - * %% - * Copyright (C) 2008 - 2015 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% - */ - -import com.google.common.collect.Lists; -import fr.ird.observe.entities.longline.GearUseFeaturesLongline; -import fr.ird.observe.entities.longline.TripLongline; -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.longline.GearUseFeaturesLonglineDto; -import fr.ird.observe.services.dto.longline.GearUseFeaturesMeasurementLonglineDto; -import fr.ird.observe.services.dto.longline.TripLonglineDto; -import fr.ird.observe.services.dto.referential.GearCaracteristicDto; -import fr.ird.observe.services.dto.referential.GearDto; -import fr.ird.observe.services.service.DataNotFoundException; - -import java.util.List; - -/** - * @author Sylvain Bavencoff - bavencoff@codelutin.com - */ -public class GearUseFeaturesLonglineServiceTopia extends ObserveServiceTopia implements GearUseFeaturesLonglineService { - - @Override - public List<GearUseFeaturesLonglineDto> getGearUseFeaturesLonglineByTripLongline(String tripLonglineId) { - - TripLongline tripLongline = loadEntity(TripLonglineDto.class, TripLongline.class, tripLonglineId); - - List<GearUseFeaturesLonglineDto> dtos = Lists.newLinkedList(); - - for (GearUseFeaturesLongline features : tripLongline.getGearUseFeaturesLongline()) { - - GearUseFeaturesLonglineDto dto = entityToDto(GearUseFeaturesLonglineDto.class, GearUseFeaturesLongline.class, features); - - dtos.add(dto); - } - - return dtos; - } - - @Override - public FormDto<GearUseFeaturesLonglineDto> loadToRead(String gearUseFeaturesLonglineId) { - - GearUseFeaturesLongline featuresLongline = loadEntity(GearUseFeaturesLonglineDto.class, GearUseFeaturesLongline.class, gearUseFeaturesLonglineId); - - FormDto<GearUseFeaturesLonglineDto> form = entityToReadFormDto(GearUseFeaturesLonglineDto.class, GearUseFeaturesLongline.class, featuresLongline); - - return form; - } - - @Override - public FormDto<GearUseFeaturesLonglineDto> loadToEdit(String gearUseFeaturesLonglineId) { - - GearUseFeaturesLongline featuresLongline = loadEntity(GearUseFeaturesLonglineDto.class, GearUseFeaturesLongline.class, gearUseFeaturesLonglineId); - - FormDto<GearUseFeaturesLonglineDto> form = entityToEditFormDto( - GearUseFeaturesLonglineDto.class, - GearUseFeaturesLongline.class, - featuresLongline, - new ReferenceTypeName(GearUseFeaturesLonglineDto.class, GearDto.class, GearUseFeaturesLonglineDto.PROPERTY_GEAR), - new ReferenceTypeName(GearUseFeaturesMeasurementLonglineDto.class, GearCaracteristicDto.class, GearUseFeaturesMeasurementLonglineDto.PROPERTY_GEAR_CARACTERISTIC)); - - return form; - } - - @Override - public FormDto<GearUseFeaturesLonglineDto> preCreate() { - - GearUseFeaturesLongline featuresLongline = newEntity(GearUseFeaturesLongline.class); - - FormDto<GearUseFeaturesLonglineDto> form = entityToEditFormDto( - GearUseFeaturesLonglineDto.class, - GearUseFeaturesLongline.class, - featuresLongline, - new ReferenceTypeName(GearUseFeaturesLonglineDto.class, GearDto.class, GearUseFeaturesLonglineDto.PROPERTY_GEAR), - new ReferenceTypeName(GearUseFeaturesMeasurementLonglineDto.class, GearCaracteristicDto.class, GearUseFeaturesMeasurementLonglineDto.PROPERTY_GEAR_CARACTERISTIC)); - - return form; - } - - @Override - public String save(String tripLonglineId, FormDto<GearUseFeaturesLonglineDto> form) { - - TripLongline tripLongline = loadEntity(TripLonglineDto.class, TripLongline.class, tripLonglineId); - - GearUseFeaturesLonglineDto featuresLonglineDto = form.getForm(); - - GearUseFeaturesLongline featuresLongline = dtoToEntity(GearUseFeaturesLonglineDto.class, GearUseFeaturesLongline.class, featuresLonglineDto); - - featuresLongline = saveEntity(GearUseFeaturesLongline.class, featuresLongline); - - if (featuresLonglineDto.isNotPersisted()) { - - tripLongline.addGearUseFeaturesLongline(featuresLongline); - - saveEntity(TripLongline.class, tripLongline); - - } - - return featuresLongline.getTopiaId(); - } - - @Override - public void delete(String tripLonglineId, String gearUseFeaturesLonglineId) { - - TripLongline tripLongline = loadEntity(TripLonglineDto.class, TripLongline.class, tripLonglineId); - - GearUseFeaturesLongline featuresLongline = loadEntity(GearUseFeaturesLonglineDto.class, GearUseFeaturesLongline.class, gearUseFeaturesLonglineId); - - if (! tripLongline.containsGearUseFeaturesLongline(featuresLongline)) { - throw new DataNotFoundException(GearUseFeaturesLonglineDto.class, gearUseFeaturesLonglineId); - } - - tripLongline.removeGearUseFeaturesLongline(featuresLongline); - - } - -} diff --git a/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/TripLonglineGearUseServiceTopia.java b/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/TripLonglineGearUseServiceTopia.java new file mode 100644 index 0000000..fe89e0a --- /dev/null +++ b/observe-services-topia/src/main/java/fr/ird/observe/services/service/longline/TripLonglineGearUseServiceTopia.java @@ -0,0 +1,81 @@ +package fr.ird.observe.services.service.longline; + +/* + * #%L + * ObServe :: Services ToPIA Implementation + * %% + * Copyright (C) 2008 - 2015 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% + */ + +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.ReferenceTypeName; +import fr.ird.observe.services.dto.longline.GearUseFeaturesLonglineDto; +import fr.ird.observe.services.dto.longline.GearUseFeaturesMeasurementLonglineDto; +import fr.ird.observe.services.dto.longline.TripLonglineGearUseDto; +import fr.ird.observe.services.dto.referential.GearCaracteristicDto; +import fr.ird.observe.services.dto.referential.GearDto; +import fr.ird.observe.services.dto.result.SaveResultDto; +import fr.ird.observe.services.dto.result.SaveResultDtos; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class TripLonglineGearUseServiceTopia extends ObserveServiceTopia implements TripLonglineGearUseService { + + @Override + public FormDto<TripLonglineGearUseDto> loadToRead(String tripLonglineId) { + + TripLongline tripLongline = loadEntity(TripLonglineGearUseDto.class, TripLongline.class, tripLonglineId); + + FormDto<TripLonglineGearUseDto> form = entityToReadFormDto(TripLonglineGearUseDto.class, TripLongline.class, tripLongline); + + return form; + } + + @Override + public FormDto<TripLonglineGearUseDto> loadToEdit(String tripLonglineId) { + + TripLongline tripLongline = loadEntity(TripLonglineGearUseDto.class, TripLongline.class, tripLonglineId); + + FormDto<TripLonglineGearUseDto> form = entityToEditFormDto( + TripLonglineGearUseDto.class, + TripLongline.class, + tripLongline, + new ReferenceTypeName(GearUseFeaturesLonglineDto.class, GearDto.class, GearUseFeaturesLonglineDto.PROPERTY_GEAR), + new ReferenceTypeName(GearUseFeaturesMeasurementLonglineDto.class, GearCaracteristicDto.class, GearUseFeaturesMeasurementLonglineDto.PROPERTY_GEAR_CARACTERISTIC)); + + return form; + } + + @Override + public SaveResultDto save(TripLonglineGearUseDto dto) { + + TripLongline tripLongline = dtoToEntity(TripLonglineGearUseDto.class, TripLongline.class, dto); + + tripLongline = saveEntity(TripLongline.class, tripLongline); + + TripLonglineTopiaDao dao = getTopiaPersistenceContext().getTripLonglineDao(); + dao.updateEndDate(tripLongline); + + return SaveResultDtos.newSaveResult(tripLongline.getTopiaId(), tripLongline.getLastUpdate()); + } + +} -- 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