branch feature/7606 updated (0b5772b -> ba8f66e)
This is an automated email from the git hooks/post-receive script. New change to branch feature/7606 in repository observe. See http://git.codelutin.com/observe.git from 0b5772b migration des écrans d'échantillons de captures cibles (refs #7606, 7607) new ba8f66e ajout des validateur (refs #7606, 7607) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit ba8f66edff5c25643dd48793dcc29b63977a7f6e Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Oct 21 09:48:32 2015 +0200 ajout des validateur (refs #7606, 7607) Summary of changes: .../dto/AbstractEspeceFieldDtoValidator.java | 29 ++++++++++++---------- .../TargetLengthDto-n1-update-error-validation.xml | 0 ...argetLengthDto-n1-update-warning-validation.xml | 4 +-- .../TargetSampleDto-n1-update-error-validation.xml | 0 4 files changed, 18 insertions(+), 15 deletions(-) copy observe-entities-validation/src/main/resources/fr/ird/observe/entities/seine/TargetLength-n1-update-error-validation.xml => observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetLengthDto-n1-update-error-validation.xml (100%) copy observe-entities-validation/src/main/resources/fr/ird/observe/entities/seine/TargetLength-n1-update-warning-validation.xml => observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetLengthDto-n1-update-warning-validation.xml (94%) copy observe-entities-validation/src/main/resources/fr/ird/observe/entities/seine/TargetSample-n1-update-error-validation.xml => observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetSampleDto-n1-update-error-validation.xml (100%) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/7606 in repository observe. See http://git.codelutin.com/observe.git commit ba8f66edff5c25643dd48793dcc29b63977a7f6e Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Oct 21 09:48:32 2015 +0200 ajout des validateur (refs #7606, 7607) --- .../dto/AbstractEspeceFieldDtoValidator.java | 29 +++--- .../TargetLengthDto-n1-update-error-validation.xml | 105 +++++++++++++++++++++ ...argetLengthDto-n1-update-warning-validation.xml | 56 +++++++++++ .../TargetSampleDto-n1-update-error-validation.xml | 49 ++++++++++ 4 files changed, 226 insertions(+), 13 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/validation/validator/dto/AbstractEspeceFieldDtoValidator.java b/observe-application-swing/src/main/java/fr/ird/observe/validation/validator/dto/AbstractEspeceFieldDtoValidator.java index fd4eaaa..542966b 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/validation/validator/dto/AbstractEspeceFieldDtoValidator.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/validation/validator/dto/AbstractEspeceFieldDtoValidator.java @@ -25,6 +25,7 @@ package fr.ird.observe.validation.validator.dto; import com.opensymphony.xwork2.util.ValueStack; import com.opensymphony.xwork2.validator.ValidationException; import com.opensymphony.xwork2.validator.validators.FieldValidatorSupport; +import fr.ird.observe.services.dto.ReferenceDto; import fr.ird.observe.services.dto.referential.SpeciesDto; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; @@ -117,7 +118,7 @@ public abstract class AbstractEspeceFieldDtoValidator extends FieldValidatorSupp */ protected String expression; - protected String speciesField = "espece"; + protected String speciesField = "species"; public ValueStack getValueStack() { return valueStack; @@ -217,7 +218,7 @@ public abstract class AbstractEspeceFieldDtoValidator extends FieldValidatorSupp } // l'species associée - SpeciesDto species = (SpeciesDto) getFieldValue(speciesFieldName, object); + ReferenceDto<SpeciesDto> species = (ReferenceDto<SpeciesDto>) getFieldValue(speciesFieldName, object); if (species == null) { @@ -263,17 +264,19 @@ public abstract class AbstractEspeceFieldDtoValidator extends FieldValidatorSupp } } - protected Bound getBound(SpeciesDto referentiel) { - - Float min = getBoundMin(referentiel); - Float max = getBoundMax(referentiel); - - if (min == null || min == 0 || max == null || max == 0) { - // l'une des deux borne n'est pas définie, on ne peut pas utiliser - // la données - return null; - } - return new Bound(min, max); + protected Bound getBound(ReferenceDto<SpeciesDto> referentiel) { + + // FIXME il faut mettre en place un cache dans la valueStack de la validation pour recupéré les SpeciesDto +// Float min = getBoundMin(referentiel); +// Float max = getBoundMax(referentiel); +// +// if (min == null || min == 0 || max == null || max == 0) { +// // l'une des deux borne n'est pas définie, on ne peut pas utiliser +// // la données +// return null; +// } +// return new Bound(min, max); + return null; } protected boolean validateBound(Float value, diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetLengthDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetLengthDto-n1-update-error-validation.xml new file mode 100644 index 0000000..3527760 --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetLengthDto-n1-update-error-validation.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit + %% + 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% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="species"> + + <!-- pas de species selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.targetLength.required.species</message> + </field-validator> + + <!-- species desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ species.enabled ]]> + </param> + <message>validator.targetLength.desactivated.species</message> + </field-validator> + + </field> + + <field name="length"> + + <!-- taille obligatoire en mode par count --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ acquisitionMode == 1 || length != null ]]> + </param> + <message>validator.targetLength.required.taille</message> + </field-validator> + + <!-- au moins un des 2 valeurs taille / weight doit etre renseignee (en mode par individu) --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ acquisitionMode == 0 || length != null || weight != null ]]> + </param> + <message>validator.targetLength.required.weight.or.taille</message> + </field-validator> + + <!-- length non renseigné ou > 0 --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ length == null || length > 0 ]]> + </param> + <message>validator.targetLength.positive.length</message> + </field-validator> + + </field> + + + <field name="weight"> + + <!-- au moins un des 2 valeurs taille / weight doit etre renseignee (en mode par individu) --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ acquisitionMode == 0 || length != null || weight != null ]]> + </param> + <message>validator.targetLength.required.weight.or.taille</message> + </field-validator> + + <!-- weight non renseigné ou > 0 --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ weight == null || weight > 0 ]]> + </param> + <message>validator.targetLength.positive.weight</message> + </field-validator> + + </field> + + + <field name="count"> + + <!-- pas d'count selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.targetLength.required.count</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetLengthDto-n1-update-warning-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetLengthDto-n1-update-warning-validation.xml new file mode 100644 index 0000000..c7d7270 --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetLengthDto-n1-update-warning-validation.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit + %% + 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% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="length"> + + <!-- validation de la taille par borne --> + <field-validator type="species_lengthDto"> + <param name="ratio">1.0</param> + <param name="expression"> + <![CDATA[ acquisitionMode == 0 || modeSaisie == 1 ]]> + </param> + <message>validator.targetLength.bound.length##${min}##${max}</message> + </field-validator> + + </field> + + + <field name="weight"> + + <!-- validation du weight par borne (uniquement pour mode saisie par individus) --> + <field-validator type="species_weightDto"> + <param name="ratio">1.0</param> + <param name="expression"> + <![CDATA[ acquisitionMode == 1 ]]> + </param> + <message>validator.targetLength.bound.weight##${min}##${max}</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetSampleDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetSampleDto-n1-update-error-validation.xml new file mode 100644 index 0000000..edf831f --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetSampleDto-n1-update-error-validation.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit + %% + 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% + --> + +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="comment"> + + <!-- comentaire de moins de 1024 caractères --> + <field-validator type="stringlength"> + <param name="maxLength">1024</param> + <message>validator.targetSample.comment.tobig</message> + </field-validator> + + <!-- comment requis selon l'species indiquee --> + + <field-validator type="collectionFieldExpression"> + <param name="collectionFieldName">targetLength</param> + <param name="mode">ALL</param> + <param name="useSensitiveContext">true</param> + <param name="expression"> + <![CDATA[ (comment != null && !comment.empty) || current.species == null || !current.species.needComment ]]></param> + <message>validator.targetSample.required.comment.for.species##${index}</message> + </field-validator> + + </field> +</validators> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
participants (1)
-
codelutin.com scm