Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

28 changed files:

Changes:

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/DataSourceEditorBodyContent.java
    ... ... @@ -40,6 +40,7 @@ import fr.ird.observe.client.datasource.editor.api.menu.actions.CloseStorageActi
    40 40
     import fr.ird.observe.client.datasource.editor.api.menu.actions.ImportAvdthFileAction;
    
    41 41
     import fr.ird.observe.client.datasource.editor.api.menu.actions.ReloadStorageAction;
    
    42 42
     import fr.ird.observe.client.datasource.editor.api.menu.actions.ShowDataSourcePresetsAction;
    
    43
    +import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationNode;
    
    43 44
     import fr.ird.observe.client.main.ObserveMainUI;
    
    44 45
     import fr.ird.observe.client.main.body.HideBodyContentNotAcceptedException;
    
    45 46
     import fr.ird.observe.client.main.body.MainUIBodyContent;
    
    ... ... @@ -79,6 +80,7 @@ public class DataSourceEditorBodyContent extends MainUIBodyContent<DataSourceEdi
    79 80
         private DataSourceEditorMenu editorMenu;
    
    80 81
         private DataSourceEditorNavigationMenu navigationMenu;
    
    81 82
         private ObserveSwingDataSource dataSource;
    
    83
    +    private NavigationNode previousNode;
    
    82 84
     
    
    83 85
         public DataSourceEditorBodyContent() {
    
    84 86
             super(1, DataSourceEditor.class);
    
    ... ... @@ -86,6 +88,10 @@ public class DataSourceEditorBodyContent extends MainUIBodyContent<DataSourceEdi
    86 88
             this.reload = e -> reload();
    
    87 89
         }
    
    88 90
     
    
    91
    +    public void setPreviousNode(NavigationNode previousNode) {
    
    92
    +        this.previousNode = previousNode;
    
    93
    +    }
    
    94
    +
    
    89 95
         private Supplier<DataSourceEditor> createSupplier() {
    
    90 96
             return () -> {
    
    91 97
                 ObserveMainUI mainUI = getClientUIContext().getMainUI();
    
    ... ... @@ -193,7 +199,10 @@ public class DataSourceEditorBodyContent extends MainUIBodyContent<DataSourceEdi
    193 199
             focusModel.addZone(new ContentZone(focusModel, dataSourceEditor));
    
    194 200
     
    
    195 201
             navigationMenu.getUiModel().setConfig(dataSourceEditor.getNavigationUI().getTree().getModel().getConfig());
    
    196
    -        dataSourceEditor.getHandler().loadNavigationUI(progressModel);
    
    202
    +        NavigationNode previousNode = this.previousNode;
    
    203
    +        // remove it right now
    
    204
    +        setPreviousNode(null);
    
    205
    +        dataSourceEditor.getHandler().loadNavigationUI(progressModel, previousNode);
    
    197 206
             progressModel.increments();
    
    198 207
         }
    
    199 208
     
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/DataSourceEditorHandler.java
    ... ... @@ -30,6 +30,7 @@ import fr.ird.observe.client.datasource.editor.api.content.ContentUIManager;
    30 30
     import fr.ird.observe.client.datasource.editor.api.navigation.NavigationTree;
    
    31 31
     import fr.ird.observe.client.datasource.editor.api.navigation.NavigationTreeModel;
    
    32 32
     import fr.ird.observe.client.datasource.editor.api.navigation.NavigationUI;
    
    33
    +import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationNode;
    
    33 34
     import fr.ird.observe.client.util.ProgressModel;
    
    34 35
     import fr.ird.observe.client.util.init.UIInitHelper;
    
    35 36
     import fr.ird.observe.client.util.session.ObserveSwingSessionHelper;
    
    ... ... @@ -153,8 +154,9 @@ public class DataSourceEditorHandler implements UIHandler<DataSourceEditor>, Wit
    153 154
          * <b>Note:</b> cette méthode doit être appelée après tout rechargement de modèle de navigation.
    
    154 155
          *
    
    155 156
          * @param progressModel the progress model to interact with ui
    
    157
    +     * @param previousNode
    
    156 158
          */
    
    157
    -    public void loadNavigationUI(ProgressModel progressModel) {
    
    159
    +    public void loadNavigationUI(ProgressModel progressModel, NavigationNode previousNode) {
    
    158 160
             boolean canReadData = getClientUIContext().getDataSourcesManager().getMainDataSource().canReadData();
    
    159 161
             NavigationUI navigationUI = ui.getNavigationUI();
    
    160 162
             NavigationTree tree = navigationUI.getTree();
    
    ... ... @@ -163,10 +165,20 @@ public class DataSourceEditorHandler implements UIHandler<DataSourceEditor>, Wit
    163 165
             treeModel.populate(null);
    
    164 166
             progressModel.increments();
    
    165 167
             // select initial node
    
    166
    -        try {
    
    167
    -            tree.selectInitialNode();
    
    168
    -        } catch (Exception e) {
    
    169
    -            log.error("Could not load initial node", e);
    
    168
    +        if (previousNode != null) {
    
    169
    +            try {
    
    170
    +                tree.reselectInitialNode(previousNode);
    
    171
    +            } catch (Exception e) {
    
    172
    +                log.error("Could not load previous node", e);
    
    173
    +                previousNode = null;
    
    174
    +            }
    
    175
    +        }
    
    176
    +        if (previousNode == null) {
    
    177
    +            try {
    
    178
    +                tree.selectInitialNode();
    
    179
    +            } catch (Exception e) {
    
    180
    +                log.error("Could not load initial node", e);
    
    181
    +            }
    
    170 182
             }
    
    171 183
             progressModel.increments();
    
    172 184
             tree.setVisible(true);
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/menu/actions/ReloadStorageAction.java
    ... ... @@ -23,8 +23,9 @@ package fr.ird.observe.client.datasource.editor.api.menu.actions;
    23 23
      */
    
    24 24
     
    
    25 25
     import fr.ird.observe.client.datasource.api.ObserveSwingDataSource;
    
    26
    +import fr.ird.observe.client.datasource.editor.api.DataSourceEditorBodyContent;
    
    26 27
     import fr.ird.observe.client.datasource.editor.api.menu.DataSourceEditorMenu;
    
    27
    -import fr.ird.observe.client.main.ObserveMainUI;
    
    28
    +import fr.ird.observe.client.datasource.editor.api.navigation.tree.NavigationNode;
    
    28 29
     import fr.ird.observe.client.util.ObserveSwingTechnicalException;
    
    29 30
     import org.apache.logging.log4j.LogManager;
    
    30 31
     import org.apache.logging.log4j.Logger;
    
    ... ... @@ -60,28 +61,24 @@ public class ReloadStorageAction extends DataSourceEditorMenuActionSupport imple
    60 61
     
    
    61 62
             log.info(String.format("Will close main data source: %s", dataSource));
    
    62 63
     
    
    63
    -        // Close
    
    64
    -        getDataSourceEditorBodyContent().doCloseStorage();
    
    64
    +        DataSourceEditorBodyContent bodyContent = getDataSourceEditorBodyContent();
    
    65 65
     
    
    66
    -        ObserveMainUI mainUI = getClientUIContext().getMainUI();
    
    66
    +        // keep selected node to select it on new navigation tree
    
    67
    +        NavigationNode selectedNode = bodyContent.get().getNavigationUI().getTree().getSelectedNode();
    
    68
    +        bodyContent.setPreviousNode(selectedNode);
    
    67 69
     
    
    68
    -        //FIXME:BodyContent reload previous selected node
    
    69
    -        getClientUIContext().getBusyModel().addTask("Reload storage");
    
    70
    -        try {
    
    71
    -
    
    72
    -            //FIXME:Datasource See why we do this?
    
    73
    -            dataSource.setCanMigrate(getClientConfig());
    
    70
    +        // Close storage
    
    71
    +        bodyContent.doCloseStorage();
    
    74 72
     
    
    75
    -            log.info(String.format("Will load main data source: %s", dataSource));
    
    73
    +        //FIXME:Datasource See why we do this?
    
    74
    +        dataSource.setCanMigrate(getClientConfig());
    
    76 75
     
    
    77
    -            try {
    
    78
    -                getDataSourceEditorBodyContent().loadStorage(mainUI, dataSource);
    
    79
    -            } catch (Exception e) {
    
    80
    -                throw new ObserveSwingTechnicalException(e);
    
    81
    -            }
    
    76
    +        log.info(String.format("Will load main data source: %s", dataSource));
    
    82 77
     
    
    83
    -        } finally {
    
    84
    -            getClientUIContext().getBusyModel().popTask();
    
    78
    +        try {
    
    79
    +            bodyContent.loadStorage(getClientUIContext().getMainUI(), dataSource);
    
    80
    +        } catch (Exception e) {
    
    81
    +            throw new ObserveSwingTechnicalException(e);
    
    85 82
             }
    
    86 83
     
    
    87 84
         }
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/navigation/tree/root/RootNavigationNode.java
    ... ... @@ -141,7 +141,7 @@ public class RootNavigationNode extends NavigationNode {
    141 141
             return result;
    
    142 142
         }
    
    143 143
     
    
    144
    -    public <N extends NavigationNode> N findChildByType0(Class<N> childType, String id) {
    
    144
    +    public <N extends NavigationNode> N findChildByTypeWithNoCreate(Class<N> childType, String id) {
    
    145 145
             return super.findChildByType(childType, id);
    
    146 146
         }
    
    147 147
     
    
    ... ... @@ -173,7 +173,10 @@ public class RootNavigationNode extends NavigationNode {
    173 173
                 NavigationNode next;
    
    174 174
                 NavigationNode oldNode = (NavigationNode) treeNode;
    
    175 175
                 if (oldNode.getLevel() == 0) {
    
    176
    -                next = ((RootNavigationNode) result).findChildByType0(oldNode.getClass(), oldNode.getInitializer().getSelectNodeId());
    
    176
    +                next = result;
    
    177
    +            } else if (oldNode.getLevel() == 1) {
    
    178
    +                // use the method which will not create node
    
    179
    +                next = ((RootNavigationNode) result).findChildByTypeWithNoCreate(oldNode.getClass(), oldNode.getInitializer().getSelectNodeId());
    
    177 180
                 } else if (oldNode.getScope().isSelectNode()) {
    
    178 181
                     next = result.findChildByType(oldNode.getClass(), oldNode.getInitializer().getSelectNodeId());
    
    179 182
                 } else {
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripUI.jaxx
    ... ... @@ -320,8 +320,8 @@
    320 320
                 </cell>
    
    321 321
                 <cell anchor='west' weightx="0.5">
    
    322 322
                   <JPanel layout="{new GridLayout()}">
    
    323
    -                <NumberEditor id='landingTotalWeight' styleClass="float3 logbookEnabled"/>
    
    324 323
                     <NumberEditor id='localMarketTotalWeight' styleClass="float3 logbookEnabled"/>
    
    324
    +                <NumberEditor id='landingTotalWeight' styleClass="float3 logbookEnabled"/>
    
    325 325
                   </JPanel>
    
    326 326
                 </cell>
    
    327 327
               </row>
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/dcp/DcpUIAdapter.java
    ... ... @@ -39,7 +39,7 @@ import fr.ird.observe.dto.referential.ps.common.ObjectMaterialDto;
    39 39
     import fr.ird.observe.dto.referential.ps.common.ObjectMaterialHierarchyDto;
    
    40 40
     import fr.ird.observe.dto.referential.ps.common.ObjectOperationReference;
    
    41 41
     import fr.ird.observe.dto.referential.ps.common.TransmittingBuoyTypeReference;
    
    42
    -import fr.ird.observe.services.service.data.ps.common.TripService;
    
    42
    +import fr.ird.observe.services.service.referential.ReferentialService;
    
    43 43
     import fr.ird.observe.spi.decoration.DecoratorService;
    
    44 44
     import io.ultreia.java4all.jaxx.widgets.combobox.BeanEnumEditor;
    
    45 45
     import io.ultreia.java4all.jaxx.widgets.combobox.FilterableComboBox;
    
    ... ... @@ -60,6 +60,7 @@ import java.util.ArrayList;
    60 60
     import java.util.List;
    
    61 61
     import java.util.Map;
    
    62 62
     import java.util.Objects;
    
    63
    +import java.util.Set;
    
    63 64
     import java.util.TreeMap;
    
    64 65
     
    
    65 66
     /**
    
    ... ... @@ -86,7 +87,7 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    86 87
     
    
    87 88
         JPanel getTransmittingBuoys();
    
    88 89
     
    
    89
    -    JLabel getNoBaliseEditor();
    
    90
    +    JLabel getNoBuoyEditor();
    
    90 91
     
    
    91 92
         FilterableComboBox<TransmittingBuoyTypeReference> getTransmittingBuoyType1();
    
    92 93
     
    
    ... ... @@ -121,9 +122,10 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    121 122
                               getTransmittingBuoy2());
    
    122 123
         }
    
    123 124
     
    
    124
    -    default void onInit(DcpUIModelStates<?> states, TripService psCommonTripService, DecoratorService decoratorService) {
    
    125
    +    default void onInit(DcpUIModelStates<?> states, ReferentialService referentialService, DecoratorService decoratorService) {
    
    125 126
     
    
    126
    -        ObjectMaterialHierarchyDto detailedForm = psCommonTripService.getObjectMaterialHierarchy();
    
    127
    +        Set<ObjectMaterialDto> dtoList = referentialService.loadDtoList(ObjectMaterialDto.class);
    
    128
    +        ObjectMaterialHierarchyDto detailedForm = ObjectMaterialHierarchyDto.build(dtoList);
    
    127 129
     
    
    128 130
             Map<String, ObjectMaterialDto> allMap = new TreeMap<>();
    
    129 131
             detailedForm.getAllDto().forEach(s -> allMap.putIfAbsent(s.getId(), s));
    
    ... ... @@ -141,13 +143,13 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    141 143
             states.getBean().addPropertyChangeListener(FloatingObjectDto.PROPERTY_OBJECT_OPERATION, e -> states.updateMaterials(getTable().getTreeTableModel(), (ObjectOperationReference) e.getNewValue()));
    
    142 144
         }
    
    143 145
     
    
    144
    -    default void installExtraActions(DcpUIModelStates<?> states) {
    
    146
    +    default void installExtraActions() {
    
    145 147
             AddFloatingObjectPreset.init((ContentUI) this, getAddPreset(), AddFloatingObjectPreset.class);
    
    146 148
             CopyFloatingObjectPartToRight.init((ContentUI) this, getCopyFloatingObjectPartToRight(), CopyFloatingObjectPartToRight.class);
    
    147 149
             CopyFloatingObjectPartToLeft.init((ContentUI) this, getCopyFloatingObjectPartToLeft(), CopyFloatingObjectPartToLeft.class);
    
    148 150
         }
    
    149 151
     
    
    150
    -    default void customizeUI(DcpUIModelStates<?> states) {
    
    152
    +    default void customizeUI() {
    
    151 153
             ContentUIInitializer.setDecoratorIndex(getVessel1(), 1);
    
    152 154
             ContentUIInitializer.setDecoratorIndex(getVessel2(), 1);
    
    153 155
             ContentUIInitializer.setDecoratorIndex(getCountry1(), 1);
    
    ... ... @@ -160,7 +162,7 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    160 162
             changeTypeOperation(states, typeOperation, false);
    
    161 163
         }
    
    162 164
     
    
    163
    -    default void stopEditUI(DcpUIModelStates<?> states) {
    
    165
    +    default void stopEditUI() {
    
    164 166
             if (getMainTabbedPane().getSelectedIndex() == 1) {
    
    165 167
                 getTable().editingCanceled(null);
    
    166 168
             }
    
    ... ... @@ -214,17 +216,12 @@ public interface DcpUIAdapter<T extends TransmittingBuoyAware> extends JAXXObjec
    214 216
                 getValidatorBuoy1().setBean(null);
    
    215 217
                 getValidatorBuoy2().setBean(null);
    
    216 218
             }
    
    217
    -//        if (TypeTransmittingBuoyOperation.retrait == typeOperation) {
    
    218
    -//            addTransmittingBuoyCoordinate();
    
    219
    -//        } else {
    
    220
    -//            removeTransmittingBuoyCoordinate(reset);
    
    221
    -//        }
    
    222 219
     
    
    223 220
             String[] codeOperations = typeOperation.getCodeOperation();
    
    224 221
             JComponent focusOwner = null;
    
    225 222
             switch (typeOperation) {
    
    226 223
                 case pasDeBalise:
    
    227
    -                editorPanel.add(getNoBaliseEditor());
    
    224
    +                editorPanel.add(getNoBuoyEditor());
    
    228 225
                     focusOwner = getComment();
    
    229 226
                     break;
    
    230 227
                 case recuperationEtRemplacement:
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/dcp/FloatingObjectUICommon.jcss
    ... ... @@ -85,7 +85,7 @@
    85 85
       visible:{typeOperation.getSelectedValue() != null};
    
    86 86
     }
    
    87 87
     
    
    88
    -#noBaliseEditor {
    
    88
    +#noBuoyEditor {
    
    89 89
       horizontalAlignment:"center";
    
    90 90
       text:"observe.Common.noBuoy";
    
    91 91
     }
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/dcp/presets/FloatingObjectPresetUI.jaxx
    ... ... @@ -155,7 +155,7 @@
    155 155
               <JPanel id="buoys" layout="{new GridLayout(1,0)}">
    
    156 156
                 <FloatingObjectBuoyPresetUI id="buoy1" constructorParams="this"/>
    
    157 157
                 <FloatingObjectBuoyPresetUI id="buoy2" constructorParams="this"/>
    
    158
    -            <JLabel id='noBaliseEditor' styleClass="skipI18n"/>
    
    158
    +            <JLabel id='noBuoyEditor' styleClass="skipI18n"/>
    
    159 159
               </JPanel>
    
    160 160
             </cell>
    
    161 161
           </row>
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/dcp/presets/FloatingObjectPresetUI.jcss
    ... ... @@ -92,7 +92,7 @@ JLabel {
    92 92
       border:{new TitledBorder(t("observe.Common.second.buoy"))};
    
    93 93
     }
    
    94 94
     
    
    95
    -#noBaliseEditor {
    
    95
    +#noBuoyEditor {
    
    96 96
       horizontalAlignment:"center";
    
    97 97
       text:"observe.Common.noBuoy";
    
    98 98
     }
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/dcp/presets/FloatingObjectPresetUIHandler.java
    ... ... @@ -64,7 +64,7 @@ public class FloatingObjectPresetUIHandler implements UIHandler<FloatingObjectPr
    64 64
             initializer.disabledIfNull(model, bean, "keepSupplyName");
    
    65 65
             ui.getBuoys().removeAll();
    
    66 66
             SwingValidatorUtil.setValidatorBean(ui, bean);
    
    67
    -        ui.getBuoys().add(ui.getNoBaliseEditor());
    
    67
    +        ui.getBuoys().add(ui.getNoBuoyEditor());
    
    68 68
     
    
    69 69
             Optional.ofNullable(floatingObjectPreset.getBuoy1()).ifPresent(t -> prepareBuoy(t, ui, buoy1));
    
    70 70
             Optional.ofNullable(floatingObjectPreset.getBuoy2()).ifPresent(t -> prepareBuoy(t, ui, buoy2));
    
    ... ... @@ -115,7 +115,7 @@ public class FloatingObjectPresetUIHandler implements UIHandler<FloatingObjectPr
    115 115
             FloatingObjectBuoyPreset bean = buoyUI.getBean();
    
    116 116
             FloatingObjectBuoyPresetUIModel model = buoyUI.getModel();
    
    117 117
             preset.copy(bean);
    
    118
    -        ui.getBuoys().remove(ui.getNoBaliseEditor());
    
    118
    +        ui.getBuoys().remove(ui.getNoBuoyEditor());
    
    119 119
             ui.getBuoys().add(buoyUI);
    
    120 120
             SwingValidatorUtil.setValidatorBean(buoyUI, model.getBean());
    
    121 121
     
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/FloatingObjectUI.jaxx
    ... ... @@ -323,7 +323,7 @@
    323 323
                           </row>
    
    324 324
                         </Table>
    
    325 325
                       </JXTitledPanel>
    
    326
    -                  <JLabel id='noBaliseEditor' styleClass="skipI18n"/>
    
    326
    +                  <JLabel id='noBuoyEditor' styleClass="skipI18n"/>
    
    327 327
                     </JPanel>
    
    328 328
                   </JPanel>
    
    329 329
                 </tab>
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/logbook/FloatingObjectUIHandler.java
    ... ... @@ -43,19 +43,19 @@ public class FloatingObjectUIHandler extends GeneratedFloatingObjectUIHandler {
    43 43
             coordinate1Label = ui.transmittingBuoy1Editor.getComponent(10);
    
    44 44
             coordinate1 = ui.transmittingBuoy1Editor.getComponent(11);
    
    45 45
             comment1 = ui.transmittingBuoy1Editor.getComponent(12);
    
    46
    -        ui.onInit(ui.getModel().getStates(), getPsCommonTripService(), getDecoratorService());
    
    46
    +        ui.onInit(ui.getModel().getStates(), getReferentialService(), getDecoratorService());
    
    47 47
         }
    
    48 48
     
    
    49 49
         @Override
    
    50 50
         protected void customizeUI() {
    
    51 51
             super.customizeUI();
    
    52
    -        ui.customizeUI(ui.getModel().getStates());
    
    52
    +        ui.customizeUI();
    
    53 53
         }
    
    54 54
     
    
    55 55
         @Override
    
    56 56
         protected void installExtraActions() {
    
    57 57
             super.installExtraActions();
    
    58
    -        ui.installExtraActions(ui.getModel().getStates());
    
    58
    +        ui.installExtraActions();
    
    59 59
         }
    
    60 60
     //FIXME:Focus ui.getModel().getStates().isCreatingMode() ? getUi().getObjectOperation() : getUi().getSupportVesselName()
    
    61 61
     
    
    ... ... @@ -72,7 +72,7 @@ public class FloatingObjectUIHandler extends GeneratedFloatingObjectUIHandler {
    72 72
     
    
    73 73
         @Override
    
    74 74
         public void stopEditUI() {
    
    75
    -        ui.stopEditUI(ui.getModel().getStates());
    
    75
    +        ui.stopEditUI();
    
    76 76
             super.stopEditUI();
    
    77 77
         }
    
    78 78
     
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/FloatingObjectUI.jaxx
    ... ... @@ -298,7 +298,7 @@
    298 298
                           </row>
    
    299 299
                         </Table>
    
    300 300
                       </JXTitledPanel>
    
    301
    -                  <JLabel id='noBaliseEditor' styleClass="skipI18n"/>
    
    301
    +                  <JLabel id='noBuoyEditor' styleClass="skipI18n"/>
    
    302 302
                     </JPanel>
    
    303 303
                   </JPanel>
    
    304 304
                 </tab>
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/FloatingObjectUIHandler.java
    ... ... @@ -32,19 +32,19 @@ public class FloatingObjectUIHandler extends GeneratedFloatingObjectUIHandler {
    32 32
         @Override
    
    33 33
         public void onInit(FloatingObjectUI ui) {
    
    34 34
             super.onInit(ui);
    
    35
    -        ui.onInit(ui.getModel().getStates(), getPsCommonTripService(), getDecoratorService());
    
    35
    +        ui.onInit(ui.getModel().getStates(), getReferentialService(), getDecoratorService());
    
    36 36
         }
    
    37 37
     
    
    38 38
         @Override
    
    39 39
         protected void customizeUI() {
    
    40 40
             super.customizeUI();
    
    41
    -        ui.customizeUI(ui.getModel().getStates());
    
    41
    +        ui.customizeUI();
    
    42 42
         }
    
    43 43
     
    
    44 44
         @Override
    
    45 45
         protected void installExtraActions() {
    
    46 46
             super.installExtraActions();
    
    47
    -        ui.installExtraActions(ui.getModel().getStates());
    
    47
    +        ui.installExtraActions();
    
    48 48
         }
    
    49 49
     //FIXME:Focus ui.getModel().getStates().isCreatingMode() ? getUi().getObjectOperation() : getUi().getSupportVesselName()
    
    50 50
     
    
    ... ... @@ -61,7 +61,7 @@ public class FloatingObjectUIHandler extends GeneratedFloatingObjectUIHandler {
    61 61
     
    
    62 62
         @Override
    
    63 63
         public void stopEditUI() {
    
    64
    -        ui.stopEditUI(ui.getModel().getStates());
    
    64
    +        ui.stopEditUI();
    
    65 65
             super.stopEditUI();
    
    66 66
         }
    
    67 67
     
    

  • models/definition/src/main/models/Observe/dto/attribute/boundNumber.properties
    ... ... @@ -69,7 +69,7 @@ data.ll.observation.SizeMeasure.attribute.size=0.0:1000.0
    69 69
     data.ll.observation.WeightMeasure.attribute.weight=0.0:1000.0
    
    70 70
     data.ps.common.Trip.attribute.fishingTime=0:1300:!logbookEnabled
    
    71 71
     data.ps.common.Trip.attribute.landingTotalWeight=0.1:3000.0:!targetWellsSamplingEnabled
    
    72
    -data.ps.common.Trip.attribute.localMarketTotalWeight=0.1:3000.0:!localMarketWellsSamplingEnabled && !localMarketSurveySamplingEnabled
    
    72
    +data.ps.common.Trip.attribute.localMarketTotalWeight=0.0:1500.0:!localMarketWellsSamplingEnabled && !localMarketSurveySamplingEnabled
    
    73 73
     data.ps.common.Trip.attribute.timeAtSea=10:2400:!logbookEnabled
    
    74 74
     data.ps.landing.Landing.attribute.weight=0.0:600.0
    
    75 75
     data.ps.localmarket.Batch.attribute.weight=0.0:5.0:!countOrWeightValid
    

  • models/dto/java/src/main/java/fr/ird/observe/dto/referential/ps/common/ObjectMaterialHierarchyDto.java
    ... ... @@ -22,13 +22,22 @@ package fr.ird.observe.dto.referential.ps.common;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    +import com.google.common.collect.ArrayListMultimap;
    
    26
    +import com.google.common.collect.Multimap;
    
    25 27
     import fr.ird.observe.dto.referential.FormulaHelper;
    
    26 28
     import io.ultreia.java4all.bean.spi.GenerateJavaBeanDefinition;
    
    27 29
     
    
    30
    +import java.util.ArrayList;
    
    31
    +import java.util.Collection;
    
    32
    +import java.util.Comparator;
    
    28 33
     import java.util.LinkedHashSet;
    
    29 34
     import java.util.LinkedList;
    
    30 35
     import java.util.List;
    
    36
    +import java.util.Map;
    
    37
    +import java.util.Optional;
    
    31 38
     import java.util.Set;
    
    39
    +import java.util.TreeMap;
    
    40
    +import java.util.TreeSet;
    
    32 41
     
    
    33 42
     /**
    
    34 43
      * Created by tchemit on 29/05/17.
    
    ... ... @@ -40,6 +49,62 @@ public class ObjectMaterialHierarchyDto extends ObjectMaterialDto {
    40 49
     
    
    41 50
         private final List<ObjectMaterialHierarchyDto> children;
    
    42 51
     
    
    52
    +    public static class Builder {
    
    53
    +
    
    54
    +        private final List<ObjectMaterialDto> dtoList;
    
    55
    +
    
    56
    +        public Builder(Collection<ObjectMaterialDto> dtoList) {
    
    57
    +            this.dtoList = new ArrayList<>(dtoList);
    
    58
    +
    
    59
    +        }
    
    60
    +
    
    61
    +        public ObjectMaterialHierarchyDto build() {
    
    62
    +            dtoList.sort(Comparator.comparing(ObjectMaterialDto::getCode));
    
    63
    +            return getObjectMaterialHierarchyList(dtoList).get(0);
    
    64
    +        }
    
    65
    +
    
    66
    +
    
    67
    +        public List<ObjectMaterialHierarchyDto> getObjectMaterialHierarchyList(List<ObjectMaterialDto> objectMaterials) {
    
    68
    +            Multimap<String, ObjectMaterialDto> childrenByParent = ArrayListMultimap.create();
    
    69
    +            objectMaterials.forEach(o -> childrenByParent.put(Optional.ofNullable(o.getParent()).map(ObjectMaterialReference::getId).orElse("Yo"), o));
    
    70
    +            Collection<ObjectMaterialDto> topLevelMaterials = childrenByParent.get("Yo");
    
    71
    +            List<ObjectMaterialHierarchyDto> result = new LinkedList<>();
    
    72
    +            Set<String> idsDone = new TreeSet<>();
    
    73
    +            for (ObjectMaterialDto topLevelMaterial : topLevelMaterials) {
    
    74
    +                ObjectMaterialHierarchyDto hierarchyDto = fillHierarchyDto(childrenByParent, topLevelMaterial, idsDone);
    
    75
    +                result.add(hierarchyDto);
    
    76
    +            }
    
    77
    +            result.sort(Comparator.comparing(ObjectMaterialDto::getCode));
    
    78
    +            return result;
    
    79
    +        }
    
    80
    +
    
    81
    +        private ObjectMaterialHierarchyDto fillHierarchyDto(Multimap<String, ObjectMaterialDto> childrenByParent, ObjectMaterialDto topLevelMaterial, Set<String> idsDone) {
    
    82
    +            Collection<ObjectMaterialDto> childrenEntities = childrenByParent.get(topLevelMaterial.getId());
    
    83
    +            String code = topLevelMaterial.getCode();
    
    84
    +            int level = code == null || code.isEmpty() ? 0 : code.split("-").length;
    
    85
    +            Map<Integer, ObjectMaterialDto> orderMap = new TreeMap<>();
    
    86
    +            for (ObjectMaterialDto child : childrenEntities) {
    
    87
    +                String code1 = child.getCode().split("-")[level];
    
    88
    +                orderMap.put(Integer.valueOf(code1), child);
    
    89
    +            }
    
    90
    +            List<ObjectMaterialDto> orderedChildren = new LinkedList<>();
    
    91
    +            orderMap.forEach((k, v) -> orderedChildren.add(v));
    
    92
    +            ObjectMaterialHierarchyDto hierarchyDto = new ObjectMaterialHierarchyDto(topLevelMaterial);
    
    93
    +            boolean add = idsDone.add(hierarchyDto.getId());
    
    94
    +            if (add) {
    
    95
    +                for (ObjectMaterialDto child : orderedChildren) {
    
    96
    +                    ObjectMaterialHierarchyDto hierarchyDto1 = fillHierarchyDto(childrenByParent, child, idsDone);
    
    97
    +                    hierarchyDto.addChild(hierarchyDto1);
    
    98
    +                }
    
    99
    +            }
    
    100
    +            return hierarchyDto;
    
    101
    +        }
    
    102
    +    }
    
    103
    +
    
    104
    +    public static ObjectMaterialHierarchyDto build(Collection<ObjectMaterialDto> dtoList) {
    
    105
    +        return new Builder(dtoList).build();
    
    106
    +    }
    
    107
    +
    
    43 108
         public ObjectMaterialHierarchyDto(ObjectMaterialDto root) {
    
    44 109
             root.copy(this);
    
    45 110
             this.children = new LinkedList<>();
    

  • models/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/logbook/FloatingObjectSpi.java
    ... ... @@ -22,16 +22,12 @@ package fr.ird.observe.entities.data.ps.logbook;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import com.google.common.collect.ArrayListMultimap;
    
    26
    -import com.google.common.collect.Multimap;
    
    27 25
     import fr.ird.observe.dto.ProtectedIdsPs;
    
    28 26
     import fr.ird.observe.dto.data.ps.dcp.FloatingObjectBuoyPreset;
    
    29 27
     import fr.ird.observe.dto.data.ps.dcp.FloatingObjectPreset;
    
    30 28
     import fr.ird.observe.dto.data.ps.logbook.FloatingObjectDto;
    
    31 29
     import fr.ird.observe.dto.form.Form;
    
    32 30
     import fr.ird.observe.dto.referential.ReferentialLocale;
    
    33
    -import fr.ird.observe.dto.referential.ps.common.ObjectMaterialDto;
    
    34
    -import fr.ird.observe.dto.referential.ps.common.ObjectMaterialHierarchyDto;
    
    35 31
     import fr.ird.observe.entities.ObserveTopiaPersistenceContextSupport;
    
    36 32
     import fr.ird.observe.entities.referential.common.Country;
    
    37 33
     import fr.ird.observe.entities.referential.common.Vessel;
    
    ... ... @@ -44,19 +40,13 @@ import fr.ird.observe.entities.referential.ps.common.TransmittingBuoyType;
    44 40
     import org.apache.logging.log4j.LogManager;
    
    45 41
     import org.apache.logging.log4j.Logger;
    
    46 42
     
    
    47
    -import java.util.Collection;
    
    48 43
     import java.util.Collections;
    
    49
    -import java.util.Comparator;
    
    50 44
     import java.util.Date;
    
    51 45
     import java.util.LinkedHashSet;
    
    52
    -import java.util.LinkedList;
    
    53
    -import java.util.List;
    
    54 46
     import java.util.Locale;
    
    55 47
     import java.util.Map;
    
    56 48
     import java.util.Optional;
    
    57 49
     import java.util.Set;
    
    58
    -import java.util.TreeMap;
    
    59
    -import java.util.TreeSet;
    
    60 50
     import java.util.function.Supplier;
    
    61 51
     
    
    62 52
     /**
    
    ... ... @@ -68,12 +58,6 @@ import java.util.function.Supplier;
    68 58
     public class FloatingObjectSpi extends GeneratedFloatingObjectSpi {
    
    69 59
         private static final Logger log = LogManager.getLogger(FloatingObjectSpi.class);
    
    70 60
     
    
    71
    -    public ObjectMaterialHierarchyDto getObjectMaterialHierarchy(ObserveTopiaPersistenceContextSupport persistenceContext, ReferentialLocale referentialLocale) {
    
    72
    -        List<ObjectMaterial> objectMaterials = ObjectMaterial.getDao(persistenceContext).findAll();
    
    73
    -        objectMaterials.sort(Comparator.comparing(ObjectMaterial::getCode));
    
    74
    -        return getObjectMaterialHierarchyList(objectMaterials, referentialLocale).get(0);
    
    75
    -    }
    
    76
    -
    
    77 61
         public Form<FloatingObjectDto> preCreate(ObserveTopiaPersistenceContextSupport persistenceContext, Locale applicationLocale, ReferentialLocale referentialLocale, Supplier<Date> nowSupplier, FloatingObjectPreset floatingObjectPreset) {
    
    78 62
             Date now = nowSupplier.get();
    
    79 63
             FloatingObject entity = newEntity(now);
    
    ... ... @@ -122,43 +106,6 @@ public class FloatingObjectSpi extends GeneratedFloatingObjectSpi {
    122 106
             super.onSave(persistenceContext, applicationLocale, referentialLocale, nowSupplier, parent, entity, dto);
    
    123 107
         }
    
    124 108
     
    
    125
    -    public List<ObjectMaterialHierarchyDto> getObjectMaterialHierarchyList(List<ObjectMaterial> objectMaterials, ReferentialLocale referentialLocale) {
    
    126
    -        Multimap<String, ObjectMaterial> childrenByParent = ArrayListMultimap.create();
    
    127
    -        objectMaterials.forEach(o -> childrenByParent.put(Optional.ofNullable(o.getParent()).map(ObjectMaterial::getTopiaId).orElse("Yo"), o));
    
    128
    -        Collection<ObjectMaterial> topLevelMaterials = childrenByParent.get("Yo");
    
    129
    -        List<ObjectMaterialHierarchyDto> result = new LinkedList<>();
    
    130
    -        Set<String> idsDone = new TreeSet<>();
    
    131
    -        for (ObjectMaterial topLevelMaterial : topLevelMaterials) {
    
    132
    -            ObjectMaterialHierarchyDto hierarchyDto = fillHierarchyDto(childrenByParent, referentialLocale, ObjectMaterial.toDto(referentialLocale, topLevelMaterial), idsDone);
    
    133
    -            result.add(hierarchyDto);
    
    134
    -        }
    
    135
    -        result.sort(Comparator.comparing(ObjectMaterialDto::getCode));
    
    136
    -        return result;
    
    137
    -    }
    
    138
    -
    
    139
    -    private ObjectMaterialHierarchyDto fillHierarchyDto(Multimap<String, ObjectMaterial> childrenByParent, ReferentialLocale referentialLocale, ObjectMaterialDto topLevelMaterial, Set<String> idsDone) {
    
    140
    -        Collection<ObjectMaterial> childrenEntities = childrenByParent.get(topLevelMaterial.getId());
    
    141
    -        List<ObjectMaterialDto> children = ObjectMaterial.toDtoList(referentialLocale, childrenEntities.stream());
    
    142
    -        String code = topLevelMaterial.getCode();
    
    143
    -        int level = code == null|| code.isEmpty() ? 0 : code.split("-").length;
    
    144
    -        Map<Integer, ObjectMaterialDto> orderMap = new TreeMap<>();
    
    145
    -        for (ObjectMaterialDto child : children) {
    
    146
    -            String code1 = child.getCode().split("-")[level];
    
    147
    -            orderMap.put(Integer.valueOf(code1), child);
    
    148
    -        }
    
    149
    -        List<ObjectMaterialDto> orderedChildren = new LinkedList<>();
    
    150
    -        orderMap.forEach((k, v) -> orderedChildren.add(v));
    
    151
    -        ObjectMaterialHierarchyDto hierarchyDto = new ObjectMaterialHierarchyDto(topLevelMaterial);
    
    152
    -        boolean add = idsDone.add(hierarchyDto.getId());
    
    153
    -        if (add) {
    
    154
    -            for (ObjectMaterialDto child : orderedChildren) {
    
    155
    -                ObjectMaterialHierarchyDto hierarchyDto1 = fillHierarchyDto(childrenByParent, referentialLocale, child, idsDone);
    
    156
    -                hierarchyDto.addChild(hierarchyDto1);
    
    157
    -            }
    
    158
    -        }
    
    159
    -        return hierarchyDto;
    
    160
    -    }
    
    161
    -
    
    162 109
         private TransmittingBuoy preCreate(ObserveTopiaPersistenceContextSupport topiaPersistenceContext, Locale applicationLocale, FloatingObjectBuoyPreset floatingObjectBuoyPreset, Date now) {
    
    163 110
             TransmittingBuoy transmittingBuoy = TransmittingBuoy.newEntity(now);
    
    164 111
             transmittingBuoy.setCode(floatingObjectBuoyPreset.getCode());
    

  • server/core/src/main/filtered-resources/META-INF/mapping-api-v1.wm
    ... ... @@ -105,7 +105,6 @@ GET /data/ps/common/TripService/getAllTripIds data
    105 105
     GET    /data/ps/common/TripService/getLogbookSetActivities                  data.ps.common.TripServiceRestApi.getLogbookSetActivities
    
    106 106
     GET    /data/ps/common/TripService/getLogbookWellPlanActivities             data.ps.common.TripServiceRestApi.getLogbookWellPlanActivities
    
    107 107
     GET    /data/ps/common/TripService/getMatchingTripsVesselWithinDateRange    data.ps.common.TripServiceRestApi.getMatchingTripsVesselWithinDateRange
    
    108
    -GET    /data/ps/common/TripService/getObjectMaterialHierarchy               data.ps.common.TripServiceRestApi.getObjectMaterialHierarchy
    
    109 108
     GET    /data/ps/common/TripService/getSpeciesByListAndTrip                  data.ps.common.TripServiceRestApi.getSpeciesByListAndTrip
    
    110 109
     GET    /data/ps/common/TripService/getTripMap                               data.ps.common.TripServiceRestApi.getTripMap
    
    111 110
     GET    /data/ps/common/TripService/isActivityEndOfSearchFound               data.ps.common.TripServiceRestApi.isActivityEndOfSearchFound
    

  • services/api-test/src/main/java/fr/ird/observe/services/service/data/ps/common/TripServiceFixtures.java
    ... ... @@ -34,7 +34,6 @@ import fr.ird.observe.dto.reference.DataDtoReferenceSet;
    34 34
     import fr.ird.observe.dto.reference.ReferentialDtoReferenceSet;
    
    35 35
     import fr.ird.observe.dto.referential.ReferentialLocale;
    
    36 36
     import fr.ird.observe.dto.referential.common.SpeciesReference;
    
    37
    -import fr.ird.observe.dto.referential.ps.common.ObjectMaterialHierarchyDto;
    
    38 37
     import fr.ird.observe.services.ObserveServicesProvider;
    
    39 38
     import fr.ird.observe.services.service.data.EditableServiceFixtures;
    
    40 39
     import fr.ird.observe.services.service.data.OpenableServiceFixtures;
    
    ... ... @@ -126,12 +125,6 @@ public class TripServiceFixtures extends GeneratedTripServiceFixtures {
    126 125
             Assert.assertTrue(activityEndOfSearchFound);
    
    127 126
         }
    
    128 127
     
    
    129
    -    @Override
    
    130
    -    public void getObjectMaterialHierarchy(ObserveServicesProvider servicesProvider, TripService service) {
    
    131
    -        ObjectMaterialHierarchyDto form = service.getObjectMaterialHierarchy();
    
    132
    -        Assert.assertNotNull(form);
    
    133
    -    }
    
    134
    -
    
    135 128
         @Override
    
    136 129
         public void preCreateLogbookFloatingObject(ObserveServicesProvider servicesProvider, TripService service) {
    
    137 130
             String activityId = getProperty("preCreateLogbookFloatingObject.activityId");
    

  • services/api/src/main/java/fr/ird/observe/services/service/data/ps/common/TripService.java
    ... ... @@ -26,7 +26,6 @@ import fr.ird.observe.dto.data.ps.dcp.FloatingObjectPreset;
    26 26
     import fr.ird.observe.dto.data.ps.logbook.ActivityReference;
    
    27 27
     import fr.ird.observe.dto.form.Form;
    
    28 28
     import fr.ird.observe.dto.reference.DataDtoReferenceSet;
    
    29
    -import fr.ird.observe.dto.referential.ps.common.ObjectMaterialHierarchyDto;
    
    30 29
     import fr.ird.observe.security.Permission;
    
    31 30
     import fr.ird.observe.services.service.data.TripAwareService;
    
    32 31
     import fr.ird.observe.services.spi.MethodCredential;
    
    ... ... @@ -65,10 +64,6 @@ public interface TripService extends TripAwareService {
    65 64
         @MethodCredential(Permission.READ_DATA)
    
    66 65
         boolean isActivityEndOfSearchFound(String routeId);
    
    67 66
     
    
    68
    -    @Get
    
    69
    -    @MethodCredential(Permission.READ_REFERENTIAL)
    
    70
    -    ObjectMaterialHierarchyDto getObjectMaterialHierarchy();
    
    71
    -
    
    72 67
         @Get
    
    73 68
         @MethodCredential(Permission.WRITE_DATA)
    
    74 69
         Form<fr.ird.observe.dto.data.ps.observation.FloatingObjectDto> preCreateObservationFloatingObject(String activityId, @Nullable FloatingObjectPreset floatingObjectPreset);
    

  • services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/ps/common/TripServiceLocalSupport.java
    ... ... @@ -29,13 +29,11 @@ import fr.ird.observe.dto.data.ps.logbook.ActivityReference;
    29 29
     import fr.ird.observe.dto.form.Form;
    
    30 30
     import fr.ird.observe.dto.reference.DataDtoReferenceSet;
    
    31 31
     import fr.ird.observe.dto.referential.ReferentialLocale;
    
    32
    -import fr.ird.observe.dto.referential.ps.common.ObjectMaterialHierarchyDto;
    
    33 32
     import fr.ird.observe.entities.data.ps.common.Program;
    
    34 33
     import fr.ird.observe.entities.data.ps.common.Trip;
    
    35 34
     import fr.ird.observe.entities.data.ps.common.TripSpi;
    
    36 35
     import fr.ird.observe.entities.data.ps.common.TripTopiaDao;
    
    37 36
     import fr.ird.observe.entities.data.ps.logbook.Activity;
    
    38
    -import fr.ird.observe.entities.data.ps.logbook.FloatingObject;
    
    39 37
     import fr.ird.observe.entities.data.ps.observation.Route;
    
    40 38
     import fr.ird.observe.services.service.data.ps.common.TripService;
    
    41 39
     
    
    ... ... @@ -73,11 +71,6 @@ public abstract class TripServiceLocalSupport extends fr.ird.observe.services.lo
    73 71
             return route.getActivity().stream().anyMatch(fr.ird.observe.entities.data.ps.observation.Activity::isActivityEndOfSearching);
    
    74 72
         }
    
    75 73
     
    
    76
    -    @Override
    
    77
    -    public ObjectMaterialHierarchyDto getObjectMaterialHierarchy() {
    
    78
    -        return FloatingObject.SPI.getObjectMaterialHierarchy(getTopiaPersistenceContext(), getReferentialLocale());
    
    79
    -    }
    
    80
    -
    
    81 74
         @Override
    
    82 75
         public Form<fr.ird.observe.dto.data.ps.observation.FloatingObjectDto> preCreateObservationFloatingObject(String activityId, FloatingObjectPreset floatingObjectPreset) {
    
    83 76
             return fr.ird.observe.entities.data.ps.observation.FloatingObject.SPI.preCreate(getTopiaPersistenceContext(), getApplicationLocale(), getReferentialLocale(), this::now, floatingObjectPreset);
    

  • services/validation/src/main/validation/fr/ird/observe/dto/data/ll/common/TripDto-create-error-validation.xmlservices/validation/src/main/validation/fr/ird/observe/dto/data/ll/common/TripDto-create-warning-validation.xml

  • services/validation/src/main/validation/fr/ird/observe/dto/data/ll/common/TripDto-update-error-validation.xml
    ... ... @@ -23,13 +23,6 @@
    23 23
         "-//Apache Struts//XWork Validator 1.0.3//EN"
    
    24 24
         "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
    
    25 25
     <validators>
    
    26
    -  <field name="vessel">
    
    27
    -    <!-- check vessel availability on trip -->
    
    28
    -    <field-validator type="tripVessel" short-circuit="true">
    
    29
    -      <param name="serviceName">servicesProvider.llCommonTripService</param>
    
    30
    -      <message/>
    
    31
    -    </field-validator>
    
    32
    -  </field>
    
    33 26
       <field name="startDate">
    
    34 27
         <!-- startDate < any activity date -->
    
    35 28
         <field-validator type="collectionFieldExpression">
    

  • services/validation/src/main/validation/fr/ird/observe/dto/data/ll/common/TripDto-update-warning-validation.xml
    1
    +<?xml version="1.0" encoding="UTF-8"?>
    
    2
    +<!--
    
    3
    +  #%L
    
    4
    +  ObServe Services :: Validation
    
    5
    +  %%
    
    6
    +  Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
    
    7
    +  %%
    
    8
    +  This program is free software: you can redistribute it and/or modify
    
    9
    +  it under the terms of the GNU General Public License as
    
    10
    +  published by the Free Software Foundation, either version 3 of the
    
    11
    +  License, or (at your option) any later version.
    
    12
    +  This program is distributed in the hope that it will be useful,
    
    13
    +  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +  GNU General Public License for more details.
    
    16
    +  You should have received a copy of the GNU General Public
    
    17
    +  License along with this program.  If not, see
    
    18
    +  <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    19
    +  #L%
    
    20
    +  -->
    
    21
    +
    
    22
    +<!DOCTYPE validators PUBLIC
    
    23
    +    "-//Apache Struts//XWork Validator 1.0.3//EN"
    
    24
    +    "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
    
    25
    +<validators>
    
    26
    +  <field name="vessel">
    
    27
    +    <!-- check vessel availability on trip -->
    
    28
    +    <field-validator type="tripVessel" short-circuit="true">
    
    29
    +      <param name="serviceName">servicesProvider.psCommonTripService</param>
    
    30
    +      <message/>
    
    31
    +    </field-validator>
    
    32
    +  </field>
    
    33
    +</validators>

  • services/validation/src/main/validation/fr/ird/observe/dto/data/ps/common/TripDto-create-error-validation.xml
    ... ... @@ -23,13 +23,6 @@
    23 23
         "-//Apache Struts//XWork Validator 1.0.3//EN"
    
    24 24
         "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
    
    25 25
     <validators>
    
    26
    -  <field name="vessel">
    
    27
    -    <!-- check vessel availability on trip -->
    
    28
    -    <field-validator type="tripVessel" short-circuit="true">
    
    29
    -      <param name="serviceName">servicesProvider.psCommonTripService</param>
    
    30
    -      <message/>
    
    31
    -    </field-validator>
    
    32
    -  </field>
    
    33 26
       <field name="formsUrl">
    
    34 27
         <!-- check url syntax except if !observationsAvailability -->
    
    35 28
         <field-validator type="url" short-circuit="true">
    

  • services/validation/src/main/validation/fr/ird/observe/dto/data/ps/common/TripDto-create-warning-validation.xml
    1
    +<?xml version="1.0" encoding="UTF-8"?>
    
    2
    +<!--
    
    3
    +  #%L
    
    4
    +  ObServe Services :: Validation
    
    5
    +  %%
    
    6
    +  Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
    
    7
    +  %%
    
    8
    +  This program is free software: you can redistribute it and/or modify
    
    9
    +  it under the terms of the GNU General Public License as
    
    10
    +  published by the Free Software Foundation, either version 3 of the
    
    11
    +  License, or (at your option) any later version.
    
    12
    +  This program is distributed in the hope that it will be useful,
    
    13
    +  but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +  GNU General Public License for more details.
    
    16
    +  You should have received a copy of the GNU General Public
    
    17
    +  License along with this program.  If not, see
    
    18
    +  <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    19
    +  #L%
    
    20
    +  -->
    
    21
    +
    
    22
    +<!DOCTYPE validators PUBLIC
    
    23
    +    "-//Apache Struts//XWork Validator 1.0.3//EN"
    
    24
    +    "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
    
    25
    +<validators>
    
    26
    +  <field name="vessel">
    
    27
    +    <!-- check vessel availability on trip -->
    
    28
    +    <field-validator type="tripVessel" short-circuit="true">
    
    29
    +      <param name="serviceName">servicesProvider.psCommonTripService</param>
    
    30
    +      <message/>
    
    31
    +    </field-validator>
    
    32
    +  </field>
    
    33
    +</validators>

  • services/validation/src/main/validation/fr/ird/observe/dto/data/ps/common/TripDto-update-error-validation.xml
    ... ... @@ -23,13 +23,6 @@
    23 23
         "-//Apache Struts//XWork Validator 1.0.3//EN"
    
    24 24
         "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
    
    25 25
     <validators>
    
    26
    -  <field name="vessel">
    
    27
    -    <!-- check vessel availability on trip -->
    
    28
    -    <field-validator type="tripVessel" short-circuit="true">
    
    29
    -      <param name="serviceName">servicesProvider.psCommonTripService</param>
    
    30
    -      <message/>
    
    31
    -    </field-validator>
    
    32
    -  </field>
    
    33 26
       <field name="startDate">
    
    34 27
         <!-- routes date check  -->
    
    35 28
         <field-validator type="collectionFieldExpression">
    

  • services/validation/src/main/validation/fr/ird/observe/dto/data/ps/common/TripDto-update-warning-validation.xml
    ... ... @@ -23,6 +23,13 @@
    23 23
         "-//Apache Struts//XWork Validator 1.0.3//EN"
    
    24 24
         "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
    
    25 25
     <validators>
    
    26
    +  <field name="vessel">
    
    27
    +    <!-- check vessel availability on trip -->
    
    28
    +    <field-validator type="tripVessel" short-circuit="true">
    
    29
    +      <param name="serviceName">servicesProvider.psCommonTripService</param>
    
    30
    +      <message/>
    
    31
    +    </field-validator>
    
    32
    +  </field>
    
    26 33
       <field name="routeObs">
    
    27 34
         <!-- check routes loch -->
    
    28 35
         <field-validator type="collectionFieldExpression">