Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
49f40106
by Tony Chemit at 2022-04-25T19:31:31+02:00
-
29d2d56e
by Tony Chemit at 2022-04-25T19:59:30+02:00
12 changed files:
- client/datasource/editor/api/src/main/i18n/getters/java.getter
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/move/layout/MoveLayoutRequestBuilder.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/move/layout/MoveLayoutTreeAdapter.java
- client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/RouteUIMoveAllTreeAdapter.java
- client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/data/layout/GenerateContentLayoutUIMoveTreeAdapter.java
- client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/data/ropen/GenerateContentRootOpenableUIMoveTreeAdapter.java
- client/datasource/editor/spi/src/main/java/fr/ird/observe/client/datasource/editor/spi/content/data/table/GenerateContentTableUIMoveTreeAdapter.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/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripImpl.java
- core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripSpi.java
Changes:
| ... | ... | @@ -167,6 +167,7 @@ observe.ui.action.info.storage.tip |
| 167 | 167 | observe.ui.action.load.from.file
|
| 168 | 168 | observe.ui.action.load.from.file.tip
|
| 169 | 169 | observe.ui.action.move.layout.multiple.message
|
| 170 | +observe.ui.action.move.layout.select.data
|
|
| 170 | 171 | observe.ui.action.move.layout.single.message
|
| 171 | 172 | observe.ui.action.move.message
|
| 172 | 173 | observe.ui.action.open.screen
|
| ... | ... | @@ -293,6 +294,7 @@ observe.ui.title.save.remoteDB |
| 293 | 294 | observe.ui.title.show.referential.usage
|
| 294 | 295 | observe.ui.title.storage.info
|
| 295 | 296 | observe.ui.title.unique.key
|
| 297 | +observe.ui.tree.action.all.tip
|
|
| 296 | 298 | observe.ui.tree.action.collapseAll.tip
|
| 297 | 299 | observe.ui.tree.action.configure.tip
|
| 298 | 300 | observe.ui.tree.action.expandAll.tip
|
| ... | ... | @@ -83,6 +83,7 @@ import java.awt.GridLayout; |
| 83 | 83 | import java.awt.event.ActionEvent;
|
| 84 | 84 | import java.awt.event.ItemEvent;
|
| 85 | 85 | import java.util.LinkedHashSet;
|
| 86 | +import java.util.LinkedList;
|
|
| 86 | 87 | import java.util.List;
|
| 87 | 88 | import java.util.Objects;
|
| 88 | 89 | import java.util.Optional;
|
| ... | ... | @@ -444,9 +445,13 @@ public class MoveLayoutRequestBuilder implements WithClientUIContextApi { |
| 444 | 445 | parentEditor.getModel().addPropertyChangeListener("selectedItem", evt -> jButton.setEnabled(canMove(evt.getNewValue())));
|
| 445 | 446 | if (!single) {
|
| 446 | 447 | JPanel typesPanel = new JPanel(new GridLayout(0, 1));
|
| 448 | + typesPanel.setBorder(BorderFactory.createTitledBorder(/*BorderFactory.createLoweredBevelBorder(),*/t("observe.ui.action.move.layout.select.data") + " "));
|
|
| 449 | + |
|
| 447 | 450 | int index = 1;
|
| 451 | + List<JCheckBox> editors = new LinkedList<>();
|
|
| 448 | 452 | for (Class<? extends DataDto> type : availableLayoutTypes) {
|
| 449 | 453 | JCheckBox typeEditor = new JCheckBox();
|
| 454 | + editors.add(typeEditor);
|
|
| 450 | 455 | Action typeAction = new AbstractAction() {
|
| 451 | 456 | @Override
|
| 452 | 457 | public void actionPerformed(ActionEvent e) {
|
| ... | ... | @@ -469,6 +474,29 @@ public class MoveLayoutRequestBuilder implements WithClientUIContextApi { |
| 469 | 474 | typesPanel.add(typeEditor);
|
| 470 | 475 | index++;
|
| 471 | 476 | }
|
| 477 | + typesPanel.add(new JSeparator(JSeparator.HORIZONTAL));
|
|
| 478 | + JCheckBox typeEditor = new JCheckBox();
|
|
| 479 | + editors.add(typeEditor);
|
|
| 480 | + Action typeAction = new AbstractAction() {
|
|
| 481 | + @Override
|
|
| 482 | + public void actionPerformed(ActionEvent e) {
|
|
| 483 | + jButton.setEnabled(updateSelectedAll(editors, parentEditor));
|
|
| 484 | + }
|
|
| 485 | + };
|
|
| 486 | + String actionName = "Select-all";
|
|
| 487 | + typeAction.putValue(Action.ACTION_COMMAND_KEY, actionName);
|
|
| 488 | + String label = t("observe.ui.tree.action.all.tip");
|
|
| 489 | + KeyStroke keyStroke = ObserveKeyStrokesEditorApi.getFunctionKeyStroke(index + 24);
|
|
| 490 | + String text = ObserveKeyStrokesEditorApi.suffixTextWithKeyStroke(label, keyStroke);
|
|
| 491 | + typeAction.putValue(Action.SHORT_DESCRIPTION, text);
|
|
| 492 | + typeAction.putValue(Action.NAME, text);
|
|
| 493 | + typeAction.putValue(Action.ACCELERATOR_KEY, keyStroke);
|
|
| 494 | + |
|
| 495 | + typeEditor.setAction(typeAction);
|
|
| 496 | + actionMap.put(actionName, typeAction);
|
|
| 497 | + inputMap.put(keyStroke, actionName);
|
|
| 498 | + typesPanel.add(typeEditor);
|
|
| 499 | + |
|
| 472 | 500 | panelMessages.add(BorderLayout.CENTER, typesPanel);
|
| 473 | 501 | }
|
| 474 | 502 | panelMessages.add(BorderLayout.SOUTH, new JLabel(""));
|
| ... | ... | @@ -573,6 +601,17 @@ public class MoveLayoutRequestBuilder implements WithClientUIContextApi { |
| 573 | 601 | return canMove(editor.getModel().getSelectedItem());
|
| 574 | 602 | }
|
| 575 | 603 | |
| 604 | + private boolean updateSelectedAll(List<JCheckBox> typeEditor, FilterableComboBox<ToolkitIdLabel> editor) {
|
|
| 605 | + if (selectedLayoutTypes.isEmpty()) {
|
|
| 606 | + selectedLayoutTypes.addAll(availableLayoutTypes);
|
|
| 607 | + typeEditor.forEach(e -> e.setSelected(true));
|
|
| 608 | + } else {
|
|
| 609 | + selectedLayoutTypes.clear();
|
|
| 610 | + typeEditor.forEach(e -> e.setSelected(false));
|
|
| 611 | + }
|
|
| 612 | + return canMove(editor.getModel().getSelectedItem());
|
|
| 613 | + }
|
|
| 614 | + |
|
| 576 | 615 | private boolean canMove(Object selectedItem) {
|
| 577 | 616 | return selectedItem != null && !selectedLayoutTypes.isEmpty();
|
| 578 | 617 | }
|
| ... | ... | @@ -25,6 +25,7 @@ package fr.ird.observe.client.datasource.editor.api.content.actions.move.layout; |
| 25 | 25 | import fr.ird.observe.client.datasource.editor.api.content.data.ropen.ContentRootOpenableUINavigationNode;
|
| 26 | 26 | import fr.ird.observe.client.datasource.editor.api.navigation.NavigationTree;
|
| 27 | 27 | import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationNode;
|
| 28 | +import fr.ird.observe.navigation.tree.navigation.NavigationTreeConfig;
|
|
| 28 | 29 | import fr.ird.observe.services.service.data.MoveLayoutRequest;
|
| 29 | 30 | |
| 30 | 31 | import javax.swing.SwingUtilities;
|
| ... | ... | @@ -45,14 +46,15 @@ public abstract class MoveLayoutTreeAdapter<ParentNode extends ContentRootOpenab |
| 45 | 46 | this.oldParentSupplier = Objects.requireNonNull(oldParentSupplier);
|
| 46 | 47 | }
|
| 47 | 48 | |
| 48 | - public abstract ParentNode getNewParentNode(ParentNode oldParentNode, String newParentId);
|
|
| 49 | - |
|
| 50 | 49 | public abstract SourceNode getNodeToSelect(ParentNode parentNode);
|
| 51 | 50 | |
| 52 | 51 | public final void adaptTree(MoveLayoutRequest request, NavigationTree tree) {
|
| 53 | 52 | boolean selectTarget = request.isSelectTarget();
|
| 54 | 53 | ParentNode oldParentNode = oldParentSupplier.get();
|
| 55 | - ParentNode newParentNode = getNewParentNode(oldParentNode, request.getNewParentId());
|
|
| 54 | + NavigationTreeConfig config = tree.getModel().getConfig();
|
|
| 55 | + String newParentId = request.getNewParentId();
|
|
| 56 | + String groupByValue = oldParentNode.getContext().getServicesProvider().getRootOpenableService().getGroupByValue(config.getGroupByName(), config.getGroupByFlavor(), newParentId);
|
|
| 57 | + @SuppressWarnings("unchecked") ParentNode newParentNode = (ParentNode) tree.getModel().getNodeFromPath(new String[]{groupByValue, newParentId}, true);
|
|
| 56 | 58 | oldParentNode.updateNode();
|
| 57 | 59 | newParentNode.updateNode();
|
| 58 | 60 | if (selectTarget) {
|
| ... | ... | @@ -44,11 +44,6 @@ public class RouteUIMoveAllTreeAdapter extends MoveLayoutTreeAdapter<TripUINavig |
| 44 | 44 | super(incomingNode::getParent);
|
| 45 | 45 | }
|
| 46 | 46 | |
| 47 | - @Override
|
|
| 48 | - public final TripUINavigationNode getNewParentNode(TripUINavigationNode oldParentNode, String newParentId) {
|
|
| 49 | - return oldParentNode.findSibling(newParentId);
|
|
| 50 | - }
|
|
| 51 | - |
|
| 52 | 47 | @Override
|
| 53 | 48 | public final RouteListUINavigationNode getNodeToSelect(TripUINavigationNode parentNode) {
|
| 54 | 49 | return parentNode.getRouteObsListUINavigationNode();
|
| ... | ... | @@ -47,11 +47,6 @@ public class GenerateContentLayoutUIMoveTreeAdapter extends GenerateContentLayou |
| 47 | 47 | " super(incomingNode::getParent);\n" +
|
| 48 | 48 | " }\n\n" +
|
| 49 | 49 | " @Override\n" +
|
| 50 | - " public final %2$s getNewParentNode(%2$s oldParentNode, String newParentId) {\n" +
|
|
| 51 | - " return oldParentNode.findSibling(newParentId);\n" +
|
|
| 52 | - " }\n" +
|
|
| 53 | - "\n" +
|
|
| 54 | - " @Override\n" +
|
|
| 55 | 50 | " public final %3$s getNodeToSelect(%2$s parentNode) {\n" +
|
| 56 | 51 | " return parentNode.get%3$s();\n" +
|
| 57 | 52 | " }\n\n" +
|
| ... | ... | @@ -48,10 +48,6 @@ public class GenerateContentRootOpenableUIMoveTreeAdapter extends GenerateConten |
| 48 | 48 | " super(() -> incomingNode);\n" +
|
| 49 | 49 | " }\n\n" +
|
| 50 | 50 | " @Override\n" +
|
| 51 | - " public final %2$s getNewParentNode(%2$s oldParentNode, String newParentId) {\n" +
|
|
| 52 | - " return oldParentNode.findSibling(newParentId);\n" +
|
|
| 53 | - " }\n\n" +
|
|
| 54 | - " @Override\n" +
|
|
| 55 | 51 | " public final %2$s getNodeToSelect(%2$s parentNode) {\n" +
|
| 56 | 52 | " return parentNode;\n" +
|
| 57 | 53 | " }\n\n" +
|
| ... | ... | @@ -49,11 +49,6 @@ public class GenerateContentTableUIMoveTreeAdapter extends GenerateContentTableU |
| 49 | 49 | " super(incomingNode::getParent);\n" +
|
| 50 | 50 | " }\n\n" +
|
| 51 | 51 | " @Override\n" +
|
| 52 | - " public final %2$s getNewParentNode(%2$s oldParentNode, String newParentId) {\n" +
|
|
| 53 | - " return oldParentNode.findSibling(newParentId);\n" +
|
|
| 54 | - " }\n" +
|
|
| 55 | - "\n" +
|
|
| 56 | - " @Override\n" +
|
|
| 57 | 52 | " public final %3$s getNodeToSelect(%2$s parentNode) {\n" +
|
| 58 | 53 | " return parentNode.get%3$s();\n" +
|
| 59 | 54 | " }\n\n" +
|
| ... | ... | @@ -374,7 +374,8 @@ observe.ui.action.locale.fr.tip=Change application's language in french |
| 374 | 374 | observe.ui.action.locale.uk=English
|
| 375 | 375 | observe.ui.action.locale.uk.tip=Change application's language in english
|
| 376 | 376 | observe.ui.action.move.groupBy.configuration=Criteria configuration\:
|
| 377 | -observe.ui.action.move.layout.multiple.message=Your are about to move some object from type '%s' beyond the following list\:
|
|
| 377 | +observe.ui.action.move.layout.multiple.message=Your are about to move some object from type '%s'
|
|
| 378 | +observe.ui.action.move.layout.select.data=Data to move
|
|
| 378 | 379 | observe.ui.action.move.layout.single.message=Your are about to move all object of type '%s'.
|
| 379 | 380 | observe.ui.action.move.message=Your are about to move %d object(s) of type '%s'\:
|
| 380 | 381 | observe.ui.action.open.last.feedback=Feed back
|
| ... | ... | @@ -836,6 +837,7 @@ observe.ui.title.show.referential.usage=Show referential usages |
| 836 | 837 | observe.ui.title.storage.info=Storage details
|
| 837 | 838 | observe.ui.title.unique.key=Unique keys used in a referentiel
|
| 838 | 839 | observe.ui.title.welcome.admin=ObServe
|
| 840 | +observe.ui.tree.action.all.tip=All
|
|
| 839 | 841 | observe.ui.tree.action.collapseAll.tip=Collapse all
|
| 840 | 842 | observe.ui.tree.action.configure.tip=Configure
|
| 841 | 843 | observe.ui.tree.action.expandAll.tip=Expand all
|
| ... | ... | @@ -374,7 +374,8 @@ observe.ui.action.locale.fr.tip=Cambiar el idioma de la applicación al francés |
| 374 | 374 | observe.ui.action.locale.uk=Inglés
|
| 375 | 375 | observe.ui.action.locale.uk.tip=Cambiar el idioma de la applicación al inglés
|
| 376 | 376 | observe.ui.action.move.groupBy.configuration=Criteria configuration\:
|
| 377 | -observe.ui.action.move.layout.multiple.message=Your are about to move some object from type '%s' beyond the fowolling list\:
|
|
| 377 | +observe.ui.action.move.layout.multiple.message=Your are about to move some object from type '%s'
|
|
| 378 | +observe.ui.action.move.layout.select.data=Data to move
|
|
| 378 | 379 | observe.ui.action.move.layout.single.message=Your are about to move all object of type '%s'.
|
| 379 | 380 | observe.ui.action.move.message=Your are about to move %d object(s) of type '%s'\: \#TODO
|
| 380 | 381 | observe.ui.action.open.last.feedback=Feed back \#TODO
|
| ... | ... | @@ -836,6 +837,7 @@ observe.ui.title.show.referential.usage=Listas de las utilizaciones de un refere |
| 836 | 837 | observe.ui.title.storage.info=Información sobre la fuente de datos
|
| 837 | 838 | observe.ui.title.unique.key=Ids de negocio del referencial %1$s
|
| 838 | 839 | observe.ui.title.welcome.admin=ObServe
|
| 840 | +observe.ui.tree.action.all.tip=All
|
|
| 839 | 841 | observe.ui.tree.action.collapseAll.tip=Cerrar los nudos
|
| 840 | 842 | observe.ui.tree.action.configure.tip=Configure \#TODO
|
| 841 | 843 | observe.ui.tree.action.expandAll.tip=Abrir los nudos
|
| ... | ... | @@ -374,7 +374,8 @@ observe.ui.action.locale.fr.tip=Changer la langue de l'application en français |
| 374 | 374 | observe.ui.action.locale.uk=Anglais
|
| 375 | 375 | observe.ui.action.locale.uk.tip=Changer la langue de l'application en anglais
|
| 376 | 376 | observe.ui.action.move.groupBy.configuration=Configuration des critères \:
|
| 377 | -observe.ui.action.move.layout.multiple.message=Vous êtes sur le point de déplacer un ensemble de données sur le type '%s' à sélectionner dans la liste suivante \:
|
|
| 377 | +observe.ui.action.move.layout.multiple.message=Vous êtes sur le point de déplacer un ensemble de données sur le type '%s'
|
|
| 378 | +observe.ui.action.move.layout.select.data=Données à déplacer
|
|
| 378 | 379 | observe.ui.action.move.layout.single.message=Vous êtes sur le point de déplacer toutes les données de type '%s'.
|
| 379 | 380 | observe.ui.action.move.message=Vous êtes sur le point de déplacer %d donnée(s) de type '%s'\:
|
| 380 | 381 | observe.ui.action.open.last.feedback=Retour d'expérience
|
| ... | ... | @@ -836,6 +837,7 @@ observe.ui.title.show.referential.usage=Listes des utilisations d'un référenti |
| 836 | 837 | observe.ui.title.storage.info=Information sur la source de données
|
| 837 | 838 | observe.ui.title.unique.key=Clefs métier du référentiel %1$s
|
| 838 | 839 | observe.ui.title.welcome.admin=ObServe
|
| 840 | +observe.ui.tree.action.all.tip=Tout
|
|
| 839 | 841 | observe.ui.tree.action.collapseAll.tip=Tout grouper
|
| 840 | 842 | observe.ui.tree.action.configure.tip=Configurer
|
| 841 | 843 | observe.ui.tree.action.expandAll.tip=Tout déplier
|
| ... | ... | @@ -34,6 +34,38 @@ public class TripImpl extends TripAbstract { |
| 34 | 34 | |
| 35 | 35 | private static final long serialVersionUID = 1L;
|
| 36 | 36 | |
| 37 | + public static boolean shouldCopyObservationsMetaData(Trip trip) {
|
|
| 38 | + return trip.getObservationsAcquisitionStatus() == null || !trip.getObservationsAcquisitionStatus().isFieldEnabler();
|
|
| 39 | + }
|
|
| 40 | + |
|
| 41 | + public static boolean shouldRemoveObservationsMetaData(Trip trip) {
|
|
| 42 | + return !trip.isObservationsFilled();
|
|
| 43 | + }
|
|
| 44 | + |
|
| 45 | + public static boolean shouldCopyLandingMetaData(Trip trip) {
|
|
| 46 | + return trip.getLandingAcquisitionStatus() == null || !trip.getLandingAcquisitionStatus().isFieldEnabler();
|
|
| 47 | + }
|
|
| 48 | + |
|
| 49 | + public static boolean shouldRemoveLandingMetaData(Trip trip) {
|
|
| 50 | + return !trip.isLandingFilled();
|
|
| 51 | + }
|
|
| 52 | + |
|
| 53 | + public static boolean shouldCopyLogbookMetaData(Trip trip) {
|
|
| 54 | + return trip.getLogbookAcquisitionStatus() == null || !trip.getLogbookAcquisitionStatus().isFieldEnabler();
|
|
| 55 | + }
|
|
| 56 | + |
|
| 57 | + public static boolean shouldRemoveLogbookMetaData(Trip trip) {
|
|
| 58 | + return !trip.isLogbookFilled();
|
|
| 59 | + }
|
|
| 60 | + |
|
| 61 | + public static boolean shouldCopyLocalmarketMetaData(Trip trip) {
|
|
| 62 | + return trip.getLocalMarketAcquisitionStatus() == null || !trip.getLocalMarketAcquisitionStatus().isFieldEnabler();
|
|
| 63 | + }
|
|
| 64 | + |
|
| 65 | + public static boolean shouldRemoveLocalmarketMetaData(Trip trip) {
|
|
| 66 | + return !trip.isLocalmarketFilled();
|
|
| 67 | + }
|
|
| 68 | + |
|
| 37 | 69 | @Override
|
| 38 | 70 | public Date getTheoreticalEndDate() {
|
| 39 | 71 | Date lastActivityDate = isRouteObsEmpty() ? null : getRouteObs().stream().map(Route::getDate).max(Date::compareTo).orElse(null);
|
| ... | ... | @@ -263,10 +263,10 @@ public class TripSpi extends GeneratedTripSpi { |
| 263 | 263 | |
| 264 | 264 | |
| 265 | 265 | public void updateObservationsMetadata(SqlScriptWriter writer, Set<Class<? extends DataEntity>> lastUpdateDates, Trip oldTrip, Trip newTrip) {
|
| 266 | - if (shouldCopyObservationsMetaData(newTrip)) {
|
|
| 266 | + if (TripImpl.shouldCopyObservationsMetaData(newTrip)) {
|
|
| 267 | 267 | writer.writeSql(copyObservationsMetadata(oldTrip, newTrip.getId()));
|
| 268 | 268 | }
|
| 269 | - if (shouldRemoveObservationsMetaData(newTrip)) {
|
|
| 269 | + if (TripImpl.shouldRemoveObservationsMetaData(oldTrip)) {
|
|
| 270 | 270 | writer.writeSql(removeObservationsMetadata(oldTrip.getId()));
|
| 271 | 271 | }
|
| 272 | 272 | lastUpdateDates.add(fr.ird.observe.entities.data.ps.observation.Route.class);
|
| ... | ... | @@ -284,14 +284,6 @@ public class TripSpi extends GeneratedTripSpi { |
| 284 | 284 | lastUpdateDates.add(fr.ird.observe.entities.data.ps.observation.ObjectObservedSpecies.class);
|
| 285 | 285 | }
|
| 286 | 286 | |
| 287 | - private boolean shouldCopyObservationsMetaData(Trip trip) {
|
|
| 288 | - return trip.getObservationsAcquisitionStatus() == null || !trip.getObservationsAcquisitionStatus().isFieldEnabler();
|
|
| 289 | - }
|
|
| 290 | - |
|
| 291 | - private boolean shouldRemoveObservationsMetaData(Trip trip) {
|
|
| 292 | - return !trip.isObservationsFilled();
|
|
| 293 | - }
|
|
| 294 | - |
|
| 295 | 287 | private String copyObservationsMetadata(Trip trip, String newId) {
|
| 296 | 288 | Program observationsProgram = trip.getObservationsProgram();
|
| 297 | 289 | AcquisitionStatus observationsAcquisitionStatus = trip.getObservationsAcquisitionStatus();
|
| ... | ... | @@ -339,24 +331,16 @@ public class TripSpi extends GeneratedTripSpi { |
| 339 | 331 | |
| 340 | 332 | public void updateLandingMetadata(SqlScriptWriter writer, Set<Class<? extends DataEntity>> lastUpdateDates, Trip oldTrip, Trip newTrip) {
|
| 341 | 333 | String newTripId = newTrip.getTopiaId();
|
| 342 | - if (shouldCopyLandingMetaData(newTrip)) {
|
|
| 334 | + if (TripImpl.shouldCopyLandingMetaData(newTrip)) {
|
|
| 343 | 335 | writer.writeSql(copyLandingMetadata(oldTrip, newTripId));
|
| 344 | 336 | }
|
| 345 | 337 | updateLogbookCommonMetadata(writer, oldTrip, newTrip);
|
| 346 | - if (shouldRemoveLandingMetaData(newTrip)) {
|
|
| 338 | + if (TripImpl.shouldRemoveLandingMetaData(oldTrip)) {
|
|
| 347 | 339 | writer.writeSql(removeLandingMetadata(oldTrip.getTopiaId()));
|
| 348 | 340 | }
|
| 349 | 341 | lastUpdateDates.add(Landing.class);
|
| 350 | 342 | }
|
| 351 | 343 | |
| 352 | - private boolean shouldCopyLandingMetaData(Trip trip) {
|
|
| 353 | - return trip.getLandingAcquisitionStatus() == null || !trip.getLandingAcquisitionStatus().isFieldEnabler();
|
|
| 354 | - }
|
|
| 355 | - |
|
| 356 | - private boolean shouldRemoveLandingMetaData(Trip trip) {
|
|
| 357 | - return !trip.isLandingFilled();
|
|
| 358 | - }
|
|
| 359 | - |
|
| 360 | 344 | private String copyLandingMetadata(Trip trip, String newId) {
|
| 361 | 345 | AcquisitionStatus landingAcquisitionStatus = trip.getLandingAcquisitionStatus();
|
| 362 | 346 | Float landingTotalWeight = trip.getLandingTotalWeight();
|
| ... | ... | @@ -379,7 +363,7 @@ public class TripSpi extends GeneratedTripSpi { |
| 379 | 363 | }
|
| 380 | 364 | |
| 381 | 365 | public void updateLogbookMetadata(SqlScriptWriter writer, Set<Class<? extends DataEntity>> lastUpdateDates, Trip oldTrip, Trip newTrip) {
|
| 382 | - if (shouldCopyLogbookMetaData(newTrip)) {
|
|
| 366 | + if (TripImpl.shouldCopyLogbookMetaData(newTrip)) {
|
|
| 383 | 367 | writer.writeSql(copyLogbookMetadata(oldTrip, newTrip.getId()));
|
| 384 | 368 | }
|
| 385 | 369 | // This avoid in others update to do it again
|
| ... | ... | @@ -389,7 +373,7 @@ public class TripSpi extends GeneratedTripSpi { |
| 389 | 373 | // This avoid in others update to do it again
|
| 390 | 374 | newTrip.setLogbookDataQuality(oldTrip.getLogbookDataQuality());
|
| 391 | 375 | |
| 392 | - if (shouldRemoveLogbookMetaData(newTrip)) {
|
|
| 376 | + if (TripImpl.shouldRemoveLogbookMetaData(oldTrip)) {
|
|
| 393 | 377 | writer.writeSql(removeLogbookMetadata(oldTrip.getId()));
|
| 394 | 378 | }
|
| 395 | 379 | if (lastUpdateDates != null) {
|
| ... | ... | @@ -407,14 +391,6 @@ public class TripSpi extends GeneratedTripSpi { |
| 407 | 391 | }
|
| 408 | 392 | }
|
| 409 | 393 | |
| 410 | - private boolean shouldCopyLogbookMetaData(Trip trip) {
|
|
| 411 | - return trip.getLogbookAcquisitionStatus() == null || !trip.getLogbookAcquisitionStatus().isFieldEnabler();
|
|
| 412 | - }
|
|
| 413 | - |
|
| 414 | - private boolean shouldRemoveLogbookMetaData(Trip trip) {
|
|
| 415 | - return !trip.isLogbookFilled();
|
|
| 416 | - }
|
|
| 417 | - |
|
| 418 | 394 | private String copyLogbookMetadata(Trip trip, String newId) {
|
| 419 | 395 | Program logbookProgram = trip.getLogbookProgram();
|
| 420 | 396 | AcquisitionStatus logbookAcquisitionStatus = trip.getLogbookAcquisitionStatus();
|
| ... | ... | @@ -506,10 +482,10 @@ public class TripSpi extends GeneratedTripSpi { |
| 506 | 482 | |
| 507 | 483 | public void updateLocalmarketMetadata(SqlScriptWriter writer, Set<Class<? extends DataEntity>> lastUpdateDates, Trip oldTrip, Trip newTrip) {
|
| 508 | 484 | String newTripId = newTrip.getId();
|
| 509 | - if (shouldCopyLocalmarketMetaData(newTrip)) {
|
|
| 485 | + if (TripImpl.shouldCopyLocalmarketMetaData(newTrip)) {
|
|
| 510 | 486 | writer.writeSql(copyLocalmarketMetadata(oldTrip, newTripId));
|
| 511 | 487 | }
|
| 512 | - if (shouldRemoveLocalmarketMetaData(newTrip)) {
|
|
| 488 | + if (TripImpl.shouldRemoveLocalmarketMetaData(oldTrip)) {
|
|
| 513 | 489 | writer.writeSql(removeLocalmarketMetadata(oldTrip.getId()));
|
| 514 | 490 | }
|
| 515 | 491 | updateLogbookCommonMetadata(writer, oldTrip, newTrip);
|
| ... | ... | @@ -521,14 +497,6 @@ public class TripSpi extends GeneratedTripSpi { |
| 521 | 497 | lastUpdateDates.add(fr.ird.observe.entities.data.ps.localmarket.SurveyPart.class);
|
| 522 | 498 | }
|
| 523 | 499 | |
| 524 | - private boolean shouldCopyLocalmarketMetaData(Trip trip) {
|
|
| 525 | - return trip.getLocalMarketAcquisitionStatus() == null || !trip.getLocalMarketAcquisitionStatus().isFieldEnabler();
|
|
| 526 | - }
|
|
| 527 | - |
|
| 528 | - private boolean shouldRemoveLocalmarketMetaData(Trip trip) {
|
|
| 529 | - return !trip.isLocalmarketFilled();
|
|
| 530 | - }
|
|
| 531 | - |
|
| 532 | 500 | private String copyLocalmarketMetadata(Trip trip, String newId) {
|
| 533 | 501 | AcquisitionStatus localMarketAcquisitionStatus = trip.getLocalMarketAcquisitionStatus();
|
| 534 | 502 | AcquisitionStatus localMarketSurveySamplingAcquisitionStatus = trip.getLocalMarketSurveySamplingAcquisitionStatus();
|