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:06:45 UTC
svn commit: r990776 [2/3] - in
/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator:
core/el/ core/factory/ core/initializer/component/
core/initializer/configuration/ core/interceptor/ core/mapper/ core/metada...
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapter.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapter.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapter.java Mon Aug 30 12:06:42 2010
@@ -23,7 +23,7 @@ import org.apache.myfaces.extensions.val
/**
* it's just a helper for proxies - you just need it, if you define the equivalent validation strategy as bean and
- * e.g. spring creates a proxy for it.
+ * e.g. spring creates a proxy for it. It is not linked to jsr303.
*
* if there is also a proxy for the extractor you can use the className property to manually repeat the
* full qualified class name.
@@ -36,5 +36,9 @@ import org.apache.myfaces.extensions.val
@UsageInformation({UsageCategory.REUSE})
public interface BeanMetaDataTransformerAdapter extends MetaDataTransformer
{
+ /**
+ * Returns the MetaDataTransformer class name.
+ * @return Class name of the MetaDataTransformer
+ */
String getMetaDataTransformerClassName();
}
\ No newline at end of file
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java Mon Aug 30 12:06:42 2010
@@ -27,7 +27,7 @@ import java.util.logging.Logger;
/**
* it's just a helper for proxies - you just need it, if you define the equivalent validation strategy as bean and
- * e.g. spring creates a proxy for it.
+ * e.g. spring creates a proxy for it. It is not linked to jsr303.
*
* if there is also a proxy for the transformer you can use the className property to manually repeat the
* full qualified class name.
@@ -45,6 +45,10 @@ public class BeanMetaDataTransformerAdap
private MetaDataTransformer metaDataTransformer;
private String metaDataTransformerClassName;
+ /**
+ * {@inheritDoc}
+ * Delegates the conversion of the MetaData to the metaDataTransformer encapsulated by the adapter.
+ */
public Map<String, Object> convertMetaData(MetaDataEntry metaDataEntry)
{
return this.metaDataTransformer.convertMetaData(metaDataEntry);
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.java Mon Aug 30 12:06:42 2010
@@ -26,8 +26,8 @@ import java.util.Map;
/**
* Allows to transform concrete meta-data to a more abstract form.<br/>
- * e.g.: @Required, @Column(nullable = false,...), @Length(minimum = 1), ... -> required = true
- *
+ * e.g.: @Required, @Column(nullable = false,...), @Length(minimum = 1), ... -> required = true <br/>
+ * For the keys of the map the constants in the CommonMetaDataKeys can be used.
* @author Gerhard Petracek
* @since 1.x.1
*/
@@ -35,5 +35,10 @@ import java.util.Map;
//*Transformer instead of *Converter to avoid naming confusion
public interface MetaDataTransformer
{
+ /**
+ * Convert the information from MetaDataEntry into the abstract format.
+ * @param metaData The MetaDataEntry to process.
+ * @return Map with the information abstract format.
+ */
Map<String, Object> convertMetaData(MetaDataEntry metaData);
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java Mon Aug 30 12:06:42 2010
@@ -18,10 +18,14 @@
*/
package org.apache.myfaces.extensions.validator.core.property;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
/**
* @author Gerhard Petracek
* @since 1.x.1
*/
+@UsageInformation(UsageCategory.INTERNAL)
public class PropertyDetails
{
//forms the id for cross-validation within complex components
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformation.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformation.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformation.java Mon Aug 30 12:06:42 2010
@@ -23,18 +23,60 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
/**
+ * Contains all the information on a property, like annotations, object and any custom information we want to keep.
+ * MetaDataEntry's are considered as a special kind of information and separate methods are created for them.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
@UsageInformation(UsageCategory.API)
public interface PropertyInformation
{
+ /**
+ * Verifies if we have information for a certain key. There are some predefined keys in PropertyInformationKeys.
+ * @param key key of the information.
+ * @return Is there information for that key maintained.
+ */
boolean containsInformation(String key);
+
+ /**
+ * Get the information for the specified key. When there isn't any information available, it returns null.
+ * @param key key of the information.
+ * @return Information linked to the key or null when no information is found for the key.
+ */
Object getInformation(String key);
+
+ /**
+ * Get the information for the specified key casted to a certain targetClass type.
+ * @see PropertyInformation#getInformation(java.lang.String)
+ * @param key key of the information.
+ * @param targetClass target class type
+ * @param <T> Type declaration for generics.
+ * @return Information linked to the key or null when no information is found for the key.
+ */
<T> T getInformation(String key, Class<T> targetClass);
+
+ /**
+ * Assign the value as information to the key.
+ * @param key key of the information.
+ * @param value value as information for the key.
+ */
void setInformation(String key, Object value);
+ /**
+ * Get all the MetaDataEntry's stored.
+ * @return MetaDataEntry's
+ */
MetaDataEntry[] getMetaDataEntries();
+
+ /**
+ * Add the MetaDataEntry to the internal structure.
+ * @param metaDataEntry MetaDataEntry to store.
+ */
void addMetaDataEntry(MetaDataEntry metaDataEntry);
+
+ /**
+ * remove all MetaDataEntry's from the internal structure.
+ */
void resetMetaDataEntries();
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/proxy/DefaultProxyHelper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/proxy/DefaultProxyHelper.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/proxy/DefaultProxyHelper.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/proxy/DefaultProxyHelper.java Mon Aug 30 12:06:42 2010
@@ -24,6 +24,8 @@ import org.apache.myfaces.extensions.val
import java.util.logging.Logger;
/**
+ * Supports CGLIB and javassist.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/proxy/ProxyHelper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/proxy/ProxyHelper.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/proxy/ProxyHelper.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/proxy/ProxyHelper.java Mon Aug 30 12:06:42 2010
@@ -22,21 +22,62 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageCategory;
/**
+ * Allows to have a helper object that deals with proxies, like CGLIB proxies, created for some objects. There are
+ * various locations where we need to know the base class or name of a prpoxy instance.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
@UsageInformation(UsageCategory.API)
public interface ProxyHelper
{
+ /**
+ * Returns the Class metadata of the proxy class. When the parameter isn't a proxy, it returns the parameter value.
+ *
+ * @param currentClass class of proxy instance or any regular class.
+ * @return base class for which the proxy was created.
+ */
Class getUnproxiedClass(Class currentClass);
+ /**
+ * Returns the Class metadata of the proxy class casted to a certain targetType. There is no check to see if the
+ * base class is actually assignable to the targetType.
+ * @see ProxyHelper#getUnproxiedClass(java.lang.Class)
+ *
+ * @param currentClass class of proxy instance or any regular class.
+ * @param targetType target class type
+ * @param <T> Type declaration for generics.
+ * @return base class for which the proxy was created.
+ */
<T> Class<T> getUnproxiedClass(Class currentClass, Class<T> targetType);
+ /**
+ * Returns the class name of the base class of the proxy.
+ * @param proxiedClass class of proxy instance or any regular class.
+ * @return class name of base class for which the proxy was created.
+ */
String getNameOfClass(Class proxiedClass);
+ /**
+ * Returns the class name of the base class of the proxy instance.
+ * @param proxiedObject proxy instance or any regular object.
+ * @return class name of base class for which the proxy was created.
+ */
String getClassNameOfObject(Object proxiedObject);
+ /**
+ * Checks if the class is a proxy class.
+ *
+ * @param currentClass proxy class to check.
+ * @return is it a proxy class or regular class.
+ */
boolean isProxiedClass(Class currentClass);
+ /**
+ * Checks if this object is a proxy.
+ *
+ * @param proxiedObject object to check.
+ * @return is it a proxy or regular object.
+ */
boolean isProxiedObject(Object proxiedObject);
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.java Mon Aug 30 12:06:42 2010
@@ -32,5 +32,11 @@ import javax.faces.component.UIComponent
@UsageInformation(UsageCategory.API)
public interface ProcessedInformationRecorder
{
+ /**
+ * Allows to store the converted value for the uiComponent.
+ *
+ * @param uiComponent JSF UI Component
+ * @param value Converted user value.
+ */
void recordUserInput(UIComponent uiComponent, Object value);
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/AbstractRenderKitWrapperFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/AbstractRenderKitWrapperFactory.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/AbstractRenderKitWrapperFactory.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/AbstractRenderKitWrapperFactory.java Mon Aug 30 12:06:42 2010
@@ -27,7 +27,8 @@ import javax.faces.render.RenderKit;
import java.util.logging.Logger;
/**
- * Base for all RenderKitWrapperFactories to force a specific behaviour
+ * Base for all RenderKitWrapperFactories to force a specific behaviour. Subclasses need to specify the logic to create
+ * the wrappers.
*
* @author Gerhard Petracek
* @since 1.x.1
@@ -45,6 +46,12 @@ public abstract class AbstractRenderKitW
logger.fine(getClass().getName() + " instantiated");
}
+ /**
+ * Adds the renderKitWrapperFactory to this instance. If it has already a RenderKitWrapperFactory, it is added to
+ * that instance, so that we have a chain of RenderKitWrapperFactory's.
+ *
+ * @param renderKitWrapperFactory The renderKitWrapperFactory to add.
+ */
public void addRenderKitWrapperFactory(AbstractRenderKitWrapperFactory renderKitWrapperFactory)
{
logger.finest(renderKitWrapperFactory.getClass().getName() + " added");
@@ -58,6 +65,9 @@ public abstract class AbstractRenderKitW
this.wrapped = renderKitWrapperFactory;
}
+ /**
+ * Set this instance an not active.
+ */
public void deactivate()
{
logger.finest(getClass().getName() + " deactivated");
@@ -65,11 +75,24 @@ public abstract class AbstractRenderKitW
this.deactivated = true;
}
+ /**
+ * Checks if this instance is not active.
+ *
+ * @return is it deactivated?
+ */
public boolean isDeactivated()
{
return deactivated;
}
+ /**
+ * Creates a RenderKit wrapper when it is not deactivated. When we have a chain of RenderKitWrapperFactory, the
+ * next instance in the chain is asked to create the RenderKit instance. The actual creation is performed by the
+ * abstract createWrapper method.
+ *
+ * @param renderKit The renderKit to use.
+ * @return The new RenderKit
+ */
public final RenderKit create(RenderKit renderKit)
{
if(isDeactivated())
@@ -92,9 +115,17 @@ public abstract class AbstractRenderKitW
return result;
}
+ /**
+ * Create the wrapper for the renderKit. The main purpose of the wrapper is that we can wrap the renderers so
+ * that additional functionality can be performed (like Validation during the decode value)
+ *
+ * @param renderKit The renderKit to use.
+ * @return Wrapped version of the RenderKit
+ */
protected abstract RenderKit createWrapper(RenderKit renderKit);
/**
+ * Checks if the JSF application is fully initialized.
* simple test for early config in case of mojarra (incl. the combination with trinidad).
* use a custom extval context impl. (see EXTVAL-58) to optimize this check for the target runtime.
* this check works for all current implementations since the jsf internals are autom. ready during a request
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java Mon Aug 30 12:06:42 2010
@@ -22,6 +22,9 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageInformation;
/**
+ * Marker exception that can be thrown by the rendererInterceptor methods to stop the execution of all after defined
+ * methods of the interceptor.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java Mon Aug 30 12:06:42 2010
@@ -22,6 +22,9 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageInformation;
/**
+ * Marker exception that can be thrown by the rendererInterceptor methods to stop the execution of all before defined
+ * methods of the interceptor.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.java Mon Aug 30 12:06:42 2010
@@ -23,6 +23,9 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageInformation;
/**
+ * Exception that can be thrown by RendererInterceptor implementations to indicate that the execution of the intercepted
+ * renderer method is aborted.
+ *
* @author Gerhard Petracek
* @since 1.x.1
*/
@@ -34,36 +37,75 @@ public class SkipRendererDelegationExcep
boolean skipOtherInterceptors = false;
private static final long serialVersionUID = 2343074077532915722L;
+ /**
+ * Initialization of empty Exception object with the skipOtherInterceptors property set to false. When exception is
+ * thrown in the getConvertedValue method, the converted value can't be altered.
+ */
public SkipRendererDelegationException()
{
}
+ /**
+ * Initialization of an empty Exception object where we can specify it other interceptors should be skipped or not.
+ * When exception is thrown in the getConvertedValue method, the converted value can't be altered.
+ *
+ * @param skipOtherInterceptors should other interceptors be skipped.
+ */
public SkipRendererDelegationException(boolean skipOtherInterceptors)
{
this.skipOtherInterceptors = skipOtherInterceptors;
}
+ /**
+ * Initialization of an Exception where we supply the interceptor where it went wrong. This interceptor is then
+ * consulted for the final value of the converted value.
+ *
+ * @param skipOtherInterceptors should other interceptors be skipped.
+ * @param rendererInterceptor interceptor that is the cause of this exception.
+ */
public SkipRendererDelegationException(boolean skipOtherInterceptors, RendererInterceptor rendererInterceptor)
{
this(skipOtherInterceptors);
this.exceptionSource = rendererInterceptor;
}
+ /**
+ * Sets an additional object with information.
+ *
+ * @param information some additional information.
+ */
public void setInformation(Object information)
{
this.information = information;
}
+ /**
+ * Gets the additional information.
+ *
+ * @return the additional information.
+ */
public Object getInformation()
{
return information;
}
+ /**
+ * Should other interceptors be skipped according to the info supplied at the time of creation of the exception.
+ *
+ * @return should other interceptors be skipped.
+ */
public boolean isSkipOtherInterceptors()
{
return skipOtherInterceptors;
}
+ /**
+ * When a rendererInterceptor is supplied at the time of the creation, it is consulted about the value the ExtVal
+ * system should return as converted value. Otherwise, it is the value of the parameter.
+ *
+ * @param currentReturnValue Converted value defined by the JSF system.
+ * @return Converted value that we should return.
+ */
public Object getReturnValueOnException(Object currentReturnValue)
{
if (this.exceptionSource != null)
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/AbstractStartupListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/AbstractStartupListener.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/AbstractStartupListener.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/AbstractStartupListener.java Mon Aug 30 12:06:42 2010
@@ -39,7 +39,8 @@ import java.util.logging.Level;
/**
* In order to execute logic just once.
- * e.g. register artifacts via api
+ * e.g. register artifacts via api. It is done before the first Restore view of the application. PhaseListeners are
+ * deregistered so that they don't have any additional impact on the application.
*
* @author Gerhard Petracek
* @since 1.x.1
@@ -64,6 +65,14 @@ public abstract class AbstractStartupLis
{
}
+ /**
+ * Is responsible for executing the one time only logic. Before the logic is performed (init method), the start-up
+ * listener has the chance of putting a configuration object in place in the initModuleConfig method.
+ * Startup listeners can be deactivated by an initialization parameter in the web.xml file and are deregistered from
+ * the JSF system. If this fails, a fallback system is in place so that the logic can't be executed more then once.
+ *
+ * @param event Jsf Phase Event info.
+ */
public void beforePhase(PhaseEvent event)
{
synchronized (AbstractStartupListener.class)
@@ -113,16 +122,31 @@ public abstract class AbstractStartupLis
}
}
+ /**
+ * Allows subclasses to put some configuration in place, before the actual initialization code is performed.
+ * @see org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration#use(org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration, boolean)
+ */
protected void initModuleConfig()
{
//override if needed
}
+ /**
+ * Logic should be executed before the RESTORE_VIEW phase.
+ *
+ * @return Restore View JSF Phase.
+ */
public PhaseId getPhaseId()
{
return PhaseId.RESTORE_VIEW;
}
+ /**
+ * Individual startup listeners can be deactivated by specifying an initialization parameter in the web.xml file
+ * with the name of the startup listener followed by ':DEACTIVATED' that have a value of 'true'.
+ *
+ * @return Is this startup listener deactivated.
+ */
protected boolean isStartupListenerDeactivated()
{
return ExtValUtils.isExtValDeactivated() ||
@@ -146,5 +170,9 @@ public abstract class AbstractStartupLis
return ExtValCoreConfiguration.get().projectStageResolver();
}
+ /**
+ * Subclasses can here put their logic that they want to be executed once, like initialization code of a module
+ * or add-on.
+ */
protected abstract void init();
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractApplicationScopeAwareStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractApplicationScopeAwareStorageManager.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractApplicationScopeAwareStorageManager.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractApplicationScopeAwareStorageManager.java Mon Aug 30 12:06:42 2010
@@ -26,7 +26,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
- * generic storage manager implementation which stores the storage implementations in the application scope
+ * Generic storage manager implementation which stores the storage implementations in the JSF application scope.
*
* @author Gerhard Petracek
* @since x.x.3
@@ -34,6 +34,11 @@ import java.util.concurrent.ConcurrentHa
@UsageInformation(REUSE)
public abstract class AbstractApplicationScopeAwareStorageManager<T> extends AbstractStorageManager<T>
{
+ /**
+ * Returns a Map of all cached instances keyed on the type of storage available in the JSF Application scope.
+ *
+ * @return Map of all cached storage Manager implementations keyed on the type of storage.
+ */
protected Map<String, T> resolveStorageMap()
{
Map applicationMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java Mon Aug 30 12:06:42 2010
@@ -26,7 +26,7 @@ import java.util.Map;
import java.util.HashMap;
/**
- * generic storage manager implementation which stores the storage implementations in the request scope
+ * Generic storage manager implementation which stores the storage implementations in the JSF request scope.
*
* @author Gerhard Petracek
* @since x.x.3
@@ -34,6 +34,11 @@ import java.util.HashMap;
@UsageInformation(REUSE)
public abstract class AbstractRequestScopeAwareStorageManager<T> extends AbstractStorageManager<T>
{
+ /**
+ * Returns a Map of all cached instances keyed on the type of storage available in the JSF Request scope.
+ *
+ * @return Map of all cached storage Manager implementations keyed on the type of storage.
+ */
protected Map<String, T> resolveStorageMap()
{
Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java Mon Aug 30 12:06:42 2010
@@ -31,7 +31,9 @@ import java.util.concurrent.CopyOnWriteA
import java.util.logging.Logger;
/**
- * generic storage manager implementation
+ * Generic storage manager implementation based on name mappers. There exists 2 subclasses,
+ * AbstractApplicationScopeAwareStorageManager and AbstractRequestScopeAwareStorageManager, that use JSF scopes to store
+ * the information.
*
* @author Gerhard Petracek
* @since x.x.3
@@ -49,6 +51,10 @@ public abstract class AbstractStorageMan
logger.fine(getClass().getName() + " instantiated");
}
+ /**
+ * {@inheritDoc}
+ * Implementation classes for the key (also named storageName), are supplied by registered nameMappers.
+ */
public T create(String storageName)
{
T storageManager;
@@ -73,6 +79,14 @@ public abstract class AbstractStorageMan
return null;
}
+ /**
+ * Retrieves the storage Manager from the cached instances, if already created previously. In the other case,
+ * a new instance is created and stored to the cache.
+ *
+ * @param storageKey The type of storage that needs to be created
+ * @param storageClassName The class name of the implementation of the storage manager.
+ * @return Implementation of the storage manager. Could be null if name mapper supplied non existent class name.
+ */
protected T resolveStorage(String storageKey, String storageClassName)
{
Map<String, T> storageMap = resolveStorageMap();
@@ -87,6 +101,11 @@ public abstract class AbstractStorageMan
return storageMap.get(storageKey);
}
+ /**
+ * Subclasses need to supply the list of all cached instances.
+ *
+ * @return Map of all cached storage Manager implementations keyed on the type of storage.
+ */
protected abstract Map<String, T> resolveStorageMap();
public synchronized void reset(String storageKey)
@@ -105,5 +124,10 @@ public abstract class AbstractStorageMan
return this.nameMapperList;
}
+ /**
+ * Returns the key where the cached instances can be found in the JSF Scope.
+ *
+ * @return key for finding the cached instances in thre JSF Scope.
+ */
public abstract String getStorageManagerKey();
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/GroupStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/GroupStorage.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/GroupStorage.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/GroupStorage.java Mon Aug 30 12:06:42 2010
@@ -22,7 +22,7 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageCategory;
/**
- * suggested interface for a group storage
+ * Suggested interface for a group storage
* used by the bvi module and add-ons
* <p/>
* it allows to manage groups for the current request
@@ -33,9 +33,32 @@ import org.apache.myfaces.extensions.val
@UsageInformation(UsageCategory.API)
public interface GroupStorage
{
+ /**
+ * Add the group, identified by the groupClass parameter, for the component identified by the clientId for the view
+ * viewId.
+ *
+ * @param groupClass The group to add.
+ * @param viewId The view where the uiComponent is located where we want to add the group.
+ * @param clientId The clientId value of the component within the view.
+ */
void addGroup(Class groupClass, String viewId, String clientId);
+ /**
+ * Add the group in the restricted group list ,identified by the groupClass parameter, for the component identified
+ * by the clientId for the view viewId.
+ *
+ * @param groupClass The group to add in the restricted group list.
+ * @param viewId The view where the uiComponent is located where we want to add the group.
+ * @param clientId The clientId value of the component within the view.
+ */
void restrictGroup(Class groupClass, String viewId, String clientId);
+ /**
+ * Gets the list of groups defined for the component with the clientId specified as parameter in the view. The
+ * array is the values of the groups added minus the groups from the restricted group list.
+ * @param viewId The view where the uiComponent is located.
+ * @param clientId The clientId value of the component within the view.
+ * @return Array of groups defined for the component.
+ */
Class[] getGroups(String viewId, String clientId);
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MetaDataStorageFilter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MetaDataStorageFilter.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MetaDataStorageFilter.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MetaDataStorageFilter.java Mon Aug 30 12:06:42 2010
@@ -23,11 +23,24 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
/**
+ * Allows a filtering of the MetaDataEntry's which are stored in the MetaDataStorage by the default implementation
+ * (DefaultMetaDataStorage). <br/>
+ * The storage of the metaData is done as part of the extraction of them from the component (see method extract of
+ * DefaultComponentMetaDataExtract). So this extraction can return less information then which is available on the
+ * property due to this filtering.
+ *
+ * @see org.apache.myfaces.extensions.validator.core.storage.DefaultMetaDataStorage
* @author Gerhard Petracek
* @since x.x.3
*/
@UsageInformation(UsageCategory.API)
public interface MetaDataStorageFilter
{
+ /**
+ * Method should filter the metaDataEntry's of the propertyInformation which are not needed by the validation
+ * process.
+ * @param propertyInformation information about constraints on the property and contains the list of
+ * MetaDataEntry's.
+ */
void filter(PropertyInformation propertyInformation);
}
\ No newline at end of file
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManager.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManager.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManager.java Mon Aug 30 12:06:42 2010
@@ -22,7 +22,11 @@ import org.apache.myfaces.extensions.val
import static org.apache.myfaces.extensions.validator.internal.UsageCategory.API;
/**
- * manager to create and reset specific storage implementations
+ * Manager to create and reset specific storage implementations. The storageManager is responsible for creating and
+ * resetting a certain storage. A manager can be responsible for multiple storages an d they are identified by a key
+ * which is a string value.
+ *
+ * @param <T> Type of Storage that is maintained by the storageManager.
*
* @author Gerhard Petracek
* @since x.x.3
@@ -30,6 +34,19 @@ import static org.apache.myfaces.extensi
@UsageInformation(API)
public interface StorageManager<T>
{
+ /**
+ * Create, or retrieve a previously created instance, of the storage for the specified key.
+ *
+ * @param key The type of storage that needs to be created
+ * @return The storage associated with the key or null when key is unknown to the storageManager.
+ */
T create(String key);
+
+ /**
+ * Resets the storage identified with the specified key. When the storage isn't created yet or the key is unknown
+ * for the storageManager, nothing is performed and no exception is thrown.
+ *
+ * @param key The type of storage that needs to be reset.
+ */
void reset(String key);
}
\ No newline at end of file
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManagerHolder.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManagerHolder.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManagerHolder.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManagerHolder.java Mon Aug 30 12:06:42 2010
@@ -22,14 +22,30 @@ import org.apache.myfaces.extensions.val
import static org.apache.myfaces.extensions.validator.internal.UsageCategory.API;
/**
- * interface to manage storage-manager instances
- *
+ * Interface to manage storage-manager instances.
+ *
+ * @see org.apache.myfaces.extensions.validator.core.storage.StorageManager
* @author Gerhard Petracek
* @since x.x.3
*/
@UsageInformation(API)
public interface StorageManagerHolder
{
+ /**
+ * Define the storage manager for the specified type.
+ * @param type The identification for the storage manager, by convention it is the object type managed by the
+ * storageManager.
+ * @param storageManager The storageManager to use.
+ * @param override if true, the previous defined storageManager is no longer used. If false, the specified
+ * storage manager is only used when no manager was defined.
+ */
void setStorageManager(Class type, StorageManager storageManager, boolean override);
+
+ /**
+ * Retrieves the storageManager for the specified type.
+ * @param type The identification for the storage manager, by convention it is the object type managed by the
+ * storageManager.
+ * @return the storageManager specified for the type or null if no manager specified for the type.
+ */
StorageManager getStorageManager(Class type);
}
\ No newline at end of file
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/ViolationSeverityInterpreterStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/ViolationSeverityInterpreterStorage.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/ViolationSeverityInterpreterStorage.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/ViolationSeverityInterpreterStorage.java Mon Aug 30 12:06:42 2010
@@ -23,8 +23,10 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverityInterpreter;
/**
- * suggested interface for a violation-severity-interpreter storage
- * used by add-ons to change the interpreter for the current request
+ * Suggested interface for a violation-severity-interpreter storage.
+ * Used by add-ons to change the interpreter for the current request.
+ * Behaves like a singleton/Application scoped object and the default for this interface is
+ * DefaultViolationSeverityInterpreterStorage.
*
* @author Gerhard Petracek
* @since x.x.3
@@ -32,7 +34,15 @@ import org.apache.myfaces.extensions.val
@UsageInformation(UsageCategory.API)
public interface ViolationSeverityInterpreterStorage
{
+ /**
+ * Puts the violationSeverityInterpreter into the storage.
+ * @param violationSeverityInterpreter ViolationSeverityInterpreter to se tin the storage.
+ */
void setViolationSeverityInterpreter(ViolationSeverityInterpreter violationSeverityInterpreter);
+ /**
+ * Retrieves the violationSeverityInterpreter from the storage.
+ * @return the violationSeverityInterpreter from the storage.
+ */
ViolationSeverityInterpreter getViolationSeverityInterpreter();
}
\ No newline at end of file
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/ConstraintSource.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/ConstraintSource.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/ConstraintSource.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/ConstraintSource.java Mon Aug 30 12:06:42 2010
@@ -30,6 +30,10 @@ import java.lang.annotation.Documented;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
+ * Annotation that specifies the class that needs to be used as source for the ExtVal constraints. <br/>
+ * If needed, this annotation can be replaced by a customer defined one if one likes to have independence of ExtVal in
+ * model classes, see constraintSourceAnnotation in ExtValCoreConfiguration.
+ *
* @author Gerhard Petracek
* @since r4
*/
@@ -39,5 +43,9 @@ import static java.lang.annotation.Reten
@UsageInformation(UsageCategory.API)
public @interface ConstraintSource
{
+ /**
+ * Class that needs to be used as source for constraints.
+ * @return Class that needs to be used as source for constraints.
+ */
Class value();
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/EmptyValueAwareValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/EmptyValueAwareValidationStrategy.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/EmptyValueAwareValidationStrategy.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/EmptyValueAwareValidationStrategy.java Mon Aug 30 12:06:42 2010
@@ -28,6 +28,9 @@ import java.lang.annotation.Documented;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
+ * Marker annotation to indicate that the strategy can handle empty values (strings of length 0) as values to validate.
+ * This was introduced to have the correct behaviour in relation to the parameter javax.faces.VALIDATE_EMPTY_FIELDS.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/IgnoreConstraintSource.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/IgnoreConstraintSource.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/IgnoreConstraintSource.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/IgnoreConstraintSource.java Mon Aug 30 12:06:42 2010
@@ -29,6 +29,10 @@ import java.lang.annotation.Documented;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
+ * Marker annotation to indicate that for the annotated property, no source for ExtVal constraints need to be searched
+ * in the class indicated by the {@link org.apache.myfaces.extensions.validator.core.validation.ConstraintSource}
+ * annotation.
+ *
* @author Gerhard Petracek
* @since r4
*/
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/NullValueAwareValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/NullValueAwareValidationStrategy.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/NullValueAwareValidationStrategy.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/NullValueAwareValidationStrategy.java Mon Aug 30 12:06:42 2010
@@ -28,6 +28,10 @@ import java.lang.annotation.Documented;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
+ * Marker annotation to indicate that the strategy can handle null values as values to validate. This was introduced
+ * to have the correct behaviour in relation to the parameter
+ * javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/SkipValidationEvaluator.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/SkipValidationEvaluator.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/SkipValidationEvaluator.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/SkipValidationEvaluator.java Mon Aug 30 12:06:42 2010
@@ -27,12 +27,25 @@ import javax.faces.context.FacesContext;
import javax.faces.component.UIComponent;
/**
+ * Evaluator that defines if a certain validation needs to be skipped for the field component. When the property
+ * module is added to the project, the default evaluator is
+ * {@code org.apache.myfaces.extensions.validator.PropertyValidationSkipValidationEvaluator}
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
@UsageInformation(UsageCategory.API)
public interface SkipValidationEvaluator
{
+ /**
+ * Is the specific validation, specified by the parameter validationStrategy, skipped for the uiComponent.
+ * Additional information about the validation can be found in the entry parameter.
+ * @param facesContext The JSF Context
+ * @param uiComponent The component for which the validation should happen.
+ * @param validationStrategy The validation that needs to be performed
+ * @param entry Additional information about the validation
+ * @return true when validation doesn't need to be performed.
+ */
boolean skipValidation(FacesContext facesContext, UIComponent uiComponent,
ValidationStrategy validationStrategy, MetaDataEntry entry);
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetProperty.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetProperty.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetProperty.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetProperty.java Mon Aug 30 12:06:42 2010
@@ -29,6 +29,12 @@ import java.lang.annotation.Documented;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
+ * To specify which property needs to be used that is the source of the ExtVal constraints. The property is searched
+ * in the class defined in {@link org.apache.myfaces.extensions.validator.core.validation.ConstraintSource}. <br/>
+ * If needed, this annotation can be replaced by a customer defined one if one likes to have independence of ExtVal in
+ * model classes, see targetPropertyAnnotation in ExtValCoreConfiguration.
+ * @see org.apache.myfaces.extensions.validator.core.validation.ConstraintSource
+ *
* @author Gerhard Petracek
* @since r4
*/
@@ -38,5 +44,9 @@ import static java.lang.annotation.Reten
@UsageInformation(UsageCategory.API)
public @interface TargetProperty
{
+ /**
+ * property name to be used.
+ * @return property to search in target class of ExtVal Constraints.
+ */
String value();
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetPropertyId.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetPropertyId.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetPropertyId.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetPropertyId.java Mon Aug 30 12:06:42 2010
@@ -30,6 +30,11 @@ import java.lang.annotation.Annotation;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
+ * Indication of what annotation has to be searched in the class that is the source of the ExtVal constraints. <br/>
+ * If needed, this annotation can be replaced by a customer defined one if one likes to have independence of ExtVal in
+ * model classes, see targetPropertyIdAnnotation in ExtValCoreConfiguration.
+ * @see org.apache.myfaces.extensions.validator.core.validation.ConstraintSource
+ *
* @author Gerhard Petracek
* @since r4
*/
@@ -39,5 +44,9 @@ import static java.lang.annotation.Reten
@UsageInformation(UsageCategory.API)
public @interface TargetPropertyId
{
+ /**
+ * Annotation to be searched.
+ * @return annotation to search in target class of ExtVal Constraints.
+ */
Class<? extends Annotation> value();
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/exception/RequiredValidatorException.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/exception/RequiredValidatorException.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/exception/RequiredValidatorException.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/exception/RequiredValidatorException.java Mon Aug 30 12:06:42 2010
@@ -25,7 +25,8 @@ import javax.faces.validator.ValidatorEx
import javax.faces.application.FacesMessage;
/**
- * to handle special cases in ValidationExceptionInterceptors
+ * To handle special cases in ValidationExceptionInterceptors. It acts just like a regular ValidatorException except
+ * that code can detect that the validation problem occurred related to a required field.
*
* @author Gerhard Petracek
* @since x.x.3
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/LabeledMessage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/LabeledMessage.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/LabeledMessage.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/LabeledMessage.java Mon Aug 30 12:06:42 2010
@@ -22,7 +22,11 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageCategory;
/**
- * don't remove *Text - it would lead to an overlap with trinidad
+ * Allows the setting and the retrieval of the label text that goes with an input component. This label text is used
+ * for the violation message to indicate where the problem occurred.
+ *
+ * don't remove *Text - it would lead to an overlap with trinidad.
+ * Used to create a special FacesMessage {@link ViolationMessage} that can hold the label text.
*
* @author Gerhard Petracek
* @since 1.x.2
@@ -30,6 +34,15 @@ import org.apache.myfaces.extensions.val
@UsageInformation(UsageCategory.API)
public interface LabeledMessage
{
+ /**
+ * Get the text for of the label of the input component.
+ * @return label text
+ */
String getLabelText();
+
+ /**
+ * Set the text for the label of the input component.
+ * @param label label text.
+ */
void setLabelText(String label);
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java Mon Aug 30 12:06:42 2010
@@ -32,5 +32,13 @@ import java.util.Locale;
@UsageInformation(UsageCategory.API)
public interface MessageResolver
{
+ /**
+ * Retrieve the message with a certain key for a certain Locale. When key is null, the return value of the method is
+ * also null.
+ *
+ * @param key Message key, can be null or empty
+ * @param locale locale for the message
+ * @return message corresponding to the key.
+ */
String getMessage(String key, Locale locale);
}
\ No newline at end of file
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java Mon Aug 30 12:06:42 2010
@@ -39,6 +39,8 @@ import java.lang.reflect.WildcardType;
import java.lang.reflect.Modifier;
/**
+ * Default implementation of the class which is capable of extracting ValidationParameter's from an annotation.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientSideValidation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientSideValidation.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientSideValidation.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientSideValidation.java Mon Aug 30 12:06:42 2010
@@ -22,6 +22,9 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageCategory;
/**
+ * A special validationParameter to indicate that no information what so ever of the validation information (like length
+ * or required) should be placed on the UIComponent so that client side could do any validation.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java Mon Aug 30 12:06:42 2010
@@ -28,6 +28,8 @@ import static java.lang.annotation.Eleme
import static java.lang.annotation.ElementType.METHOD;
/**
+ * Key part of the ValidationParameter. There can be only one key defined for each different parameter.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java Mon Aug 30 12:06:42 2010
@@ -28,6 +28,9 @@ import static java.lang.annotation.Eleme
import static java.lang.annotation.ElementType.METHOD;
/**
+ * Value part of the ValidationParameter. Multiple values can be defined for one {@link ParameterKey} and they can be
+ * distinguished by the id member.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
@@ -36,5 +39,10 @@ import static java.lang.annotation.Eleme
@UsageInformation(UsageCategory.API)
public @interface ParameterValue
{
+ /**
+ * Identification when multiple values are defined for one key.
+ *
+ * @return By default, the ParameterValue.class value.
+ */
Class id() default ParameterValue.class;
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java Mon Aug 30 12:06:42 2010
@@ -22,6 +22,9 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageCategory;
/**
+ * Marker interface for the validation parameters. Normally, each parameter has a {@link ParameterKey} and has one or
+ * more {@link ParameterValue}. It is also possible to create a validation parameter by just extending this interface.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractor.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractor.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractor.java Mon Aug 30 12:06:42 2010
@@ -26,14 +26,62 @@ import java.util.List;
import java.lang.annotation.Annotation;
/**
+ * Allows the extraction of ValidationParameters.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
@UsageInformation(UsageCategory.API)
public interface ValidationParameterExtractor
{
+ /**
+ * Extract all the {@link ValidationParameter}s defined on the annotation. The resulting Map contains as key all
+ * the {@link ParameterKey}s found. The value for each key, is the value defined as the {@link ParameterValue}
+ * (or the list of) of the ParameterValue part.<br/>
+ * When no ValidationParameters found, the method need to return an empty Map.
+ *
+ * @param annotation The annotation for which we want to extract the information.
+ * @return Map with all ParameterKeys and ParameterValues found.
+ */
Map<Object, List<Object>> extract(Annotation annotation);
+
+ /**
+ * Extract all the values defined as the {@link ParameterValue} found in the annotation for the key which is a
+ * {@link ParameterKey}. When no values found, the method returns an empty list.
+ *
+ * @param annotation The annotation for which we want to extract the information.
+ * @param key Value for the ParameterKey that is used for filtering the ValidationParameters found.
+ * @return List with all the ParameterValues found.
+ */
List<Object> extract(Annotation annotation, Object key);
+
+ /**
+ * Extract all the values defined as the {@link ParameterValue} found in the annotation for the key which is a
+ * {@link ParameterKey} where only those results are included which are assignable to the type specified in the
+ * parameter valueType. When no values found, the method returns an empty list.
+ *
+ * @param annotation The annotation for which we want to extract the information.
+ * @param key Value for the ParameterKey that is used for filtering the ValidationParameters found.
+ * @param valueType ParameterValue must be assignable to this type to be added to the result.
+ * @param <T> Class type of the result which is the same as the class type of the parameter valueType.
+ * @return List with all the ParameterValues found.
+ */
<T> List<T> extract(Annotation annotation, Object key, Class<T> valueType);
+
+ /**
+ * Extract the value defined as the {@link ParameterValue} found in the annotation for the key which is a
+ * {@link ParameterKey} where only those results are included which are assignable to the type specified in the
+ * parameter valueType and the ParameterValue id defined is the same as the parameter valueId. <br/>
+ * Multiple ParameterValues can be defined and each of them could be assigned an id to distinguish the different
+ * values. <br/>
+ * When no value matches the parameters of the method, the result of the method invocation is null.
+ *
+ * @param annotation The annotation for which we want to extract the information.
+ * @param key Value for the ParameterKey that is used for filtering the ValidationParameters found.
+ * @param valueType ParameterValue must be assignable to this type to be added to the result.
+ * @param valueId value of the id member of the ParameterValue we are looking for.
+ * @param <T> Class type of the result which is the same as the class type of the parameter valueType.
+ * @return Value of the found ParameterValue.
+ */
<T> T extract(Annotation annotation, Object key, Class<T> valueType, Class valueId);
}
\ No newline at end of file
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractorFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractorFactory.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractorFactory.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractorFactory.java Mon Aug 30 12:06:42 2010
@@ -22,11 +22,18 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.internal.UsageCategory;
/**
+ * Definition of the factory class which is capable of creating classes that can extract ValidationParameter's from
+ * the annotations.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
@UsageInformation(UsageCategory.API)
public interface ValidationParameterExtractorFactory
{
+ /**
+ * Creates an instance of a class capable of extracting ValidationParameter's from annotations.
+ * @return Extractor for ValidationParameter's from annotations.
+ */
ValidationParameterExtractor create();
}
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java Mon Aug 30 12:06:42 2010
@@ -24,12 +24,18 @@ import org.apache.myfaces.extensions.val
import javax.faces.application.FacesMessage;
/**
+ * ValidationParameter to indicate the severity of the FacesMessage in case of a validation failure. By default, the
+ * severity is Error.
+ *
* @author Gerhard Petracek
* @since x.x.3
*/
@UsageInformation(UsageCategory.API)
public interface ViolationSeverity
{
+ /**
+ * ViolationSeverity Info.
+ */
interface Info extends ValidationParameter
{
@ParameterKey
@@ -42,6 +48,9 @@ public interface ViolationSeverity
//MessageType postfix = MessageType.INFO;
}
+ /**
+ * ViolationSeverity Warn.
+ */
interface Warn extends ValidationParameter
{
@ParameterKey
@@ -54,6 +63,9 @@ public interface ViolationSeverity
//MessageType postfix = MessageType.WARN;
}
+ /**
+ * ViolationSeverity Error.
+ */
interface Error extends ValidationParameter
{
@ParameterKey
@@ -66,6 +78,9 @@ public interface ViolationSeverity
//MessageType postfix = MessageType.ERROR;
}
+ /**
+ * ViolationSeverity Fatal.
+ */
interface Fatal extends ValidationParameter
{
@ParameterKey
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java Mon Aug 30 12:06:42 2010
@@ -35,7 +35,8 @@ import java.util.MissingResourceExceptio
import java.util.logging.Level;
/**
- * Provides the ability of message resolving to ValidationStrategies
+ * Provides the ability of message resolving to ValidationStrategies. This abstract class is a good candidate as parent
+ * class of your custom validation strategies.
*
* @author Gerhard Petracek
* @since 1.x.1
@@ -47,6 +48,15 @@ public abstract class AbstractAnnotation
//e.g. for injecting a message resolver via spring
private MessageResolver messageResolver;
+ /**
+ * Resolves the key from the error message to get the actual message in the correct language. The language is taken
+ * from the viewRoot. When a messageResolver is injected into this object, it is used to resolve the message.
+ * Otherwise the default rules are taken to define the messageResolver.
+ * {@see org.apache.myfaces.extensions.validator.util.ExtValUtils#getMessageResolverForValidationStrategy(org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy)}
+ *
+ * @param key key of the error message that needs to be resolved.
+ * @return Resolved message.
+ */
protected String resolveMessage(String key)
{
Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
@@ -55,11 +65,29 @@ public abstract class AbstractAnnotation
ExtValUtils.getMessageResolverForValidationStrategy(this).getMessage(key, locale);
}
+ /**
+ * Returns the error message for the validation failure associated with the annotation. The message is determined
+ * by using the {@see getValidationErrorMsgKey} method for obtaining the key of the message which then is
+ * resolved by the method {@see resolveMessage}.
+ *
+ * @param annotation The annotation associated with the validation Strategy.
+ * @return The error message used in the summary part of the FacesMessage.
+ */
protected String getErrorMessageSummary(A annotation)
{
return resolveMessage(getValidationErrorMsgKey(annotation));
}
+ /**
+ * Returns the error message for the validation failure associated with the annotation the is used in the detail
+ * part of the FacesMessage. The message is determined by using the {@see getValidationErrorMsgKey} method for
+ * obtaining the key where the suffix '_detail' is added to. Then it is resolved by the method
+ * {@see resolveMessage}. When the key isn't found, the resulting exception is just logged but not propagated.
+ * So the detail message isn't required and null is returned instead.
+ *
+ * @param annotation The annotation associated with the validation Strategy.
+ * @return The error message used in the detail part of the FacesMessage or null.
+ */
protected String getErrorMessageDetail(A annotation)
{
try
@@ -75,18 +103,41 @@ public abstract class AbstractAnnotation
return null;
}
+ /**
+ * Creates the FacesMessage that can be used to inform the user of a validation error. This method can be called by
+ * subclasses in the {@see processValidation} method when a ValidationException is created in response of a
+ * violation.
+ *
+ * @param annotation The annotation associated with the validation Strategy
+ * @return FacesMessage for informing user of the problem.
+ */
protected FacesMessage getValidationErrorFacesMessage(A annotation)
{
return ExtValUtils.createFacesMessage(getErrorMessageSummary(annotation), getErrorMessageDetail(annotation));
}
+ /**
+ * Determines the key of the message that needs to be resolved in case this ValidationStrategy.
+ *
+ * @param annotation The annotation associated with the validation Strategy.
+ * @return The key of the error message.
+ */
protected abstract String getValidationErrorMsgKey(A annotation);
+ /**
+ * Injection point for a messageResolver that needs to be used by this validationStrategy.
+ *
+ * @param messageResolver messageResolver that needs to be used by this validationStrategy.
+ */
public void setMessageResolver(MessageResolver messageResolver)
{
this.messageResolver = messageResolver;
}
+ /**
+ * {@inheritDoc}
+ * Adds the label of the component to the metaDataEntry dataHolder parameter.
+ */
@Override
protected boolean processAfterValidatorException(FacesContext facesContext,
UIComponent uiComponent,
@@ -100,6 +151,15 @@ public abstract class AbstractAnnotation
facesContext, uiComponent, metaDataEntry, convertedObject, validatorException);
}
+ /**
+ * Returns the label of the uiComponent field that could be used in the error messages. By default it returns null.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The JSF component that contained the value entered by the user.
+ * @param metaDataEntry The data holder which stores the meta-data and some information where the meta-data was
+ * around.
+ * @return The label of the uiComponent field to use in error messages.
+ */
//e.g. for custom annotations - override if needed
protected String getLabel(FacesContext facesContext, UIComponent uiComponent, MetaDataEntry metaDataEntry)
{
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java Mon Aug 30 12:06:42 2010
@@ -48,6 +48,14 @@ public abstract class AbstractValidation
logger.fine(getClass().getName() + " instantiated");
}
+ /**
+ * {@inheritDoc}
+ * Before actually executing the validation (done by the method processValidation) any initialization can be
+ * performed by the overriding the initValidation method. When a Validation exception occurs, the method
+ * processAfterValidatorException executes the registered
+ * {@link org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor}'s.
+ *
+ */
public void validate(FacesContext facesContext, UIComponent uiComponent,
MetaDataEntry metaDataEntry, Object convertedObject)
{
@@ -97,6 +105,16 @@ public abstract class AbstractValidation
}
}
+ /**
+ * Allows some initialization before the actual validation is performed. This initialization is executed before
+ * each validation and not only once when th class is constructed.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The JSF component that contained the value entered by the user.
+ * @param metaDataEntry The data holder which stores the meta-data and some information where the meta-data was
+ * around.
+ * @param convertedObject Converted object of the user entered value.
+ */
protected void initValidation(FacesContext facesContext,
UIComponent uiComponent,
MetaDataEntry metaDataEntry,
@@ -106,6 +124,19 @@ public abstract class AbstractValidation
}
//override if needed
+ /**
+ * Executes the registered ValidationExceptionInterceptor to process the validation exception.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The JSF component that contained the value entered by the user.
+ * @param metaDataEntry The data holder which stores the meta-data and some information where the meta-data was
+ * around.
+ * @param convertedObject Converted object of the user entered value.
+ * @param validatorException The validation exception that occurred.
+ * @return should return true when you like to have the ValidatorException thrown by the
+ * ExtValUtils#tryToThrowValidatorExceptionForComponent method.
+ * {@see org.apache.myfaces.extensions.validator.util.ExtValUtils#tryToThrowValidatorExceptionForComponent(javax.faces.component.UIComponent, javax.faces.application.FacesMessage, java.lang.Throwable)}
+ */
protected boolean processAfterValidatorException(FacesContext facesContext,
UIComponent uiComponent,
MetaDataEntry metaDataEntry,
@@ -116,6 +147,19 @@ public abstract class AbstractValidation
uiComponent, metaDataEntry, convertedObject, validatorException, this);
}
+ /**
+ /**
+ * Validates the value in the convertedObject parameter which the user entered as value of the uiComponent.
+ * Additional validation information can be found in the metaDataEntry parameter. The method throws a
+ * ValidatorException when violation of the validation rules occurs.
+ *
+ * @param facesContext The JSF Context
+ * @param uiComponent The JSF component that contained the value entered by the user.
+ * @param metaDataEntry The data holder which stores the meta-data and some information where the meta-data was
+ * around.
+ * @param convertedObject Converted object of the user entered value.
+ * @throws ValidatorException When violation of the validation rules occurs.
+ */
protected abstract void processValidation(FacesContext facesContext,
UIComponent uiComponent, MetaDataEntry metaDataEntry,
Object convertedObject) throws ValidatorException;
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractVirtualValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractVirtualValidationStrategy.java?rev=990776&r1=990775&r2=990776&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractVirtualValidationStrategy.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractVirtualValidationStrategy.java Mon Aug 30 12:06:42 2010
@@ -26,7 +26,9 @@ import javax.faces.context.FacesContext;
import javax.faces.component.UIComponent;
/**
- * to map constraints directly to a meta-data transformer if there is no validation strategy (required by jsr 303)
+ * To map constraints directly to a meta-data transformer if there is no validation strategy (required by jsr 303).
+ * So the ValidationStrategy is only used to have the component initialization and is not used to do the actual
+ * validation.
*
* @author Gerhard Petracek
* @since x.x.3
@@ -34,6 +36,11 @@ import javax.faces.component.UIComponent
@UsageInformation(UsageCategory.REUSE)
public abstract class AbstractVirtualValidationStrategy implements IdentifiableValidationStrategy
{
+ /**
+ * {@inheritDoc}
+ * Throws an unsupportedOperationException when the method gets executed. This ValidationStrategy should never
+ * be used to perform actual validations.
+ */
public final void validate(
FacesContext facesContext, UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject)
{