[Git][ultreiaio/ird-observe][feature/issue-2734] 9 commits: Fix WithIndex generation - See #1203
Tony CHEMIT pushed to branch feature/issue-2734 at ultreiaio / ird-observe Commits: d7d59ba3 by Tony Chemit at 2024-09-02T09:57:04+02:00 Fix WithIndex generation - See #1203 - - - - - fb92220f by Tony Chemit at 2024-09-02T11:14:27+02:00 Fix onRemoveRow method (we already are using the modelRow) - See #1203 - - - - - 92243249 by Tony Chemit at 2024-09-02T11:14:36+02:00 Add new queries in TripDao - - - - - 8b5e5e8d by Tony Chemit at 2024-09-02T11:14:36+02:00 Add new methods in TripService - - - - - 090661ff by Tony Chemit at 2024-09-02T11:14:36+02:00 Add new labels (will be used for ui for new actions) - - - - - 1c2c4ae4 by Tony Chemit at 2024-09-02T11:14:36+02:00 Open API (to hack to order of configuration actions) - - - - - 29a53618 by Tony Chemit at 2024-09-02T11:14:36+02:00 Add ContentTableUITableModel.addNewEntry(bean) method to be able to create a new row from a given bean - - - - - 76e86dd5 by Tony Chemit at 2024-09-02T11:14:36+02:00 Implements action AddActivitiesFromSample on Well form - - - - - cebcab9b by Tony Chemit at 2024-09-02T11:14:36+02:00 Implements action AddActivitiesFromSample on Sample form - - - - - 28 changed files: - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/open/ContentOpen.java - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUITableModel.java - client/datasource/editor/ps/src/main/i18n/getters/java.getter - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/SampleActivityTableModel.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/SampleUI.jaxx - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/SampleUIHandler.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/SampleUIModelStates.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/WellActivityUITableModel.java - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/WellUI.jaxx - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/WellUIHandler.java - + client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/actions/AddActivitiesFromSample.java - + client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/actions/AddActivitiesFromWell.java - core/api/dto-decoration/src/main/i18n/getters/labels.getter - core/api/services/src/main/java/fr/ird/observe/services/service/data/ps/common/TripService.java - core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripSpi.java - core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripTopiaDao.java - core/persistence/java/src/main/resources/fr/ird/observe/entities/data/ps/common/TripImpl.hbm.xml - core/persistence/test/src/test/java/fr/ird/observe/entities/data/ps/common/TripTopiaDaoTest.java - core/services/i18n/src/main/i18n/translations/services_en_GB.properties - core/services/i18n/src/main/i18n/translations/services_es_ES.properties - core/services/i18n/src/main/i18n/translations/services_fr_FR.properties - core/services/local/src/main/java/fr/ird/observe/services/local/service/data/ps/common/TripServiceLocalSupport.java - core/services/test/src/main/java/fr/ird/observe/services/service/data/ps/common/TripServiceFixtures.java - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/data/ps/common/TripService.properties - model/src/main/models/Observe/dto/class/i18nLabels.properties - model/src/main/resources/META-INF/persistence/fr/ird/observe/entities/data/ps/common/Trip-sql-queries.properties - server/core/src/main/filtered-resources/META-INF/mapping-api-client.wm - toolkit/templates/src/main/java/fr/ird/observe/toolkit/templates/dto/DtoTransformer.java Changes: ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/open/ContentOpen.java ===================================== @@ -484,6 +484,10 @@ public class ContentOpen<U extends ContentUI> { } } + public ArrayListMultimap<ContentUI, JComponent> getConfigureActions() { + return configureActions; + } + public final <D extends DataDto, C extends ContainerChildDto, SubUi extends ContentTableUI<D, C, SubUi>> void initTabUI(SubUi subUi, JPanel subUiPane, int tabIndex, Consumer<D> dataConsumer) { subUiMap.put(subUi, subUiPane); subUiPane.remove(subUi); ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUITableModel.java ===================================== @@ -226,8 +226,7 @@ public abstract class ContentTableUITableModel<D extends DataDto, C extends Cont // do nothing by default } - protected void onRemovedRow(int row) { - int modelRow = getModelRow(row); + protected void onRemovedRow(int modelRow) { inlineModels.keySet().forEach(inlineModel -> inlineModel.removeRow(modelRow)); } @@ -377,6 +376,48 @@ public abstract class ContentTableUITableModel<D extends DataDto, C extends Cont changeSelectedRow(viewRow); } + public final void addNewEntry(C bean) { + ensureEditable(); + + int selectedRow = getSelectedRow(); + if (selectedRow > -1) { + // il y avait une ligne précédemment sélectionnée, + // on doit verifier que l'on peut changer d'entrée + if (!isCanQuitEditingRow()) { + // on ne peut pas quitter la ligne en cours d'édition + // on annule donc l'opération + return; + } + } + // on est autorise a ajouter une nouvelle entrée + // hook before changing row + // FIXME I am not quite sure of this flow, should not it be managed another way, somewhere else? + onBeforeAddNewEntry(selectedRow); + + int row = getRowCount(); + + data.add(bean); + if (getModel().getStates().isWithIndex()) { + ((WithIndex) bean).setIndex(getRowCount()); + } + + updateBeanList(false); + + this.create = true; + fireTableRowsInserted(row, row); + this.create = false; + + int viewRow = getContext().getTable().convertRowIndexToView(row); + + updateEmpty(); + + // on est en mode creation + setCreate(true); + + // la nouvelle ligne est celle en cours d'édition + changeSelectedRow(viewRow); + } + protected String getDeleteExtraMessage(C bean) { return null; } ===================================== client/datasource/editor/ps/src/main/i18n/getters/java.getter ===================================== @@ -21,10 +21,14 @@ observe.data.ps.dcp.FloatingObjectPreset.reloadDefaultConfiguration.title observe.data.ps.localmarket.Batch.weight.computed.tip observe.data.ps.localmarket.Batch.weight.observed.tip observe.data.ps.logbook.Activity.create.title +observe.data.ps.logbook.Sample.action.addActivitiesFromWell +observe.data.ps.logbook.Sample.action.addActivitiesFromWell.tip observe.data.ps.logbook.Sample.notSuperSample.with.moreThanOne.sampleSpecies.message observe.data.ps.logbook.Sample.notSuperSample.with.moreThanOne.sampleSpecies.title observe.data.ps.logbook.SampleActivity.weightedWeightComputed.computed.tip observe.data.ps.logbook.SampleActivity.weightedWeightComputed.observed.tip +observe.data.ps.logbook.Well.action.addActivitiesFromSample +observe.data.ps.logbook.Well.action.addActivitiesFromSample.tip observe.data.ps.logbook.WellPlan.create.activity.tip observe.data.ps.observation.Catch.catchWeightComputed.computed.tip observe.data.ps.observation.Catch.catchWeightComputed.observed.tip ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/SampleActivityTableModel.java ===================================== @@ -189,7 +189,7 @@ public class SampleActivityTableModel extends EditableTableModel<SampleActivityD } @Override - protected SampleActivityDto createNewRow() { + public SampleActivityDto createNewRow() { return SampleActivityDto.newDto(new Date()); } ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/SampleUI.jaxx ===================================== @@ -167,4 +167,5 @@ </JTabbedPane> </JPanel> <JMenuItem id='addSampleSpecies'/> + <JMenuItem id='fillActivitiesFromWell'/> </fr.ird.observe.client.datasource.editor.api.content.data.open.ContentOpenableUI> ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/SampleUIHandler.java ===================================== @@ -23,8 +23,10 @@ package fr.ird.observe.client.datasource.editor.ps.data.logbook; */ +import fr.ird.observe.client.datasource.editor.ps.data.logbook.actions.AddActivitiesFromWell; import fr.ird.observe.client.util.UIHelper; import fr.ird.observe.dto.data.ps.logbook.SampleDto; +import fr.ird.observe.dto.form.Form; import java.beans.PropertyChangeEvent; import java.beans.PropertyVetoException; @@ -59,6 +61,13 @@ public class SampleUIHandler extends GeneratedSampleUIHandler { super.startEditUI(); } + @Override + protected void installMoveAction() { + super.installMoveAction(); + // We install the action here to be at proper order in configure menu + AddActivitiesFromWell.installAction(ui); + } + private void onSuperSampleChanged(PropertyChangeEvent event) throws PropertyVetoException { boolean oldValue = (boolean) event.getOldValue(); boolean newValue = (boolean) event.getNewValue(); ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/SampleUIModelStates.java ===================================== @@ -36,21 +36,29 @@ import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition; import java.beans.PropertyVetoException; import java.util.List; +import java.util.Set; @GenerateJavaBeanDefinition public class SampleUIModelStates extends GeneratedSampleUIModelStates { private final SampleActivityTableModel sampleActivityTableModel; + private final Set<String> availableWellInTrip; public SampleUIModelStates(GeneratedSampleUIModel model) { super(model); this.sampleActivityTableModel = new SampleActivityTableModel(this); + String tripId = getClientValidationContext().getSelectModel().getPs().getCommonTrip().getId(); + this.availableWellInTrip = getReferenceCache().getDataSource().getPsCommonTripService().getLogbookWellIdsFromWellPlan(tripId); } public SampleActivityTableModel getSampleActivityTableModel() { return sampleActivityTableModel; } + public boolean isWellInTrip(String well) { + return availableWellInTrip.contains(well); + } + public boolean isSuperSample() { return getBean().isSuperSample(); } ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/WellActivityUITableModel.java ===================================== @@ -103,4 +103,5 @@ public class WellActivityUITableModel extends GeneratedWellActivityUITableModel values.removeAll(columnValues); editor.setData(values); } + } ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/WellUI.jaxx ===================================== @@ -115,4 +115,5 @@ <Object id="delegateContentUI" initializer="mainTabbedPane"/> <WellActivityUIModelStates id='wellActivityStates' initializer="wellActivityUI.getModel().getStates()"/> <JButton id='save'/> + <JMenuItem id='fillActivitiesFromSample'/> </fr.ird.observe.client.datasource.editor.api.content.data.open.ContentOpenableUI> ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/WellUIHandler.java ===================================== @@ -33,6 +33,7 @@ import fr.ird.observe.client.datasource.editor.api.content.data.open.actions.Sav import fr.ird.observe.client.datasource.editor.api.navigation.NavigationTree; import fr.ird.observe.client.datasource.editor.ps.data.common.TripLogbookUINavigationNode; import fr.ird.observe.client.datasource.editor.ps.data.common.TripUINavigationNode; +import fr.ird.observe.client.datasource.editor.ps.data.logbook.actions.AddActivitiesFromSample; import fr.ird.observe.client.datasource.validation.ClientValidationContext; import fr.ird.observe.client.util.init.DefaultUIInitializerResult; import fr.ird.observe.datasource.security.ConcurrentModificationException; @@ -80,14 +81,21 @@ public class WellUIHandler extends GeneratedWellUIHandler { InputMap inputMap = ui.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); ActionMap actionMap = ui.getActionMap(); + AddActivitiesFromSample.installAction(ui); prefixAction(ui.getWellActivityUI().getDeleteEntry(), type); prefixAction(ui.getWellActivityUI().getShowTechnicalInformations(), type); + prefixAction(ui.getFillActivitiesFromSample(), type); registerInnerAction(ui.getWellActivityUI().getResetEntry(), inputMap, actionMap); registerInnerAction(ui.getWellActivityUI().getSaveEntry(), inputMap, actionMap); registerInnerAction(ui.getWellActivityUI().getSaveAndNewEntry(), inputMap, actionMap); addConfigureActions(ui, false); initTabUI(ui.getWellActivityUI(), ui.getWellActivityPanel(), 1, d -> ui.getModel().getStates().getBean().setWellActivity(d.getWellActivity())); + getConfigureActions().remove(ui, ui.getFillActivitiesFromSample()); + // Big hack to put at the good place the ui.getFillActivitiesFromSample() action in the menu + getConfigureActions().get(ui.getWellActivityUI()).remove(ui.getWellActivityUI().getShowTechnicalInformations()); + getConfigureActions().put(ui.getWellActivityUI(), ui.getFillActivitiesFromSample()); + getConfigureActions().put(ui.getWellActivityUI(), ui.getWellActivityUI().getShowTechnicalInformations()); return result; } }; ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/actions/AddActivitiesFromSample.java ===================================== @@ -0,0 +1,106 @@ +package fr.ird.observe.client.datasource.editor.ps.data.logbook.actions; + +/*- + * #%L + * ObServe Client :: DataSource :: Editor :: PS + * %% + * Copyright (C) 2008 - 2024 IRD, 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 com.google.common.collect.Maps; +import fr.ird.observe.client.datasource.editor.api.ObserveKeyStrokesEditorApi; +import fr.ird.observe.client.datasource.editor.api.content.actions.ConfigureMenuAction; +import fr.ird.observe.client.datasource.editor.api.content.data.open.ContentOpenableUIModelStates; +import fr.ird.observe.client.datasource.editor.api.content.data.open.actions.ContentOpenableUIActionSupport; +import fr.ird.observe.client.datasource.editor.ps.data.logbook.WellActivityUI; +import fr.ird.observe.client.datasource.editor.ps.data.logbook.WellActivityUIModel; +import fr.ird.observe.client.datasource.editor.ps.data.logbook.WellActivityUITableModel; +import fr.ird.observe.client.datasource.editor.ps.data.logbook.WellUI; +import fr.ird.observe.client.datasource.editor.ps.data.logbook.WellUIModelStates; +import fr.ird.observe.dto.data.ps.logbook.ActivityStubDto; +import fr.ird.observe.dto.data.ps.logbook.WellActivityDto; +import fr.ird.observe.dto.data.ps.logbook.WellDto; +import io.ultreia.java4all.i18n.I18n; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.awt.event.ActionEvent; +import java.beans.PropertyChangeEvent; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +/** + * Created at 01/09/2024. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 9.3.7 + */ +public class AddActivitiesFromSample extends ContentOpenableUIActionSupport<WellDto, WellUI> implements ConfigureMenuAction<WellUI> { + + private static final Logger log = LogManager.getLogger(AddActivitiesFromSample.class); + + public AddActivitiesFromSample() { + super(WellDto.class, I18n.n("observe.data.ps.logbook.Well.action.addActivitiesFromSample"), I18n.n("observe.data.ps.logbook.Well.action.addActivitiesFromSample.tip"), "generate", ObserveKeyStrokesEditorApi.KEY_STROKE_GENERATE); + } + + public static void installAction(WellUI ui) { + AddActivitiesFromSample action = new AddActivitiesFromSample(); + ui.getModel().getStates().addPropertyChangeListener(ContentOpenableUIModelStates.PROPERTY_MODE, action::updateEnableState); + ui.getModel().getStates().getBean().addPropertyChangeListener(WellDto.PROPERTY_WELL, action::updateEnableState); + ui.getModel().getStates().getBean().addPropertyChangeListener(WellDto.PROPERTY_WELL_ACTIVITY, action::updateEnableState); + AddActivitiesFromSample.init(ui, ui.getFillActivitiesFromSample(), action); + } + + @Override + protected void doActionPerformed(ActionEvent e, WellUI ui) { + WellUIModelStates states = ui.getModel().getStates(); + WellDto bean = states.getBean(); + String well = bean.getWell(); + log.info("Will seek from activities for sample: {}", well); + WellActivityUI wellActivityUI = ui.getWellActivityUI(); + WellActivityUITableModel tableModel = wellActivityUI.getTableModel(); + WellActivityUIModel model = wellActivityUI.getModel(); + List<ActivityStubDto> availableActivities = wellActivityUI.getModel().getStates().getActivity(); + Map<String, ActivityStubDto> activitiesCache = new TreeMap<>(Maps.uniqueIndex(availableActivities, ActivityStubDto::getTopiaId)); + String tripId = getClientValidationContext().getSelectModel().getPs().getCommonTrip().getId(); + Set<String> logbookWellActivityFromSample = getServicesProvider().getPsCommonTripService().createLogbookWellActivityFromSample(tripId, well); + for (String activityId : logbookWellActivityFromSample) { + log.info("Create Well activity for activity: {}", activityId); + ActivityStubDto activity = activitiesCache.get(activityId); + WellActivityDto wellActivityDto = model.newTableEditBean(); + wellActivityDto.setActivity(activity); + tableModel.addNewEntry(wellActivityDto); + wellActivityUI.getSaveEntry().setEnabled(true); + try { + wellActivityUI.getSaveEntry().doClick(); + } finally { + wellActivityUI.getSaveEntry().setEnabled(false); + } + } + } + + private void updateEnableState(PropertyChangeEvent evt) { + WellUIModelStates states = ui.getModel().getStates(); + boolean readingMode = states.isReadingMode(); + String well = states.getBean().getWell(); + List<WellActivityDto> wellActivity = states.getBean().getWellActivity(); + setEnabled(!readingMode && well != null && !well.isEmpty() && wellActivity.isEmpty()); + } +} ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/actions/AddActivitiesFromWell.java ===================================== @@ -0,0 +1,102 @@ +package fr.ird.observe.client.datasource.editor.ps.data.logbook.actions; + +/*- + * #%L + * ObServe Client :: DataSource :: Editor :: PS + * %% + * Copyright (C) 2008 - 2024 IRD, 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 com.google.common.collect.Maps; +import fr.ird.observe.client.datasource.editor.api.ObserveKeyStrokesEditorApi; +import fr.ird.observe.client.datasource.editor.api.content.actions.ConfigureMenuAction; +import fr.ird.observe.client.datasource.editor.api.content.data.open.ContentOpenableUIModelStates; +import fr.ird.observe.client.datasource.editor.api.content.data.open.actions.ContentOpenableUIActionSupport; +import fr.ird.observe.client.datasource.editor.ps.data.logbook.SampleActivityTableModel; +import fr.ird.observe.client.datasource.editor.ps.data.logbook.SampleUI; +import fr.ird.observe.client.datasource.editor.ps.data.logbook.SampleUIModelStates; +import fr.ird.observe.dto.data.ps.logbook.ActivityStubDto; +import fr.ird.observe.dto.data.ps.logbook.SampleActivityDto; +import fr.ird.observe.dto.data.ps.logbook.SampleDto; +import io.ultreia.java4all.i18n.I18n; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.awt.event.ActionEvent; +import java.beans.PropertyChangeEvent; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +/** + * Created at 01/09/2024. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 9.3.7 + */ +public class AddActivitiesFromWell extends ContentOpenableUIActionSupport<SampleDto, SampleUI> implements ConfigureMenuAction<SampleUI> { + + private static final Logger log = LogManager.getLogger(AddActivitiesFromWell.class); + + public AddActivitiesFromWell() { + super(SampleDto.class, I18n.n("observe.data.ps.logbook.Sample.action.addActivitiesFromWell"), I18n.n("observe.data.ps.logbook.Sample.action.addActivitiesFromWell.tip"), "generate", ObserveKeyStrokesEditorApi.KEY_STROKE_GENERATE); + } + + public static void installAction(SampleUI ui) { + AddActivitiesFromWell action = new AddActivitiesFromWell(); + ui.getModel().getStates().addPropertyChangeListener(ContentOpenableUIModelStates.PROPERTY_MODE, action::updateEnableState); + ui.getModel().getStates().getBean().addPropertyChangeListener(SampleDto.PROPERTY_WELL, action::updateEnableState); + ui.getModel().getStates().getBean().addPropertyChangeListener(SampleDto.PROPERTY_SAMPLE_ACTIVITY, action::updateEnableState); + AddActivitiesFromWell.init(ui, ui.getFillActivitiesFromWell(), action); + } + + @Override + protected void doActionPerformed(ActionEvent e, SampleUI ui) { + SampleUIModelStates states = ui.getModel().getStates(); + SampleDto bean = states.getBean(); + String well = bean.getWell(); + log.info("Will seek from activities from well: {}", well); + SampleActivityTableModel tableModel = states.getSampleActivityTableModel(); + List<ActivityStubDto> availableActivities = tableModel.getActivities(); + Map<String, ActivityStubDto> activitiesCache = new TreeMap<>(Maps.uniqueIndex(availableActivities, ActivityStubDto::getTopiaId)); + String tripId = getClientValidationContext().getSelectModel().getPs().getCommonTrip().getId(); + Set<String> logbookSampleActivityFromWellPlan = getServicesProvider().getPsCommonTripService().createLogbookSampleActivityFromWellPlan(tripId, well); + List<SampleActivityDto> sampleActivities = new LinkedList<>(); + for (String activityId : logbookSampleActivityFromWellPlan) { + log.info("Create Sample activity for activity: {}", activityId); + ActivityStubDto activity = activitiesCache.get(activityId); + SampleActivityDto sampleActivityDto = tableModel.createNewRow(); + sampleActivityDto.setActivity(activity); + sampleActivityDto.setWeightedWeight(null); + sampleActivityDto.setWeightedWeightComputed(false); + sampleActivities.add(sampleActivityDto); + } + bean.setSampleActivity(sampleActivities); + tableModel.setData(sampleActivities); + } + + private void updateEnableState(PropertyChangeEvent evt) { + SampleUIModelStates states = ui.getModel().getStates(); + boolean readingMode = states.isReadingMode(); + String well = states.getBean().getWell(); + List<SampleActivityDto> sampleActivity = states.getBean().getSampleActivity(); + setEnabled(!readingMode && well != null && !well.isEmpty() && states.isWellInTrip(well.trim()) && sampleActivity.isEmpty()); + } +} ===================================== core/api/dto-decoration/src/main/i18n/getters/labels.getter ===================================== @@ -977,6 +977,8 @@ observe.data.ps.logbook.Route.navigation.unsaved observe.data.ps.logbook.Route.timeAtSea observe.data.ps.logbook.Route.title observe.data.ps.logbook.Route.type +observe.data.ps.logbook.Sample.action.addActivitiesFromWell +observe.data.ps.logbook.Sample.action.addActivitiesFromWell.tip observe.data.ps.logbook.Sample.action.create observe.data.ps.logbook.Sample.action.move observe.data.ps.logbook.Sample.action.move.choose.parent.message @@ -1026,6 +1028,8 @@ observe.data.ps.logbook.SampleSpeciesMeasure.type observe.data.ps.logbook.TransmittingBuoy.code observe.data.ps.logbook.TransmittingBuoy.country observe.data.ps.logbook.TransmittingBuoy.type +observe.data.ps.logbook.Well.action.addActivitiesFromSample +observe.data.ps.logbook.Well.action.addActivitiesFromSample.tip observe.data.ps.logbook.Well.action.create observe.data.ps.logbook.Well.action.move observe.data.ps.logbook.Well.action.move.choose.parent.message ===================================== core/api/services/src/main/java/fr/ird/observe/services/service/data/ps/common/TripService.java ===================================== @@ -32,9 +32,11 @@ import fr.ird.observe.services.service.MethodCredential; import fr.ird.observe.services.service.data.TripAwareService; import io.ultreia.java4all.http.spi.Get; import io.ultreia.java4all.http.spi.Nullable; +import io.ultreia.java4all.http.spi.Post; import io.ultreia.java4all.http.spi.Service; import java.util.List; +import java.util.Set; /** * Created on 26/07/2021. @@ -57,6 +59,40 @@ public interface TripService extends TripAwareService { @MethodCredential(Permission.READ_DATA) List<ActivityStubDto> getLogbookWellPlanActivities(String tripId); + /** + * @param tripId selected trip id + * @return the set of {@code Well#well} used in the well plan of selected trip + */ + @Get + @MethodCredential(Permission.READ_DATA) + Set<String> getLogbookWellIdsFromWellPlan(String tripId); + + /** + * @param tripId selected trip id + * @param wellId selected well id + * @return the set of activity ids found in well plan for selected trip and well + */ + @Post + @MethodCredential(Permission.READ_DATA) + Set<String> createLogbookSampleActivityFromWellPlan(String tripId, String wellId); + + /** + * @param tripId selected trip id + * @return the set of {@code Well#well} used in the sample of the selected trip + */ + @Get + @MethodCredential(Permission.READ_DATA) + Set<String> getLogbookWellIdsFromSample(String tripId); + + /** + * @param tripId selected trip id + * @param wellId selected well id + * @return the set of activity ids found in sample for selected trip and well + */ + @Post + @MethodCredential(Permission.READ_DATA) + Set<String> createLogbookWellActivityFromSample(String tripId, String wellId); + @Get @MethodCredential(Permission.READ_DATA) boolean isActivityEndOfSearchFound(String routeId); ===================================== core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripSpi.java ===================================== @@ -42,6 +42,10 @@ import fr.ird.observe.entities.data.DataEntity; import fr.ird.observe.entities.data.ps.landing.Landing; import fr.ird.observe.entities.data.ps.logbook.Activity; import fr.ird.observe.entities.data.ps.logbook.Route; +import fr.ird.observe.entities.data.ps.logbook.Sample; +import fr.ird.observe.entities.data.ps.logbook.SampleActivity; +import fr.ird.observe.entities.data.ps.logbook.Well; +import fr.ird.observe.entities.data.ps.logbook.WellActivity; import fr.ird.observe.entities.referential.common.DataQuality; import fr.ird.observe.entities.referential.common.Ocean; import fr.ird.observe.entities.referential.common.Species; @@ -62,6 +66,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Stream; @@ -380,4 +385,41 @@ public class TripSpi extends GeneratedTripSpi { lastUpdateDates.add(fr.ird.observe.entities.data.ps.localmarket.SurveyPart.class); } + public Set<String> getLogbookWellIdsFromWellPlan(ServiceContext context, String tripId) { + return Trip.getDao(context).getLogbookWellIdsFromWellPlan(tripId); + } + + public Set<String> getLogbookWellIdsFromSample(ServiceContext context, String tripId) { + return Trip.getDao(context).getLogbookWellIdsFromSample(tripId); + } + + public Set<String> createLogbookSampleActivityFromWellPlan(ServiceContext context, String tripId, String wellId) { + Trip trip = loadEntity(context, tripId); + Set<String> result = new LinkedHashSet<>(); + for (Well well : trip.getWell()) { + if (!well.getWell().equals(wellId)) { + continue; + } + for (WellActivity wellActivity : well.getWellActivity()) { + Activity activity = wellActivity.getActivity(); + result.add(activity.getId()); + } + } + return result; + } + + public Set<String> createLogbookWellActivityFromSample(ServiceContext context, String tripId, String wellId) { + Set<String> result = new LinkedHashSet<>(); + Trip trip = loadEntity(context, tripId); + for (Sample sample : trip.getSample()) { + if (!sample.getWell().equals(wellId)) { + continue; + } + for (SampleActivity sampleActivity : sample.getSampleActivity()) { + result.add(sampleActivity.getActivity().getId()); + } + } + + return result; + } } ===================================== core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripTopiaDao.java ===================================== @@ -44,6 +44,7 @@ import java.sql.Timestamp; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.function.Consumer; import java.util.function.Function; @@ -68,6 +69,22 @@ public class TripTopiaDao extends AbstractTripTopiaDao<Trip> { return findMultipleResultBySqlQuery(queryLogbookWellPlanActivities(tripId), s -> toActivityStubDto(s, vesselActivities)); } + public Set<String> getLogbookWellIdsFromWellPlan(String tripId) { + return Set.copyOf(findMultipleResultBySqlQuery(queryLogbookWellIdsFromWellPlan(tripId))); + } + + public Set<String> getLogbookActivityIdsFromWellPlan(String tripId, String wellId) { + return new LinkedHashSet<>(findMultipleResultBySqlQuery(queryLogbookActivityIdsFromWellPlan(tripId, wellId))); + } + + public Set<String> getLogbookWellIdsFromSample(String tripId) { + return Set.copyOf(findMultipleResultBySqlQuery(queryLogbookWellIdsFromSample(tripId))); + } + + public Set<String> getLogbookActivityIdsFromSample(String tripId, String wellId) { + return new LinkedHashSet<>(findMultipleResultBySqlQuery(queryLogbookActivityIdsFromSample(tripId, wellId))); + } + public boolean isActivitiesAcquisitionModeByTimeEnabled(String tripId) { return this.<Number>findSingleResultBySqlQuery(queryIsActivitiesAcquisitionModeByTimeEnabled(tripId)).intValue() == 0; } ===================================== core/persistence/java/src/main/resources/fr/ird/observe/entities/data/ps/common/TripImpl.hbm.xml ===================================== @@ -228,6 +228,26 @@ FROM ps_logbook.Route r INNER JOIN ps_logbook.Activity a ON a.route = r.topiaId WHERE r.trip = ? AND a.time IS NULL +]]></sql-query> + <sql-query name="fr.ird.observe.entities.data.ps.common.Trip::LogbookActivityIdsFromSample" read-only="true" + comment="Get all logbook activity ids from samples filtered on a Sample.well"> + <query-param name="tripId" type="java.lang.String"/> + <query-param name="wellId" type="java.lang.String"/><![CDATA[ + SELECT + DISTINCT(sa.activity) + FROM ps_logbook.Sample s + INNER JOIN ps_logbook.sampleActivity sa ON sa.sample = s.topiaId + WHERE s.trip = ? AND s.well = ? +]]></sql-query> + <sql-query name="fr.ird.observe.entities.data.ps.common.Trip::LogbookActivityIdsFromWellPlan" read-only="true" + comment="Get all logbook activity ids from well plan filtered on a trip and a Well.well"> + <query-param name="tripId" type="java.lang.String"/> + <query-param name="wellId" type="java.lang.String"/><![CDATA[ + SELECT + DISTINCT(wa.activity) + FROM ps_logbook.well w + INNER JOIN ps_logbook.wellActivity wa ON wa.well = w.topiaId + WHERE w.trip = ? AND w.well = ? ]]></sql-query> <sql-query name="fr.ird.observe.entities.data.ps.common.Trip::LogbookActivityPoint" read-only="true" comment="Get logbook activity points"> @@ -274,6 +294,22 @@ INNER JOIN ps_logbook.transmittingBuoy t ON t.floatingObject = f.topiaId WHERE r.trip = ? AND t.latitude IS NOT NULL AND t.longitude IS NOT NULL ORDER BY r.date, a.time +]]></sql-query> + <sql-query name="fr.ird.observe.entities.data.ps.common.Trip::LogbookWellIdsFromSample" read-only="true" + comment="Get all logbook well ids from samples"> + <query-param name="tripId" type="java.lang.String"/><![CDATA[ + SELECT + DISTINCT(s.well) + FROM ps_logbook.Sample s + WHERE s.trip = ? +]]></sql-query> + <sql-query name="fr.ird.observe.entities.data.ps.common.Trip::LogbookWellIdsFromWellPlan" read-only="true" + comment="Get all logbook well ids from well plan"> + <query-param name="tripId" type="java.lang.String"/><![CDATA[ + SELECT + DISTINCT(w.well) + FROM ps_logbook.well w + WHERE w.trip = ? ]]></sql-query> <sql-query name="fr.ird.observe.entities.data.ps.common.Trip::LogbookWellPlanActivities" read-only="true" comment="Get all logbook well plan activities for the given trip"> ===================================== core/persistence/test/src/test/java/fr/ird/observe/entities/data/ps/common/TripTopiaDaoTest.java ===================================== @@ -42,6 +42,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; @@ -64,7 +65,7 @@ public class TripTopiaDaoTest extends PersistenceTestSupportRead { @Test public void loadSqlQueries() { - ObservePersistenceFixtures.assertSqlQueries(Trip.class, 19); + ObservePersistenceFixtures.assertSqlQueries(Trip.class, 23); } @Test @@ -122,6 +123,42 @@ public class TripTopiaDaoTest extends PersistenceTestSupportRead { } } + @Test + public void getLogbookWellIdsFromSample() { + try (ObserveTopiaPersistenceContext persistenceContext = localTestMethodResource.newPersistenceContext()) { + Set<String> actual = Trip.SPI.getDao(persistenceContext).getLogbookWellIdsFromSample(tripId); + Assert.assertNotNull(actual); + Assert.assertEquals(1, actual.size()); + } + } + + @Test + public void getLogbookWellIdsFromWellPlan() { + try (ObserveTopiaPersistenceContext persistenceContext = localTestMethodResource.newPersistenceContext()) { + Set<String> actual = Trip.SPI.getDao(persistenceContext).getLogbookWellIdsFromWellPlan(tripId); + Assert.assertNotNull(actual); + Assert.assertEquals(1, actual.size()); + } + } + + @Test + public void getLogbookActivityIdsFromWellPlan() { + try (ObserveTopiaPersistenceContext persistenceContext = localTestMethodResource.newPersistenceContext()) { + Set<String> actual = Trip.SPI.getDao(persistenceContext).getLogbookActivityIdsFromWellPlan(tripId, "3T"); + Assert.assertNotNull(actual); + Assert.assertEquals(1, actual.size()); + } + } + + @Test + public void getLogbookActivityIdsFromSample() { + try (ObserveTopiaPersistenceContext persistenceContext = localTestMethodResource.newPersistenceContext()) { + Set<String> actual = Trip.SPI.getDao(persistenceContext).getLogbookActivityIdsFromSample(tripId, "3T"); + Assert.assertNotNull(actual); + Assert.assertEquals(1, actual.size()); + } + } + @Test public void buildMap() { try (ObserveTopiaPersistenceContext persistenceContext = localTestMethodResource.newPersistenceContext()) { ===================================== core/services/i18n/src/main/i18n/translations/services_en_GB.properties ===================================== @@ -1205,6 +1205,8 @@ observe.data.ps.logbook.Route.title=Route observe.data.ps.logbook.Route.type=Route observe.data.ps.logbook.Route.validation.date.after.currentPsCommonTrip.startDate=Date (%2$s) must be after trip start date (%1$s). observe.data.ps.logbook.Route.validation.date.before.currentPsCommonTrip.endDate=Date (%1$s) must be before trip end date (%2$s). +observe.data.ps.logbook.Sample.action.addActivitiesFromWell=Add activities from well +observe.data.ps.logbook.Sample.action.addActivitiesFromWell.tip=Add activities from well observe.data.ps.logbook.Sample.action.create=Next sample observe.data.ps.logbook.Sample.action.move=Change trip observe.data.ps.logbook.Sample.action.move.choose.parent.message=Select target trip @@ -1263,6 +1265,8 @@ observe.data.ps.logbook.SampleSpeciesMeasure.type=Sample species measure observe.data.ps.logbook.TransmittingBuoy.code=Code observe.data.ps.logbook.TransmittingBuoy.country=Flag country observe.data.ps.logbook.TransmittingBuoy.type=Transmitting buoy +observe.data.ps.logbook.Well.action.addActivitiesFromSample=Add activities from samples +observe.data.ps.logbook.Well.action.addActivitiesFromSample.tip=Add activities from samples observe.data.ps.logbook.Well.action.create=Next well observe.data.ps.logbook.Well.action.move=Change trip observe.data.ps.logbook.Well.action.move.choose.parent.message=Select target trip ===================================== core/services/i18n/src/main/i18n/translations/services_es_ES.properties ===================================== @@ -1205,6 +1205,8 @@ observe.data.ps.logbook.Route.title=Ruta observe.data.ps.logbook.Route.type=Ruta observe.data.ps.logbook.Route.validation.date.after.currentPsCommonTrip.startDate=El día de observación (%2$s) debe ser superior o igual a la fecha de comienzo de marea (%1$s). observe.data.ps.logbook.Route.validation.date.before.currentPsCommonTrip.endDate=Date (%1$s) must be before trip end date (%2$s). +observe.data.ps.logbook.Sample.action.addActivitiesFromWell=Add activities from well \#TODO +observe.data.ps.logbook.Sample.action.addActivitiesFromWell.tip=Add activities from well \#TODO observe.data.ps.logbook.Sample.action.create=Next sample \#TODO observe.data.ps.logbook.Sample.action.move=Change trip observe.data.ps.logbook.Sample.action.move.choose.parent.message=Select target trip @@ -1263,6 +1265,8 @@ observe.data.ps.logbook.SampleSpeciesMeasure.type=Sample species measure observe.data.ps.logbook.TransmittingBuoy.code=Identificación observe.data.ps.logbook.TransmittingBuoy.country=Bandera observe.data.ps.logbook.TransmittingBuoy.type=TransmittingBuoy +observe.data.ps.logbook.Well.action.addActivitiesFromSample=Add activities from samples \#TODO +observe.data.ps.logbook.Well.action.addActivitiesFromSample.tip=Add activities from samples \#TODO observe.data.ps.logbook.Well.action.create=Next well observe.data.ps.logbook.Well.action.move=Change trip observe.data.ps.logbook.Well.action.move.choose.parent.message=Select target trip ===================================== core/services/i18n/src/main/i18n/translations/services_fr_FR.properties ===================================== @@ -1205,6 +1205,8 @@ observe.data.ps.logbook.Route.title=Route observe.data.ps.logbook.Route.type=Route observe.data.ps.logbook.Route.validation.date.after.currentPsCommonTrip.startDate=Le jour d'observation (%2$s) doit être supérieure ou égale à la date de début de la marée (%1$s). observe.data.ps.logbook.Route.validation.date.before.currentPsCommonTrip.endDate=La date (%1$s) doit être inférieure ou égale à la date de fin de marée (%2$s). +observe.data.ps.logbook.Sample.action.addActivitiesFromWell=Récupérer les activités +observe.data.ps.logbook.Sample.action.addActivitiesFromWell.tip=Récupérer les activités depuis le plan de cuve observe.data.ps.logbook.Sample.action.create=Échantillon suivant observe.data.ps.logbook.Sample.action.move=Changer de marée observe.data.ps.logbook.Sample.action.move.choose.parent.message=À quelle marée voulez-vous associer les échantillons sélectionnés ? @@ -1263,6 +1265,8 @@ observe.data.ps.logbook.SampleSpeciesMeasure.type=Mesure d'un échantillon espè observe.data.ps.logbook.TransmittingBuoy.code=Identifiant observe.data.ps.logbook.TransmittingBuoy.country=Pavillon observe.data.ps.logbook.TransmittingBuoy.type=Balise émettrice +observe.data.ps.logbook.Well.action.addActivitiesFromSample=Déduire les activités +observe.data.ps.logbook.Well.action.addActivitiesFromSample.tip=Déduire les activités depuis les échantillons observe.data.ps.logbook.Well.action.create=Cuve suivante observe.data.ps.logbook.Well.action.move=Changer de marée observe.data.ps.logbook.Well.action.move.choose.parent.message=À quelle marée voulez-vous associer les cuves sélectionnées ? ===================================== core/services/local/src/main/java/fr/ird/observe/services/local/service/data/ps/common/TripServiceLocalSupport.java ===================================== @@ -38,6 +38,7 @@ import fr.ird.observe.services.service.data.ps.common.TripService; import java.util.Date; import java.util.LinkedHashSet; import java.util.List; +import java.util.Set; /** * Created on 26/07/2021. @@ -82,6 +83,26 @@ public abstract class TripServiceLocalSupport extends ObserveServiceLocal implem return Trip.SPI.getLogbookWellPlanActivities(this, tripId); } + @Override + public Set<String> getLogbookWellIdsFromWellPlan(String tripId) { + return Trip.SPI.getLogbookWellIdsFromWellPlan(this, tripId); + } + + @Override + public Set<String> createLogbookSampleActivityFromWellPlan(String tripId, String wellId) { + return Trip.SPI.createLogbookSampleActivityFromWellPlan(this, tripId, wellId); + } + + @Override + public Set<String> createLogbookWellActivityFromSample(String tripId, String wellId) { + return Trip.SPI.createLogbookWellActivityFromSample(this, tripId, wellId); + } + + @Override + public Set<String> getLogbookWellIdsFromSample(String tripId) { + return Trip.SPI.getLogbookWellIdsFromSample(this, tripId); + } + @Override public boolean isActivityEndOfSearchFound(String routeId) { return Trip.SPI.isActivityEndOfSearchFound(this, routeId); ===================================== core/services/test/src/main/java/fr/ird/observe/services/service/data/ps/common/TripServiceFixtures.java ===================================== @@ -41,6 +41,7 @@ import fr.ird.observe.services.service.data.RootOpenableServiceFixtures; import org.junit.Assert; import java.util.List; +import java.util.Map; import java.util.Set; public class TripServiceFixtures extends GeneratedTripServiceFixtures { @@ -170,4 +171,38 @@ public class TripServiceFixtures extends GeneratedTripServiceFixtures { Assert.assertNotNull(actual.getObject().getId()); Assert.assertEquals(tripId, actual.getObject().getId()); } + + @Override + public void getLogbookWellIdsFromSample(ObserveServicesProvider servicesProvider, TripService service) { + String tripId = getProperty("getLogbookWellIdsFromSample.tripId"); + Set<String> actual = service.getLogbookWellIdsFromSample(tripId); + Assert.assertNotNull(actual); + Assert.assertEquals(getIntegerProperty("getLogbookWellIdsFromSample.count"), actual.size()); + } + + @Override + public void getLogbookWellIdsFromWellPlan(ObserveServicesProvider servicesProvider, TripService service) { + String tripId = getProperty("getLogbookWellIdsFromWellPlan.tripId"); + Set<String> actual = service.getLogbookWellIdsFromWellPlan(tripId); + Assert.assertNotNull(actual); + Assert.assertEquals(getIntegerProperty("getLogbookWellIdsFromWellPlan.count"), actual.size()); + } + + @Override + public void createLogbookSampleActivityFromWellPlan(ObserveServicesProvider servicesProvider, TripService service) { + String tripId = getProperty("createLogbookSampleActivityFromWellPlan.tripId"); + String wellId = getProperty("createLogbookSampleActivityFromWellPlan.wellId"); + Set<String> actual = service.createLogbookSampleActivityFromWellPlan(tripId, wellId); + Assert.assertNotNull(actual); + Assert.assertEquals(getIntegerProperty("createLogbookSampleActivityFromWellPlan.count"), actual.size()); + } + + @Override + public void createLogbookWellActivityFromSample(ObserveServicesProvider servicesProvider, TripService service) { + String tripId = getProperty("createLogbookWellActivityFromSample.tripId"); + String wellId = getProperty("createLogbookWellActivityFromSample.wellId"); + Set<String> actual = service.createLogbookWellActivityFromSample(tripId, wellId); + Assert.assertNotNull(actual); + Assert.assertEquals(getIntegerProperty("createLogbookWellActivityFromSample.count"), actual.size()); + } } ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/data/ps/common/TripService.properties ===================================== @@ -19,6 +19,12 @@ # <http://www.gnu.org/licenses/gpl-3.0.html>. # #L% ### +createLogbookSampleActivityFromWellPlan.count=1 +createLogbookSampleActivityFromWellPlan.tripId=${defaultTripId} +createLogbookSampleActivityFromWellPlan.wellId=${defaultWellId} +createLogbookWellActivityFromSample.count=1 +createLogbookWellActivityFromSample.tripId=${defaultTripId} +createLogbookWellActivityFromSample.wellId=${defaultWellId} defaultActivityId=FIXME defaultId=${PS_COMMON_TRIP} defaultNewParentId=${REFERENTIAL_PS_COMMON_PROGRAM_MOVE} @@ -28,6 +34,7 @@ defaultRouteId=FIXME defaultSpeciesListId=fr.ird.referential.common.SpeciesList#1239832675370#0.1 defaultTripId=${PS_COMMON_TRIP} defaultVesselId=fr.ird.referential.common.Vessel#1239832679425#0.9136908731720471 +defaultWellId=3T delete.id=${defaultId} exists.id=${defaultId} getAllTrip.count=4 @@ -36,6 +43,10 @@ getChildren.count=1 getChildren.parentId=${defaultParentId} getChildrenUpdate.count=1 getChildrenUpdate.parentId=${defaultParentId} +getLogbookWellIdsFromSample.count=1 +getLogbookWellIdsFromSample.tripId=${defaultTripId} +getLogbookWellIdsFromWellPlan.count=1 +getLogbookWellIdsFromWellPlan.tripId=${defaultTripId} getLogbookWellPlanActivities.count=3 getLogbookWellPlanActivities.tripId=${defaultTripId} getMatchingTripsVesselWithinDateRange.count=0 ===================================== model/src/main/models/Observe/dto/class/i18nLabels.properties ===================================== @@ -75,13 +75,13 @@ data.ps.logbook.Catch=comment,species,speciesFate,weight,weightCategory,weightMe data.ps.logbook.FloatingObject=materialsValid,objectOperation,quadrant,supportVesselName,country,vessel,computedBiodegradable,computedNonEntangling,computedSimplifiedObjectType,computedValues,generalTab,buoysTab,materialsTab,notComputed,type.short,computedWhenArrivingBiodegradable,computedWhenLeavingBiodegradable,computedWhenArrivingNonEntangling,computedWhenLeavingNonEntangling,computedWhenArrivingSimplifiedObjectType,computedWhenLeavingSimplifiedObjectType data.ps.logbook.FloatingObjectPart=whenArriving,whenLeaving data.ps.logbook.Route=activity,comment,date,fishingTime,timeAtSea -data.ps.logbook.Sample=number,activity,bigsWeight,comment,person,sampleQuality,sampleType,smallsWeight,superSample,totalWeight,well,generalTab,activityTab,notSuperSample.with.moreThanOne.sampleSpecies.message,notSuperSample.with.moreThanOne.sampleSpecies.title,personTab,psSampler.available,psSampler.selected +data.ps.logbook.Sample=number,activity,bigsWeight,comment,person,sampleQuality,sampleType,smallsWeight,superSample,totalWeight,well,generalTab,activityTab,notSuperSample.with.moreThanOne.sampleSpecies.message,notSuperSample.with.moreThanOne.sampleSpecies.title,personTab,psSampler.available,psSampler.selected,action.addActivitiesFromWell,action.addActivitiesFromWell.tip data.ps.logbook.SampleActivity=activity,weightedWeight,weightedWeightComputed,weightedWeightComputed.short,weightedWeightComputed.computed.tip,weightedWeightComputed.observed.tip data.ps.logbook.SampleSampleSpecies=superSample,sampleSpecies,species data.ps.logbook.SampleSpecies=comment,measuredCount,sampleSpeciesMeasure,sizeMeasureType,species,subSampleNumber,totalCount,startTime,endTime,startTime.short,endTime.short,generalTab data.ps.logbook.SampleSpeciesMeasure=count,sizeClass data.ps.logbook.TransmittingBuoy=comment,code,transmittingBuoyOwnership,transmittingBuoyType,transmittingBuoyOperation,country,vessel,latitude,longitude,quadrant -data.ps.logbook.Well=well,wellVessel,wellFactory,wellSamplingConformity,wellSamplingStatus,generalTab,wellActivityTab,action.save,action.save.tip,wellVessel.short,wellFactory.short,wellAlternativeNumbering +data.ps.logbook.Well=well,wellVessel,wellFactory,wellSamplingConformity,wellSamplingStatus,generalTab,wellActivityTab,action.save,action.save.tip,wellVessel.short,wellFactory.short,wellAlternativeNumbering,action.addActivitiesFromSample,action.addActivitiesFromSample.tip data.ps.logbook.WellActivity=activity,wellActivitySpecies,computedTotalWeight,computedTotalWeight.short data.ps.logbook.WellActivitySpecies=species,weight,weightCategory,count,setSpeciesNumber data.ps.observation.Activity=date,coordinate,observedSystem.available,observedSystem.selected,comment,currentFpaZone,dataQuality,detectionMode,ersId,floatingObjectEmpty,latitude,longitude,nextFpaZone,nonTargetCatchSpecies,observedSystem,observedSystemDistance,previousFpaZone,quadrant,reasonForNoFishing,seaSurfaceTemperature,surroundingActivity,time,vesselActivity,vesselSpeed,wind,generalTab,error.no.activity.6,measurementsTab,observedSystemTab ===================================== model/src/main/resources/META-INF/persistence/fr/ird/observe/entities/data/ps/common/Trip-sql-queries.properties ===================================== @@ -93,6 +93,34 @@ INNER JOIN ps_logbook.activity a ON a.route = r.topiaId\ INNER JOIN ps_common.vesselActivity va ON a.vesselActivity = va.topiaId\ WHERE r.trip = ? AND va.allowSet = TRUE OR va.topiaId = 'fr.ird.referential.ps.common.VesselActivity#1464000000000#32'\ ORDER BY r.date,a.time +LogbookWellIdsFromWellPlan.comment=Get all logbook well ids from well plan +LogbookWellIdsFromWellPlan.parameter.1=tripId|java.lang.String +LogbookWellIdsFromWellPlan=SELECT\ +DISTINCT(w.well)\ +FROM ps_logbook.well w\ +WHERE w.trip = ? +LogbookActivityIdsFromWellPlan.comment=Get all logbook activity ids from well plan filtered on a trip and a Well.well +LogbookActivityIdsFromWellPlan.parameter.1=tripId|java.lang.String +LogbookActivityIdsFromWellPlan.parameter.2=wellId|java.lang.String +LogbookActivityIdsFromWellPlan=SELECT\ +DISTINCT(wa.activity)\ +FROM ps_logbook.well w\ +INNER JOIN ps_logbook.wellActivity wa ON wa.well = w.topiaId\ +WHERE w.trip = ? AND w.well = ? +LogbookWellIdsFromSample.comment=Get all logbook well ids from samples +LogbookWellIdsFromSample.parameter.1=tripId|java.lang.String +LogbookWellIdsFromSample=SELECT\ +DISTINCT(s.well)\ +FROM ps_logbook.Sample s\ +WHERE s.trip = ? +LogbookActivityIdsFromSample.comment=Get all logbook activity ids from samples filtered on a Sample.well +LogbookActivityIdsFromSample.parameter.1=tripId|java.lang.String +LogbookActivityIdsFromSample.parameter.2=wellId|java.lang.String +LogbookActivityIdsFromSample=SELECT\ +DISTINCT(sa.activity)\ +FROM ps_logbook.Sample s\ +INNER JOIN ps_logbook.sampleActivity sa ON sa.sample = s.topiaId\ +WHERE s.trip = ? AND s.well = ? UpdateVersion.comment=Update trip version UpdateVersion.parameter.1=lastUpdateDate|java.sql.Timestamp UpdateVersion.parameter.2=tripId|java.lang.String ===================================== server/core/src/main/filtered-resources/META-INF/mapping-api-client.wm ===================================== @@ -141,7 +141,11 @@ GET /data/ps/AvdthService/importData data POST /data/ps/ConsolidateDataService/consolidateLocalmarketBatch data.ps.ConsolidateDataServiceRestApi.consolidateLocalmarketBatch POST /data/ps/ConsolidateDataService/consolidateTrip data.ps.ConsolidateDataServiceRestApi.consolidateTrip GET /data/ps/ConsolidateDataService/newSimplifiedObjectTypeManager data.ps.ConsolidateDataServiceRestApi.newSimplifiedObjectTypeManager +POST /data/ps/common/TripService/createLogbookSampleActivityFromWellPlan data.ps.common.TripServiceRestApi.createLogbookSampleActivityFromWellPlan +POST /data/ps/common/TripService/createLogbookWellActivityFromSample data.ps.common.TripServiceRestApi.createLogbookWellActivityFromSample GET /data/ps/common/TripService/getAllTripIds data.ps.common.TripServiceRestApi.getAllTripIds +GET /data/ps/common/TripService/getLogbookWellIdsFromSample data.ps.common.TripServiceRestApi.getLogbookWellIdsFromSample +GET /data/ps/common/TripService/getLogbookWellIdsFromWellPlan data.ps.common.TripServiceRestApi.getLogbookWellIdsFromWellPlan GET /data/ps/common/TripService/getLogbookWellPlanActivities data.ps.common.TripServiceRestApi.getLogbookWellPlanActivities GET /data/ps/common/TripService/getMatchingTripsVesselWithinDateRange data.ps.common.TripServiceRestApi.getMatchingTripsVesselWithinDateRange GET /data/ps/common/TripService/getSpeciesByListAndTrip data.ps.common.TripServiceRestApi.getSpeciesByListAndTrip ===================================== toolkit/templates/src/main/java/fr/ird/observe/toolkit/templates/dto/DtoTransformer.java ===================================== @@ -737,7 +737,7 @@ public class DtoTransformer extends BeanTransformer implements TemplateContract } super.createProperty(output, attr, usePCS, generateBooleanGetMethods, generateNotEmptyCollections); boolean multiple = JavaGeneratorUtil.isNMultiplicity(attr); - if (multiple && JavaGeneratorUtil.isOrdered(attr)) { + if (multiple) { // check out if we are using a WithIndex type if (attrType.endsWith("Dto")) { attrType = attrType.substring(0, attrType.length() - "Dto".length()); View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/a8286844ccfb8f04e8bf6d249... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/a8286844ccfb8f04e8bf6d249... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT (@tchemit)