This is an automated email from the git hooks/post-receive script. New commit to branch feature/7605 in repository observe. See http://git.codelutin.com/observe.git commit 40f8542ce3c6113f14ab14c2b4818e17bdabeae8 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Oct 20 15:53:09 2015 +0200 mise en place de la validation (refs #7605) --- .../ui/content/table/impl/seine/TargetCatchUI.jaxx | 2 +- ...Dto-n1-update-targetCatch-error-validation.xml} | 0 ...n1-update-targetDiscarded-error-validation.xml} | 6 +- ...-n1-update-targetDiscarded-error-validation.xml | 98 ++++++++++++++++++++++ ...-update-targetDiscarded-warning-validation.xml} | 24 +++--- 5 files changed, 116 insertions(+), 14 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx index 881e02d..193fb48 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/TargetCatchUI.jaxx @@ -65,7 +65,7 @@ <BeanValidator id='validator' beanClass='fr.ird.observe.services.dto.seine.SetSeineTargetCatchDto' errorTableModel='{getErrorTableModel()}' - context='n1-update'> + context='n1-update-targetCatch'> <!-- clef unique --> <field name="targetCatch" component="editorPanel"/> </BeanValidator> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-targetCatch-error-validation.xml similarity index 100% copy from observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml copy to observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-targetCatch-error-validation.xml diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-targetDiscarded-error-validation.xml similarity index 84% copy from observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml copy to observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-targetDiscarded-error-validation.xml index f6d972a..551d94a 100644 --- a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-targetDiscarded-error-validation.xml @@ -28,12 +28,12 @@ <field name="targetCatch"> - <!-- clef unique sur la categorie weight et well --> + <!-- clef unique sur la categorie weight et la raison rejet --> <field-validator type="collectionFieldExpression"> <param name="mode">UNIQUE_KEY</param> - <param name="keys">weightCategory.id,well</param> - <message>validator.targetCatch.uniqueKey</message> + <param name="keys">weightCategory.id,reasonForDiscard.id</param> + <message>validator.targetDiscarded.uniqueKey</message> </field-validator> </field> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetDiscarded-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetDiscarded-error-validation.xml new file mode 100644 index 0000000..d01264e --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetDiscarded-error-validation.xml @@ -0,0 +1,98 @@ +<?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.targetDiscarded.required.species</message> + </field-validator> + + <!-- species desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ species.enabled ]]> + </param> + <message>validator.targetDiscarded.desactivated.species</message> + </field-validator> + + </field> + + <field name="weightCategory"> + + <!-- pas de categorie weight selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.targetDiscarded.required.weightCategory</message> + </field-validator> + + <!-- weightCategory desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ weightCategory.enabled ]]> + </param> + <message>validator.targetDiscarded.desactivated.weightCategory</message> + </field-validator> + + </field> + + <field name="reasonForDiscard"> + + <!-- pas de raison rejet selectionne --> + <field-validator type="required" short-circuit="true"> + <message>validator.targetDiscarded.required.reasonForDiscard</message> + </field-validator> + + <!-- reasonForDiscard desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ reasonForDiscard.enabled ]]> + </param> + <message>validator.targetDiscarded.desactivated.reasonForDiscard</message> + </field-validator> + + </field> + + <field name="comment"> + + <!-- comentaire de moins de 1024 caractères --> + <field-validator type="stringlength"> + <param name="maxLength">1024</param> + <message>validator.targetDiscarded.comment.tobig</message> + </field-validator> + + <!-- comment requis selon le raison rejet --> + + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ (comment != null && !comment.empty) || reasonForDiscard == null || !reasonForDiscard.needComment ]]></param> + <message>validator.targetDiscarded.required.comment.for.reasonForDiscard</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetDiscarded-warning-validation.xml similarity index 62% rename from observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml rename to observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetDiscarded-warning-validation.xml index f6d972a..47eff2d 100644 --- a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineTargetCatchDto-n1-update-error-validation.xml +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/TargetCatchDto-n1-update-targetDiscarded-warning-validation.xml @@ -7,15 +7,13 @@ %% 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 + 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 + 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% @@ -26,14 +24,20 @@ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> <validators> - <field name="targetCatch"> + <field name="catchWeight"> - <!-- clef unique sur la categorie weight et well --> + <!-- weight non renseigné --> + <field-validator type="required" short-circuit="true"> + <message>validator.targetDiscarded.required.weight</message> + </field-validator> - <field-validator type="collectionFieldExpression"> - <param name="mode">UNIQUE_KEY</param> - <param name="keys">weightCategory.id,well</param> - <message>validator.targetCatch.uniqueKey</message> + <!-- weight entre 0 et 400 --> + <field-validator type="double" short-circuit="true"> + <param name="minExclusive">0</param> + <param name="maxInclusive">400</param> + <message> + validator.targetDiscarded.bound.weight##${minExclusive}##${maxInclusive} + </message> </field-validator> </field> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.