This is an automated email from the git hooks/post-receive script. New commit to branch feature/7609 in repository observe. See http://git.codelutin.com/observe.git commit 3a84c63696a65a7b197099a652d3522a129370ce Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Oct 21 11:43:35 2015 +0200 ajout des validateurs (refs #7609) --- .../content/table/impl/seine/NonTargetCatchUI.jaxx | 2 +- ...onTargetCatchDto-n1-update-error-validation.xml | 150 +++++++++++++++++++++ ...TargetCatchDto-n1-update-warning-validation.xml | 91 +++++++++++++ ...onTargetCatchDto-n1-update-error-validation.xml | 42 ++++++ 4 files changed, 284 insertions(+), 1 deletion(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx index cea2797..b9d95ad 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/content/table/impl/seine/NonTargetCatchUI.jaxx @@ -69,7 +69,7 @@ <BeanValidator id='validator' beanClass='fr.ird.observe.services.dto.seine.SetSeineNonTargetCatchDto' errorTableModel='{getErrorTableModel()}' - context='n1-update-nonTargetCatch'> + context='n1-update'> <!-- clef unique --> <field name="nonTargetCatch" component="editorPanel"/> </BeanValidator> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetCatchDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetCatchDto-n1-update-error-validation.xml new file mode 100644 index 0000000..a2b886b --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetCatchDto-n1-update-error-validation.xml @@ -0,0 +1,150 @@ +<?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.nonTargetCatch.comment.tobig</message> + </field-validator> + + <!-- comment requis selone la speciesFate selectionne --> + + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ (comment != null && !comment.empty) || speciesFate == null || !speciesFate.needComment ]]></param> + <message>validator.nonTargetCatch.required.comment.for.speciesFate</message> + </field-validator> + + <!-- comment requis selone la reasonForDiscard selectionne --> + + <field-validator type="fieldexpression"> + <param name="expression"> + <![CDATA[ (comment != null && !comment.empty) || reasonForDiscard == null || !reasonForDiscard.needComment ]]></param> + <message>validator.nonTargetCatch.required.comment.for.reasonForDiscard</message> + </field-validator> + + </field> + + <field name="species"> + + <!-- pas de species selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.nonTargetCatch.required.species</message> + </field-validator> + + <!-- species desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ species.enabled ]]> + </param> + <message>validator.nonTargetCatch.desactivated.species</message> + </field-validator> + + </field> + + <field name="speciesFate"> + + <!-- pas de objectFate species selectionnee --> + <field-validator type="required" short-circuit="true"> + <message>validator.nonTargetCatch.required.speciesFate</message> + </field-validator> + + <!-- speciesFate desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ speciesFate.enabled ]]> + </param> + <message>validator.nonTargetCatch.desactivated.speciesFate</message> + </field-validator> + + </field> + + <field name="reasonForDiscard"> + + <!-- reasonForDiscard desactive --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ reasonForDiscard == null || reasonForDiscard.enabled ]]> + </param> + <message>validator.nonTargetCatch.desactivated.reasonForDiscard</message> + </field-validator> + + </field> + + <field name="catchWeight"> + + <!-- au moins un des deux valeurs catchWeight / totalCount doit etre renseignee --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ catchWeight != null || totalCount != null ]]> + </param> + <message>validator.nonTargetCatch.required.weightOrNombreEstime</message> + </field-validator> + + </field> + + <field name="totalCount"> + + <!-- au moins un des deux valeurs catchWeight / totalCount doit etre renseignee --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ catchWeight != null || totalCount != null ]]> + </param> + <message>validator.nonTargetCatch.required.weightOrNombreEstime</message> + </field-validator> + + </field> + + <field name="meanWeight"> + + <!-- weight moyen non renseignée ou > 0 --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ meanWeight == null || meanWeight > 0 ]]> + </param> + <message>validator.nonTargetCatch.positive.meanWeight</message> + </field-validator> + + </field> + + <field name="meanLength"> + + <!-- taille moyenne non renseignée ou > 0 --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ meanLength == null || meanLength > 0 ]]> + </param> + <message>validator.nonTargetCatch.positive.meanLength</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetCatchDto-n1-update-warning-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetCatchDto-n1-update-warning-validation.xml new file mode 100644 index 0000000..1cfbfdc --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/NonTargetCatchDto-n1-update-warning-validation.xml @@ -0,0 +1,91 @@ +<?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="catchWeight"> + + <!-- weight estimé non renseigné ou 0.0 < poids estime <= 400.0 --> + <field-validator type="fieldexpressionwithparams"> + <param name="doubleParams">min:0.0|max:400.0</param> + <param name="expression"> + <![CDATA[ catchWeight == null || (doubles.min < catchWeight && catchWeight <= doubles.max)]]> + </param> + <message>validator.nonTargetCatch.bound.catchWeight##${doubles.min}##${doubles.max}</message> + </field-validator> + + </field> + + <field name="totalCount"> + + <!-- count estimé non renseigné ou 0 < nombre estime <= 10000 --> + <field-validator type="fieldexpressionwithparams"> + <param name="intParams">min:0|max:10000</param> + <param name="expression"> + <![CDATA[ totalCount == null || (ints.min < totalCount && totalCount <= ints.max)]]> + </param> + <message>validator.nonTargetCatch.bound.totalCount##${ints.min}##${ints.max}</message> + </field-validator> + + </field> + + <field name="meanWeight"> + + <!-- au moins un des deux valeurs meanWeight / meanLength doit etre renseignee --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ meanWeight != null || meanLength != null ]]> + </param> + <message>validator.nonTargetCatch.required.weightOrTailleMoyen</message> + </field-validator> + + <!-- validation du weight par borne --> + <field-validator type="species_weight"> + <param name="ratio">1.0</param> + <message>validator.nonTargetCatch.bound.meanWeight##${min}##${max}</message> + </field-validator> + + </field> + + <field name="meanLength"> + + <!-- au moins un des deux valeurs meanWeight / meanLength doit etre renseignee --> + <field-validator type="fieldexpression" short-circuit="true"> + <param name="expression"> + <![CDATA[ meanWeight != null || meanLength != null ]]> + </param> + <message>validator.nonTargetCatch.required.weightOrTailleMoyen</message> + </field-validator> + + <!-- validation de la taille par borne --> + <field-validator type="species_length"> + <param name="ratio">1.0</param> + <message>validator.nonTargetCatch.bound.meanLength##${min}##${max}</message> + </field-validator> + + </field> + +</validators> diff --git a/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineNonTargetCatchDto-n1-update-error-validation.xml b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineNonTargetCatchDto-n1-update-error-validation.xml new file mode 100644 index 0000000..2d04e6a --- /dev/null +++ b/observe-application-swing/src/main/resources/fr/ird/observe/services/dto/seine/SetSeineNonTargetCatchDto-n1-update-error-validation.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + ObServe :: Validation + %% + Copyright (C) 2008 - 2013 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="nonTargetCatch"> + + <!-- clef unique sur la espèce - objectFate --> + + <field-validator type="collectionFieldExpression"> + <param name="mode">UNIQUE_KEY</param> + <param name="keys">species.id,speciesFate.id</param> + <message>validator.nonTargetCatch.uniqueKey</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>.