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

Commits:

20 changed files:

Changes:

  • client-configuration/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    29
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>client-configuration</artifactId>
    

  • client/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    29
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>client</artifactId>
    

  • dto/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    30
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>dto</artifactId>
    

  • dto/src/main/java/fr/ird/observe/dto/data/longline/TripLonglineDto.java deleted
    1
    -package fr.ird.observe.dto.data.longline;
    
    2
    -
    
    3
    -/*-
    
    4
    - * #%L
    
    5
    - * ObServe :: Dto
    
    6
    - * %%
    
    7
    - * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
    
    8
    - * %%
    
    9
    - * This program is free software: you can redistribute it and/or modify
    
    10
    - * it under the terms of the GNU General Public License as
    
    11
    - * published by the Free Software Foundation, either version 3 of the
    
    12
    - * License, or (at your option) any later version.
    
    13
    - *
    
    14
    - * This program is distributed in the hope that it will be useful,
    
    15
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    - * GNU General Public License for more details.
    
    18
    - *
    
    19
    - * You should have received a copy of the GNU General Public
    
    20
    - * License along with this program.  If not, see
    
    21
    - * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    - * #L%
    
    23
    - */
    
    24
    -
    
    25
    -import com.google.common.collect.Iterables;
    
    26
    -import fr.ird.observe.dto.IdHelper;
    
    27
    -import org.apache.logging.log4j.LogManager;
    
    28
    -import org.apache.logging.log4j.Logger;
    
    29
    -
    
    30
    -public class TripLonglineDto extends GeneratedTripLonglineDto {
    
    31
    -
    
    32
    -    private static final Logger log = LogManager.getLogger(TripLonglineDto.class);
    
    33
    -    private static final long serialVersionUID = 3977866185675257699L;
    
    34
    -
    
    35
    -    public TripLonglineActivityDto getPreviousActivity(String activitySeineId) {
    
    36
    -
    
    37
    -        TripLonglineActivityDto previous = null;
    
    38
    -
    
    39
    -        if (activitySeineId != null) {
    
    40
    -
    
    41
    -            int currentPosition = Iterables.indexOf(getActivityLongline(), IdHelper.newIdPredicate(activitySeineId)::test);
    
    42
    -            if (currentPosition >= 1) {
    
    43
    -                previous = Iterables.get(getActivityLongline(), currentPosition - 1);
    
    44
    -            }
    
    45
    -        }
    
    46
    -
    
    47
    -        if (previous != null) {
    
    48
    -            log.debug("previous activity " + previous.getTimeStamp());
    
    49
    -
    
    50
    -        } else {
    
    51
    -            log.debug("no previous activity for " + activityLongline);
    
    52
    -        }
    
    53
    -
    
    54
    -        return previous;
    
    55
    -    }
    
    56
    -}

  • dto/src/main/models/Observe.model
    ... ... @@ -348,7 +348,6 @@ activityLongline + {*} data.longline.TripLonglineActivity | ordered unique
    348 348
     
    
    349 349
     data.longline.TripLonglineActivity > data.Data
    
    350 350
     timeStamp + {*:1} Date
    
    351
    -seaSurfaceTemperature + {*:1} Float
    
    352 351
     
    
    353 352
     data.longline.TripLonglineGearUse > data.Data | form=data.longline.GearUseFeaturesLongline
    
    354 353
     gearUseFeaturesLongline + {*} data.longline.GearUseFeaturesLongline | ordered
    

  • observe/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    29
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>observe</artifactId>
    

  • persistence/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    29
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>persistence</artifactId>
    

  • persistence/src/main/java/fr/ird/observe/binder/data/longline/TripLonglineActivityEntityDtoBinder.java
    ... ... @@ -53,6 +53,5 @@ public class TripLonglineActivityEntityDtoBinder extends DataEntityDtoBinderSupp
    53 53
             copyEntityDataFieldsToDto(entity, dto);
    
    54 54
     
    
    55 55
             dto.setTimeStamp(entity.getTimeStamp());
    
    56
    -        dto.setSeaSurfaceTemperature(entity.getSeaSurfaceTemperature());
    
    57 56
         }
    
    58 57
     }

  • pom.xml
    ... ... @@ -31,7 +31,7 @@
    31 31
     
    
    32 32
       <groupId>fr.ird.observe</groupId>
    
    33 33
       <artifactId>ird-observe</artifactId>
    
    34
    -  <version>7.0-RC-23-SNAPSHOT</version>
    
    34
    +  <version>7.0-RC-22-SNAPSHOT</version>
    
    35 35
       <packaging>pom</packaging>
    
    36 36
     
    
    37 37
       <name>ObServe :: Pom</name>
    

  • server-configuration/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    29
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>server-configuration</artifactId>
    

  • server/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    30
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>server</artifactId>
    

  • services-client/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    30
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>services-client</artifactId>
    

  • services-local/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    30
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>services-local</artifactId>
    

  • services/pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>fr.ird.observe</groupId>
    
    29 29
         <artifactId>ird-observe</artifactId>
    
    30
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    30
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <artifactId>services</artifactId>
    

  • services/src/main/java/fr/ird/observe/services/validation/validators/TemperatureCompareFieldValidator.java deleted
    1
    -package fr.ird.observe.services.validation.validators;
    
    2
    -
    
    3
    -/*-
    
    4
    - * #%L
    
    5
    - * ObServe :: Services API
    
    6
    - * %%
    
    7
    - * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io
    
    8
    - * %%
    
    9
    - * This program is free software: you can redistribute it and/or modify
    
    10
    - * it under the terms of the GNU General Public License as
    
    11
    - * published by the Free Software Foundation, either version 3 of the
    
    12
    - * License, or (at your option) any later version.
    
    13
    - *
    
    14
    - * This program is distributed in the hope that it will be useful,
    
    15
    - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    - * GNU General Public License for more details.
    
    18
    - *
    
    19
    - * You should have received a copy of the GNU General Public
    
    20
    - * License along with this program.  If not, see
    
    21
    - * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    - * #L%
    
    23
    - */
    
    24
    -
    
    25
    -import com.opensymphony.xwork2.validator.ValidationException;
    
    26
    -import com.opensymphony.xwork2.validator.validators.FieldValidatorSupport;
    
    27
    -import io.ultreia.java4all.lang.Numbers;
    
    28
    -import org.nuiton.jaxx.widgets.temperature.I18nEnumHelper;
    
    29
    -import org.nuiton.jaxx.widgets.temperature.TemperatureEditorModel;
    
    30
    -import org.nuiton.jaxx.widgets.temperature.TemperatureFormat;
    
    31
    -
    
    32
    -import java.util.Map;
    
    33
    -
    
    34
    -/**
    
    35
    - * To validate that the temperature is in correct bound.
    
    36
    - * <p>
    
    37
    - * Created by tchemit on 22/09/2018.
    
    38
    - *
    
    39
    - * @author Tony Chemit - dev@tchemit.fr
    
    40
    - */
    
    41
    -public class TemperatureCompareFieldValidator extends FieldValidatorSupport {
    
    42
    -
    
    43
    -    /**
    
    44
    -     * Name of the field to compare against.
    
    45
    -     */
    
    46
    -    private String compareFieldName;
    
    47
    -
    
    48
    -    /**
    
    49
    -     * Default temperature format (bottom are based on this format).
    
    50
    -     */
    
    51
    -    private TemperatureFormat defaultTemperatureFormat;
    
    52
    -    /**
    
    53
    -     * Compare temperature format (compare temperature is base on this format).
    
    54
    -     */
    
    55
    -    private TemperatureFormat compareTemperatureFormat;
    
    56
    -    /**
    
    57
    -     * Delta authorized.
    
    58
    -     */
    
    59
    -    private Float delta;
    
    60
    -
    
    61
    -    /**
    
    62
    -     * Min temperature.
    
    63
    -     */
    
    64
    -    private Float min;
    
    65
    -    /**
    
    66
    -     * Max temperature.
    
    67
    -     */
    
    68
    -    private Float max;
    
    69
    -
    
    70
    -    public void setDefaultTemperatureFormat(String defaultTemperatureFormat) {
    
    71
    -        this.defaultTemperatureFormat = TemperatureFormat.valueOf(defaultTemperatureFormat);
    
    72
    -    }
    
    73
    -
    
    74
    -    public void setCompareTemperatureFormat(String compareTemperatureFormat) {
    
    75
    -        this.compareTemperatureFormat = TemperatureFormat.valueOf(compareTemperatureFormat);
    
    76
    -    }
    
    77
    -
    
    78
    -    public void setMin(String min) {
    
    79
    -        this.min = Float.valueOf(min);
    
    80
    -    }
    
    81
    -
    
    82
    -    public void setMax(String max) {
    
    83
    -        this.max = Float.valueOf(max);
    
    84
    -    }
    
    85
    -
    
    86
    -    public void setDelta(String delta) {
    
    87
    -        this.delta = Float.valueOf(delta);
    
    88
    -    }
    
    89
    -
    
    90
    -    public void setCompareFieldName(String compareFieldName) {
    
    91
    -        this.compareFieldName = compareFieldName;
    
    92
    -    }
    
    93
    -
    
    94
    -    @Override
    
    95
    -    public void validate(Object object) throws ValidationException {
    
    96
    -        if (min == null) {
    
    97
    -            throw new ValidationException("No parameter 'min' filled");
    
    98
    -        }
    
    99
    -        if (max == null) {
    
    100
    -            throw new ValidationException("No parameter 'max' filled");
    
    101
    -        }
    
    102
    -        if (min >= max) {
    
    103
    -            throw new ValidationException(String.format("No parameter 'min' (%s) is greater than 'max' (%s)", min, max));
    
    104
    -        }
    
    105
    -        String fieldName = getFieldName();
    
    106
    -        if (fieldName == null) {
    
    107
    -            throw new ValidationException("No parameter 'fieldName' filled");
    
    108
    -        }
    
    109
    -        if (compareFieldName == null) {
    
    110
    -            throw new ValidationException("No parameter 'compareFieldName' filled");
    
    111
    -        }
    
    112
    -        if (delta == null) {
    
    113
    -            throw new ValidationException("No parameter 'bottom' filled");
    
    114
    -        }
    
    115
    -        Float temperature = (Float) getFieldValue(fieldName, object);
    
    116
    -        if (temperature == null) {
    
    117
    -            return;
    
    118
    -        }
    
    119
    -        Float againstTemperature = (Float) getFieldValue(compareFieldName, object);
    
    120
    -        if (againstTemperature == null) {
    
    121
    -            return;
    
    122
    -        }
    
    123
    -        @SuppressWarnings("unchecked") Map<String, TemperatureEditorModel> map = (Map<String, TemperatureEditorModel>) getFieldValue("temperatureEditorModels", object);
    
    124
    -        TemperatureFormat temperatureFormat = defaultTemperatureFormat;
    
    125
    -        if (map != null) {
    
    126
    -
    
    127
    -            TemperatureEditorModel temperatureEditorModel = map.get(fieldName);
    
    128
    -            //FIXME une validation est lancé dans l'ui alors que l'on ne devrait pas et on a pas ce composant alors
    
    129
    -            if (temperatureEditorModel != null) {
    
    130
    -                temperatureFormat = temperatureEditorModel.getFormat();
    
    131
    -            }
    
    132
    -        }
    
    133
    -
    
    134
    -        float bottom = againstTemperature - delta;
    
    135
    -        if (bottom < min) {
    
    136
    -            bottom = min;
    
    137
    -        }
    
    138
    -        float top = againstTemperature + delta;
    
    139
    -        if (top > max) {
    
    140
    -            top = max;
    
    141
    -        }
    
    142
    -        if (temperature < bottom || temperature > top) {
    
    143
    -            if (!temperatureFormat.equals(defaultTemperatureFormat)) {
    
    144
    -                bottom = Numbers.roundOneDigit(defaultTemperatureFormat.convert(bottom, temperatureFormat));
    
    145
    -                top = Numbers.roundOneDigit(defaultTemperatureFormat.convert(top, temperatureFormat));
    
    146
    -            }
    
    147
    -            if (!temperatureFormat.equals(compareTemperatureFormat)) {
    
    148
    -                againstTemperature = compareTemperatureFormat.convert(againstTemperature, temperatureFormat);
    
    149
    -            }
    
    150
    -            stack.set(fieldName + "Compare", new TemperatureResult(bottom, top, againstTemperature, I18nEnumHelper.getLabel(temperatureFormat)));
    
    151
    -            try {
    
    152
    -                addFieldError(fieldName, object);
    
    153
    -            } finally {
    
    154
    -                stack.pop();
    
    155
    -            }
    
    156
    -        }
    
    157
    -
    
    158
    -    }
    
    159
    -
    
    160
    -    @Override
    
    161
    -    public String getValidatorType() {
    
    162
    -        return "temperatureCompare";
    
    163
    -    }
    
    164
    -
    
    165
    -    static class TemperatureResult {
    
    166
    -        private final float bottom;
    
    167
    -        private final float top;
    
    168
    -        private final Float againstTemperature;
    
    169
    -        private final String format;
    
    170
    -
    
    171
    -        TemperatureResult(float bottom, float top, Float againstTemperature, String format) {
    
    172
    -            this.bottom = bottom;
    
    173
    -            this.top = top;
    
    174
    -            this.againstTemperature = againstTemperature;
    
    175
    -            this.format = format;
    
    176
    -        }
    
    177
    -
    
    178
    -        public Float getAgainstTemperature() {
    
    179
    -            return againstTemperature;
    
    180
    -        }
    
    181
    -
    
    182
    -        public float getBottom() {
    
    183
    -            return bottom;
    
    184
    -        }
    
    185
    -
    
    186
    -        public float getTop() {
    
    187
    -            return top;
    
    188
    -        }
    
    189
    -
    
    190
    -        public String getFormat() {
    
    191
    -            return format;
    
    192
    -        }
    
    193
    -    }
    
    194
    -
    
    195
    -}
    
    196
    -

  • test/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    29
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>test</artifactId>
    

  • validation/pom.xml
    ... ... @@ -26,7 +26,7 @@
    26 26
       <parent>
    
    27 27
         <groupId>fr.ird.observe</groupId>
    
    28 28
         <artifactId>ird-observe</artifactId>
    
    29
    -    <version>7.0-RC-23-SNAPSHOT</version>
    
    29
    +    <version>7.0-RC-22-SNAPSHOT</version>
    
    30 30
       </parent>
    
    31 31
     
    
    32 32
       <artifactId>validation</artifactId>
    

  • validation/src/main/resources/fr/ird/observe/dto/data/longline/ActivityLonglineDto-update-error-validation.xml
    ... ... @@ -70,18 +70,6 @@
    70 70
             observe.validation.activity.bound.seaSurfaceTemperature##${seaSurfaceTemperatureBound.min}##${seaSurfaceTemperatureBound.max}##${seaSurfaceTemperatureBound.format}
    
    71 71
           </message>
    
    72 72
         </field-validator>
    
    73
    -    <!-- coherence temperature surface (delta de 12° par rapport a celle de l'activity precedente) -->
    
    74
    -    <field-validator type="temperatureCompare" short-circuit="true">
    
    75
    -      <param name="min">12.0</param>
    
    76
    -      <param name="max">35.0</param>
    
    77
    -      <param name="delta">12.0</param>
    
    78
    -      <param name="defaultTemperatureFormat">C</param>
    
    79
    -      <param name="compareTemperatureFormat">C</param>
    
    80
    -      <param name="compareFieldName">currentTrip.getPreviousActivity(id).seaSurfaceTemperature</param>
    
    81
    -      <message>
    
    82
    -        observe.validation.activity.invalid.seaSurfaceTemperature##${currentTrip.getPreviousActivity(id).timeStamp}##${seaSurfaceTemperatureCompare.againstTemperature}##${seaSurfaceTemperatureCompare.bottom}##${seaSurfaceTemperatureCompare.top}##${seaSurfaceTemperatureCompare.format}
    
    83
    -      </message>
    
    84
    -    </field-validator>
    
    85 73
     
    
    86 74
       </field>
    
    87 75
     
    

  • validation/src/main/resources/fr/ird/observe/dto/data/seine/ActivitySeineDto-update-error-validation.xml
    ... ... @@ -188,18 +188,6 @@
    188 188
             observe.validation.activity.bound.seaSurfaceTemperature##${seaSurfaceTemperatureBound.min}##${seaSurfaceTemperatureBound.max}##${seaSurfaceTemperatureBound.format}
    
    189 189
           </message>
    
    190 190
         </field-validator>
    
    191
    -    <!-- coherence temperature surface (delta de 12° par rapport a celle de l'activity precedente) -->
    
    192
    -    <field-validator type="temperatureCompare" short-circuit="true">
    
    193
    -      <param name="min">12.0</param>
    
    194
    -      <param name="max">35.0</param>
    
    195
    -      <param name="delta">12.0</param>
    
    196
    -      <param name="defaultTemperatureFormat">C</param>
    
    197
    -      <param name="compareTemperatureFormat">C</param>
    
    198
    -      <param name="compareFieldName">currentRoute.getPreviousActivity(id).seaSurfaceTemperature</param>
    
    199
    -      <message>
    
    200
    -        observe.validation.activity.invalid.seaSurfaceTemperature##${currentRoute.getPreviousActivity(id).time}##${seaSurfaceTemperatureCompare.againstTemperature}##${seaSurfaceTemperatureCompare.bottom}##${seaSurfaceTemperatureCompare.top}##${seaSurfaceTemperatureCompare.format}
    
    201
    -      </message>
    
    202
    -    </field-validator>
    
    203 191
     
    
    204 192
       </field>
    
    205 193
     
    

  • validation/src/main/resources/validators.xml
    ... ... @@ -70,6 +70,5 @@
    70 70
         <validator name="nonTargetCatchObservedSystem" class="fr.ird.observe.services.validation.validators.NonTargetCatchObservedSystemValidator"/>
    
    71 71
         <validator name="activitySeine_observedSystem" class="fr.ird.observe.services.validation.validators.ActivitySeineObservedSystemValidator"/>
    
    72 72
         <validator name="temperatureBound" class="fr.ird.observe.services.validation.validators.TemperatureBoundFieldValidator"/>
    
    73
    -    <validator name="temperatureCompare" class="fr.ird.observe.services.validation.validators.TemperatureCompareFieldValidator"/>
    
    74 73
     
    
    75 74
     </validators>