org.apache.struts2.oval.interceptor
Class DefaultOValValidationManager

java.lang.Object
  extended by org.apache.struts2.oval.interceptor.DefaultOValValidationManager
All Implemented Interfaces:
OValValidationManager

public class DefaultOValValidationManager
extends java.lang.Object
implements OValValidationManager


Field Summary
protected  boolean validateJPAAnnotations
           
protected static java.lang.String VALIDATION_CONFIG_SUFFIX
           
protected  java.util.Map<java.lang.String,java.util.List<net.sf.oval.configuration.Configurer>> validatorCache
           
protected  java.util.Map<java.lang.String,net.sf.oval.configuration.Configurer> validatorFileCache
           
 
Constructor Summary
DefaultOValValidationManager()
           
 
Method Summary
protected  void addIfNotNull(java.util.List<net.sf.oval.configuration.Configurer> configurers, net.sf.oval.configuration.Configurer configurer)
           
protected  net.sf.oval.configuration.xml.XMLConfigurer buildAliasValidatorConfigs(java.lang.Class aClass, java.lang.String context, boolean checkFile)
           
protected  net.sf.oval.configuration.xml.XMLConfigurer buildClassValidatorConfigs(java.lang.Class aClass, boolean checkFile)
           
protected static java.lang.String buildValidatorKey(java.lang.Class clazz, java.lang.String context)
           
 java.util.List<net.sf.oval.configuration.Configurer> getConfigurers(java.lang.Class clazz, java.lang.String context, boolean validateJPAAnnotations)
          This method 'collects' all the validator configurations for a given action invocation.
protected  net.sf.oval.configuration.xml.XMLConfigurer loadFile(java.lang.String fileName, java.lang.Class clazz, boolean checkFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION_CONFIG_SUFFIX

protected static final java.lang.String VALIDATION_CONFIG_SUFFIX
See Also:
Constant Field Values

validatorCache

protected final java.util.Map<java.lang.String,java.util.List<net.sf.oval.configuration.Configurer>> validatorCache

validatorFileCache

protected final java.util.Map<java.lang.String,net.sf.oval.configuration.Configurer> validatorFileCache

validateJPAAnnotations

protected boolean validateJPAAnnotations
Constructor Detail

DefaultOValValidationManager

public DefaultOValValidationManager()
Method Detail

getConfigurers

public java.util.List<net.sf.oval.configuration.Configurer> getConfigurers(java.lang.Class clazz,
                                                                           java.lang.String context,
                                                                           boolean validateJPAAnnotations)
Description copied from interface: OValValidationManager

This method 'collects' all the validator configurations for a given action invocation.

It will traverse up the class hierarchy looking for validators for every super class and directly implemented interface of the current action, as well as adding validators for any alias of this invocation. Nifty!

Given the following class structure:

   interface Thing;
   interface Animal extends Thing;
   interface Quadraped extends Animal;
   class AnimalImpl implements Animal;
   class QuadrapedImpl extends AnimalImpl implements Quadraped;
   class Dog extends QuadrapedImpl;
 

This method will look for the following config files for Dog:

   Animal
   Animal-context
   AnimalImpl
   AnimalImpl-context
   Quadraped
   Quadraped-context
   QuadrapedImpl
   QuadrapedImpl-context
   Dog
   Dog-context
 

Note that the validation rules for Thing is never looked for because no class in the hierarchy directly implements Thing.

Specified by:
getConfigurers in interface OValValidationManager
Parameters:
clazz - the Class to look up validators for.
context - the context to use when looking up validators. updated.
Returns:
a list of xml configurers for the given class and context.

buildValidatorKey

protected static java.lang.String buildValidatorKey(java.lang.Class clazz,
                                                    java.lang.String context)

addIfNotNull

protected void addIfNotNull(java.util.List<net.sf.oval.configuration.Configurer> configurers,
                            net.sf.oval.configuration.Configurer configurer)

buildAliasValidatorConfigs

protected net.sf.oval.configuration.xml.XMLConfigurer buildAliasValidatorConfigs(java.lang.Class aClass,
                                                                                 java.lang.String context,
                                                                                 boolean checkFile)

buildClassValidatorConfigs

protected net.sf.oval.configuration.xml.XMLConfigurer buildClassValidatorConfigs(java.lang.Class aClass,
                                                                                 boolean checkFile)

loadFile

protected net.sf.oval.configuration.xml.XMLConfigurer loadFile(java.lang.String fileName,
                                                               java.lang.Class clazz,
                                                               boolean checkFile)


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.