You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by rd...@apache.org on 2010/08/30 14:12:57 UTC
svn commit: r990777 [1/3] - in
/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator:
core/el/ core/factory/ core/initializer/component/
core/initializer/configuration/ core/interceptor/ co...
Author: rdebusscher
Date: Mon Aug 30 12:12:55 2010
New Revision: 990777
URL: http://svn.apache.org/viewvc?rev=990777&view=rev
Log:
EXTVAL-29 - Core module - classes marked as API and REUSE
Modified:
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ValueBindingExpression.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/ClassMappingFactory.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FacesMessageFactory.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryFinder.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/NameMapperAwareFactory.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/AbstractHtmlCoreComponentsComponentInitializer.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/ComponentInitializer.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfiguration.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationEntry.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticInMemoryConfiguration.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticResourceBundleConfiguration.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractValidationInterceptor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ComponentInitializationAwareMetaDataExtractionInterceptor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/MetaDataExtractionInterceptor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/PropertyValidationInterceptor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/RendererInterceptor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ViolationExceptionInterceptor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/AbstractCustomNameMapper.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/NameMapper.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/SubMapperAwareNameMapper.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/MetaDataEntry.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/ComponentMetaDataExtractorFactory.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/MetaDataExtractor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapter.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformation.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/proxy/DefaultProxyHelper.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/proxy/ProxyHelper.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/AbstractRenderKitWrapperFactory.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/AbstractStartupListener.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractApplicationScopeAwareStorageManager.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/GroupStorage.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MetaDataStorageFilter.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManager.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManagerHolder.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/ViolationSeverityInterpreterStorage.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/ConstraintSource.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/EmptyValueAwareValidationStrategy.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/IgnoreConstraintSource.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/NullValueAwareValidationStrategy.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/SkipValidationEvaluator.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetProperty.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetPropertyId.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/exception/RequiredValidatorException.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/LabeledMessage.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientSideValidation.java
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/ValidationParameterExtractor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractorFactory.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractVirtualValidationStrategy.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapter.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapterImpl.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/IdentifiableValidationStrategy.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ConstraintSourceUtils.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValAnnotationUtils.java
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.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/el/ELHelper.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.java Mon Aug 30 12:12:55 2010
@@ -26,7 +26,7 @@ import javax.faces.component.UIComponent
import javax.faces.context.FacesContext;
/**
- * in order to centralize the jsf version dependency within the core
+ * Structure of the object that handles EL here centralized to isolate the jsf version dependency within the core.
*
* @author Gerhard Petracek
* @since 1.x.1
@@ -34,17 +34,59 @@ import javax.faces.context.FacesContext;
@UsageInformation(UsageCategory.API)
public interface ELHelper
{
+ /**
+ * Return the bean instance from the JSF contexts with the specified name.
+ * @param beanName The bean name we are interested in, no EL expression.
+ * @return instance for the bean name or null.
+ */
Object getBean(String beanName);
+ /**
+ * Evaluates the expression equivalent of the ValueBindingExpression parameter and returns the result.
+ * @param facesContext The JSF Context
+ * @param valueBindingExpression information about expression to evaluate.
+ * @return result of the expression equivalent of the ValueBindingExpression parameter
+ */
Object getValueOfExpression(FacesContext facesContext, ValueBindingExpression valueBindingExpression);
+ /**
+ * Returns the type of the expression equivalent of the ValueBindingExpression parameter.
+ * @param facesContext The JSF Context
+ * @param valueBindingExpression information about expression to evaluate.
+ * @return type of the expression equivalent of the ValueBindingExpression parameter
+ */
Class getTypeOfExpression(FacesContext facesContext, ValueBindingExpression valueBindingExpression);
+ /**
+ * Extracts the property details (expression, base object and property name) information from the UIComponent's
+ * value attribute.
+ * @param uiComponent The UIComponent of interest.
+ * @return property details information
+ */
PropertyDetails getPropertyDetailsOfValueBinding(UIComponent uiComponent);
+ /**
+ * Determines if the expression is a valid expression, meaning that the expression can be evaluated without
+ * exception.
+ * @param facesContext The JSF Context
+ * @param valueBindingExpression The EL expression we want to evaluate.
+ * @return valid EL expression ?
+ */
boolean isELTermValid(FacesContext facesContext, String valueBindingExpression);
+ /**
+ * A very basic check of the EL expression is well formed.
+ * @param o Object
+ * @return
+ */
boolean isELTermWellFormed(Object o);
+ /**
+ * Gets the value of the attribute specified by the parameter name for the UIComponent.
+ *
+ * @param uiComponent The UIComponent
+ * @param name The name of the attribute.
+ * @return The ValueExpression assigned to the attribute.
+ */
Object getBindingOfComponent(UIComponent uiComponent, String name);
}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ValueBindingExpression.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/el/ValueBindingExpression.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ValueBindingExpression.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ValueBindingExpression.java Mon Aug 30 12:12:55 2010
@@ -25,6 +25,8 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.util.ExtValUtils;
/**
+ * Object that stores the different parts of an expression string.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
@@ -39,6 +41,14 @@ public class ValueBindingExpression
private static final ELHelper EL_HELPER = ExtValUtils.getELHelper();
+ /**
+ * Replace the property of the expression by the new property specified as parameter or add the property when
+ * expression has no property yet. When the expression doesn't have a property (like {#bean}), the property is
+ * added to the base expression.
+ * @param valueBindingExpression The valueBindingExpression where we want to replace or add the property.
+ * @param newProperty The property to use.
+ * @return The resulting valueBindingExpression where property is replaced or added.
+ */
public static ValueBindingExpression replaceOrAddProperty(ValueBindingExpression valueBindingExpression,
String newProperty)
{
@@ -52,6 +62,13 @@ public class ValueBindingExpression
}
}
+ /**
+ * Replace the property in the expression string by the property specified as parameter.
+ *
+ * @param valueBindingExpression The valueBindingExpression where we want to replace the property
+ * @param newProperty The property to use.
+ * @return The resulting valueBindingExpression where property is replaced.
+ */
public static ValueBindingExpression replaceProperty(ValueBindingExpression valueBindingExpression,
String newProperty)
{
@@ -71,6 +88,13 @@ public class ValueBindingExpression
}
}
+ /**
+ * Add the property to the expression string.
+ *
+ * @param valueBindingExpression The valueBindingExpression where we want to add the property
+ * @param newProperty The property to add.
+ * @return The resulting valueBindingExpression where property is added.
+ */
public static ValueBindingExpression addProperty(ValueBindingExpression valueBindingExpression, String newProperty)
{
String sourceExpression = valueBindingExpression.getExpressionString();
@@ -87,6 +111,12 @@ public class ValueBindingExpression
}
}
+ /**
+ * Creates an instance of a ValueBindingExpression based on a well formed EL expression. The creation is a recursive
+ * process that extracts the last property, the token the property is separated from the rest (. or [/[') and the
+ * text before the token as a new (ValueBinding)Expression. see the tests for some
+ * @param expression The EL expression
+ */
public ValueBindingExpression(String expression)
{
if(!EL_HELPER.isELTermWellFormed(expression))
@@ -129,6 +159,10 @@ public class ValueBindingExpression
}
}
+ /**
+ * The (last) property of the expression.
+ * @return The (last) property of the expression.
+ */
public String getProperty()
{
this.value = this.value.trim();
@@ -149,6 +183,12 @@ public class ValueBindingExpression
return base;
}
+ /**
+ * Recreates the expression string from which this valueBindingExpression was build. There is no guarantee that the
+ * same format is kep, for example {#bean['property']} could become {#bean.property}
+ *
+ * @return The expression string equivalent of the valueBindingExpression.
+ */
public String getExpressionString()
{
if(this.base != null)
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.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/factory/AbstractNameMapperAwareFactory.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java Mon Aug 30 12:12:55 2010
@@ -31,6 +31,9 @@ import java.util.Collections;
import java.util.Comparator;
/**
+ * Default implementation of a NameMapperAwareFactory where the concrete implementation is responsible for the storage
+ * of the list of nameMappers.
+ *
* @author Gerhard Petracek
* @since 1.x.2
*/
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/ClassMappingFactory.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/factory/ClassMappingFactory.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/ClassMappingFactory.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/ClassMappingFactory.java Mon Aug 30 12:12:55 2010
@@ -22,11 +22,24 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageCategory;
/**
+ * A structure of a factory that creates classes of the target type R for a certain source class of type P. Most
+ * factories uses the NameMapper facility to configure the type of objects that should be returned.
+ *
+ * @param <P> generic type for the source type
+ * @param <R> generic type for the target type.
+
* @author Gerhard Petracek
* @since 1.x.1
*/
@UsageInformation(UsageCategory.API)
public interface ClassMappingFactory<P, R>
{
+ /**
+ * Create an instance of the target type based on the source type. An example is the
+ * DefaultMetaDataTransformerFactory that creates a metaDataTransformer for a certain ValidationStrategy.
+ *
+ * @param source source type to be used.
+ * @return target object.
+ */
R create(P source);
}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FacesMessageFactory.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/factory/FacesMessageFactory.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FacesMessageFactory.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FacesMessageFactory.java Mon Aug 30 12:12:55 2010
@@ -24,13 +24,31 @@ import org.apache.myfaces.extensions.val
import javax.faces.application.FacesMessage;
/**
+ * Structure for a factory that creates FacesMessages that also implement the LabeledMessage interface. The LabelMessage
+ * interface adds label capabilities to the FacesMessage.
+ *
* @author Gerhard Petracek
* @since 1.x.2
*/
@UsageInformation(UsageCategory.API)
public interface FacesMessageFactory
{
+ /**
+ * Converts the facesMessage so that is implements the LabelMessage interface. If the parameter implements already
+ * the correct interface, it is returned without change.
+ *
+ * @param facesMessage The facesMessage to convert
+ * @return A FacesMessage instance that also implements LabelMessage.
+ */
FacesMessage convert(FacesMessage facesMessage);
+ /**
+ * Create a LabelMessage implementing FacesMessage using the parameters as content.
+ *
+ * @param severity Severity for the FacesMessage.
+ * @param summary summary text for the message.
+ * @param detail detail test for the message.
+ * @return A FacesMessage instance that also implements LabelMessage.
+ */
FacesMessage create(FacesMessage.Severity severity, String summary, String detail);
}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryFinder.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/factory/FactoryFinder.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryFinder.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryFinder.java Mon Aug 30 12:12:55 2010
@@ -22,11 +22,22 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageCategory;
/**
+ * Structure for the object that is able to locate the different factories within the ExtVal Framework.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
@UsageInformation(UsageCategory.API)
public interface FactoryFinder
{
+ /**
+ * Retrieves the default or configured factory. It is instantiated the first time and retrieved from a cache in the
+ * subsequent requests.
+ *
+ * @param factoryName The name of the factory we want to retrieve.
+ * @param targetClass The class type the factory needs to be casted to.
+ * @param <T> generic type parameter
+ * @return Factory instance, can never be null.
+ */
<T> T getFactory(FactoryNames factoryName, Class<T> targetClass);
}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.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/factory/FactoryNames.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java Mon Aug 30 12:12:55 2010
@@ -22,6 +22,9 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageCategory;
/**
+ * Names of factories known by the FactoryFinder.
+ * @see org.apache.myfaces.extensions.validator.core.factory.FactoryFinder
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/NameMapperAwareFactory.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/factory/NameMapperAwareFactory.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/NameMapperAwareFactory.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/NameMapperAwareFactory.java Mon Aug 30 12:12:55 2010
@@ -23,13 +23,33 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
/**
+ * Factory that works with NameMappers to define what should be created. The factory ask each name mapper for a possible
+ * candidate for creation (name mappers can be ordered) and return the result of the first that answers with a non null
+ * value.
+ *
* @author Gerhard Petracek
* @since 1.x.2
*/
@UsageInformation(UsageCategory.API)
public interface NameMapperAwareFactory<T extends NameMapper>
{
+ /**
+ * Register the NameMapper for usage. When nameMapper is used in a call to the deny method, it isn't registered
+ * and there is no further trace of this deny action.
+ *
+ * @param classToAdd nameMapper to add.
+ */
void register(T classToAdd);
+
+ /**
+ * Removes the nameMapper from the list.
+ * @param classToDeregister nameMapper to remove.
+ */
void deregister(Class<? extends NameMapper> classToDeregister);
+
+ /**
+ * Deregister the nameMapper and makes sure that the nameMapper can't be registered in the future..
+ * @param classToDeny nameMapper to deny, this is, deregister and doesn't allow registration in the future.
+ */
void deny(Class<? extends NameMapper> classToDeny);
}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/AbstractHtmlCoreComponentsComponentInitializer.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/initializer/component/AbstractHtmlCoreComponentsComponentInitializer.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/AbstractHtmlCoreComponentsComponentInitializer.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/AbstractHtmlCoreComponentsComponentInitializer.java Mon Aug 30 12:12:55 2010
@@ -41,12 +41,24 @@ import javax.faces.component.html.HtmlIn
import java.util.Map;
/**
+ * Basic implementation of a ComponentInitializer that could be used for concrete versions in the validation modules or
+ * custom made ComponentInitializer.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
@UsageInformation(UsageCategory.REUSE)
public abstract class AbstractHtmlCoreComponentsComponentInitializer implements ComponentInitializer
{
+ /**
+ * When the component is one of the standard input components, the max length attribute is configured and the
+ * required attribute is configured when empty fields need to be validated and required initialization is active
+ * by the configuration.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component that should be initialised
+ * @param metaData Information from the MetaDataEntry in the abstract form.
+ */
public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData)
{
if(processComponent(uiComponent))
@@ -60,15 +72,35 @@ public abstract class AbstractHtmlCoreCo
}
}
+ /**
+ * Checks if in the configuration is set that empty fields should be validated.
+ *
+ * @return Do we need to validate empty fields.
+ */
protected boolean validateEmptyFields()
{
return ExtValUtils.validateEmptyFields();
}
+ /**
+ * Concrete implementation need to determine if they set the required attribute based on the supplied information.
+ * Be aware that this method is only called when certain conditions are met, see configureComponent method.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The UIComponent which should be configured.
+ * @param metaData Information from the MetaDataEntry in the abstract form.
+ */
protected abstract void configureRequiredAttribute(FacesContext facesContext,
UIComponent uiComponent,
Map<String, Object> metaData);
+ /**
+ * When the component is an editableValueHolder which is supported, the method returns true so that component
+ * initialization can take place.
+ *
+ * @param uiComponent The UIComponent which should be configured.
+ * @return Should the component be initialized.
+ */
protected boolean processComponent(UIComponent uiComponent)
{
return uiComponent instanceof HtmlInputText ||
@@ -101,6 +133,15 @@ public abstract class AbstractHtmlCoreCo
return !(isReadOnly || isDisabled);
}
+ /**
+ * Set the max length specified in the validation constraints, if any, as value of the maxLength attribute of the
+ * component. The length is searched with the value CommonMetaDataKeys.MAX_LENGTH as key and is only set when the
+ * component is a HtmlInputText or a HtmlInputSecret.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component to configure.
+ * @param metaData Information from the MetaDataEntry in the abstract form.
+ */
protected void configureMaxLengthAttribute(FacesContext facesContext,
UIComponent uiComponent,
Map<String, Object> metaData)
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/ComponentInitializer.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/initializer/component/ComponentInitializer.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/ComponentInitializer.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/ComponentInitializer.java Mon Aug 30 12:12:55 2010
@@ -29,7 +29,7 @@ import java.util.Map;
/**
* Allows to initialize components beforeEncodeBegin.<br/>
* e.g.: you can add information for client-side validation mechanisms,...
- *
+ * The MetaDataTransformers are used to convert MetaDataEntry to the map based information supplied here.
* @author Gerhard Petracek
* @since 1.x.1
*/
@@ -37,5 +37,11 @@ import java.util.Map;
@UsageInformation(UsageCategory.API)
public interface ComponentInitializer
{
+ /**
+ * Initialize components with information from the meta-data.
+ * @param facesContext The JSF Context
+ * @param uiComponent The component that should be initialised
+ * @param metaData Information from the MetaDataEntry in the abstract form.
+ */
void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData);
}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfiguration.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/initializer/configuration/StaticConfiguration.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfiguration.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfiguration.java Mon Aug 30 12:12:55 2010
@@ -24,12 +24,26 @@ import org.apache.myfaces.extensions.val
import java.util.List;
/**
+ * Mechanism to define some implementation classes of ExtVal concept. The configuration resembles the services
+ * approach.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
@UsageInformation(UsageCategory.API)
public interface StaticConfiguration<T, R>
{
+ /**
+ * Specify the file location where configuration can be found.
+ *
+ * @param path file location of the configuration.
+ */
void setSourceOfMapping(String path);
+
+ /**
+ * Retrieves the information. The return result can be cached for performance reasons. The method should always
+ * return an object and never null.
+ * @return List of configuration entries.
+ */
List<StaticConfigurationEntry<T, R>> getMapping();
}
\ No newline at end of file
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationEntry.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/initializer/configuration/StaticConfigurationEntry.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationEntry.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationEntry.java Mon Aug 30 12:12:55 2010
@@ -22,6 +22,8 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageInformation;
/**
+ * POJO data class to store the mapping between source and target by using generics.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.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/initializer/configuration/StaticConfigurationNames.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java Mon Aug 30 12:12:55 2010
@@ -22,6 +22,8 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageCategory;
/**
+ * List of all concepts where a StaticConfiguration is/can be defined for.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticInMemoryConfiguration.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/initializer/configuration/StaticInMemoryConfiguration.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticInMemoryConfiguration.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticInMemoryConfiguration.java Mon Aug 30 12:12:55 2010
@@ -25,6 +25,10 @@ import java.util.List;
import java.util.ArrayList;
/**
+ * Implementation of the StaticConfiguration interface that can be used to programmatically add some implementation
+ * entries.
+ * See for an example org.apache.myfaces.extensions.validator.PropertyValidationModuleStartupListener
+ * #addSkipValidationSupport().
* @author Gerhard Petracek
* @since 1.x.1
*/
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticResourceBundleConfiguration.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/initializer/configuration/StaticResourceBundleConfiguration.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticResourceBundleConfiguration.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticResourceBundleConfiguration.java Mon Aug 30 12:12:55 2010
@@ -27,6 +27,8 @@ import java.util.Enumeration;
import java.util.ArrayList;
/**
+ * Implementation of the StaticConfiguration interface that uses resource bundles to load the information.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractValidationInterceptor.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/interceptor/AbstractValidationInterceptor.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractValidationInterceptor.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractValidationInterceptor.java Mon Aug 30 12:12:55 2010
@@ -47,6 +47,12 @@ import java.util.HashMap;
import java.util.logging.Level;
/**
+ * A basic implementation of a RendererInterceptor for validating fields. It adds some extension point for subclasses
+ * and performs tasks like : <br/>
+ * - storing field values (recordProcessedInformation) <br/>
+ * - resetting required information property UIComponent <br/>
+ * - calling before and after Validation interceptors <br/>
+ * - etc ...
* @author Gerhard Petracek
* @since x.x.3
*/
@@ -55,12 +61,28 @@ public abstract class AbstractValidation
{
private ELHelper elHelper;
+ /**
+ * Defines if the required option of UIComponents need to be set to false after a decode. It is one of the
+ * conditions that determine if the false is set. see afterDecode method in this class.
+ *
+ * @return false when required property should not be reset to false.
+ */
protected boolean isRequiredInitializationSupported()
{
return false;
}
@Override
+ /**
+ * Sets required property of UIComponent to false after decoding when the isRequiredResetActivated and
+ * isRequiredInitializationActive methods of ExtValUtils indicate that required property should be set and reset.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param renderer The renderer that will be called for the apply request values JSF phase.
+ * @throws SkipAfterInterceptorsException Can be thrown to stop the execution of the afterDecode
+ * methods of the registered interceptors.
+ */
public void afterDecode(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
throws SkipAfterInterceptorsException
{
@@ -77,6 +99,19 @@ public abstract class AbstractValidation
}
@Override
+ /**
+ * When the component should be processed and component initialization is not deactivated, the initialization of
+ * the UIComponent is performed. The initialization can be that the required and length properties are set based
+ * on the annotations found on the property of the target property.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param renderer The renderer that will be called for the render response JSF phase.
+ * @throws IOException In case the response writer is accessed and there was an IO problem.
+ * @throws SkipBeforeInterceptorsException Can be thrown to stop the execution of the beforeEncodeBegin methods of
+ * the registered interceptors.
+ * @throws SkipRendererDelegationException Can be thrown to stop the execution of the beforeEncodeBegin method.
+ */
public void beforeEncodeBegin(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException
{
@@ -86,9 +121,40 @@ public abstract class AbstractValidation
}
}
+ /**
+ * Initialize the component based on the annotations found on the property of the target property. The properties
+ * that can be set are for instance the length and required attribute of the Component.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ */
protected abstract void initComponent(FacesContext facesContext, UIComponent uiComponent);
@Override
+ /**
+ * The method performs the validation of the field and calls the registered interceptors regarding the validation.
+ * The main steps are :<br/>
+ * - Get the converted value from the renderer (possibly cached by the RendererProxy)<br/>
+ * - Store the value for use in the cross validation options <br/>
+ * - Adjust the converted value for interpret empty values as null.<br/>
+ * - Execute the beforeValidation method of the registered PropertyValidationInterceptor's. <br/>
+ * - Perform the validation when the PropertyValidationInterceptor have indicate it that it should be performed.
+ * <br/>
+ * - When a validation error occurred, ask the ViolationSeverityInterpreter if this validation should result in an
+ * exception <br/>
+ * - Execute the afterValidation method of the registered PropertyValidationInterceptor's. (when validation actually
+ * tooks place)
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param submittedValue The submitted value
+ * @param renderer The renderer that will be called for the apply request values JSF phase.
+ * @throws ConverterException ExtVal validation strategies can throw ValidationExceptions which are converted by
+ * AbstractValidationInterceptor
+ * @throws SkipBeforeInterceptorsException Can be thrown to stop the execution of the beforeGetConvertedValue
+ * methods of the registered interceptors.
+ * @throws SkipRendererDelegationException Can be thrown to stop the execution of the beforeGetConvertedValue
+ * method.
+ */
public void beforeGetConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o, Renderer wrapped)
throws ConverterException, SkipBeforeInterceptorsException, SkipRendererDelegationException
{
@@ -117,7 +183,7 @@ public abstract class AbstractValidation
if(recordProcessedInformation())
{
- //recorde user input e.g. for cross-component validation
+ //record user input e.g. for cross-component validation
for(ProcessedInformationRecorder recorder : ExtValContext.getContext().getProcessedInformationRecorders())
{
recorder.recordUserInput(uiComponent, convertedObject);
@@ -162,18 +228,40 @@ public abstract class AbstractValidation
}
}
+ /**
+ * Execute the beforeValidation method of the registered PropertyValidationInterceptor's.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The UIComponent which is processed.
+ * @param value The value to validate
+ * @return true when validation can proceed, false otherwise.
+ */
protected boolean processBeforeValidation(FacesContext facesContext, UIComponent uiComponent, Object value)
{
return ExtValUtils.executeGlobalBeforeValidationInterceptors(facesContext, uiComponent, value,
PropertyInformation.class.getName(), getPropertyInformation(facesContext, uiComponent), getModuleKey());
}
+ /**
+ * Execute the afterValidation method of the registered PropertyValidationInterceptor's.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The UIComponent which is processed.
+ * @param value The value which has just been validated.
+ */
protected void processAfterValidation(FacesContext facesContext, UIComponent uiComponent, Object value)
{
ExtValUtils.executeGlobalAfterValidationInterceptors(facesContext, uiComponent, value,
PropertyInformation.class.getName(), getPropertyInformation(facesContext, uiComponent), getModuleKey());
}
+ /**
+ * Get the property information of the UIComponent from the MetaDataExtractor.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The UIComponent which is processed.
+ * @return All the information about the UIComponent (like annotations, custom info from Extractor, etc)
+ */
protected PropertyInformation getPropertyInformation(FacesContext facesContext, UIComponent uiComponent)
{
Map<String, Object> properties = getPropertiesForComponentMetaDataExtractor(uiComponent);
@@ -183,6 +271,13 @@ public abstract class AbstractValidation
return metaDataExtractor.extract(facesContext, uiComponent);
}
+ /**
+ * Create the properties which will be used by the selection of the MetaDataExtractor. By default it adds the
+ * ModuleKey (if available) and the UIComponent.
+ *
+ * @param uiComponent The UIComponent which is processed.
+ * @return properties used by the selection of the MetaDataExtractor
+ */
protected Map<String, Object> getPropertiesForComponentMetaDataExtractor(UIComponent uiComponent)
{
Map<String, Object> properties = new HashMap<String, Object>();
@@ -195,8 +290,22 @@ public abstract class AbstractValidation
return properties;
}
+ /**
+ * Implementations must return the MetaDataExtractor that will perform the extraction of the meta data from the
+ * component. The component itself is present in the properties map when it would influence the type of Extractor
+ * which is returned.
+ *
+ * @param properties Properties that can be used to determine the extractor which is returned.
+ * @return The MetaDataExtractor used for performing the xtraction of the meta data from the component.
+ */
protected abstract MetaDataExtractor getComponentMetaDataExtractor(Map<String, Object> properties);
+ /**
+ * Converts an empty String to null when the parameter interpretEmptyStringValuesAsNull is set.
+ *
+ * @param convertedObject Converted objected
+ * @return Adjusted value that should be used from now on as converted value.
+ */
protected Object transformValueForValidation(Object convertedObject)
{
if ("".equals(convertedObject) && interpretEmptyStringValuesAsNull())
@@ -207,6 +316,14 @@ public abstract class AbstractValidation
return convertedObject;
}
+ /**
+ * Determines if the value should be validated in case it is empty (null or no characters in string). If it happens
+ * to be empty and the configuration indicates that we don't need to validate such values, the method return false
+ * and no ExtVal validations will be performed.
+ *
+ * @param convertedObject The converted value.
+ * @return Should the value be converted?
+ */
protected boolean validateValue(Object convertedObject)
{
if(isValueToValidateEmpty(convertedObject) && !validateEmptyFields())
@@ -220,29 +337,62 @@ public abstract class AbstractValidation
return true;
}
+ /**
+ * Defines if a value is empty. The definition of empty is that it is null or has no characters in the String value.
+ * @param convertedObject The converted value.
+ * @return is the value empty?
+ */
protected boolean isValueToValidateEmpty(Object convertedObject)
{
return convertedObject == null || "".equals(convertedObject);
}
+ /**
+ * Check if empty fields should be validated based on the configuration parameter javax.faces.VALIDATE_EMPTY_FIELDS.
+ * @return Do we need to validate empty fields.
+ */
protected boolean validateEmptyFields()
{
return ExtValUtils.validateEmptyFields();
}
+ /**
+ * Check if empty string values should be interpret as null based on the configuration parameter
+ * javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL.
+ *
+ * @return Do we need to interpret empty String values as null.
+ */
protected boolean interpretEmptyStringValuesAsNull()
{
return ExtValUtils.interpretEmptyStringValuesAsNull();
}
+ /**
+ * Perform the actual validation of the value.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The UIComponent which is processed.
+ * @param convertedObject The adjusted converted value.
+ */
protected abstract void processValidation(
FacesContext facesContext, UIComponent uiComponent, Object convertedObject);
+ /**
+ * Determines if the value of the UIComponent needs to be processed. By default it is so when the component is a
+ * EditableValueHolder and the value binding can be interpreted.
+ *
+ * @param uiComponent The UIComponent which is processed.
+ * @return Do we need to process the UIComponent
+ */
protected boolean processComponent(UIComponent uiComponent)
{
return uiComponent instanceof EditableValueHolder && isValueBindingOfComponentValid(uiComponent);
}
+ /**
+ * Returns the ELHelper to be used in the process of the validation. It is cached for performance reasons.
+ * @return The ELHelper.
+ */
protected ELHelper getELHelper()
{
if(this.elHelper == null)
@@ -252,6 +402,12 @@ public abstract class AbstractValidation
return this.elHelper;
}
+ /**
+ * Determines if the value binding of the component is valid. That is, it can be processed by the ELHelper.
+ * {@see org.apache.myfaces.extensions.validator.core.el.ELHelper#getPropertyDetailsOfValueBinding(javax.faces.component.UIComponent)}
+ * @param uiComponent The UIComponent which is processed.
+ * @return Is the value binding correct, interpretable by ExtVal.
+ */
private boolean isValueBindingOfComponentValid(UIComponent uiComponent)
{
try
@@ -264,23 +420,42 @@ public abstract class AbstractValidation
}
}
+ /**
+ * Checks from the configuration if the component initialization is deactivated.
+ * @return Is the component initialization deactivated.
+ */
private boolean isComponentInitializationDeactivated()
{
return ExtValCoreConfiguration.get().deactivateComponentInitialization();
}
+ /**
+ * Will the converted value be stored for the cross validation feature. By default it is not stored.
+ * @return will the the converted value be stored.
+ */
protected boolean recordProcessedInformation()
{
//override if needed
return false;
}
+ /**
+ * Identification of the validation module. By default it returns null so no module is assigned.
+ * @return Identification of the validation module.
+ */
protected Class getModuleKey()
{
//override if needed
return null;
}
+ /**
+ * Returns the properties which will be made available to interceptors. By default the moduleKey and the UIComponent
+ * itself is added.
+ *
+ * @param uiComponent The UIComponent which is processed.
+ * @return properties for the interceptors.
+ */
protected Map<String, Object> getInterceptorProperties(UIComponent uiComponent)
{
Map<String, Object> result = new HashMap<String, Object>();
@@ -294,6 +469,11 @@ public abstract class AbstractValidation
return result;
}
+ /**
+ * Store the interceptor properties in the RendererInterceptorPropertyStorage.
+ *
+ * @param uiComponent The UIComponent which is processed.
+ */
private void setRendererInterceptorProperties(UIComponent uiComponent)
{
RendererInterceptorPropertyStorage interceptorPropertyStorage = getRendererInterceptorPropertyStorage();
@@ -305,6 +485,10 @@ public abstract class AbstractValidation
}
}
+ /**
+ * remove the interceptor properties from the RendererInterceptorPropertyStorage.
+ * @param uiComponent The UIComponent which is processed.
+ */
private void resetRendererInterceptorProperties(UIComponent uiComponent)
{
RendererInterceptorPropertyStorage interceptorPropertyStorage = getRendererInterceptorPropertyStorage();
@@ -315,6 +499,11 @@ public abstract class AbstractValidation
}
}
+ /**
+ * Retrieves the RendererInterceptorPropertyStorage defined in the ExtVal system.
+ *
+ * @return The RendererInterceptorPropertyStorage
+ */
private RendererInterceptorPropertyStorage getRendererInterceptorPropertyStorage()
{
return ExtValUtils.getStorage(RendererInterceptorPropertyStorage.class,
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ComponentInitializationAwareMetaDataExtractionInterceptor.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/interceptor/ComponentInitializationAwareMetaDataExtractionInterceptor.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ComponentInitializationAwareMetaDataExtractionInterceptor.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ComponentInitializationAwareMetaDataExtractionInterceptor.java Mon Aug 30 12:12:55 2010
@@ -25,6 +25,9 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.util.JsfUtils;
/**
+ * This is an abstract base class that can be used to define a MetaDataExtractionInterceptor that should only be
+ * invoked when the MetaDataExtraction happens in the Render Response Phase.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
@@ -40,5 +43,10 @@ public abstract class ComponentInitializ
}
}
+ /**
+ * Perform any additional actions on the PropertyInformation data after the extraction is performed and before it is
+ * used to determine UIComponents adjustments.
+ * @param propertyInformation he information entry which contains information about the property
+ */
protected abstract void afterExtractingForComponentInitialization(PropertyInformation propertyInformation);
}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/MetaDataExtractionInterceptor.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/interceptor/MetaDataExtractionInterceptor.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/MetaDataExtractionInterceptor.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/MetaDataExtractionInterceptor.java Mon Aug 30 12:12:55 2010
@@ -24,6 +24,9 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.core.InvocationOrderSupport;
/**
+ * Allows to intercept into the work of the
+ * {@link org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor}
+ *
* @author Gerhard Petracek
* @since 1.x.2
*/
@@ -32,7 +35,9 @@ import org.apache.myfaces.extensions.val
public interface MetaDataExtractionInterceptor
{
/**
- *
+ * Perform any additional actions on the PropertyInformation data after the extraction is performed and before it is
+ * used to determine validation strategies or UIComponent adjustments.
+ *
* @param propertyInformation the information entry which contains information about the property
*/
void afterExtracting(PropertyInformation propertyInformation);
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/PropertyValidationInterceptor.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/interceptor/PropertyValidationInterceptor.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/PropertyValidationInterceptor.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/PropertyValidationInterceptor.java Mon Aug 30 12:12:55 2010
@@ -28,6 +28,8 @@ import javax.faces.component.UIComponent
import java.util.Map;
/**
+ * Interface to define interceptors that can perform logic before and after the validations are executed.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
@@ -36,6 +38,12 @@ import java.util.Map;
public interface PropertyValidationInterceptor extends ValidationParameter
{
/**
+ * Executed before the RendererInterceptor calls the validation Strategies to validate the converted value.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param convertedObject The converted object
+ * @param properties Additional information of interest. Contains the PropertyInformation object.
* @return false if the validation process should be bypassed
*/
boolean beforeValidation(FacesContext facesContext,
@@ -44,8 +52,12 @@ public interface PropertyValidationInter
Map<String, Object> properties);
/**
- * processed if validation was executed
- * in contrast to ValidationExceptionInterceptor it gets executed in any case
+ * Processed if validation was executed
+ * in contrast to ValidationExceptionInterceptor it gets executed in any case.
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param convertedObject The converted object
+ * @param properties Additional information of interest. Contains the PropertyInformation object.
*/
void afterValidation(FacesContext facesContext,
UIComponent uiComponent,
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/RendererInterceptor.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/interceptor/RendererInterceptor.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/RendererInterceptor.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/RendererInterceptor.java Mon Aug 30 12:12:55 2010
@@ -42,42 +42,169 @@ public interface RendererInterceptor
{
String getInterceptorId();
+ /**
+ * Defines the value for the converted value that should be returned by the getConvertedValue method of the
+ * Renderer in case the there was a SkipRendererDelegationException thrown.
+ * @param skipRendererDelegationException The exception thrown to abort RendererInterceptor execution.
+ * @param currentReturnValue The converted value that is defined at this time. This can be null also when the
+ * user has inputted some text in case of an Exception during the beforeConvertedValue 'phase'
+ * @return value that should be used as converted value.
+ */
Object getReturnValueOnSkipRendererDelegationException(
SkipRendererDelegationException skipRendererDelegationException, Object currentReturnValue);
/*
* before
*/
+
+ /**
+ * The "before decode phase" of ExtVal. The code is executed before the decode method is executed of the Renderer.
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param renderer The renderer that will be called for the apply request values JSF phase.
+ * @throws SkipBeforeInterceptorsException Can be thrown to stop the execution of the beforeDecode methods of the
+ * registered interceptors.
+ * @throws SkipRendererDelegationException Can be thrown to stop the execution of the beforeDecode method and allows
+ * additional interceptors to run and change the converted value.
+ */
void beforeDecode(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
throws SkipBeforeInterceptorsException, SkipRendererDelegationException;
+ /**
+ * The "before encode phase" of ExtVal. The code is executed before the encodeBegin method is executed of the
+ * Renderer.
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param renderer The renderer that will be called for the render response JSF phase.
+ * @throws IOException In case the response writer is accessed and there was an IO problem.
+ * @throws SkipBeforeInterceptorsException Can be thrown to stop the execution of the beforeEncodeBegin methods of
+ * the registered interceptors.
+ * @throws SkipRendererDelegationException Can be thrown to stop the execution of the beforeEncodeBegin method.
+ */
void beforeEncodeBegin(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException;
+ /**
+ * The "before encode children phase" of ExtVal. The code is executed before the encodeChildren method is executed
+ * of the Renderer.
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param renderer The renderer that will be called for the render response JSF phase.
+ * @throws IOException In case the response writer is accessed and there was an IO problem.
+ * @throws SkipBeforeInterceptorsException Can be thrown to stop the execution of the beforeEncodeChildren methods
+ * of the registered interceptors.
+ * @throws SkipRendererDelegationException Can be thrown to stop the execution of the beforeEncodeChildren method.
+ */
void beforeEncodeChildren(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException;
+ /**
+ * The "before encode end phase" of ExtVal. The code is executed before the encodeEnd method is executed
+ * of the Renderer.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param renderer The renderer that will be called for the render response JSF phase.
+ * @throws IOException In case the response writer is accessed and there was an IO problem.
+ * @throws SkipBeforeInterceptorsException Can be thrown to stop the execution of the beforeEncodeEnd methods of the
+ * registered interceptors.
+ * @throws SkipRendererDelegationException Can be thrown to stop the execution of the beforeEncodeEnd method.
+ */
void beforeEncodeEnd(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException;
- void beforeGetConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o, Renderer renderer)
+ /**
+ * The "before get converted value phase" of ExtVal. The code is executed before the getConvertedValue method is
+ * executed of the Renderer.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param submittedValue The submitted value
+ * @param renderer The renderer that will be called for the apply request values JSF phase.
+ * @throws ConverterException ExtVal validation strategies can throw ValidationExceptions which are converted by
+ * AbstractValidationInterceptor
+ * @throws SkipBeforeInterceptorsException Can be thrown to stop the execution of the beforeGetConvertedValue
+ * methods of the registered interceptors.
+ * @throws SkipRendererDelegationException Can be thrown to stop the execution of the beforeGetConvertedValue
+ * method.
+ */
+ void beforeGetConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object submittedValue,
+ Renderer renderer)
throws ConverterException, SkipBeforeInterceptorsException, SkipRendererDelegationException;
/*
* after
*/
+
+ /**
+ * The "after decode phase" of ExtVal. The code is executed after the decode method is executed
+ * of the Renderer.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param renderer The renderer that will be called for the apply request values JSF phase.
+ * @throws SkipAfterInterceptorsException Can be thrown to stop the execution of the afterDecode
+ * methods of the registered interceptors.
+ */
void afterDecode(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
throws SkipAfterInterceptorsException;
+ /**
+ * The "after encode begin phase" of ExtVal. The code is executed after the encodeBegin method is executed
+ * of the Renderer.
+ *
+ * @param facesContext The JSF context
+ * @param uiComponent In case the response writer is accessed and there was an IO problem.
+ * @param renderer The renderer that will be called for the render response JSF phase.
+ * @throws IOException In case the response writer is accessed and there was an IO problem.
+ * @throws SkipAfterInterceptorsException Can be thrown to stop the execution of the afterEncodeBegin
+ * methods of the registered interceptors.
+ */
void afterEncodeBegin(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
throws IOException, SkipAfterInterceptorsException;
+ /**
+ * The "after encode children phase" of ExtVal. The code is executed after the encodeChildren method is executed
+ * of the Renderer.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param renderer The renderer that will be called for the render response JSF phase.
+ * @throws IOException In case the response writer is accessed and there was an IO problem.
+ * @throws SkipAfterInterceptorsException Can be thrown to stop the execution of the afterEncodeChildren
+ * methods of the registered interceptors.
+ */
void afterEncodeChildren(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
throws IOException, SkipAfterInterceptorsException;
+ /**
+ * The "after encode end phase" of ExtVal. The code is executed after the encodeEnd method is executed
+ * of the Renderer.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param renderer The renderer that will be called for the render response JSF phase.
+ * @throws IOException In case the response writer is accessed and there was an IO problem.
+ * @throws SkipAfterInterceptorsException Can be thrown to stop the execution of the afterEncodeEnd
+ * methods of the registered interceptors.
+ */
void afterEncodeEnd(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
throws IOException, SkipAfterInterceptorsException;
- void afterGetConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o, Renderer renderer)
+ /**
+ * The "after get converted value phase" of ExtVal. The code is executed after the getConvertedValue method is
+ * executed of the Renderer.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The component which is processed
+ * @param submittedValue The submitted value
+ * @param renderer The renderer that will be called for the render response JSF phase.
+ * @throws ConverterException ExtVal validation strategies can throw ValidationExceptions which are converted by
+ * AbstractValidationInterceptor
+ * @throws SkipAfterInterceptorsException Can be thrown to stop the execution of the afterGetConvertedValue
+ * methods of the registered interceptors.
+ */
+ void afterGetConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object submittedValue, Renderer
+ renderer)
throws ConverterException, SkipAfterInterceptorsException;
}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.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/interceptor/ValidationExceptionInterceptor.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java Mon Aug 30 12:12:55 2010
@@ -28,7 +28,7 @@ import javax.faces.component.UIComponent
import javax.faces.validator.ValidatorException;
/**
- * Allows to intercept validatior exceptions.
+ * Allows to intercept validator exceptions.
*
* @author Gerhard Petracek
* @since 1.x.1
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ViolationExceptionInterceptor.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/interceptor/ViolationExceptionInterceptor.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ViolationExceptionInterceptor.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ViolationExceptionInterceptor.java Mon Aug 30 12:12:55 2010
@@ -31,6 +31,8 @@ import javax.faces.validator.ValidatorEx
import javax.faces.context.FacesContext;
/**
+ * A validation interceptor that sets the valid property of the uiComponent to false.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/AbstractCustomNameMapper.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/mapper/AbstractCustomNameMapper.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/AbstractCustomNameMapper.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/AbstractCustomNameMapper.java Mon Aug 30 12:12:55 2010
@@ -24,7 +24,8 @@ import org.apache.myfaces.extensions.val
import java.util.logging.Logger;
/**
- * A generic implementation. Subclasses just have to now the fully qualified name of the name mapper.
+ * A generic implementation of a custom name mapper that can be configured using configuration. Subclasses just have
+ * to specify the fully qualified name of the configured name mapper.
*
* NameMappers are stateless.
*
@@ -42,6 +43,10 @@ public abstract class AbstractCustomName
logger.fine(getClass().getName() + " instantiated");
}
+ /**
+ * {@inheritDoc}
+ * When no name mapper is configured, the method returns null.
+ */
public String createName(T source)
{
if (customNameMapper == null)
@@ -57,5 +62,10 @@ public abstract class AbstractCustomName
return (customNameMapper != null) ? customNameMapper.createName(source) : null;
}
+ /**
+ * Returns the fully qualified class name of the configured name mapper that must be used.
+ *
+ * @return fully qualified class name of a custom name mapper.
+ */
protected abstract String getCustomNameMapperClassName();
}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/NameMapper.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/mapper/NameMapper.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/NameMapper.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/NameMapper.java Mon Aug 30 12:12:55 2010
@@ -26,7 +26,8 @@ import org.apache.myfaces.extensions.val
* Interface for name mappers.
* A name mapper calculates a name for a given source object.
* e.g. Meta-Data Key (e.g.: annotation class name) -> ValidationStrategy
- *
+ * NameMappers are stateless.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
@@ -34,5 +35,10 @@ import org.apache.myfaces.extensions.val
@UsageInformation(UsageCategory.API)
public interface NameMapper<T>
{
+ /**
+ * Returns the name for the source or null when this name mapper doesn't support the type of source.
+ * @param source Object for which the name must be created.
+ * @return name or null when source isn't supported.
+ */
String createName(T source);
}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/SubMapperAwareNameMapper.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/mapper/SubMapperAwareNameMapper.java?rev=990777&r1=990776&r2=990777&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/SubMapperAwareNameMapper.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/SubMapperAwareNameMapper.java Mon Aug 30 12:12:55 2010
@@ -22,7 +22,7 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageInformation;
/**
- * interface for name-mappers which have to delegate to other (sub-)name-mappers
+ * Interface for name-mappers which have to delegate to other (sub-)name-mappers.
*
* @author Gerhard Petracek
* @since x.x.3
@@ -30,5 +30,9 @@ import org.apache.myfaces.extensions.val
@UsageInformation(UsageCategory.API)
public interface SubMapperAwareNameMapper<T> extends NameMapper<T>
{
+ /**
+ * Add a (sub-)name mapper to list to delegate to.
+ * @param nameMapper nameMapper to add
+ */
void addNameMapper(NameMapper<T> nameMapper);
}
\ No newline at end of file