Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 74e2ce9f by Tony CHEMIT at 2018-09-13T20:46:34Z Ajout de la donnée observe_longline.SampleLogbook - Au niveau de l'activité (See #913) - - - - - 24 changed files: - client/src/main/java/fr/ird/observe/client/ui/content/ObserveFocusManager.java - client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUI.jaxx - client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUI.jcss - client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUIHandler.java - + client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUIModel.java - client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/longline/logbook/ActivityLonglineSampleLogbookNavigationTreeNode.java - client/src/main/resources/i18n/client_en_GB.properties - client/src/main/resources/i18n/client_es_ES.properties - client/src/main/resources/i18n/client_fr_FR.properties - persistence/src/main/java/fr/ird/observe/binder/data/longline/SampleLogbookEntityDtoBinder.java - persistence/src/main/java/fr/ird/observe/entities/longline/ActivityLonglineLogbookTopiaDao.java - persistence/src/main/models/Observe-06-data-longline-logbook.model - server/src/main/filtered-resources/mapping - services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/ActivityLonglineLogbookSampleServiceLocal.java - services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/ActivityLonglineLogbookServiceLocal.java - services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/SetLonglineLogbookCatchServiceLocal.java - services/src/main/java/fr/ird/observe/services/service/data/longline/ActivityLonglineLogbookSampleService.java - services/src/main/java/fr/ird/observe/services/service/data/longline/SetLonglineLogbookCatchService.java - test/src/main/resources/db/8.2/dataForTestLongline.sql.gz - test/src/main/resources/db/8.2/dataForTestSeine.sql.gz - test/src/main/resources/db/8.2/empty_h2.sql.gz - test/src/main/resources/db/8.2/empty_pg.sql.gz - test/src/main/resources/db/8.2/referentiel.sql.gz Changes: ===================================== client/src/main/java/fr/ird/observe/client/ui/content/ObserveFocusManager.java ===================================== @@ -27,6 +27,7 @@ import fr.ird.observe.client.ui.content.data.longline.GearUseFeaturesLonglineUI; import fr.ird.observe.client.ui.content.data.longline.TripLonglineListUI; import fr.ird.observe.client.ui.content.data.longline.TripLonglineUI; import fr.ird.observe.client.ui.content.data.longline.logbook.ActivityLonglineLogbookListUI; +import fr.ird.observe.client.ui.content.data.longline.logbook.ActivityLonglineLogbookSampleUI; import fr.ird.observe.client.ui.content.data.longline.logbook.ActivityLonglineLogbookUI; import fr.ird.observe.client.ui.content.data.longline.logbook.BaitsCompositionLogbookUI; import fr.ird.observe.client.ui.content.data.longline.logbook.BranchlinesCompositionLogbookUI; @@ -387,6 +388,32 @@ public class ObserveFocusManager { }); + builder.put(ActivityLonglineLogbookSampleUI.class, new ObserveLayoutFocusTraversalPolicy<ActivityLonglineLogbookSampleUI>() { + + @Override + protected Component getFirstComponentForEdit(Container aContainer) { + ActivityLonglineLogbookSampleUI ui = getUi(); + if (ui.getTableModel().isEmpty()) { + return ui.getNewEntry(); + } + return ui.getSpecies(); + } + + @Override + protected Component getLastComponentForEdit(Container aContainer) { + ActivityLonglineLogbookSampleUI ui = getUi(); + if (ui.getSave().isEnabled()) { + return ui.getSave(); + } + if (ui.getReset().isEnabled()) { + return ui.getReset(); + } + return null; + } + + }); + + builder.put(LonglineDetailCompositionObsUI.class, new ObserveLayoutFocusTraversalPolicy<LonglineDetailCompositionObsUI>() { @Override ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUI.jaxx ===================================== @@ -8,116 +8,194 @@ 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% --> -<fr.ird.observe.client.ui.content.ContentUI - i18nFormat="observe.common.SampleLogbookDto.%s" - superGenericType='SampleLogbookDto, ActivityLonglineLogbookSampleUI' - contentTitle='{n("observe.common.SampleLogbookDto.title")}'> + +<fr.ird.observe.client.ui.content.table.ContentTableUI + i18nFormat="observe.common.SamplePartLogbookDto.%s" + superGenericType='SampleLogbookDto, SamplePartLogbookDto, ActivityLonglineLogbookSampleUI' + contentTitle='{n("observe.common.SampleLogbookDto.title")}' + saveNewEntryText='{n("observe.common.SampleLogbookDto.action.create")}' + saveNewEntryTip='{n("observe.common.SampleLogbookDto.action.create.tip")}'> <style source="../../../Common.jcss"/> + <style source="../../CommonTable.jcss"/> <import> - fr.ird.observe.dto.data.longline.SampleLogbookDto + fr.ird.observe.dto.referential.SexReference + fr.ird.observe.dto.referential.SizeMeasureTypeReference + fr.ird.observe.dto.referential.LengthMeasureMethodReference + fr.ird.observe.dto.referential.WeightMeasureTypeReference + fr.ird.observe.dto.referential.WeightMeasureMethodReference + fr.ird.observe.dto.referential.SpeciesReference fr.ird.observe.dto.data.longline.SamplePartLogbookDto - fr.ird.observe.dto.referential.DataQualityReference - + fr.ird.observe.dto.data.longline.SampleLogbookDto + fr.ird.observe.client.constants.AcquisitionMode + fr.ird.observe.client.ui.content.table.* + fr.ird.observe.client.ui.util.JComment fr.ird.observe.client.ui.actions.content.ResetEditUIAction fr.ird.observe.client.ui.actions.content.SaveEditUIAction fr.ird.observe.client.ui.actions.main.global.ResetDataGlobalUIAction fr.ird.observe.client.ui.actions.main.global.SaveDataGlobalUIAction - fr.ird.observe.client.ObserveSwingApplicationContext - org.nuiton.jaxx.widgets.gis.absolute.CoordinatesEditor - org.nuiton.jaxx.widgets.datetime.DateTimeEditor + org.nuiton.jaxx.widgets.number.NumberEditor + org.nuiton.jaxx.widgets.select.BeanFilterableComboBox - java.util.Collection + java.awt.Dimension static fr.ird.observe.client.ui.util.UIHelper.getStringValue static org.nuiton.i18n.I18n.n </import> <!-- model --> - <SampleLogbookUIModel id='model'/> + <ActivityLonglineLogbookSampleUIModel id='model' constructorParams='this'/> <!-- edit bean --> <SampleLogbookDto id='bean'/> + <!-- table edit bean --> + <SamplePartLogbookDto id='tableEditBean'/> + + <!-- table model --> + <ContentTableModel id='tableModel'/> + <!-- le validateur de l'écran --> - <BeanValidator id='validator' context='update' - beanClass='fr.ird.observe.dto.data.longline.SampleLogbookDto' - errorTableModel='{getErrorTableModel()}'> - <field name='timeStamp' component='timeStamp'/> - <field name='longitude' component='coordinates'/> - <field name='latitude' component='coordinates'/> - <field name='quadrant' component='coordinates'/> - <field name='samplePartLogbook' component='samplePartLogbookPanel'/> + <BeanValidator id='validator' beanClass='fr.ird.observe.dto.data.longline.SampleLogbookDto' + errorTableModel='{getErrorTableModel()}' context='update'> </BeanValidator> - <JPanel id="body" layout='{new BorderLayout()}'> - <Table insets="0" fill="both" constraints='BorderLayout.CENTER'> - <row> - <cell weightx="1" weighty="1"> - - <JTabbedPane id='mainTabbedPane'> - - <tab id='caracteristicsTab' computeI18n=""> - - <JPanel layout='{new BorderLayout()}'> - <Table fill='both' constraints='BorderLayout.NORTH' insets="0"> - - <!-- timeStamp --> - <row> - <cell weightx="1"> - <DateTimeEditor id='timeStamp' constructorParams='this'/> - </cell> - </row> - - <!-- latitude - longitude - quadrant --> - <row> - <cell anchor="east"> - <CoordinatesEditor id='coordinates' constructorParams='this'/> - </cell> - </row> - </Table> - </JPanel> - </tab> - - <tab id='samplePartLogbookTab' computeI18n=""> - <JPanel id="samplePartLogbookPanel" layout='{new BorderLayout()}'> - <SamplePartLogbookUI id="samplePartLogbookUI" constructorParams="ObserveSwingApplicationContext.get().getMainUI()"/> - </JPanel> - </tab> - </JTabbedPane> - </cell> - </row> - </Table> - </JPanel> - - <SamplePartLogbookUIModel id="samplePartLogbookModel" initializer="samplePartLogbookUI.getModel()"/> - - <!-- actions --> - <Table id="actions" fill='both' weightx='1' insets='0'> + <!-- le validateur d'une entrée de tableau --> + <BeanValidator id='validatorTable' autoField='true' beanClass='fr.ird.observe.dto.data.longline.SamplePartLogbookDto' + errorTableModel='{getErrorTableModel()}' context='update' parentValidator='{validator}'/> + + <ButtonGroup id='acquisitionModeGroup' + onStateChanged='getHandler().updateAcquisitionMode((AcquisitionMode) acquisitionModeGroup.getSelectedValue())'/> + + <JLabel id='hideFormInformation' styleClass="skipI18n"/> + + <Table id='editorPanel' fill='both' insets='1'> + + <!-- mode de saisie --> <row> - <cell columns="2"> - <JButton id='move'/> + <cell columns="3"> + <JPanel id='acquisitionModePanel'> + <JRadioButton id='acquisitionModeEffectif'/> + <JRadioButton id='acquisitionModeIndividu'/> + </JPanel> + </cell> + </row> + + <!-- species --> + <row> + <cell> + <JLabel id='speciesLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanFilterableComboBox id='species' constructorParams='this' genericType='SpeciesReference'/> + </cell> + </row> + + <!-- count --> + <row> + <cell> + <JLabel id='countLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <NumberEditor id='count' constructorParams='this' styleClass="int6"/> + </cell> + </row> + + <!-- sizeMeasureType --> + <row> + <cell> + <JLabel id='sizeMeasureTypeLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <JPanel id='sizeMeasureTypePanel' layout='{new BorderLayout()}'> + <BeanFilterableComboBox id='sizeMeasureType' genericType='SizeMeasureTypeReference' + constructorParams='this' constraints="BorderLayout.CENTER"/> + <JButton id="defaultSizeMeasureType" constraints="BorderLayout.EAST" + onActionPerformed="getHandler().resetDefaultSizeMeasureType()"/> + </JPanel> </cell> </row> + + <!-- length --> <row> - <cell weightx="0.5"> - <JButton id='reset'/> + <cell> + <JLabel id='lengthLabel'/> </cell> - <cell weightx="0.5"> - <JButton id='save'/> + <cell weightx='1' anchor='east'> + <NumberEditor id='length' constructorParams='this' styleClass="float1"/> </cell> </row> + + <!-- sizeMeasureMethod --> + <row> + <cell> + <JLabel id='lengthMeasureMethodLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanFilterableComboBox id='lengthMeasureMethod' constructorParams='this' genericType='LengthMeasureMethodReference'/> + </cell> + </row> + + <!-- weightMeasureType --> + <row> + <cell> + <JLabel id='weightMeasureTypeLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanFilterableComboBox id='weightMeasureType' constructorParams='this' genericType='WeightMeasureTypeReference'/> + </cell> + </row> + <!-- weightMeasureMethod --> + <row> + <cell> + <JLabel id='weightMeasureMethodLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanFilterableComboBox id='weightMeasureMethod' constructorParams='this' genericType='WeightMeasureMethodReference'/> + </cell> + </row> + + <!-- weight --> + <row> + <cell> + <JLabel id='weightLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <NumberEditor id='weight' constructorParams='this' styleClass="float2"/> + </cell> + </row> + + <!-- sex --> + <row> + <cell> + <JLabel id='sexLabel'/> + </cell> + <cell weightx='1' anchor='east'> + <BeanFilterableComboBox id='sex' genericType='SexReference' constructorParams='this'/> + </cell> + </row> + </Table> -</fr.ird.observe.client.ui.content.ContentUI> + <!--FIXME Voir comment juste ajouter des actions à la table parent--> + <Table id="actions" fill='both' weightx='1' insets='0'> + <row> + <cell columns="2"> + <JButton id='move'/> + </cell> + </row> + </Table> +</fr.ird.observe.client.ui.content.table.ContentTableUI> ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUI.jcss ===================================== @@ -20,56 +20,77 @@ * #L% */ -#model { - editable:true; - modified:{validator.isChanged() || samplePartLogbookModel.isModified()}; - valid:{validator.isValid() && samplePartLogbookModel.isValid()}; - enabled:{!model.isReadingMode()}; +#species { + selectedItem:{tableEditBean.getSpecies()}; } -/* ***************************************************************************** */ -/* CARACTERISTICS TAB ********************************************************* */ -/* ***************************************************************************** */ +#sizeMeasureType { + selectedItem:{tableEditBean.getSizeMeasureType()}; +} + +#lengthMeasureMethod { + selectedItem:{tableEditBean.getLengthMeasureMethod()}; +} + +#weightMeasureType { + selectedItem:{tableEditBean.getWeightMeasureType()}; +} + +#weightMeasureMethod { + selectedItem:{tableEditBean.getWeightMeasureMethod()}; +} + +#sex { + selectedItem:{tableEditBean.getSex()}; +} -#caracteristicsTab { - icon:{handler.getErrorIconIfFalse(model.isCaracteristicsTabValid())}; +#count { + property:{SamplePartLogbookDto.PROPERTY_COUNT}; + numberValue:{tableEditBean.getCount()}; } -#timeStamp { - date:{bean.getTimeStamp()}; - propertyDate: {SampleLogbookDto.PROPERTY_TIME_STAMP}; - propertyDayDate: {SampleLogbookDto.PROPERTY_DATE}; - propertyTimeDate: {SampleLogbookDto.PROPERTY_TIME}; +#length { + numberValue:{tableEditBean.getLength()}; } -#coordinates { - propertyLatitude:{SampleLogbookDto.PROPERTY_LATITUDE}; - propertyLongitude:{SampleLogbookDto.PROPERTY_LONGITUDE}; - propertyQuadrant:{SampleLogbookDto.PROPERTY_QUADRANT}; - latitude:{bean.getLatitude()}; - longitude:{bean.getLongitude()}; - quadrant:{bean.getQuadrant()}; +#weight { + numberValue:{tableEditBean.getWeight()}; } -/* ***************************************************************************** */ -/* SAMPLE PART TAB ************************************************************ */ -/* ***************************************************************************** */ +#acquisitionModeGroup { + selectedValue:{AcquisitionMode.valueOf(tableEditBean.getAcquisitionMode())}; +} + +#acquisitionModePanel { + border:{new TitledBorder(t("observe.common.acquisitionMode"))}; + layout:{new GridLayout(1,0)}; +} -#samplePartLogbookTab { - icon:{handler.getErrorIconIfFalse(model.isSamplePartLogbookTabValid())}; +#acquisitionModeEffectif { + buttonGroup:"acquisitionModeGroup"; + value:{AcquisitionMode.byEffectif}; + text:{AcquisitionMode.byEffectif.toString()}; + selected:{tableEditBean.getAcquisitionMode() == 0}; + enabled:{!tableModel.isEditable() || tableModel.isCreate()}; } -#save { - _globalAction:{SaveDataGlobalUIAction.ACTION_NAME}; +#acquisitionModeIndividu { + buttonGroup:"acquisitionModeGroup"; + value:{AcquisitionMode.byIndividu}; + text:{AcquisitionMode.byIndividu.toString()}; + selected:{tableEditBean.getAcquisitionMode() == 1}; + enabled:{!tableModel.isEditable() || tableModel.isCreate()}; } -#reset { - _globalAction:{ResetDataGlobalUIAction.ACTION_NAME}; +#defaultSizeMeasureType { + actionIcon:combobox-reset2; + toolTipText:"observe.common.Sample.action.resetDefaultSizeMeasureType.tip"; } #move { text:"observe.common.SampleLogbookDto.move"; actionIcon:"move-activities"; mnemonic:A; - enabled:{model.isUpdatingMode() && model.isValid() && !model.isModified()}; + visible:{model.isUpdatingMode()}; + enabled:{model.isValid() && !model.isModified()}; } ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUIHandler.java ===================================== @@ -10,23 +10,25 @@ package fr.ird.observe.client.ui.content.data.longline.logbook; * 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.client.ObserveSwingApplicationContext; -import fr.ird.observe.client.db.ObserveSwingDataSource; +import fr.ird.observe.client.constants.AcquisitionMode; import fr.ird.observe.client.ui.content.ContentMode; -import fr.ird.observe.client.ui.content.ContentUIHandler; -import fr.ird.observe.client.validation.ClientValidationContext; +import fr.ird.observe.client.ui.content.table.ContentTableModel; +import fr.ird.observe.client.ui.content.table.ContentTableUIHandler; +import fr.ird.observe.client.ui.util.UIHelper; import fr.ird.observe.dto.data.longline.ActivityLonglineLogbookDto; import fr.ird.observe.dto.data.longline.SampleLogbookDto; import fr.ird.observe.dto.data.longline.SampleLogbookHelper; @@ -34,22 +36,30 @@ import fr.ird.observe.dto.data.longline.SamplePartLogbookDto; import fr.ird.observe.dto.form.Form; import fr.ird.observe.dto.form.FormDefinition; import fr.ird.observe.dto.navigation.edit.node.ObserveLonglineLogbookActivityEditNode; -import fr.ird.observe.dto.navigation.select.node.ObserveLonglineLogbookActivitySampleSelectNode; +import fr.ird.observe.dto.navigation.select.node.ObserveLonglineLogbookActivitySelectNode; +import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet; +import fr.ird.observe.dto.referential.SexReference; +import fr.ird.observe.dto.referential.SizeMeasureTypeReference; +import fr.ird.observe.dto.referential.SpeciesReference; +import fr.ird.observe.dto.referential.WeightMeasureTypeReference; import fr.ird.observe.dto.result.SaveResultDto; import fr.ird.observe.spi.DtoModelHelper; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.nuiton.jaxx.runtime.spi.UIHandler; -import org.nuiton.jaxx.validator.swing.SwingValidatorMessage; -import org.nuiton.jaxx.validator.swing.SwingValidatorMessageTableModel; import org.nuiton.validator.NuitonValidatorScope; -import javax.swing.event.TableModelListener; -import java.util.Date; -import java.util.HashSet; +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.table.DefaultTableCellRenderer; +import java.awt.GridBagConstraints; +import java.awt.Insets; +import java.beans.PropertyChangeListener; +import java.util.LinkedList; +import java.util.List; import java.util.Optional; -import java.util.Set; +import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; /** @@ -58,214 +68,243 @@ import static org.nuiton.i18n.I18n.t; * @author Tony Chemit - dev@tchemit.fr * @since 3.8 */ -public class ActivityLonglineLogbookSampleUIHandler extends ContentUIHandler<SampleLogbookDto, ActivityLonglineLogbookSampleUI> implements UIHandler<ActivityLonglineLogbookSampleUI> { +public class ActivityLonglineLogbookSampleUIHandler extends ContentTableUIHandler<SampleLogbookDto, SamplePartLogbookDto, ActivityLonglineLogbookSampleUI> implements UIHandler<ActivityLonglineLogbookSampleUI> { - private static final Logger log = LogManager.getLogger(ActivityLonglineLogbookSampleUIHandler.class); - protected final TableModelListener computeTabValidStateListener; + private static final Logger log = LogManager.getLogger(SamplePartLogbookUIHandler.class); + private final PropertyChangeListener speciesChanged; ActivityLonglineLogbookSampleUIHandler() { - super(ObserveLonglineLogbookActivitySampleSelectNode.class, ObserveLonglineLogbookActivityEditNode.class); - computeTabValidStateListener = e -> { - SwingValidatorMessageTableModel source = (SwingValidatorMessageTableModel) e.getSource(); - computeTabValidState(source); - }; - } - - @Override - protected void installFocusTraversalPolicy() { - // rien a installer - } + super(ObserveLonglineLogbookActivitySelectNode.class, ObserveLonglineLogbookActivityEditNode.class); + addReferentialFilter(SamplePartLogbookDto.PROPERTY_SPECIES, incomingReferences -> { + String setId = ObserveSwingApplicationContext.get().getNavigationEdit().getLongline().getSetLogbook().getId(); + if (setId == null) { + return new LinkedList<>(); + } + ReferentialDtoReferenceSet<SpeciesReference> sampleSpecies = getSetLonglineLogbookCatchService().getSampleSpecies(setId); + return new LinkedList<>(sampleSpecies.toSet()); + }); - @Override - protected boolean computeCanWrite(ObserveSwingDataSource dataSource) { - return dataSource.canWriteData(); + speciesChanged = evt -> onSpeciesChanged((SpeciesReference) evt.getNewValue()); } @Override protected ContentMode getContentMode() { - String selectedId = getSelectedId(); - if (selectedId == null) { - return ContentMode.CREATE; - } - if (selectedId.equals(getEditNode().getId())) { - return ContentMode.UPDATE; - } - addMessage(getUi(), - NuitonValidatorScope.INFO, - getTypeI18nKey(ActivityLonglineLogbookDto.class), - t("observe.common.ActivityLonglineLogbookDto.message.not.open")); - return ContentMode.READ; - } - - @Override - public void afterInit(ActivityLonglineLogbookSampleUI ui) { - super.afterInit(ui); - { - // init floatlinesComposition tab - SamplePartLogbookUI compositionUI = ui.getSamplePartLogbookUI(); - ui.getSamplePartLogbookPanel().remove(compositionUI); - ui.getSamplePartLogbookPanel().add(compositionUI.getBody()); + ContentMode contentMode = super.getContentMode(); + if (ContentMode.READ == contentMode) { + addMessage(getUi(), + NuitonValidatorScope.INFO, + getTypeI18nKey(ActivityLonglineLogbookDto.class), + t("observe.common.ActivityLonglineObsDto.message.not.open")); } - getModel().addPropertyChangeListener(SampleLogbookUIModel.PROPERTY_MODE, evt -> { - showIndividualTabs(evt.getNewValue() != ContentMode.CREATE); - }); + return contentMode; } + @SuppressWarnings("unchecked") @Override - public void openUI() { - - getUi().getCoordinates().resetModel(); + protected void onSelectedRowChanged(int editingRow, + SamplePartLogbookDto bean, + boolean create) { + ContentTableModel<SampleLogbookDto, SamplePartLogbookDto> model = getTableModel(); - super.openUI(); + if (!model.isEditable()) { + return; + } - String activityId = getSelectedParentId(); - String setId = getSelectedId(); + SamplePartLogbookDto tableEditBean = getTableEditBean(); + tableEditBean.removePropertyChangeListener(SamplePartLogbookDto.PROPERTY_SPECIES, speciesChanged); - if (log.isInfoEnabled()) { - log.info("tripId = " + activityId); - log.info("setId = " + setId); + SpeciesReference species = bean.getSpecies(); + ActivityLonglineLogbookSampleUI ui = getUi(); + if (log.isDebugEnabled()) { + log.debug("selected species " + species); } - ContentMode mode = computeContentMode(); + List<SpeciesReference> availableSpecies; + JComponent requestFocus; + Optional<SizeMeasureTypeReference> sizeMeasureType; - // update mode - Form<SampleLogbookDto> form; - if (setId == null) { - // create mode - form = getTripLonglineSampleLogbookService().preCreate(activityId); - } else { - // update mode - form = getTripLonglineSampleLogbookService().loadForm(setId); - } + if (create) { - loadReferentialReferenceSetsInModel(form); + if (model.isCreate()) { - getModel().setForm(form); - SampleLogbookHelper.copySampleLogbookDto(form.getObject(), getBean()); - - SampleLogbookDto bean = getBean(); - bean.setTimeStamp(new Date()); + // on passe le mode de saisie en count + ui.getAcquisitionModeGroup().setSelectedValue(null); + ui.getAcquisitionModeGroup().setSelectedValue(AcquisitionMode.byEffectif); + } - // utilisation du mode requis - setContentMode(mode); + availableSpecies = getModel().getReferentialReferences(SamplePartLogbookDto.PROPERTY_SPECIES); + // on utilise le code par defaut de l'espèce + sizeMeasureType = getSpeciesDefaultSizeMeasureType(species); + getUi().getModel().setDefaultSizeMeasureType(sizeMeasureType.orElse(null)); - // 1. Mise à jour latitude/longitude: - getUi().getCoordinates().setLatitudeAndLongitude(bean.getLatitude(), bean.getLongitude()); - // 2. Mise à jour du quadrant : - // Si le bean de données contient un quadrant, on met simplement à jour le composant de coordonnées pour sélectionner le quadrant voulu - // sinon, on réinitialise les quadrants du composant afin qu'aucun d'eux ne soit sélectionné (par exemple dans le cas de la création de la première activité d'une route) - if (bean.getQuadrant() == null) { - getUi().getCoordinates().resetQuadrant(); + requestFocus = ui.getSpecies(); } else { - getUi().getCoordinates().setQuadrant(bean.getQuadrant()); - } - { - // open floatlinesComposition tab - SamplePartLogbookUIModel floatlinesCompositionModel = getUi().getSamplePartLogbookModel(); - floatlinesCompositionModel.setReferentialReferenceSets(getModel().getReferentialReferenceSets()); + requestFocus = ui.getCount(); - Optional<FormDefinition<SamplePartLogbookDto>> optionalFormDefinition = DtoModelHelper.getOptionalFormDefinition(SamplePartLogbookDto.class); - optionalFormDefinition.ifPresent(getUi().getSamplePartLogbookUI().getHandler()::loadReferentialReferenceSetsInModel); + // on passe le mode de saisie + int acquisitionMode = bean.getAcquisitionMode(); + AcquisitionMode enumValue = AcquisitionMode.valueOf(acquisitionMode); + ui.getAcquisitionModeGroup().setSelectedValue(null); + ui.getAcquisitionModeGroup().setSelectedValue(enumValue); - floatlinesCompositionModel.setForm(form); - SampleLogbookHelper.copySampleLogbookDto(form.getObject(), floatlinesCompositionModel.getBean()); + availableSpecies = Lists.newArrayList(species); - SamplePartLogbookUI compositionUI = getUi().getSamplePartLogbookUI(); - compositionUI.open(); - compositionUI.getValidator().setBean(null); + sizeMeasureType = Optional.ofNullable(bean.getSizeMeasureType()); } - if (mode != ContentMode.READ) { - getUi().startEdit(null); - } - // To be sure always remove listener (could prevent some leaks) - getUi().getErrorTableModel().removeTableModelListener(computeTabValidStateListener); - // listen messages to see if required to add - getUi().getErrorTableModel().addTableModelListener(computeTabValidStateListener); + ui.getSizeMeasureType().setSelectedItem(null); + sizeMeasureType.ifPresent(sizeMeasureTypeDtoReferentialReference -> ui.getSizeMeasureType().setSelectedItem(sizeMeasureTypeDtoReferentialReference)); + + ui.getSpecies().setData(availableSpecies); + UIHelper.askFocus(requestFocus); - SwingValidatorMessageTableModel errorTableModel = getUi().getErrorTableModel(); - computeTabValidState(errorTableModel); + tableEditBean.addPropertyChangeListener(SamplePartLogbookDto.PROPERTY_SPECIES, speciesChanged); } @Override - protected void prepareValidationContext() { - super.prepareValidationContext(); - ClientValidationContext validationContext = ObserveSwingApplicationContext.get().getValidationContext(); - validationContext.setCoordinatesEditor("coordinate", getUi().getCoordinates()); + public void afterInit(ActivityLonglineLogbookSampleUI ui) { + super.afterInit(ui); + getUi().getActions().add(getUi().getReset(), new GridBagConstraints(0, 1, 1, 1, 0.5, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0)); + getUi().getActions().add(getUi().getSave(), new GridBagConstraints(1, 1, 1, 1, 0.5, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0)); } - @Override - public void startEditUI(String... binding) { - SampleLogbookUIModel model = getModel(); - boolean create = model.getMode() == ContentMode.CREATE; - String contextName = getValidatorContextName(model.getMode()); - getUi().getValidator().setContext(contextName); - if (create) { - addInfoMessage(t("observe.common.SampleLogbook.message.creating")); - } else { - addInfoMessage(t("observe.common.SampleLogbook.message.updating")); - } - super.startEditUI(SampleLogbookDto.PROPERTY_TIME_STAMP, - SampleLogbookDto.PROPERTY_LATITUDE, - SampleLogbookDto.PROPERTY_LONGITUDE, - SampleLogbookDto.PROPERTY_QUADRANT); - model.setModified(false); + protected void initTableUI(DefaultTableCellRenderer renderer) { + JTable table = getUi().getTable(); + + UIHelper.setI18nTableHeaderRenderer(table, + n("observe.common.SamplePartLogbookDto.table.species"), + n("observe.common.SamplePartLogbookDto.table.species.tip"), + n("observe.common.SamplePartLogbookDto.table.count"), + n("observe.common.SamplePartLogbookDto.table.count.tip"), + n("observe.common.SamplePartLogbookDto.table.sizeMeasureType"), + n("observe.common.SamplePartLogbookDto.table.sizeMeasureType.tip"), + n("observe.common.SamplePartLogbookDto.table.length"), + n("observe.common.SamplePartLogbookDto.table.length.tip"), + n("observe.common.SamplePartLogbookDto.table.weightMeasureType"), + n("observe.common.SamplePartLogbookDto.table.weightMeasureType.tip"), + n("observe.common.SamplePartLogbookDto.table.weight"), + n("observe.common.SamplePartLogbookDto.table.weight.tip"), + n("observe.common.SamplePartLogbookDto.table.sex"), + n("observe.common.SamplePartLogbookDto.table.sex.tip")); + + UIHelper.setTableColumnRenderer(table, 0, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, SpeciesReference.class)); + UIHelper.setTableColumnRenderer(table, 1, UIHelper.newEmptyNumberTableCellRenderer(renderer)); + UIHelper.setTableColumnRenderer(table, 2, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, SizeMeasureTypeReference.class)); + UIHelper.setTableColumnRenderer(table, 3, UIHelper.newEmptyNumberTableCellRenderer(renderer)); + UIHelper.setTableColumnRenderer(table, 4, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, WeightMeasureTypeReference.class)); + UIHelper.setTableColumnRenderer(table, 5, UIHelper.newEmptyNumberTableCellRenderer(renderer)); + UIHelper.setTableColumnRenderer(table, 6, UIHelper.newReferentialReferenceDecorateTableCellRenderer(renderer, SexReference.class)); } @Override - protected boolean doSave(SampleLogbookDto bean) { - bean.setSamplePartLogbook(getUi().getSamplePartLogbookModel().getBean().getSamplePartLogbook()); - SaveResultDto saveResult = getActivityLonglineLogbookSampleService().save(getSelectedId(), bean); + protected void doPersist(SampleLogbookDto bean) { + SaveResultDto saveResult = getActivityLonglineLogbookSampleService().save(bean); saveResult.toDto(bean); - return true; } @Override - protected void afterSave(boolean refresh) { - if (getModel().isCreatingMode()) { - getModel().setMode(ContentMode.UPDATE); - restartEditUI(); - } else { - super.afterSave(refresh); - getUi().getSamplePartLogbookUI().getHandler().afterSave(refresh); + protected void loadEditBean(String beanId) { + Form<SampleLogbookDto> form = getActivityLonglineLogbookSampleService().loadForm(beanId); + loadReferentialReferenceSetsInModel(form); + + Optional<FormDefinition<SamplePartLogbookDto>> optionalFormDefinition = DtoModelHelper.getOptionalFormDefinition(SamplePartLogbookDto.class); + optionalFormDefinition.ifPresent(this::loadReferentialReferenceSetsInModel); + getModel().setForm(form); + + SampleLogbookHelper.copySampleLogbookDto(form.getObject(), getBean()); + + } + + private Optional<SizeMeasureTypeReference> getSpeciesDefaultSizeMeasureType(SpeciesReference species) { + Optional<SizeMeasureTypeReference> result = Optional.empty(); + if (species != null) { + + String sizeMeasureId = species.getSizeMeasureTypeId(); + result = getUi().getSizeMeasureType().getData().stream() + .filter(s -> s.getId().equals(sizeMeasureId)).findFirst(); } + return result; } - protected void computeTabValidState(SwingValidatorMessageTableModel errorTableModel) { + /** + * Le mode de saisie a été mis à jour. + * + * @param newMode le nouveau de mode de saisie à utiliser + * @since 3.0 + */ + void updateAcquisitionMode(AcquisitionMode newMode) { - Set<String> errorProperties = new HashSet<>(); - int rowCount = errorTableModel.getRowCount(); - for (int i = 0; i < rowCount; i++) { + if (log.isDebugEnabled()) { + log.debug(String.format("Change acquisition mode to %s", newMode)); + } + if (newMode == null) { - SwingValidatorMessage row = errorTableModel.getRow(i); - if (NuitonValidatorScope.ERROR.equals(row.getScope())) { - errorProperties.add(row.getField()); - } + // mode null (cela peut arriver avec les bindings) + return; } - boolean caracteristicsTabValid = !errorProperties.removeAll(SampleLogbookUIModel.CARACTERISTICS_TAB_PROPERTIES); - boolean samplePartLogbookTabValid = !errorProperties.removeAll(SampleLogbookUIModel.SAMPLE_PART_TAB_PROPERTIES); + ActivityLonglineLogbookSampleUI ui = getUi(); + + boolean createMode = ui.getTableModel().isCreate(); - SampleLogbookUIModel model = getModel(); - model.setCaracteristicsTabValid(caracteristicsTabValid); - model.setSamplePartLogbookTabValid(samplePartLogbookTabValid); + SamplePartLogbookDto editBean = ui.getTableEditBean(); + switch (newMode) { + case byEffectif: + + // le weight n'est pas modifiable + ui.getWeight().setEnabled(false); + ui.getWeightMeasureType().setEnabled(false); + + // l'count est modifiable + ui.getCount().setEnabled(true); + + if (createMode) { + + // on supprime le weight (si il a été saisie) + editBean.setWeight(null); + editBean.setWeightMeasureType(null); + // on supprime aussi l'count (pour forcer la saisie) + editBean.setCount(null); + } + break; + + case byIndividu: + + // le weight est pas modifiable + ui.getWeight().setEnabled(true); + ui.getWeightMeasureType().setEnabled(true); + + // l'count n'est pas modifiable et est toujours de 1 + ui.getCount().setEnabled(false); + + if (createMode) { + + // on positionne l'count à 1 (seule valeur possible) + editBean.setCount(1); + } + break; + } + + if (createMode) { + + // on propage le mode de saisie dans le bean + editBean.setAcquisitionMode(newMode.ordinal()); + } } - @Override - public SampleLogbookUIModel getModel() { - return (SampleLogbookUIModel) super.getModel(); + public void resetDefaultSizeMeasureType() { + getUi().getSizeMeasureType().setSelectedItem(null); + getUi().getSizeMeasureType().setSelectedItem(getUi().getModel().getDefaultSizeMeasureType()); } - private void showIndividualTabs(boolean newValue) { - getUi().getSamplePartLogbookTab().setEnabled(newValue); - if (!newValue && getUi().getMainTabbedPane().getSelectedIndex() > 2) { - // go back to first tab - getUi().getMainTabbedPane().setSelectedIndex(0); - } + + private void onSpeciesChanged(SpeciesReference species) { + Optional<SizeMeasureTypeReference> sizeMeasureType = getSpeciesDefaultSizeMeasureType(species); + getUi().getModel().setDefaultSizeMeasureType(sizeMeasureType.orElse(null)); } } ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookSampleUIModel.java ===================================== @@ -0,0 +1,118 @@ +package fr.ird.observe.client.ui.content.data.longline.logbook; + +/*- + * #%L + * ObServe :: Client + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * 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.client.ui.content.table.ContentTableMeta; +import fr.ird.observe.client.ui.content.table.ContentTableModel; +import fr.ird.observe.client.ui.content.table.ContentTableUIModel; +import fr.ird.observe.client.ui.content.table.ObserveContentTableUI; +import fr.ird.observe.dto.data.longline.SampleLogbookDto; +import fr.ird.observe.dto.data.longline.SamplePartLogbookDto; +import fr.ird.observe.dto.data.longline.SamplePartLogbookHelper; +import fr.ird.observe.dto.referential.SizeMeasureTypeReference; + +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; + +/** + * Created by tchemit on 13/09/2018. + * + * @author Tony Chemit - dev@tchemit.fr + */ +public class ActivityLonglineLogbookSampleUIModel extends ContentTableUIModel<SampleLogbookDto, SamplePartLogbookDto> { + + public static final String PROPERTY_DEFAULT_SIZE_MEASURE_TYPE = "defaultSizeMeasureType"; + private static final long serialVersionUID = 1L; + private SizeMeasureTypeReference defaultSizeMeasureType; + + public ActivityLonglineLogbookSampleUIModel(ActivityLonglineLogbookSampleUI ui) { + + super(SampleLogbookDto.class, + SamplePartLogbookDto.class, + new String[]{ + SampleLogbookDto.PROPERTY_SAMPLE_PART_LOGBOOK, + SampleLogbookDto.PROPERTY_DATE, + SampleLogbookDto.PROPERTY_LATITUDE, + SampleLogbookDto.PROPERTY_LONGITUDE, + SampleLogbookDto.PROPERTY_QUADRANT}, + new String[]{SamplePartLogbookDto.PROPERTY_SPECIES, + SamplePartLogbookDto.PROPERTY_ACQUISITION_MODE, + SamplePartLogbookDto.PROPERTY_SIZE_MEASURE_TYPE, + SamplePartLogbookDto.PROPERTY_LENGTH_MEASURE_METHOD, + SamplePartLogbookDto.PROPERTY_WEIGHT_MEASURE_TYPE, + SamplePartLogbookDto.PROPERTY_SEX, + SamplePartLogbookDto.PROPERTY_COUNT, + SamplePartLogbookDto.PROPERTY_LENGTH, + SamplePartLogbookDto.PROPERTY_WEIGHT}); + + List<ContentTableMeta<SamplePartLogbookDto>> metas = Arrays.asList( + ContentTableModel.newTableMeta(SamplePartLogbookDto.class, SamplePartLogbookDto.PROPERTY_SPECIES, false), + ContentTableModel.newTableMeta(SamplePartLogbookDto.class, SamplePartLogbookDto.PROPERTY_COUNT, false), + ContentTableModel.newTableMeta(SamplePartLogbookDto.class, SamplePartLogbookDto.PROPERTY_SIZE_MEASURE_TYPE, false), + ContentTableModel.newTableMeta(SamplePartLogbookDto.class, SamplePartLogbookDto.PROPERTY_LENGTH, false), + ContentTableModel.newTableMeta(SamplePartLogbookDto.class, SamplePartLogbookDto.PROPERTY_WEIGHT_MEASURE_TYPE, false), + ContentTableModel.newTableMeta(SamplePartLogbookDto.class, SamplePartLogbookDto.PROPERTY_WEIGHT, false), + ContentTableModel.newTableMeta(SamplePartLogbookDto.class, SamplePartLogbookDto.PROPERTY_SEX, false)); + + initModel(ui, metas); + } + + @Override + protected ContentTableModel<SampleLogbookDto, SamplePartLogbookDto> createTableModel( + ObserveContentTableUI<SampleLogbookDto, SamplePartLogbookDto, ?> ui, + List<ContentTableMeta<SamplePartLogbookDto>> contentTableMetas) { + + return new ContentTableModel<SampleLogbookDto, SamplePartLogbookDto>(ui, contentTableMetas) { + private static final long serialVersionUID = 1L; + + @Override + protected Collection<SamplePartLogbookDto> getChilds(SampleLogbookDto bean) { + return bean.getSamplePartLogbook(); + } + + @Override + protected void load(SamplePartLogbookDto source, SamplePartLogbookDto target) { + SamplePartLogbookHelper.copySamplePartLogbookDto(source, target); + } + + @Override + protected void setChilds(SampleLogbookDto parent, List<SamplePartLogbookDto> childs) { + parent.setSamplePartLogbook(new LinkedList<>(childs)); + } + }; + } + + + public SizeMeasureTypeReference getDefaultSizeMeasureType() { + return defaultSizeMeasureType; + } + + public void setDefaultSizeMeasureType(SizeMeasureTypeReference defaultSizeMeasureType) { + SizeMeasureTypeReference oldValue = getDefaultSizeMeasureType(); + this.defaultSizeMeasureType = defaultSizeMeasureType; + firePropertyChange(PROPERTY_DEFAULT_SIZE_MEASURE_TYPE, oldValue, defaultSizeMeasureType); + } + +} ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/logbook/ActivityLonglineLogbookUIHandler.java ===================================== @@ -215,6 +215,9 @@ class ActivityLonglineLogbookUIHandler extends ContentOpenableUIHandler<Activity if (notPersisted) { // ouverture de l'activité après création getEditNode().setId(bean.getId()); + // on doit recharger le bean car on y a ajoute son sample + ActivityLonglineLogbookDto newBean = getActivityLonglineLogbookService().loadDto(bean.getId()); + getModel().setBean(newBean); } addSet = notPersisted && ActivityLonglineLogbookHelper.FISHING_OPERATION_ID.equals(bean.getVesselActivityLongline().getId()); ===================================== client/src/main/java/fr/ird/observe/client/ui/tree/navigation/nodes/longline/logbook/ActivityLonglineSampleLogbookNavigationTreeNode.java ===================================== @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.tree.navigation.nodes.longline.logbook; * 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>. @@ -23,10 +23,12 @@ package fr.ird.observe.client.ui.tree.navigation.nodes.longline.logbook; */ import fr.ird.observe.client.ui.content.data.longline.logbook.ActivityLonglineLogbookSampleUI; -import fr.ird.observe.client.ui.tree.navigation.nodes.ReferenceNavigationTreeNodeSupport; +import fr.ird.observe.client.ui.tree.navigation.nodes.ClassNavigationTreeNode; +import fr.ird.observe.dto.IdHelper; import fr.ird.observe.dto.data.longline.SampleLogbookDto; import fr.ird.observe.dto.data.longline.SampleLogbookReference; -import fr.ird.observe.dto.navigation.select.node.ObserveLonglineLogbookActivitySampleSelectNode; + +import static org.nuiton.i18n.I18n.t; /** * Created on 14/11/16. @@ -34,16 +36,10 @@ import fr.ird.observe.dto.navigation.select.node.ObserveLonglineLogbookActivityS * @author Tony Chemit - dev@tchemit.fr * @since 6.0 */ -public class ActivityLonglineSampleLogbookNavigationTreeNode extends ReferenceNavigationTreeNodeSupport<SampleLogbookDto, SampleLogbookReference> { +public class ActivityLonglineSampleLogbookNavigationTreeNode extends ClassNavigationTreeNode<SampleLogbookDto> { - public ActivityLonglineSampleLogbookNavigationTreeNode(SampleLogbookReference data) { - super(data, ObserveLonglineLogbookActivitySampleSelectNode.class, null, false); - } - - @Override - public void reload() { - SampleLogbookReference data = getServicesProvider().getActivityLonglineLogbookSampleService().loadReferenceToRead(getId()); - setData(data); + ActivityLonglineSampleLogbookNavigationTreeNode(SampleLogbookReference data) { + super(SampleLogbookDto.class, t("observe.ui.tree.longline.sample")); } @Override @@ -54,4 +50,9 @@ public class ActivityLonglineSampleLogbookNavigationTreeNode extends ReferenceNa public boolean isLeaf() { return true; } + + @Override + public String getIconPath() { + return "navigation." + IdHelper.getDtoSimplifiedName(getData()); + } } ===================================== client/src/main/resources/i18n/client_en_GB.properties ===================================== @@ -1746,6 +1746,7 @@ observe.ui.tree.longline.obs.activity.list=Observations observe.ui.tree.longline.obs.activity.unsaved=New activity observe.ui.tree.longline.obs.set.unsaved=New fishing operation observe.ui.tree.longline.obs.tdr=Tdrs +observe.ui.tree.longline.sample=Samples observe.ui.tree.longline.sensorUsed=Sensors used observe.ui.tree.longline.setDetailComposition=Detailed compositions observe.ui.tree.longline.setGlobalComposition=Global compositions ===================================== client/src/main/resources/i18n/client_es_ES.properties ===================================== @@ -1746,6 +1746,7 @@ observe.ui.tree.longline.obs.activity.list=Observations \#TODO observe.ui.tree.longline.obs.activity.unsaved=Nueva actividad observe.ui.tree.longline.obs.set.unsaved=Nuevo lance observe.ui.tree.longline.obs.tdr=Registradores de profundidad +observe.ui.tree.longline.sample=Muestreos observe.ui.tree.longline.sensorUsed=Sensores utilizados observe.ui.tree.longline.setDetailComposition=Composiciones detalladas observe.ui.tree.longline.setGlobalComposition=Composiciones globales ===================================== client/src/main/resources/i18n/client_fr_FR.properties ===================================== @@ -1746,6 +1746,7 @@ observe.ui.tree.longline.obs.activity.list=Observations observe.ui.tree.longline.obs.activity.unsaved=Nouvelle activité observe.ui.tree.longline.obs.set.unsaved=Nouvelle opération de pêche observe.ui.tree.longline.obs.tdr=Enregistreurs de profondeur +observe.ui.tree.longline.sample=Échantillons observe.ui.tree.longline.sensorUsed=Capteurs utilisés observe.ui.tree.longline.setDetailComposition=Compositions détaillées observe.ui.tree.longline.setGlobalComposition=Compositions globales ===================================== persistence/src/main/java/fr/ird/observe/binder/data/longline/SampleLogbookEntityDtoBinder.java ===================================== @@ -23,6 +23,7 @@ package fr.ird.observe.binder.data.longline; */ import fr.ird.observe.binder.data.DataEntityDtoBinderSupport; +import fr.ird.observe.dto.CoordinateHelper; import fr.ird.observe.dto.data.longline.SampleLogbookDto; import fr.ird.observe.dto.referential.ReferentialLocale; import fr.ird.observe.entities.longline.SampleLogbook; @@ -54,6 +55,7 @@ public class SampleLogbookEntityDtoBinder extends DataEntityDtoBinderSupport<Sam dto.setLatitude(entity.getLatitude()); dto.setLongitude(entity.getLongitude()); dto.setTimeStamp(entity.getTimeStamp()); + dto.setQuadrant(CoordinateHelper.getQuadrant(dto.getLongitude(), dto.getLatitude())); dto.setSamplePartLogbook(toListData(referentialLocale, entity.getSamplePartLogbook())); } ===================================== persistence/src/main/java/fr/ird/observe/entities/longline/ActivityLonglineLogbookTopiaDao.java ===================================== @@ -62,6 +62,7 @@ public class ActivityLonglineLogbookTopiaDao extends AbstractActivityLonglineLog " a.topiaId," + " a.timestamp," + " a.set," + + " a.sample," + " va.topiaId," + " va." + I18nReferenceEntities.getPropertyName(referenceLocale) + " FROM observe_longline.activityLogbook a, observe_longline.vesselActivity va" + @@ -80,6 +81,7 @@ public class ActivityLonglineLogbookTopiaDao extends AbstractActivityLonglineLog " a.topiaId," + " a.timestamp," + " a.set," + + " a.sample," + " va.topiaId," + " va." + I18nReferenceEntities.getPropertyName(referenceLocale) + " FROM observe_longline.activityLogbook a, observe_longline.vesselActivity va" + @@ -108,16 +110,20 @@ public class ActivityLonglineLogbookTopiaDao extends AbstractActivityLonglineLog String setId = set.getString(3); if (setId != null) { - SetLonglineLogbookImpl setLongline = new SetLonglineLogbookImpl(); setLongline.setTopiaId(setId); activity.setSetLongline(setLongline); - + } + String sampleId = set.getString(4); + if (sampleId != null) { + SampleLogbook sample = new SampleLogbookImpl(); + sample.setTopiaId(sampleId); + activity.setSample(sample); } VesselActivityLongline vesselActivity = new VesselActivityLonglineImpl(); - String vesselActivityId = set.getString(4); + String vesselActivityId = set.getString(5); vesselActivity.setTopiaId(vesselActivityId); - String label = set.getString(5); + String label = set.getString(6); I18nReferenceEntities.setLabel(referenceLocale, vesselActivity, label); activity.setVesselActivityLongline(vesselActivity); return activity; ===================================== persistence/src/main/models/Observe-06-data-longline-logbook.model ===================================== @@ -195,5 +195,4 @@ longline.SampleLogbook > ObserveDataEntity | entity timeStamp + {*:1} Date latitude + {*:1} Float | sqlType=numeric longitude + {*:1} Float | sqlType=numeric -quadrant + {*:1} Integer samplePartLogbook + {*} longline.SamplePartLogbook | ordered reverseDbName=sample ===================================== server/src/main/filtered-resources/mapping ===================================== @@ -95,12 +95,7 @@ POST /api/v1/data/longline/ActivityLongLineObsEncounterService/save GET /api/v1/data/longline/ActivityLongLineObsSensorUsedService/getDataFile v1.data.longline.ActivityLongLineObsSensorUsedServiceRestApi.getDataFile GET /api/v1/data/longline/ActivityLongLineObsSensorUsedService/loadForm v1.data.longline.ActivityLongLineObsSensorUsedServiceRestApi.loadForm POST /api/v1/data/longline/ActivityLongLineObsSensorUsedService/save v1.data.longline.ActivityLongLineObsSensorUsedServiceRestApi.save -DELETE /api/v1/data/longline/ActivityLonglineLogbookSampleService/delete v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.delete -GET /api/v1/data/longline/ActivityLonglineLogbookSampleService/exists v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.exists -GET /api/v1/data/longline/ActivityLonglineLogbookSampleService/loadDto v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.loadDto GET /api/v1/data/longline/ActivityLonglineLogbookSampleService/loadForm v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.loadForm -GET /api/v1/data/longline/ActivityLonglineLogbookSampleService/loadReferenceToRead v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.loadReferenceToRead -GET /api/v1/data/longline/ActivityLonglineLogbookSampleService/preCreate v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.preCreate POST /api/v1/data/longline/ActivityLonglineLogbookSampleService/save v1.data.longline.ActivityLonglineLogbookSampleServiceRestApi.save DELETE /api/v1/data/longline/ActivityLonglineLogbookService/delete v1.data.longline.ActivityLonglineLogbookServiceRestApi.delete GET /api/v1/data/longline/ActivityLonglineLogbookService/exists v1.data.longline.ActivityLonglineLogbookServiceRestApi.exists @@ -137,6 +132,7 @@ POST /api/v1/data/longline/LandingLogbookService/moveLandingLogbookToTripLongl POST /api/v1/data/longline/LandingLogbookService/moveLandingLogbooksToTripLongline v1.data.longline.LandingLogbookServiceRestApi.moveLandingLogbooksToTripLongline GET /api/v1/data/longline/LandingLogbookService/preCreate v1.data.longline.LandingLogbookServiceRestApi.preCreate POST /api/v1/data/longline/LandingLogbookService/save v1.data.longline.LandingLogbookServiceRestApi.save +GET /api/v1/data/longline/SetLonglineLogbookCatchService/getSampleSpecies v1.data.longline.SetLonglineLogbookCatchServiceRestApi.getSampleSpecies GET /api/v1/data/longline/SetLonglineLogbookCatchService/loadForm v1.data.longline.SetLonglineLogbookCatchServiceRestApi.loadForm POST /api/v1/data/longline/SetLonglineLogbookCatchService/save v1.data.longline.SetLonglineLogbookCatchServiceRestApi.save GET /api/v1/data/longline/SetLonglineLogbookGlobalCompositionService/loadForm v1.data.longline.SetLonglineLogbookGlobalCompositionServiceRestApi.loadForm ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/ActivityLonglineLogbookSampleServiceLocal.java ===================================== @@ -10,21 +10,19 @@ package fr.ird.observe.services.local.service.data.longline; * 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.dto.DataNotFoundException; import fr.ird.observe.dto.data.longline.SampleLogbookDto; -import fr.ird.observe.dto.data.longline.SampleLogbookReference; import fr.ird.observe.dto.form.Form; import fr.ird.observe.dto.result.SaveResultDto; import fr.ird.observe.entities.longline.ActivityLonglineLogbook; @@ -38,65 +36,23 @@ import fr.ird.observe.services.service.data.longline.ActivityLonglineLogbookSamp public class ActivityLonglineLogbookSampleServiceLocal extends ObserveServiceLocal implements ActivityLonglineLogbookSampleService { @Override - public SampleLogbookReference loadReferenceToRead(String sampleLogbookId) { - return SAMPLE_LOGBOOK_SPI.loadEntityToDataReferenceDto(getTopiaPersistenceContext(), sampleLogbookId, getReferentialLocale()); - } - - @Override - public SampleLogbookDto loadDto(String sampleLogbookId) { - return SAMPLE_LOGBOOK_SPI.loadEntityToDataDto(getTopiaPersistenceContext(), sampleLogbookId, getReferentialLocale()); - } - - @Override - public boolean exists(String sampleLogbookId) { - return SAMPLE_LOGBOOK_SPI.existsEntity(getTopiaPersistenceContext(), sampleLogbookId); - } - - @Override - public Form<SampleLogbookDto> loadForm(String sampleLogbookId) { - SampleLogbook sampleLogbook = SAMPLE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), sampleLogbookId); - return SAMPLE_LOGBOOK_SPI.dataEntityToForm(sampleLogbook, getReferentialLocale()); - } - - @Override - public Form<SampleLogbookDto> preCreate(String activityLonglineId) { + public Form<SampleLogbookDto> loadForm(String activityLonglineId) { ActivityLonglineLogbook activity = ACTIVITY_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), activityLonglineId); - SampleLogbook preCreated = SAMPLE_LOGBOOK_SPI.newEntity(); -// SampleLogbook lastSampleLogbook = Iterables.getLast(tripLongline.getSample(), null); -// Date timestamp; -// if (lastSampleLogbook == null) { -// // première activité, on utilise la date de début de marée (voir http://forge.codelutin.com/issues/6777) -// Calendar calendar = Calendar.getInstance(); -// calendar.setTime(tripLongline.getStartDate()); -// timestamp = calendar.getTime(); -// } else { -// // on reprend la date et l'heure de la dernière activité -// timestamp = lastSampleLogbook.getStartDate(); -// } -// preCreated.setStartDate(timestamp); - return SAMPLE_LOGBOOK_SPI.dataEntityToForm(preCreated, getReferentialLocale()); + SampleLogbook sampleLogbook = activity.getSample(); + return SAMPLE_LOGBOOK_SPI.dataEntityToForm(sampleLogbook, getReferentialLocale()); } @Override - public SaveResultDto save(String activityLonglineId, SampleLogbookDto dto) { - ActivityLonglineLogbook activity = ACTIVITY_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), activityLonglineId); + public SaveResultDto save(SampleLogbookDto dto) { +// ActivityLonglineLogbook activity = ACTIVITY_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), activityLonglineId); SampleLogbook entity = SAMPLE_LOGBOOK_SPI.loadOrCreateEntityFromDataDto(getTopiaPersistenceContext(), dto); checkLastUpdateDate(entity, dto); SAMPLE_LOGBOOK_SPI.copyDataDtoToEntity(dto, entity, getReferentialLocale()); SaveResultDto result = saveEntity(entity); - if (dto.isNotPersisted()) { - activity.setSample(entity); - } +// if (dto.isNotPersisted()) { +// activity.setSample(entity); +// } return result; } - @Override - public void delete(String activityLonglineId, String sampleLogbookId) { - ActivityLonglineLogbook activity = ACTIVITY_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), activityLonglineId); - if (activity.getSample() == null || sampleLogbookId.equals(activity.getSample().getTopiaId())) { - throw new DataNotFoundException(SampleLogbookDto.class, sampleLogbookId); - } - activity.setSample(null); - } - } ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/ActivityLonglineLogbookServiceLocal.java ===================================== @@ -36,8 +36,11 @@ import fr.ird.observe.dto.result.TripChildSaveResultHelper; import fr.ird.observe.entities.longline.ActivityLonglineLogbook; import fr.ird.observe.entities.longline.ActivityLonglineLogbookTopiaDao; import fr.ird.observe.entities.longline.ActivityLonglineLogbooks; +import fr.ird.observe.entities.longline.SampleLogbook; import fr.ird.observe.entities.longline.TripLongline; +import fr.ird.observe.services.local.ObserveServiceContextLocal; import fr.ird.observe.services.local.service.ObserveServiceLocal; +import fr.ird.observe.services.service.data.longline.ActivityLonglineLogbookSampleService; import fr.ird.observe.services.service.data.longline.ActivityLonglineLogbookService; import java.util.ArrayList; @@ -50,6 +53,14 @@ import java.util.List; */ public class ActivityLonglineLogbookServiceLocal extends ObserveServiceLocal implements ActivityLonglineLogbookService { + private ActivityLonglineLogbookSampleService sampleService; + + @Override + public void setServiceContext(ObserveServiceContextLocal serviceContext) { + super.setServiceContext(serviceContext); + sampleService = serviceContext.newService(ActivityLonglineLogbookSampleService.class); + } + @Override public DataDtoReferenceSet<ActivityLonglineLogbookReference> getActivityLonglineByTripLongline(String tripLonglineId) { ActivityLonglineLogbookTopiaDao dao = ACTIVITY_LONGLINE_LOGBOOK_SPI.getDao(getTopiaPersistenceContext()); @@ -110,10 +121,22 @@ public class ActivityLonglineLogbookServiceLocal extends ObserveServiceLocal imp ActivityLonglineLogbook entity = ACTIVITY_LONGLINE_LOGBOOK_SPI.loadOrCreateEntityFromDataDto(getTopiaPersistenceContext(), dto); checkLastUpdateDate(entity, dto); ACTIVITY_LONGLINE_LOGBOOK_SPI.copyDataDtoToEntity(dto, entity, getReferentialLocale()); + boolean notPersisted = dto.isNotPersisted(); + if (notPersisted) { + // create a unique sample + SampleLogbook preCreated = SAMPLE_LOGBOOK_SPI.newEntity(); + preCreated.setLatitude(entity.getLatitude()); + preCreated.setLongitude(entity.getLongitude()); + preCreated.setTimeStamp(entity.getTimeStamp()); + saveEntity(preCreated); + entity.setSample(preCreated); + } SaveResultDto saveResultDto = saveEntity(entity); + TripChildSaveResultDto result = TripChildSaveResultHelper.of(saveResultDto); - if (dto.isNotPersisted()) { + if (notPersisted) { tripLongline.addActivityLonglineLogbook(entity); + } boolean wasEndDateUpdated = TRIP_LONGLINE_SPI.getDao(getTopiaPersistenceContext()).updateEndDate(tripLongline); result.setTripEndDateUpdated(wasEndDateUpdated); ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/SetLonglineLogbookCatchServiceLocal.java ===================================== @@ -24,11 +24,16 @@ package fr.ird.observe.services.local.service.data.longline; import fr.ird.observe.dto.data.longline.SetLonglineLogbookCatchDto; import fr.ird.observe.dto.form.Form; +import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet; +import fr.ird.observe.dto.referential.SpeciesReference; import fr.ird.observe.dto.result.SaveResultDto; +import fr.ird.observe.entities.longline.CatchLonglineLogbook; import fr.ird.observe.entities.longline.SetLonglineLogbook; import fr.ird.observe.services.local.service.ObserveServiceLocal; import fr.ird.observe.services.service.data.longline.SetLonglineLogbookCatchService; +import java.util.stream.Collectors; + /** * @author Tony Chemit - dev@tchemit.fr */ @@ -48,4 +53,14 @@ public class SetLonglineLogbookCatchServiceLocal extends ObserveServiceLocal imp return saveEntity(entity); } + @Override + public ReferentialDtoReferenceSet<SpeciesReference> getSampleSpecies(String setLonglineId) { + SetLonglineLogbook set = SET_LONGLINE_LOGBOOK_SPI.loadEntity(getTopiaPersistenceContext(), setLonglineId); + return SPECIES_SPI.toReferentialReferenceSet(set.getCatchLongline().stream() + .map(CatchLonglineLogbook::getSpeciesCatch) + .distinct() + .collect(Collectors.toList()), + getReferentialLocale(), null); + } + } ===================================== services/src/main/java/fr/ird/observe/services/service/data/longline/ActivityLonglineLogbookSampleService.java ===================================== @@ -10,12 +10,12 @@ package fr.ird.observe.services.service.data.longline; * 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>. @@ -23,14 +23,12 @@ package fr.ird.observe.services.service.data.longline; */ import fr.ird.observe.dto.data.longline.SampleLogbookDto; -import fr.ird.observe.dto.data.longline.SampleLogbookReference; import fr.ird.observe.dto.form.Form; import fr.ird.observe.dto.result.SaveResultDto; import fr.ird.observe.services.service.ObserveService; import fr.ird.observe.services.spi.ReadDataPermission; import fr.ird.observe.services.spi.Write; import fr.ird.observe.services.spi.WriteDataPermission; -import io.ultreia.java4all.http.spi.Delete; import io.ultreia.java4all.http.spi.Get; import io.ultreia.java4all.http.spi.Post; @@ -41,32 +39,11 @@ public interface ActivityLonglineLogbookSampleService extends ObserveService { @Get @ReadDataPermission - Form<SampleLogbookDto> loadForm(String sampleLogbookId); - - @Get - @ReadDataPermission - SampleLogbookDto loadDto(String sampleLogbookId); - - @Get - @ReadDataPermission - SampleLogbookReference loadReferenceToRead(String sampleLogbookId); - - @Get - @ReadDataPermission - boolean exists(String sampleLogbookId); - - @Get - @WriteDataPermission - Form<SampleLogbookDto> preCreate(String activityLonglineId); + Form<SampleLogbookDto> loadForm(String activityLonglineId); @WriteDataPermission @Write @Post - SaveResultDto save(String activityLonglineId, SampleLogbookDto dto); - - @Write - @WriteDataPermission - @Delete - void delete(String activityLonglineId, String sampleLogbookId); + SaveResultDto save(SampleLogbookDto dto); } ===================================== services/src/main/java/fr/ird/observe/services/service/data/longline/SetLonglineLogbookCatchService.java ===================================== @@ -24,6 +24,8 @@ package fr.ird.observe.services.service.data.longline; import fr.ird.observe.dto.data.longline.SetLonglineLogbookCatchDto; import fr.ird.observe.dto.form.Form; +import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet; +import fr.ird.observe.dto.referential.SpeciesReference; import fr.ird.observe.dto.result.SaveResultDto; import fr.ird.observe.services.service.ObserveService; import fr.ird.observe.services.spi.ReadDataPermission; @@ -46,4 +48,8 @@ public interface SetLonglineLogbookCatchService extends ObserveService { @Post SaveResultDto save(SetLonglineLogbookCatchDto dto); + @Get + @ReadDataPermission + ReferentialDtoReferenceSet<SpeciesReference> getSampleSpecies(String setLonglineId); + } ===================================== test/src/main/resources/db/8.2/dataForTestLongline.sql.gz ===================================== The diff for this file was not included because it is too large. ===================================== test/src/main/resources/db/8.2/dataForTestSeine.sql.gz ===================================== The diff for this file was not included because it is too large. ===================================== test/src/main/resources/db/8.2/empty_h2.sql.gz ===================================== @@ -78,7 +78,7 @@ create table OBSERVE_LONGLINE.mitigationtype_setlogbook (set varchar(255), mitig create table OBSERVE_LONGLINE.mitigationtype_setobs (set varchar(255), mitigationType varchar(255) not null); create table OBSERVE_LONGLINE.observationTripType (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.onBoardProcessing (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId)); -create table OBSERVE_LONGLINE.sampleLogbook (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, timeStamp timestamp, latitude numeric, longitude numeric, quadrant integer, trip varchar(255), primary key (topiaId)); +create table OBSERVE_LONGLINE.sampleLogbook (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, timeStamp timestamp, latitude numeric, longitude numeric, trip varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.samplePartLogbook (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, length numeric, weight numeric, count integer, acquisitionMode integer, tagNumber varchar(255), species varchar(255), sex varchar(255), sizeMeasureType varchar(255), lengthMeasureMethod varchar(255), weightMeasureType varchar(255), weightMeasureMethod varchar(255), sample varchar(255), sample_idx integer, primary key (topiaId)); create table OBSERVE_LONGLINE.sectionObs (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, settingIdentifier integer not null, haulingIdentifier integer, set varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.sensorBrand (topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status integer, brandName varchar(255), primary key (topiaId)); ===================================== test/src/main/resources/db/8.2/empty_pg.sql.gz ===================================== @@ -78,7 +78,7 @@ create table OBSERVE_LONGLINE.mitigationtype_setlogbook (set varchar(255), mitig create table OBSERVE_LONGLINE.mitigationtype_setobs (set varchar(255), mitigationType varchar(255) not null); create table OBSERVE_LONGLINE.observationTripType (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.onBoardProcessing (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, label1 varchar(255), label2 varchar(255), label3 varchar(255), label4 varchar(255), label5 varchar(255), label6 varchar(255), label7 varchar(255), label8 varchar(255), primary key (topiaId)); -create table OBSERVE_LONGLINE.sampleLogbook (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, timeStamp timestamp, latitude numeric, longitude numeric, quadrant int4, trip varchar(255), primary key (topiaId)); +create table OBSERVE_LONGLINE.sampleLogbook (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, timeStamp timestamp, latitude numeric, longitude numeric, trip varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.samplePartLogbook (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, length numeric, weight numeric, count int4, acquisitionMode int4, tagNumber varchar(255), species varchar(255), sex varchar(255), sizeMeasureType varchar(255), lengthMeasureMethod varchar(255), weightMeasureType varchar(255), weightMeasureMethod varchar(255), sample varchar(255), sample_idx int4, primary key (topiaId)); create table OBSERVE_LONGLINE.sectionObs (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, settingIdentifier int4 not null, haulingIdentifier int4, set varchar(255), primary key (topiaId)); create table OBSERVE_LONGLINE.sensorBrand (topiaId varchar(255) not null, topiaVersion int8 not null, topiaCreateDate timestamp, lastUpdateDate timestamp not null, code varchar(255), uri varchar(255), needComment boolean not null, status int4, brandName varchar(255), primary key (topiaId)); ===================================== test/src/main/resources/db/8.2/referentiel.sql.gz ===================================== The diff for this file was not included because it is too large. View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/74e2ce9fc3da3749e2e91f0bbf15... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/74e2ce9fc3da3749e2e91f0bbf15... You're receiving this email because of your account on gitlab.com.