myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r779813 - in /myfaces/extensions/validator/branches/branch_for_jsf_1_1: core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions...
Date Fri, 29 May 2009 01:32:09 GMT
Author: gpetracek
Date: Fri May 29 01:32:08 2009
New Revision: 779813

URL: http://svn.apache.org/viewvc?rev=779813&view=rev
Log:
EXTVAL-43 and EXTVAL-44 first draft

Added:
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java
Modified:
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.java

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java?rev=779813&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java
(added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java
Fri May 29 01:32:08 2009
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+@Target({FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface ParameterKey
+{
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java?rev=779813&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java
(added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java
Fri May 29 01:32:08 2009
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+@Target({FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface ParameterValue
+{
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java?rev=779813&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java
(added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java
Fri May 29 01:32:08 2009
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface ValidationParameter
+{
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java?rev=779813&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java
(added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java
Fri May 29 01:32:08 2009
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface ViolationSeverity
+{
+    interface Info extends ValidationParameter
+    {
+        @ParameterKey
+        public Class KEY = ViolationSeverity.class;
+                
+        @ParameterValue
+        public FacesMessage.Severity SEVERITY = FacesMessage.SEVERITY_INFO;
+
+        //@ParameterValue
+        //MessageType postfix = MessageType.INFO;
+    }
+
+    interface Warn extends ValidationParameter
+    {
+        @ParameterKey
+        public Class KEY = ViolationSeverity.class;
+
+        @ParameterValue
+        FacesMessage.Severity SEVERITY = FacesMessage.SEVERITY_WARN;
+
+        //@ParameterValue
+        //MessageType postfix = MessageType.WARN;
+    }
+
+    interface Error extends ValidationParameter
+    {
+        @ParameterKey
+        public Class KEY = ViolationSeverity.class;
+
+        @ParameterValue
+        FacesMessage.Severity SEVERITY = FacesMessage.SEVERITY_ERROR;
+
+        //@ParameterValue
+        //MessageType postfix = MessageType.ERROR;
+    }
+
+    interface Fatal extends ValidationParameter
+    {
+        @ParameterKey
+        public Class KEY = ViolationSeverity.class;
+
+        @ParameterValue
+        FacesMessage.Severity SEVERITY = FacesMessage.SEVERITY_FATAL;
+
+        //@ParameterValue
+        //MessageType postfix = MessageType.FATAL;
+    }
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java
Fri May 29 01:32:08 2009
@@ -23,12 +23,20 @@
 import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
 import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
 import org.apache.myfaces.extensions.validator.core.validation.message.LabeledMessage;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterKey;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterValue;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
 import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
 import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.faces.component.UIComponent;
+import javax.faces.component.EditableValueHolder;
 import javax.faces.component.html.HtmlInputText;
 import javax.faces.component.html.HtmlInputSecret;
 import javax.faces.component.html.HtmlSelectBooleanCheckbox;
@@ -42,6 +50,13 @@
 import javax.faces.context.FacesContext;
 import javax.faces.validator.ValidatorException;
 import javax.faces.application.FacesMessage;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.WildcardType;
 
 /**
  * @author Gerhard Petracek
@@ -50,6 +65,8 @@
 @UsageInformation(UsageCategory.INTERNAL)
 public class HtmlCoreComponentsValidationExceptionInterceptor implements ValidationExceptionInterceptor
 {
+    protected final Log logger = LogFactory.getLog(getClass());
+
     public boolean afterThrowing(UIComponent uiComponent,
                                  MetaDataEntry metaDataEntry,
                                  Object convertedObject,
@@ -58,6 +75,7 @@
     {
         if(processComponent(uiComponent))
         {
+            FacesContext facesContext = FacesContext.getCurrentInstance();
             FacesMessage facesMessage = ExtValUtils.convertFacesMessage(validatorException.getFacesMessage());
 
             String label = (String) ReflectionUtils.tryToInvokeMethod(uiComponent,
@@ -65,7 +83,7 @@
 
             if(label == null)
             {
-                label = uiComponent.getClientId(FacesContext.getCurrentInstance());
+                label = uiComponent.getClientId(facesContext);
             }
 
             //override the label if the annotation provides a label
@@ -86,10 +104,140 @@
                     ExtValUtils.tryToPlaceLabel(facesMessage, label, i);
                 }
             }
+
+            if(metaDataEntry != null && metaDataEntry.getValue() instanceof Annotation)
+            {
+                if(!displayAsException(facesMessage, metaDataEntry.getValue(Annotation.class)))
+                {
+                    facesContext.addMessage(uiComponent.getClientId(facesContext), facesMessage);
+                    //it's a special case - since validation will continue it's essential
to reset it
+                    ((EditableValueHolder)uiComponent).setRequired(false);
+                    return false;
+                }
+            }
         }
         return true;
     }
 
+    @ToDo(value = Priority.MEDIUM, description = "refactor to a generic parameter extractor")
+    private boolean displayAsException(FacesMessage facesMessage, Annotation annotation)
+    {
+        boolean isError = true;
+
+        for(Method currentAnnotationAttribute : annotation.annotationType().getDeclaredMethods())
+        {
+            try
+            {
+                if(!isValidationParameter(currentAnnotationAttribute.getGenericReturnType()))
+                {
+                    continue;
+                }
+
+                Object parameterValue = currentAnnotationAttribute.invoke(annotation);
+
+                if(parameterValue instanceof Class[])
+                {
+                    for(Class currentParameterValue : (Class[])parameterValue)
+                    {
+                        //keep check so that following is true:
+                        //if at least one parameter is found which tells that it isn't a
blocking error, let it pass
+                        if(!processParameterValue(annotation, currentParameterValue, facesMessage))
+                        {
+                            isError = false;
+                        }
+                    }
+                }
+                else if(parameterValue instanceof Class)
+                {
+                    //keep check so that following is true:
+                    //if at least one parameter is found which tells that it isn't a blocking
error, let it pass
+                    if(!processParameterValue(annotation, (Class)parameterValue, facesMessage))
+                    {
+                        isError = false;
+                    }
+                }
+            }
+            catch (Throwable e)
+            {
+                if(this.logger.isWarnEnabled())
+                {
+                    this.logger.warn(e);
+                }
+            }
+        }
+
+        return isError;
+    }
+
+    private boolean processParameterValue(Annotation annotation, Class parameterClass, FacesMessage
facesMessage)
+            throws Exception
+    {
+        boolean showAsError = true;
+
+        for(Field currentField : parameterClass.getDeclaredFields())
+        {
+            if(currentField.isAnnotationPresent(ParameterKey.class))
+            {
+                Object key = parameterClass.getDeclaredField(currentField.getName()).get(annotation);
+                //invoke ParameterProcessors(key, annotation)
+            }
+            //no "else if" to allow both at one field
+            if(currentField.isAnnotationPresent(ParameterValue.class))
+            {
+                Object value = parameterClass.getDeclaredField(currentField.getName()).get(annotation);
+                if(value instanceof FacesMessage.Severity)
+                {
+                    facesMessage.setSeverity((FacesMessage.Severity)value);
+                    if(((FacesMessage.Severity)value).compareTo(FacesMessage.SEVERITY_ERROR)
< 0)
+                    {
+                        showAsError = false;
+                    }
+                }
+            }
+        }
+
+        return showAsError;
+    }
+
+    private boolean isValidationParameter(Type genericReturnType)
+    {
+        if(genericReturnType instanceof GenericArrayType)
+        {
+            if(((GenericArrayType)genericReturnType).getGenericComponentType() instanceof
ParameterizedType)
+            {
+                return analyzeParameterizedType(
+                        (ParameterizedType)((GenericArrayType)genericReturnType).getGenericComponentType());
+            }
+        }
+        else if(genericReturnType instanceof ParameterizedType)
+        {
+            return analyzeParameterizedType(
+                    (ParameterizedType)genericReturnType);
+        }
+
+        return false;
+    }
+
+    private boolean analyzeParameterizedType(ParameterizedType parameterizedType)
+    {
+        for(Type type : parameterizedType.getActualTypeArguments())
+        {
+            if(type instanceof WildcardType)
+            {
+                for(Type upperBounds : ((WildcardType)type).getUpperBounds())
+                {
+                    if(upperBounds instanceof Class &&
+                            ((Class)upperBounds).isAssignableFrom(ValidationParameter.class))
+                    {
+                        return true;
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+
     protected boolean processComponent(UIComponent uiComponent)
     {
         return uiComponent instanceof HtmlInputText ||

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.java
Fri May 29 01:32:08 2009
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
 
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
@@ -39,4 +41,6 @@
     double minimum() default 0;
 
     double maximum() default Double.MAX_VALUE;
-}
+
+    Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.java
Fri May 29 01:32:08 2009
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
 
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
@@ -39,4 +41,6 @@
     int minimum() default 0;
 
     int maximum() default Integer.MAX_VALUE;
-}
+
+    Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.java
Fri May 29 01:32:08 2009
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
 
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
@@ -39,4 +41,6 @@
     long minimum() default 0;
 
     long maximum() default Long.MAX_VALUE;
-}
+
+    Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java
Fri May 29 01:32:08 2009
@@ -1,42 +1,46 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.extensions.validator.baseval.annotation;
-
-import org.apache.myfaces.extensions.validator.internal.UsageInformation;
-import org.apache.myfaces.extensions.validator.internal.UsageCategory;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-
-/**
- * @author Gerhard Petracek
- * @since 1.x.1
- */
-@Target({METHOD, FIELD})
-@Retention(RUNTIME)
-@UsageInformation(UsageCategory.API)
-public @interface Pattern
-{
-    String[] value();
-
-    String validationErrorMsgKey() default "no_match";
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.baseval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface Pattern
+{
+    String[] value();
+
+    String validationErrorMsgKey() default "no_match";
+
+    Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java
Fri May 29 01:32:08 2009
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
 
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
@@ -43,4 +45,6 @@
      * @return an optional error message key
      */
     String validationErrorMsgKey() default "field_required";
+
+    Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
 }

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.java
Fri May 29 01:32:08 2009
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
 
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
@@ -37,4 +39,6 @@
 public @interface Validator
 {
     Class<? extends javax.faces.validator.Validator>[] value();
-}
+
+    Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java
Fri May 29 01:32:08 2009
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
 
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
@@ -54,4 +56,6 @@
     String notEqualErrorMsgKey() default "wrong_date_not_equal";
 
     int errorMessageDateStyle() default DateFormat.MEDIUM;
-}
+
+    Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.java
Fri May 29 01:32:08 2009
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
 
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
@@ -39,4 +41,6 @@
     String[] value();
 
     String validationErrorMsgKey() default "duplicated_content_required";
-}
+
+    Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.java
Fri May 29 01:32:08 2009
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
 
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
@@ -39,4 +41,6 @@
     String[] value();
 
     String validationErrorMsgKey() default "duplicated_content_denied";
-}
+
+    Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.java?rev=779813&r1=779812&r2=779813&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.java
Fri May 29 01:32:08 2009
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
 
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
@@ -45,4 +47,6 @@
     RequiredIfType is() default RequiredIfType.not_empty;
 
     String validationErrorMsgKey() default "empty_field";
-}
+
+    Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
+}
\ No newline at end of file



Mime
View raw message