cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl AssertValidationRule.java EmailValidationRule.java LengthValidationRule.java Mod10ValidationRule.java RangeValidationRule.java RegExpValidationRule.java ValueCountValidationRule.java
Date Thu, 13 Nov 2003 13:15:42 GMT
bruno       2003/11/13 05:15:42

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/formmodel
                        AggregateField.java
               src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl
                        AssertValidationRule.java EmailValidationRule.java
                        LengthValidationRule.java Mod10ValidationRule.java
                        RangeValidationRule.java RegExpValidationRule.java
                        ValueCountValidationRule.java
  Log:
  Mention "woody" i18n catalogue explicitely
  
  Revision  Changes    Path
  1.11      +5 -3      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AggregateField.java
  
  Index: AggregateField.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AggregateField.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AggregateField.java	31 Oct 2003 10:37:25 -0000	1.10
  +++ AggregateField.java	13 Nov 2003 13:15:41 -0000	1.11
  @@ -52,6 +52,7 @@
   
   import org.apache.cocoon.woody.FormContext;
   import org.apache.cocoon.woody.Constants;
  +import org.apache.cocoon.woody.util.I18nMessage;
   import org.apache.cocoon.woody.datatype.ValidationError;
   import org.apache.cocoon.woody.datatype.ValidationRule;
   import org.apache.cocoon.woody.formmodel.AggregateFieldDefinition.SplitMapping;
  @@ -59,6 +60,7 @@
   import org.apache.oro.text.regex.PatternMatcher;
   import org.apache.oro.text.regex.Perl5Matcher;
   import org.apache.oro.text.regex.MatchResult;
  +import org.apache.excalibur.xml.sax.XMLizable;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   import org.outerj.expression.ExpressionException;
  @@ -188,16 +190,16 @@
           validationError = null;
   
           if (enteredValue == null && isRequired()) {
  -            validationError = new ValidationError("general.field-required");
  +            validationError = new ValidationError(new I18nMessage("general.field-required",
Constants.I18N_CATALOGUE));
               return false;
           } else if (enteredValue == null)
               return true;
           else if (!fieldsHaveValues()) {
  -            Object splitFailMessage = definition.getSplitFailMessage();
  +            XMLizable splitFailMessage = definition.getSplitFailMessage();
               if (splitFailMessage != null)
                   validationError = new ValidationError(splitFailMessage);
               else
  -                validationError = new ValidationError("aggregatedfield.split-failed", new
String[] { definition.getSplitRegexp()});
  +                validationError = new ValidationError(new I18nMessage("aggregatedfield.split-failed",
new String[] { definition.getSplitRegexp()}, Constants.I18N_CATALOGUE));
               return false;
           } else {
               // validate my child fields
  
  
  
  1.3       +3 -3      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/AssertValidationRule.java
  
  Index: AssertValidationRule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/AssertValidationRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AssertValidationRule.java	26 Jun 2003 09:11:24 -0000	1.2
  +++ AssertValidationRule.java	13 Nov 2003 13:15:41 -0000	1.3
  @@ -74,16 +74,16 @@
           } catch (CannotYetResolveWarning w) {
               return null;
           } catch (ExpressionException e) {
  -            return new ValidationError("Error evaluating expression on assert validation
rule.");
  +            return new ValidationError("Error evaluating expression on assert validation
rule.", false);
           }
   
           if (!(expressionResult instanceof Boolean))
  -            return new ValidationError("Got non-boolean result from expression on assert
validation rule.");
  +            return new ValidationError("Got non-boolean result from expression on assert
validation rule.", false);
   
           if (((Boolean)expressionResult).booleanValue())
               return null;
           else
  -            return hasFailMessage() ? getFailMessage() : new ValidationError("Assertion
validation rule failed.");
  +            return hasFailMessage() ? getFailMessage() : new ValidationError("Assertion
validation rule failed.", false);
       }
   
       public boolean supportsType(Class clazz, boolean arrayType) {
  
  
  
  1.3       +3 -1      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/EmailValidationRule.java
  
  Index: EmailValidationRule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/EmailValidationRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EmailValidationRule.java	26 Jun 2003 09:11:24 -0000	1.2
  +++ EmailValidationRule.java	13 Nov 2003 13:15:41 -0000	1.3
  @@ -51,6 +51,8 @@
   package org.apache.cocoon.woody.datatype.validationruleimpl;
   
   import org.apache.cocoon.woody.datatype.ValidationError;
  +import org.apache.cocoon.woody.util.I18nMessage;
  +import org.apache.cocoon.woody.Constants;
   import org.outerj.expression.ExpressionContext;
   
   /**
  @@ -64,7 +66,7 @@
           if (isEmail(email))
               return null;
           else
  -            return hasFailMessage() ? getFailMessage() : new ValidationError("validation.string.invalidemail");
  +            return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.invalidemail",
Constants.I18N_CATALOGUE));
       }
   
       public boolean supportsType(Class clazz, boolean arrayType) {
  
  
  
  1.3       +6 -4      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/LengthValidationRule.java
  
  Index: LengthValidationRule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/LengthValidationRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LengthValidationRule.java	26 Jun 2003 09:11:24 -0000	1.2
  +++ LengthValidationRule.java	13 Nov 2003 13:15:41 -0000	1.3
  @@ -52,6 +52,8 @@
   
   import org.apache.cocoon.woody.datatype.ValidationError;
   import org.apache.cocoon.woody.formmodel.CannotYetResolveWarning;
  +import org.apache.cocoon.woody.util.I18nMessage;
  +import org.apache.cocoon.woody.Constants;
   import org.outerj.expression.ExpressionContext;
   import org.outerj.expression.Expression;
   
  @@ -96,7 +98,7 @@
                   return null;
               int length = ((BigDecimal)result).intValue();
               if (string.length() != length)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.string.exact-length",
new String[] {String.valueOf(length)});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.exact-length",
new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
               return null;
           } else if (minExpr != null && maxExpr != null) {
               Object result = evaluateNumeric(minExpr, expressionContext, "min", "length");
  @@ -114,7 +116,7 @@
               int maxLength = ((BigDecimal)result).intValue();
   
               if (string.length() < minLength || string.length() > maxLength)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.string.range-length",
new String[] {String.valueOf(minLength), String.valueOf(maxLength)});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.range-length",
new String[] {String.valueOf(minLength), String.valueOf(maxLength)}, Constants.I18N_CATALOGUE));
               return null;
           } else if (minExpr != null) {
               Object result = evaluateNumeric(minExpr, expressionContext, "min", "length");
  @@ -124,7 +126,7 @@
                   return null;
               int length = ((BigDecimal)result).intValue();
               if (string.length() < length)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.string.min-length",
new String[] {String.valueOf(length)});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.min-length",
new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
               return null;
           } else if (maxExpr != null) {
               Object result = evaluateNumeric(maxExpr, expressionContext, "max", "length");
  @@ -134,7 +136,7 @@
                   return null;
               int length = ((BigDecimal)result).intValue();
               if (string.length() > length)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.string.max-length",
new String[] {String.valueOf(length)});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.max-length",
new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
               return null;
           }
           return null;
  
  
  
  1.2       +3 -1      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/Mod10ValidationRule.java
  
  Index: Mod10ValidationRule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/Mod10ValidationRule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Mod10ValidationRule.java	26 Jun 2003 09:09:59 -0000	1.1
  +++ Mod10ValidationRule.java	13 Nov 2003 13:15:41 -0000	1.2
  @@ -51,6 +51,8 @@
   package org.apache.cocoon.woody.datatype.validationruleimpl;
   
   import org.apache.cocoon.woody.datatype.ValidationError;
  +import org.apache.cocoon.woody.util.I18nMessage;
  +import org.apache.cocoon.woody.Constants;
   import org.outerj.expression.ExpressionContext;
   
   /**
  @@ -77,7 +79,7 @@
               }
           }
           if(!((sum % 10) == 0))
  -            return hasFailMessage() ? getFailMessage() : new ValidationError("validation.mod10");
  +            return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.mod10",
Constants.I18N_CATALOGUE));
           else
               return null;
       }
  
  
  
  1.4       +5 -3      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/RangeValidationRule.java
  
  Index: RangeValidationRule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/RangeValidationRule.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RangeValidationRule.java	1 Oct 2003 18:20:23 -0000	1.3
  +++ RangeValidationRule.java	13 Nov 2003 13:15:41 -0000	1.4
  @@ -52,6 +52,8 @@
   
   import org.apache.cocoon.woody.datatype.ValidationError;
   import org.apache.cocoon.woody.formmodel.CannotYetResolveWarning;
  +import org.apache.cocoon.woody.util.I18nMessage;
  +import org.apache.cocoon.woody.Constants;
   import org.outerj.expression.ExpressionContext;
   import org.outerj.expression.Expression;
   
  @@ -109,7 +111,7 @@
               BigDecimal max = (BigDecimal) result;
   
               if (decimal.compareTo(min) < 0 || decimal.compareTo(max) > 0)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.numeric.range",
new String[]{min.toString(), max.toString()});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.numeric.range",
new String[]{min.toString(), max.toString()}, Constants.I18N_CATALOGUE));
               return null;
           } else if (minExpr != null) {
               Object result = evaluateNumeric(minExpr, expressionContext, MIN_ATTR, RANGE_ELEM);
  @@ -119,7 +121,7 @@
                   return null;
               BigDecimal min = (BigDecimal) result;
               if (decimal.compareTo(min) < 0)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.numeric.min",
new String[]{min.toString()});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.numeric.min",
new String[]{min.toString()}, Constants.I18N_CATALOGUE));
               return null;
           } else if (maxExpr != null) {
               Object result = evaluateNumeric(maxExpr, expressionContext, MAX_ATTR, RANGE_ELEM);
  @@ -129,7 +131,7 @@
                   return null;
               BigDecimal max = (BigDecimal) result;
               if (decimal.compareTo(max) > 0)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.numeric.max",
new String[]{max.toString()});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.numeric.max",
new String[]{max.toString()}, Constants.I18N_CATALOGUE));
               return null;
           }
           return null;
  
  
  
  1.3       +3 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/RegExpValidationRule.java
  
  Index: RegExpValidationRule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/RegExpValidationRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RegExpValidationRule.java	13 Jul 2003 01:27:48 -0000	1.2
  +++ RegExpValidationRule.java	13 Nov 2003 13:15:41 -0000	1.3
  @@ -51,7 +51,8 @@
   package org.apache.cocoon.woody.datatype.validationruleimpl;
   
   import org.apache.cocoon.woody.datatype.ValidationError;
  -import org.apache.cocoon.woody.datatype.validationruleimpl.AbstractValidationRule;
  +import org.apache.cocoon.woody.util.I18nMessage;
  +import org.apache.cocoon.woody.Constants;
   import org.apache.oro.text.regex.Pattern;
   import org.apache.oro.text.regex.PatternMatcher;
   import org.apache.oro.text.regex.Perl5Matcher;
  @@ -76,7 +77,7 @@
       	if(matchesRegExp(string))
   	     	return null;   
   	    else
  -	    	return hasFailMessage() ? getFailMessage() : new ValidationError("validation.string.regexp",
new String[] {regexp});
  +	    	return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.regexp",
new String[] {regexp}, Constants.I18N_CATALOGUE));
       }
       
       private boolean matchesRegExp(String string) {
  
  
  
  1.3       +6 -4      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/ValueCountValidationRule.java
  
  Index: ValueCountValidationRule.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/ValueCountValidationRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ValueCountValidationRule.java	26 Jun 2003 09:11:24 -0000	1.2
  +++ ValueCountValidationRule.java	13 Nov 2003 13:15:41 -0000	1.3
  @@ -52,6 +52,8 @@
   
   import org.apache.cocoon.woody.datatype.ValidationError;
   import org.apache.cocoon.woody.formmodel.CannotYetResolveWarning;
  +import org.apache.cocoon.woody.util.I18nMessage;
  +import org.apache.cocoon.woody.Constants;
   import org.outerj.expression.ExpressionContext;
   import org.outerj.expression.Expression;
   
  @@ -98,7 +100,7 @@
                   return null;
               int length = ((BigDecimal)result).intValue();
               if (array.length != length)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.array.exact-valuecount",
new String[] {String.valueOf(length)});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.exact-valuecount",
new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
               return null;
           } else if (minExpr != null && maxExpr != null) {
               Object result = evaluateNumeric(minExpr, expressionContext, "min", "value-count");
  @@ -116,7 +118,7 @@
               int maxLength = ((BigDecimal)result).intValue();
   
               if (array.length < minLength || array.length > maxLength)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.array.range-valuecount",
new String[] {String.valueOf(minLength), String.valueOf(maxLength)});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.range-valuecount",
new String[] {String.valueOf(minLength), String.valueOf(maxLength)}, Constants.I18N_CATALOGUE));
               return null;
           } else if (minExpr != null) {
               Object result = evaluateNumeric(minExpr, expressionContext, "min", "value-count");
  @@ -126,7 +128,7 @@
                   return null;
               int length = ((BigDecimal)result).intValue();
               if (array.length < length)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.array.min-valuecount",
new String[] {String.valueOf(length)});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.min-valuecount",
new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
               return null;
           } else if (maxExpr != null) {
               Object result = evaluateNumeric(maxExpr, expressionContext, "max", "value-count");
  @@ -136,7 +138,7 @@
                   return null;
               int length = ((BigDecimal)result).intValue();
               if (array.length > length)
  -                return hasFailMessage() ? getFailMessage() : new ValidationError("validation.array.max-valuecount",
new String[] {String.valueOf(length)});
  +                return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.max-valuecount",
new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
               return null;
           }
           return null;
  
  
  

Mime
View raw message