[Git][ultreiaio/ird-observe][develop-7.x] 2 commits: Revert "[jgitflow-maven-plugin]updating poms for 7.0-RC-23-SNAPSHOT development[skip ci]"
Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe Commits: 330cd263 by Tony CHEMIT at 2018-09-23T11:00:05Z Revert "[jgitflow-maven-plugin]updating poms for 7.0-RC-23-SNAPSHOT development[skip ci]" This reverts commit 6a01a724cd1b921bd952795c25d83e0dbe5e0c02. - - - - - dedbdd76 by Tony CHEMIT at 2018-09-23T11:12:55Z Un contrôle insoupçonné vérifie les températures entre activités - Closes #1080 - - - - - 20 changed files: - client-configuration/pom.xml - client/pom.xml - dto/pom.xml - − dto/src/main/java/fr/ird/observe/dto/data/longline/TripLonglineDto.java - dto/src/main/models/Observe.model - observe/pom.xml - persistence/pom.xml - persistence/src/main/java/fr/ird/observe/binder/data/longline/TripLonglineActivityEntityDtoBinder.java - pom.xml - server-configuration/pom.xml - server/pom.xml - services-client/pom.xml - services-local/pom.xml - services/pom.xml - − services/src/main/java/fr/ird/observe/services/validation/validators/TemperatureCompareFieldValidator.java - test/pom.xml - validation/pom.xml - validation/src/main/resources/fr/ird/observe/dto/data/longline/ActivityLonglineDto-update-error-validation.xml - validation/src/main/resources/fr/ird/observe/dto/data/seine/ActivitySeineDto-update-error-validation.xml - validation/src/main/resources/validators.xml Changes: ===================================== client-configuration/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>client-configuration</artifactId> ===================================== client/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>client</artifactId> ===================================== dto/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>dto</artifactId> ===================================== dto/src/main/java/fr/ird/observe/dto/data/longline/TripLonglineDto.java deleted ===================================== @@ -1,56 +0,0 @@ -package fr.ird.observe.dto.data.longline; - -/*- - * #%L - * ObServe :: Dto - * %% - * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.collect.Iterables; -import fr.ird.observe.dto.IdHelper; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class TripLonglineDto extends GeneratedTripLonglineDto { - - private static final Logger log = LogManager.getLogger(TripLonglineDto.class); - private static final long serialVersionUID = 3977866185675257699L; - - public TripLonglineActivityDto getPreviousActivity(String activitySeineId) { - - TripLonglineActivityDto previous = null; - - if (activitySeineId != null) { - - int currentPosition = Iterables.indexOf(getActivityLongline(), IdHelper.newIdPredicate(activitySeineId)::test); - if (currentPosition >= 1) { - previous = Iterables.get(getActivityLongline(), currentPosition - 1); - } - } - - if (previous != null) { - log.debug("previous activity " + previous.getTimeStamp()); - - } else { - log.debug("no previous activity for " + activityLongline); - } - - return previous; - } -} ===================================== dto/src/main/models/Observe.model ===================================== @@ -348,7 +348,6 @@ activityLongline + {*} data.longline.TripLonglineActivity | ordered unique data.longline.TripLonglineActivity > data.Data timeStamp + {*:1} Date -seaSurfaceTemperature + {*:1} Float data.longline.TripLonglineGearUse > data.Data | form=data.longline.GearUseFeaturesLongline gearUseFeaturesLongline + {*} data.longline.GearUseFeaturesLongline | ordered ===================================== observe/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>observe</artifactId> ===================================== persistence/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>persistence</artifactId> ===================================== persistence/src/main/java/fr/ird/observe/binder/data/longline/TripLonglineActivityEntityDtoBinder.java ===================================== @@ -53,6 +53,5 @@ public class TripLonglineActivityEntityDtoBinder extends DataEntityDtoBinderSupp copyEntityDataFieldsToDto(entity, dto); dto.setTimeStamp(entity.getTimeStamp()); - dto.setSeaSurfaceTemperature(entity.getSeaSurfaceTemperature()); } } ===================================== pom.xml ===================================== @@ -31,7 +31,7 @@ <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> <packaging>pom</packaging> <name>ObServe :: Pom</name> ===================================== server-configuration/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>server-configuration</artifactId> ===================================== server/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>server</artifactId> ===================================== services-client/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>services-client</artifactId> ===================================== services-local/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>services-local</artifactId> ===================================== services/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>services</artifactId> ===================================== services/src/main/java/fr/ird/observe/services/validation/validators/TemperatureCompareFieldValidator.java deleted ===================================== @@ -1,196 +0,0 @@ -package fr.ird.observe.services.validation.validators; - -/*- - * #%L - * ObServe :: Services API - * %% - * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.opensymphony.xwork2.validator.ValidationException; -import com.opensymphony.xwork2.validator.validators.FieldValidatorSupport; -import io.ultreia.java4all.lang.Numbers; -import org.nuiton.jaxx.widgets.temperature.I18nEnumHelper; -import org.nuiton.jaxx.widgets.temperature.TemperatureEditorModel; -import org.nuiton.jaxx.widgets.temperature.TemperatureFormat; - -import java.util.Map; - -/** - * To validate that the temperature is in correct bound. - * <p> - * Created by tchemit on 22/09/2018. - * - * @author Tony Chemit - dev@tchemit.fr - */ -public class TemperatureCompareFieldValidator extends FieldValidatorSupport { - - /** - * Name of the field to compare against. - */ - private String compareFieldName; - - /** - * Default temperature format (bottom are based on this format). - */ - private TemperatureFormat defaultTemperatureFormat; - /** - * Compare temperature format (compare temperature is base on this format). - */ - private TemperatureFormat compareTemperatureFormat; - /** - * Delta authorized. - */ - private Float delta; - - /** - * Min temperature. - */ - private Float min; - /** - * Max temperature. - */ - private Float max; - - public void setDefaultTemperatureFormat(String defaultTemperatureFormat) { - this.defaultTemperatureFormat = TemperatureFormat.valueOf(defaultTemperatureFormat); - } - - public void setCompareTemperatureFormat(String compareTemperatureFormat) { - this.compareTemperatureFormat = TemperatureFormat.valueOf(compareTemperatureFormat); - } - - public void setMin(String min) { - this.min = Float.valueOf(min); - } - - public void setMax(String max) { - this.max = Float.valueOf(max); - } - - public void setDelta(String delta) { - this.delta = Float.valueOf(delta); - } - - public void setCompareFieldName(String compareFieldName) { - this.compareFieldName = compareFieldName; - } - - @Override - public void validate(Object object) throws ValidationException { - if (min == null) { - throw new ValidationException("No parameter 'min' filled"); - } - if (max == null) { - throw new ValidationException("No parameter 'max' filled"); - } - if (min >= max) { - throw new ValidationException(String.format("No parameter 'min' (%s) is greater than 'max' (%s)", min, max)); - } - String fieldName = getFieldName(); - if (fieldName == null) { - throw new ValidationException("No parameter 'fieldName' filled"); - } - if (compareFieldName == null) { - throw new ValidationException("No parameter 'compareFieldName' filled"); - } - if (delta == null) { - throw new ValidationException("No parameter 'bottom' filled"); - } - Float temperature = (Float) getFieldValue(fieldName, object); - if (temperature == null) { - return; - } - Float againstTemperature = (Float) getFieldValue(compareFieldName, object); - if (againstTemperature == null) { - return; - } - @SuppressWarnings("unchecked") Map<String, TemperatureEditorModel> map = (Map<String, TemperatureEditorModel>) getFieldValue("temperatureEditorModels", object); - TemperatureFormat temperatureFormat = defaultTemperatureFormat; - if (map != null) { - - TemperatureEditorModel temperatureEditorModel = map.get(fieldName); - //FIXME une validation est lancé dans l'ui alors que l'on ne devrait pas et on a pas ce composant alors - if (temperatureEditorModel != null) { - temperatureFormat = temperatureEditorModel.getFormat(); - } - } - - float bottom = againstTemperature - delta; - if (bottom < min) { - bottom = min; - } - float top = againstTemperature + delta; - if (top > max) { - top = max; - } - if (temperature < bottom || temperature > top) { - if (!temperatureFormat.equals(defaultTemperatureFormat)) { - bottom = Numbers.roundOneDigit(defaultTemperatureFormat.convert(bottom, temperatureFormat)); - top = Numbers.roundOneDigit(defaultTemperatureFormat.convert(top, temperatureFormat)); - } - if (!temperatureFormat.equals(compareTemperatureFormat)) { - againstTemperature = compareTemperatureFormat.convert(againstTemperature, temperatureFormat); - } - stack.set(fieldName + "Compare", new TemperatureResult(bottom, top, againstTemperature, I18nEnumHelper.getLabel(temperatureFormat))); - try { - addFieldError(fieldName, object); - } finally { - stack.pop(); - } - } - - } - - @Override - public String getValidatorType() { - return "temperatureCompare"; - } - - static class TemperatureResult { - private final float bottom; - private final float top; - private final Float againstTemperature; - private final String format; - - TemperatureResult(float bottom, float top, Float againstTemperature, String format) { - this.bottom = bottom; - this.top = top; - this.againstTemperature = againstTemperature; - this.format = format; - } - - public Float getAgainstTemperature() { - return againstTemperature; - } - - public float getBottom() { - return bottom; - } - - public float getTop() { - return top; - } - - public String getFormat() { - return format; - } - } - -} - ===================================== test/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>test</artifactId> ===================================== validation/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0-RC-23-SNAPSHOT</version> + <version>7.0-RC-22-SNAPSHOT</version> </parent> <artifactId>validation</artifactId> ===================================== validation/src/main/resources/fr/ird/observe/dto/data/longline/ActivityLonglineDto-update-error-validation.xml ===================================== @@ -70,18 +70,6 @@ observe.validation.activity.bound.seaSurfaceTemperature##${seaSurfaceTemperatureBound.min}##${seaSurfaceTemperatureBound.max}##${seaSurfaceTemperatureBound.format} </message> </field-validator> - <!-- coherence temperature surface (delta de 12° par rapport a celle de l'activity precedente) --> - <field-validator type="temperatureCompare" short-circuit="true"> - <param name="min">12.0</param> - <param name="max">35.0</param> - <param name="delta">12.0</param> - <param name="defaultTemperatureFormat">C</param> - <param name="compareTemperatureFormat">C</param> - <param name="compareFieldName">currentTrip.getPreviousActivity(id).seaSurfaceTemperature</param> - <message> - observe.validation.activity.invalid.seaSurfaceTemperature##${currentTrip.getPreviousActivity(id).timeStamp}##${seaSurfaceTemperatureCompare.againstTemperature}##${seaSurfaceTemperatureCompare.bottom}##${seaSurfaceTemperatureCompare.top}##${seaSurfaceTemperatureCompare.format} - </message> - </field-validator> </field> ===================================== validation/src/main/resources/fr/ird/observe/dto/data/seine/ActivitySeineDto-update-error-validation.xml ===================================== @@ -188,18 +188,6 @@ observe.validation.activity.bound.seaSurfaceTemperature##${seaSurfaceTemperatureBound.min}##${seaSurfaceTemperatureBound.max}##${seaSurfaceTemperatureBound.format} </message> </field-validator> - <!-- coherence temperature surface (delta de 12° par rapport a celle de l'activity precedente) --> - <field-validator type="temperatureCompare" short-circuit="true"> - <param name="min">12.0</param> - <param name="max">35.0</param> - <param name="delta">12.0</param> - <param name="defaultTemperatureFormat">C</param> - <param name="compareTemperatureFormat">C</param> - <param name="compareFieldName">currentRoute.getPreviousActivity(id).seaSurfaceTemperature</param> - <message> - observe.validation.activity.invalid.seaSurfaceTemperature##${currentRoute.getPreviousActivity(id).time}##${seaSurfaceTemperatureCompare.againstTemperature}##${seaSurfaceTemperatureCompare.bottom}##${seaSurfaceTemperatureCompare.top}##${seaSurfaceTemperatureCompare.format} - </message> - </field-validator> </field> ===================================== validation/src/main/resources/validators.xml ===================================== @@ -70,6 +70,5 @@ <validator name="nonTargetCatchObservedSystem" class="fr.ird.observe.services.validation.validators.NonTargetCatchObservedSystemValidator"/> <validator name="activitySeine_observedSystem" class="fr.ird.observe.services.validation.validators.ActivitySeineObservedSystemValidator"/> <validator name="temperatureBound" class="fr.ird.observe.services.validation.validators.TemperatureBoundFieldValidator"/> - <validator name="temperatureCompare" class="fr.ird.observe.services.validation.validators.TemperatureCompareFieldValidator"/> </validators> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/1703fb1fc75e38d99cde60635d8... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/1703fb1fc75e38d99cde60635d8... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT