Observe-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
September 2024
- 1 participants
- 128 discussions
[Git][ultreiaio/ird-observe] Pushed new branch feature/issue-2907
by Tony CHEMIT (@tchemit) 02 Sep '24
by Tony CHEMIT (@tchemit) 02 Sep '24
02 Sep '24
Tony CHEMIT pushed new branch feature/issue-2907 at ultreiaio / ird-observe
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/tree/feature/issue-2907
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 4 commits: Add new ClientConfig option to store the speciesList and fill from the...
by Tony CHEMIT (@tchemit) 02 Sep '24
by Tony CHEMIT (@tchemit) 02 Sep '24
02 Sep '24
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
f238bf01 by Tony Chemit at 2024-09-02T11:41:44+02:00
Add new ClientConfig option to store the speciesList and fill from the hardcoded list in consolidate action
- - - - -
c4d28d74 by Tony Chemit at 2024-09-02T12:03:44+02:00
Add the species list in consolidation request, then use it in consolidation code instead of the hardcoded list
- - - - -
4d45c7fb by Tony Chemit at 2024-09-02T12:03:44+02:00
Use the species list in Consolidation action in GUI (and for this time add a TODO to configure this list in config UI)
- - - - -
77540b5f by Tony Chemit at 2024-09-02T12:04:14+02:00
Merge branch 'feature/issue-2929' into develop
Rendre configurable la liste des espèces à inclure dans la consolidation du sampleActivity.wieghtedWeight - Closes #2929
- - - - -
17 changed files:
- client/configuration/src/main/config/Client.ini
- client/configuration/src/main/i18n/getters/config.getter
- client/core/src/main/java/fr/ird/observe/client/main/body/ClientConfigUI.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/ConsolidateConfigUI.jaxx
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/ConsolidateModel.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/ConsolidateUIHandler.java
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/actions/Start.java
- client/runner/src/main/i18n/translations/client-runner_en_GB.properties
- client/runner/src/main/i18n/translations/client-runner_es_ES.properties
- client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
- core/api/dto-consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/common/TripConsolidateRequest.java
- core/persistence/consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/common/TripConsolidateEngine.java
- core/persistence/consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/logbook/SampleActivityConsolidateActions.java
- core/persistence/consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/logbook/SampleActivityConsolidateContext.java
- core/persistence/consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/logbook/SampleActivityConsolidateEngine.java
- core/services/test/src/main/java/fr/ird/observe/services/service/data/ps/ConsolidateDataServiceFixtures.java
- core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/data/ps/ConsolidateDataService.properties
Changes:
=====================================
client/configuration/src/main/config/Client.ini
=====================================
@@ -476,6 +476,12 @@ key = instance.consolidation.failIfLengthLengthParameterNotFound
type = Boolean
defaultValue = false
+[option consolidationSpeciesListForLogbookSampleActivityWeightedWeight]
+description = observe.config.consolidation.speciesListForLogbookSampleActivityWeightedWeight
+key = instance.consolidation.speciesListForLogbookSampleActivityWeightedWeight
+type = String[]
+defaultValue = fr.ird.referential.common.Species#1239832685474#0.8943253454598569,fr.ird.referential.common.Species#1239832685474#0.975344121171992,fr.ird.referential.common.Species#1239832685475#0.13349466123905152,fr.ird.referential.common.Species#1239832685476#0.5618871286604711,fr.ird.referential.common.Species#1239832685477#0.8024257002747615,fr.ird.referential.common.Species#1239832685477#0.3846921632590058,fr.ird.referential.common.Species#1441287921299#0.016754076421811148,fr.ird.referential.common.Species#1433499265113#0.891799515346065,fr.ird.referential.common.Species#1239832685477#0.2673009297087321,fr.ird.referential.common.Species#1239832685478#0.7676744877900202,fr.ird.referential.common.Species#1239832685477#0.5989181185528589,fr.ird.referential.common.Species#1239832685476#0.36339915670317835
+
[option sizeMeasureTypeSeineObservationTargetSampleId]
description = observe.config.sizeMeasureType.seine.observation.targetSample
key = referential.sizeMeasureType.seine.observation.targetSample
=====================================
client/configuration/src/main/i18n/getters/config.getter
=====================================
@@ -22,6 +22,7 @@ observe.config.client.logFiles.timeout.description
observe.config.client.temporaryFiles.timeout.description
observe.config.consolidation.failIfLengthLengthParameterNotFound
observe.config.consolidation.failIfLengthWeightParameterNotFound
+observe.config.consolidation.speciesListForLogbookSampleActivityWeightedWeight
observe.config.coordinate.format
observe.config.db.locale
observe.config.dcpPresetsDirectory.description
=====================================
client/core/src/main/java/fr/ird/observe/client/main/body/ClientConfigUI.java
=====================================
@@ -251,7 +251,7 @@ public class ClientConfigUI extends JXTitledPanel implements WithClientUIContext
// helper.setCloseAction(((DataSourceEditor)currentBody.get()).getContentUIManager()::restartEdit);
// }
- addApplicationOptions(helper);
+ addApplicationOptions(helper, dataSource);
addUiOptions(helper);
addNavigationOptions(helper);
addMapOptions(helper);
@@ -261,7 +261,7 @@ public class ClientConfigUI extends JXTitledPanel implements WithClientUIContext
return helper;
}
- private void addApplicationOptions(ObserveConfigUIBuilder helper) {
+ private void addApplicationOptions(ObserveConfigUIBuilder helper, ObserveSwingDataSource dataSource) {
helper.addCategory(n("observe.config.category.application"),
n("observe.config.category.application.description"),
@@ -273,6 +273,9 @@ public class ClientConfigUI extends JXTitledPanel implements WithClientUIContext
helper.addOption(ClientConfigOption.VALIDATION_USE_DISABLED_REFERENTIAL);
helper.addOption(ClientConfigOption.CONSOLIDATION_FAIL_IF_LENGTH_WEIGHT_PARAMETER_NOT_FOUND);
helper.addOption(ClientConfigOption.CONSOLIDATION_FAIL_IF_LENGTH_LENGTH_PARAMETER_NOT_FOUND);
+ if (dataSource != null && dataSource.isOpen()) {
+ helper.addOption(ClientConfigOption.CONSOLIDATION_SPECIES_LIST_FOR_LOGBOOK_SAMPLE_ACTIVITY_WEIGHTED_WEIGHT);
+ }
}
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/ConsolidateConfigUI.jaxx
=====================================
@@ -60,6 +60,14 @@ public void destroy() {
<JCheckBox id='consolidationFailIfLengthLengthParameterNotFound' styleClass="skipI18n"/>
</cell>
</row>
+ <row>
+ <cell anchor="west">
+ <JLabel id='consolidationSpeciesListForLogbookSampleActivityWeightedWeightLabel' styleClass="skipI18n"/>
+ </cell>
+ <cell weightx='1' fill="horizontal">
+ <JLabel id='consolidationSpeciesListForLogbookSampleActivityWeightedWeight' styleClass="skipI18n"/>
+ </cell>
+ </row>
</Table>
<!--Table id='consolidationReportConfig' fill='both' constraints='BorderLayout.CENTER'>
<row>
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/ConsolidateModel.java
=====================================
@@ -30,6 +30,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.nuiton.jaxx.runtime.swing.wizard.ext.WizardState;
+import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@@ -42,19 +43,18 @@ import java.util.TreeSet;
public class ConsolidateModel extends AdminActionModel {
private static final Logger log = LogManager.getLogger(ConsolidateModel.class);
- /**
- * Data source to use for operation.
- */
- private ObserveSwingDataSource source;
/**
* To track trip that has already been consolidated (they won't be again processed).
*/
private final Set<String> alreadyDoneTripIds;
-
+ /**
+ * Data source to use for operation.
+ */
+ private ObserveSwingDataSource source;
private boolean consolidationFailIfLengthWeightParameterNotFound;
private boolean consolidationFailIfLengthLengthParameterNotFound;
+ private List<String> consolidationSpeciesListForLogbookSampleActivityWeightedWeight;
private boolean skipForReport;
-
public ConsolidateModel() {
super(AdminStep.CONSOLIDATE);
this.alreadyDoneTripIds = new TreeSet<>();
@@ -88,6 +88,7 @@ public class ConsolidateModel extends AdminActionModel {
setConsolidationFailIfLengthWeightParameterNotFound(getClientConfig().isConsolidationFailIfLengthWeightParameterNotFound());
setConsolidationFailIfLengthLengthParameterNotFound(getClientConfig().isConsolidationFailIfLengthLengthParameterNotFound());
+ setConsolidationSpeciesListForLogbookSampleActivityWeightedWeight(getClientConfig().getConsolidationSpeciesListForLogbookSampleActivityWeightedWeightList());
}
@Override
@@ -123,6 +124,16 @@ public class ConsolidateModel extends AdminActionModel {
firePropertyChange("consolidationFailIfLengthLengthParameterNotFound", oldValue, consolidationFailIfLengthLengthParameterNotFound);
}
+ public List<String> getConsolidationSpeciesListForLogbookSampleActivityWeightedWeight() {
+ return consolidationSpeciesListForLogbookSampleActivityWeightedWeight;
+ }
+
+ public void setConsolidationSpeciesListForLogbookSampleActivityWeightedWeight(List<String> consolidationSpeciesListForLogbookSampleActivityWeightedWeight) {
+ List<String> oldValue = this.consolidationSpeciesListForLogbookSampleActivityWeightedWeight;
+ this.consolidationSpeciesListForLogbookSampleActivityWeightedWeight = consolidationSpeciesListForLogbookSampleActivityWeightedWeight;
+ firePropertyChange("consolidationSpeciesListForLogbookSampleActivityWeightedWeight", oldValue, consolidationSpeciesListForLogbookSampleActivityWeightedWeight);
+ }
+
public boolean isSkipForReport() {
return skipForReport;
}
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/ConsolidateUIHandler.java
=====================================
@@ -49,6 +49,7 @@ public class ConsolidateUIHandler extends AdminTabUIHandler<ConsolidateUI> imple
ConsolidateConfigUI extraConfig = new ConsolidateConfigUI(UIHelper.initialContext(configUI, this));
SelectConsolidationConfigFlag.init(extraConfig, extraConfig.getConsolidationFailIfLengthWeightParameterNotFound(), new SelectConsolidationConfigFlag("consolidationFailIfLengthWeightParameterNotFound", ConsolidateModel::isConsolidationFailIfLengthWeightParameterNotFound, ConsolidateModel::setConsolidationFailIfLengthWeightParameterNotFound, 5));
SelectConsolidationConfigFlag.init(extraConfig, extraConfig.getConsolidationFailIfLengthLengthParameterNotFound(), new SelectConsolidationConfigFlag("consolidationFailIfLengthLengthParameterNotFound", ConsolidateModel::isConsolidationFailIfLengthLengthParameterNotFound, ConsolidateModel::setConsolidationFailIfLengthLengthParameterNotFound, 6));
+ extraConfig.getConsolidationSpeciesListForLogbookSampleActivityWeightedWeight().setText("<html><body><b>TODO</b></body></html>");
configUI.getExtraConfig().add(extraConfig);
}
}
=====================================
client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/consolidate/actions/Start.java
=====================================
@@ -168,6 +168,7 @@ public class Start extends AdminTabUIActionSupport<ConsolidateUI> {
request.setTripId(tripId);
request.setFailIfLengthWeightParameterNotFound(stepModel.isConsolidationFailIfLengthWeightParameterNotFound());
request.setFailIfLengthLengthParameterNotFound(stepModel.isConsolidationFailIfLengthLengthParameterNotFound());
+ request.setSpeciesListForLogbookSampleActivityWeightedWeight(Set.copyOf(stepModel.getConsolidationSpeciesListForLogbookSampleActivityWeightedWeight()));
TripConsolidateResult result = consolidateDataService.consolidateTrip(simplifiedObjectTypeSpecializedRules, request);
if (result != null) {
=====================================
client/runner/src/main/i18n/translations/client-runner_en_GB.properties
=====================================
@@ -39,6 +39,7 @@ observe.config.client.logFiles.timeout.description=Log files delete (in hours)
observe.config.client.temporaryFiles.timeout.description=Temporary files delete (in hours)
observe.config.consolidation.failIfLengthLengthParameterNotFound=In consolidate action, raise an error if a lengthLengthParameter is not found, otherwise add an warning in action
observe.config.consolidation.failIfLengthWeightParameterNotFound=In consolidate action, raise an error if a lengthWeightParameter is not found, otherwise add an warning in action
+observe.config.consolidation.speciesListForLogbookSampleActivityWeightedWeight=Species list to use in consolidation of field weighted weight (Seine / Logbook SampleActivity)
observe.config.coordinate.format=Position format (DMD, DD, DMS)
observe.config.db.locale=Language of data source (fr_FR, en_GB or es_ES)
observe.config.dcpPresetsDirectory.description=Dcp presets directory
=====================================
client/runner/src/main/i18n/translations/client-runner_es_ES.properties
=====================================
@@ -39,6 +39,7 @@ observe.config.client.logFiles.timeout.description=Log files delete (in hours) \
observe.config.client.temporaryFiles.timeout.description=Temporary files delete (in hours) \#TODO
observe.config.consolidation.failIfLengthLengthParameterNotFound=In consolidate action, raise an error if a lengthLengthParameter is not found, otherwise add an warning in action \#TODO
observe.config.consolidation.failIfLengthWeightParameterNotFound=In consolidate action, raise an error if a lengthWeightParameter is not found, otherwise add an warning in action \#TODO
+observe.config.consolidation.speciesListForLogbookSampleActivityWeightedWeight=Species list to use in consolidation of field weighted weight (Seine / Logbook SampleActivity) \#TODO
observe.config.coordinate.format=Formato de posición (DMD, DD, DMS)
observe.config.db.locale=Idioma del referencial (fr_FR, en_GB o es_ES)
observe.config.dcpPresetsDirectory.description=Dcp presets directory \#TODO
=====================================
client/runner/src/main/i18n/translations/client-runner_fr_FR.properties
=====================================
@@ -39,6 +39,7 @@ observe.config.client.logFiles.timeout.description=Nettoyage des fichiers de log
observe.config.client.temporaryFiles.timeout.description=Nettoyage des fichiers temporaires (en heures)
observe.config.consolidation.failIfLengthLengthParameterNotFound=Dans l'action de consolidation, déclencher une erreur si une relation taille-taille n'est pas trouvée, sinon consigner cela en avertissement de l'action
observe.config.consolidation.failIfLengthWeightParameterNotFound=Dans l'action de consolidation, déclencher une erreur si une relation taille-poids n'est pas trouvée, sinon consigner cela en avertissement de l'action
+observe.config.consolidation.speciesListForLogbookSampleActivityWeightedWeight=Liste des espèces à utiliser dans l'action de consolidation du champs Poids pondéré des échantillons calée (Senne / Livre de bord)
observe.config.coordinate.format=Format des positions (DMD, DD, DMS)
observe.config.db.locale=La langue du référentiel (fr_FR, en_GB ou es_ES)
observe.config.dcpPresetsDirectory.description=Répertoire des pré-configurations de DCP
=====================================
core/api/dto-consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/common/TripConsolidateRequest.java
=====================================
@@ -25,6 +25,8 @@ package fr.ird.observe.consolidation.data.ps.common;
import io.ultreia.java4all.util.json.JsonAware;
+import java.util.Set;
+
/**
* Request to consolidate a trip.
* <p>
@@ -47,6 +49,8 @@ public class TripConsolidateRequest implements JsonAware {
*/
private boolean failIfLengthLengthParameterNotFound;
+ private Set<String> speciesListForLogbookSampleActivityWeightedWeight;
+
public boolean isFailIfLengthWeightParameterNotFound() {
return failIfLengthWeightParameterNotFound;
}
@@ -70,4 +74,12 @@ public class TripConsolidateRequest implements JsonAware {
public void setFailIfLengthLengthParameterNotFound(boolean failIfLengthLengthParameterNotFound) {
this.failIfLengthLengthParameterNotFound = failIfLengthLengthParameterNotFound;
}
+
+ public Set<String> getSpeciesListForLogbookSampleActivityWeightedWeight() {
+ return speciesListForLogbookSampleActivityWeightedWeight;
+ }
+
+ public void setSpeciesListForLogbookSampleActivityWeightedWeight(Set<String> speciesListForLogbookSampleActivityWeightedWeight) {
+ this.speciesListForLogbookSampleActivityWeightedWeight = speciesListForLogbookSampleActivityWeightedWeight;
+ }
}
=====================================
core/persistence/consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/common/TripConsolidateEngine.java
=====================================
@@ -88,7 +88,7 @@ public class TripConsolidateEngine {
Trip trip = Trip.loadEntity(context, tripId);
- Set<ToolkitIdModifications> logbookSampleActivityResults = consolidateLogbookSampleActivities(trip);
+ Set<ToolkitIdModifications> logbookSampleActivityResults = consolidateLogbookSampleActivities(trip, request.getSpeciesListForLogbookSampleActivityWeightedWeight());
Set<ToolkitIdModifications> localmarketBatchResults = consolidateLocalmarketBatches(trip, failIfLengthWeightParameterNotFound);
Set<fr.ird.observe.consolidation.data.ps.observation.ActivityConsolidateResult> observationActivityConsolidateResults = consolidateObservationActivities(trip, failIfLengthWeightParameterNotFound, failIfLengthLengthParameterNotFound);
@@ -133,12 +133,12 @@ public class TripConsolidateEngine {
}
}
- private Set<ToolkitIdModifications> consolidateLogbookSampleActivities(Trip trip) {
+ private Set<ToolkitIdModifications> consolidateLogbookSampleActivities(Trip trip, Set<String> speciesListForLogbookSampleActivityWeightedWeight) {
Set<ToolkitIdModifications> result = new LinkedHashSet<>();
if (trip.isWellEmpty() || trip.isSampleEmpty()) {
return result;
}
- logbookSampleActivityConsolidateEngine.consolidateTrip(trip, result);
+ logbookSampleActivityConsolidateEngine.consolidateTrip(trip,speciesListForLogbookSampleActivityWeightedWeight, result);
return result;
}
=====================================
core/persistence/consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/logbook/SampleActivityConsolidateActions.java
=====================================
@@ -43,24 +43,6 @@ public enum SampleActivityConsolidateActions implements AtomicConsolidateAction<
*/
ComputeWeightedWeight() {
- /**
- * Filter on these species to compute any weight on SampleActivitySpecies
- */
- public final Set<String> SPECIES_IDS = Set.of(
- "fr.ird.referential.common.Species#1239832685474#0.8943253454598569", // YFT
- "fr.ird.referential.common.Species#1239832685474#0.975344121171992", // SKJ
- "fr.ird.referential.common.Species#1239832685475#0.13349466123905152", // BET
- "fr.ird.referential.common.Species#1239832685476#0.5618871286604711", // ALB
- "fr.ird.referential.common.Species#1239832685477#0.8024257002747615", // LTA
- "fr.ird.referential.common.Species#1239832685477#0.3846921632590058", // FRI
- "fr.ird.referential.common.Species#1441287921299#0.016754076421811148", // TUN
- "fr.ird.referential.common.Species#1433499265113#0.891799515346065", // TUS
- "fr.ird.referential.common.Species#1239832685477#0.2673009297087321", // KAW
- "fr.ird.referential.common.Species#1239832685478#0.7676744877900202", // LOT
- "fr.ird.referential.common.Species#1239832685477#0.5989181185528589", // FRZ
- "fr.ird.referential.common.Species#1239832685476#0.36339915670317835" // BLT
- );
-
@Override
public List<String> fieldNames() {
return List.of(SampleActivity.PROPERTY_WEIGHTED_WEIGHT, SampleActivity.PROPERTY_WEIGHTED_WEIGHT_COMPUTED);
@@ -74,13 +56,13 @@ public enum SampleActivityConsolidateActions implements AtomicConsolidateAction<
@Override
public void accept(SampleActivityConsolidateContext context, SampleActivity datum) {
String wellId = context.getSampleWell();
-
+ Set<String> speciesList = context.getSpeciesListForLogbookSampleActivityWeightedWeight();
Activity activity = datum.getActivity();
// See https://gitlab.com/ultreiaio/ird-observe/-/issues/2053
// Get total weight of the set which is this well
- double w1 = context.sumOnTripWell(w -> w.getTotalWeight(activity, SPECIES_IDS, Set.of(wellId)));
+ double w1 = context.sumOnTripWell(w -> w.getTotalWeight(activity, speciesList, Set.of(wellId)));
if (w1 == 0) {
// limit case if the well was not found in trip well plan
log.warn("Well {} not found for activity {} in trip well plan.", wellId, activity.getTopiaId());
@@ -89,9 +71,9 @@ public enum SampleActivityConsolidateActions implements AtomicConsolidateAction<
return;
}
// Get total weight of the set which are in well that has been sampled
- double w2 = context.sumOnTripWell(w -> w.getTotalWeight(activity, SPECIES_IDS, context.getSampledWellIds()));
+ double w2 = context.sumOnTripWell(w -> w.getTotalWeight(activity, speciesList, context.getSampledWellIds()));
// Get total weight of the set in any well
- double wT = context.sumOnTripWell(w -> w.getTotalWeight(activity, SPECIES_IDS));
+ double wT = context.sumOnTripWell(w -> w.getTotalWeight(activity, speciesList));
// the weighted weight is the formula: weightedWeight = (w1/w2)*wT
float weightedWeight = (float) ((w1 / w2) * wT);
Float oldWeightedWeight = datum.getWeightedWeight();
=====================================
core/persistence/consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/logbook/SampleActivityConsolidateContext.java
=====================================
@@ -47,17 +47,19 @@ public class SampleActivityConsolidateContext implements ConsolidateContext<Samp
private final JavaBeanMonitor monitor;
private final Decorator decorator;
private final Set<Well> tripWell;
+ private final Set<String> speciesListForLogbookSampleActivityWeightedWeight;
private final Set<ToolkitIdModifications> resultBuilder;
private final java.util.Set<String> warnings = new LinkedHashSet<>();
private final Set<String> sampledWellIds;
private Sample sample;
private SampleActivity datum;
- public SampleActivityConsolidateContext(JavaBeanMonitor monitor, Decorator decorator, Trip trip, Set<ToolkitIdModifications> resultBuilder) {
+ public SampleActivityConsolidateContext(JavaBeanMonitor monitor, Decorator decorator, Trip trip, Set<String> speciesListForLogbookSampleActivityWeightedWeight, Set<ToolkitIdModifications> resultBuilder) {
this.monitor = monitor;
this.decorator = decorator;
this.tripWell = trip.getWell();
this.sampledWellIds = trip.getSample().stream().map(Sample::getWell).collect(Collectors.toSet());
+ this.speciesListForLogbookSampleActivityWeightedWeight = speciesListForLogbookSampleActivityWeightedWeight;
this.resultBuilder = resultBuilder;
}
@@ -65,6 +67,10 @@ public class SampleActivityConsolidateContext implements ConsolidateContext<Samp
return sampledWellIds;
}
+ public Set<String> getSpeciesListForLogbookSampleActivityWeightedWeight() {
+ return speciesListForLogbookSampleActivityWeightedWeight;
+ }
+
public void watch(Sample sample, SampleActivity datum) {
this.sample = Objects.requireNonNull(sample);
this.datum = Objects.requireNonNull(datum);
=====================================
core/persistence/consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/logbook/SampleActivityConsolidateEngine.java
=====================================
@@ -47,8 +47,8 @@ public class SampleActivityConsolidateEngine {
this.decorator = decoratorService.getDecoratorByType(SampleActivity.class);
}
- public void consolidateTrip(Trip trip, Set<ToolkitIdModifications> resultBuilder) {
- SampleActivityConsolidateContext context = new SampleActivityConsolidateContext(monitor, decorator, trip, resultBuilder);
+ public void consolidateTrip(Trip trip, Set<String> speciesListForLogbookSampleActivityWeightedWeight, Set<ToolkitIdModifications> resultBuilder) {
+ SampleActivityConsolidateContext context = new SampleActivityConsolidateContext(monitor, decorator, trip, speciesListForLogbookSampleActivityWeightedWeight,resultBuilder);
for (Sample sample : trip.getSample()) {
if (sample.isSampleActivityEmpty()) {
continue;
=====================================
core/services/test/src/main/java/fr/ird/observe/services/service/data/ps/ConsolidateDataServiceFixtures.java
=====================================
@@ -42,6 +42,7 @@ import io.ultreia.java4all.util.Dates;
import org.junit.Assert;
import java.net.URL;
+import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@@ -205,6 +206,7 @@ public class ConsolidateDataServiceFixtures extends GeneratedConsolidateDataServ
TripConsolidateRequest request = new TripConsolidateRequest();
request.setTripId(getProperty("consolidateTrip.id"));
request.setFailIfLengthWeightParameterNotFound(false);
+ request.setSpeciesListForLogbookSampleActivityWeightedWeight(Set.copyOf(Arrays.asList(getArrayProperty("consolidateTrip.speciesListForLogbookSampleActivityWeightedWeight"))));
TripConsolidateResult actual = service.consolidateTrip(simplifiedObjectTypeSpecializedRules, request);
Assert.assertNotNull(actual);
=====================================
core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/data/ps/ConsolidateDataService.properties
=====================================
@@ -2,20 +2,20 @@
# #%L
# ObServe Core :: Services :: Test
# %%
-# Copyright (C) 2008 - 2024 IRD, Ultreia.io
+# 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.
+# 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,
+# 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
+# License along with this program. If not^ see
# <http://www.gnu.org/licenses/gpl-3.0.html>.
# #L%
###
@@ -29,3 +29,4 @@ consolidateTrip.logbookSampleActivity.count=1
consolidateTrip.observationsActivityResult.count=4
consolidateTrip.observationsActivityResult.withModifications.count=4
consolidateTrip.observationsActivityResult.withWarnings.count=4
+consolidateTrip.speciesListForLogbookSampleActivityWeightedWeight=fr.ird.referential.common.Species#1239832685474#0.8943253454598569^fr.ird.referential.common.Species#1239832685474#0.975344121171992^fr.ird.referential.common.Species#1239832685475#0.13349466123905152^fr.ird.referential.common.Species#1239832685476#0.5618871286604711^fr.ird.referential.common.Species#1239832685477#0.8024257002747615^fr.ird.referential.common.Species#1239832685477#0.3846921632590058^fr.ird.referential.common.Species#1441287921299#0.016754076421811148^fr.ird.referential.common.Species#1433499265113#0.891799515346065^fr.ird.referential.common.Species#1239832685477#0.2673009297087321^fr.ird.referential.common.Species#1239832685478#0.7676744877900202^fr.ird.referential.common.Species#1239832685477#0.5989181185528589^fr.ird.referential.common.Species#1239832685476#0.36339915670317835
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/64f014211e783793d2faa393…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/64f014211e783793d2faa393…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] 8 commits: Add new queries in TripDao
by Tony CHEMIT (@tchemit) 02 Sep '24
by Tony CHEMIT (@tchemit) 02 Sep '24
02 Sep '24
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
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
- - - - -
64f01421 by Tony Chemit at 2024-09-02T11:15:24+02:00
Merge branch 'feature/issue-2734' into develop
La liste des activités associées à un échantillon pourrait être déduite du plan de cuves, et inversément - Closes #2734
- - - - -
27 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
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
=====================================
@@ -376,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(a)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(a)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
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/fb92220ff621d9321d0e50c0…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/fb92220ff621d9321d0e50c0…
You're receiving this email because of your account on gitlab.com.
1
0
02 Sep '24
Tony CHEMIT deleted branch feature/issue-2734 at ultreiaio / ird-observe
--
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][feature/issue-2734] 9 commits: Fix WithIndex generation - See #1203
by Tony CHEMIT (@tchemit) 02 Sep '24
by Tony CHEMIT (@tchemit) 02 Sep '24
02 Sep '24
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(a)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(a)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/a8286844ccfb8f04e8bf6d24…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/a8286844ccfb8f04e8bf6d24…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] Fix onRemoveRow method (we already are using the modelRow) - See #1203
by Tony CHEMIT (@tchemit) 02 Sep '24
by Tony CHEMIT (@tchemit) 02 Sep '24
02 Sep '24
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
fb92220f by Tony Chemit at 2024-09-02T11:14:27+02:00
Fix onRemoveRow method (we already are using the modelRow) - See #1203
- - - - -
1 changed file:
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUITableModel.java
Changes:
=====================================
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));
}
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/fb92220ff621d9321d0e50c0d…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/fb92220ff621d9321d0e50c0d…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe][develop] Fix WithIndex generation - See #1203
by Tony CHEMIT (@tchemit) 02 Sep '24
by Tony CHEMIT (@tchemit) 02 Sep '24
02 Sep '24
Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
d7d59ba3 by Tony Chemit at 2024-09-02T09:57:04+02:00
Fix WithIndex generation - See #1203
- - - - -
1 changed file:
- toolkit/templates/src/main/java/fr/ird/observe/toolkit/templates/dto/DtoTransformer.java
Changes:
=====================================
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/-/commit/d7d59ba3cda3837494ae0120a…
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/commit/d7d59ba3cda3837494ae0120a…
You're receiving this email because of your account on gitlab.com.
1
0
[Git][ultreiaio/ird-observe] Pushed new branch feature/issue-2734
by Tony CHEMIT (@tchemit) 01 Sep '24
by Tony CHEMIT (@tchemit) 01 Sep '24
01 Sep '24
Tony CHEMIT pushed new branch feature/issue-2734 at ultreiaio / ird-observe
--
View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/tree/feature/issue-2734
You're receiving this email because of your account on gitlab.com.
1
0