it.eng.spagobi.validation
Class SpagoBIValidationImpl

java.lang.Object
  extended by it.eng.spagobi.validation.SpagoBIValidationImpl
All Implemented Interfaces:
it.eng.spago.validation.ValidationEngineIFace

public class SpagoBIValidationImpl
extends java.lang.Object
implements it.eng.spago.validation.ValidationEngineIFace

Author:
zoppello TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Field Summary
private  java.lang.String _serviceName
           
private  java.lang.String _serviceType
           
private  it.eng.spago.base.SourceBean _serviceValidations
           
private  it.eng.spago.base.SourceBean _validationStructure
           
private static java.lang.String ALPHANUMERIC_STRING_REGEXP
           
static int ERROR_ALFANUMERIC
           
static int ERROR_DATE
           
static int ERROR_DECIMALS
           
static int ERROR_EMAIL
           
static int ERROR_FISCALCODE
           
static int ERROR_GENERIC
           
static int ERROR_LETTERSTRING
           
static int ERROR_MANDATORY
           
static int ERROR_MAXLENGTH
           
static int ERROR_MINLENGTH
           
static int ERROR_NUMERIC
           
static int ERROR_RANGE
           
static int ERROR_REGEXP
           
static int ERROR_URL
           
private static java.lang.String FISCAL_CODE_REGEXP
           
private static java.lang.String LETTER_STRING_REGEXP
           
static java.lang.String NAME_ATTRIBUTE
           
static java.lang.String TOUPPERCASE_ATTRIBUTE
           
 
Constructor Summary
SpagoBIValidationImpl()
          Thise methodis called everyTime a service with label serviceName is called, if the service validator is configured correctly into the validator.xml configuration file.
 
Method Summary
private  void automaticValidation(it.eng.spago.base.SourceBean serviceRequest, it.eng.spago.error.EMFErrorHandler errorHandler)
          For each input field type (Numeric, URL, extc:), this method applies validation.
 boolean isBlocking()
          A method which says if a validator has blocking properties.
 boolean validate(java.lang.String serviceType, java.lang.String serviceName, it.eng.spago.dispatching.service.RequestContextIFace context)
          From the request and response container this method controls if validation conditions declarated into the validator.xml>/code> file are verifyed, and, if yes, acknowledge to start validation control.
private  boolean validateService(it.eng.spago.base.RequestContainer requestContainer, it.eng.spago.base.ResponseContainer responseContainer)
          When the validation is started, if a control has generated errors, this method interrupts validation without going on with other controls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_serviceName

private java.lang.String _serviceName

_serviceType

private java.lang.String _serviceType

_serviceValidations

private it.eng.spago.base.SourceBean _serviceValidations

_validationStructure

private it.eng.spago.base.SourceBean _validationStructure

NAME_ATTRIBUTE

public static final java.lang.String NAME_ATTRIBUTE
See Also:
Constant Field Values

TOUPPERCASE_ATTRIBUTE

public static final java.lang.String TOUPPERCASE_ATTRIBUTE
See Also:
Constant Field Values

ERROR_GENERIC

public static final int ERROR_GENERIC
See Also:
Constant Field Values

ERROR_MANDATORY

public static final int ERROR_MANDATORY
See Also:
Constant Field Values

ERROR_LETTERSTRING

public static final int ERROR_LETTERSTRING
See Also:
Constant Field Values

ERROR_ALFANUMERIC

public static final int ERROR_ALFANUMERIC
See Also:
Constant Field Values

ERROR_NUMERIC

public static final int ERROR_NUMERIC
See Also:
Constant Field Values

ERROR_EMAIL

public static final int ERROR_EMAIL
See Also:
Constant Field Values

ERROR_FISCALCODE

public static final int ERROR_FISCALCODE
See Also:
Constant Field Values

ERROR_DECIMALS

public static final int ERROR_DECIMALS
See Also:
Constant Field Values

ERROR_RANGE

public static final int ERROR_RANGE
See Also:
Constant Field Values

ERROR_MAXLENGTH

public static final int ERROR_MAXLENGTH
See Also:
Constant Field Values

ERROR_MINLENGTH

public static final int ERROR_MINLENGTH
See Also:
Constant Field Values

ERROR_REGEXP

public static final int ERROR_REGEXP
See Also:
Constant Field Values

ERROR_DATE

public static final int ERROR_DATE
See Also:
Constant Field Values

ERROR_URL

public static final int ERROR_URL
See Also:
Constant Field Values

LETTER_STRING_REGEXP

private static final java.lang.String LETTER_STRING_REGEXP
See Also:
Constant Field Values

FISCAL_CODE_REGEXP

private static final java.lang.String FISCAL_CODE_REGEXP
See Also:
Constant Field Values

ALPHANUMERIC_STRING_REGEXP

private static final java.lang.String ALPHANUMERIC_STRING_REGEXP
See Also:
Constant Field Values
Constructor Detail

SpagoBIValidationImpl

public SpagoBIValidationImpl()
Thise methodis called everyTime a service with label serviceName is called, if the service validator is configured correctly into the validator.xml configuration file. It starts the validation procedure.

Parameters:
serviceName - The name of the service
serviceType - The type of the service (PAGE; ACTION)
Method Detail

validate

public boolean validate(java.lang.String serviceType,
                        java.lang.String serviceName,
                        it.eng.spago.dispatching.service.RequestContextIFace context)
From the request and response container this method controls if validation conditions declarated into the validator.xml>/code> file are verifyed, and, if yes, acknowledge to start validation control.

Specified by:
validate in interface it.eng.spago.validation.ValidationEngineIFace
Parameters:
requestContainer - The input request container
responseContainer - The input response container
Returns:
a boolean value which says if conditions are verified.
Throws:
java.lang.Exception - if an exception occurs.

isBlocking

public boolean isBlocking()
A method which says if a validator has blocking properties. If a validator is blocking and his validation is not passed, all execution will be interrupted.

Specified by:
isBlocking in interface it.eng.spago.validation.ValidationEngineIFace
Returns:
A boolean value saying if validator is blocking or not.

validateService

private boolean validateService(it.eng.spago.base.RequestContainer requestContainer,
                                it.eng.spago.base.ResponseContainer responseContainer)
When the validation is started, if a control has generated errors, this method interrupts validation without going on with other controls.

Parameters:
requestContainer - The input request container
responseContainer - The input response container
Returns:
A boolean value saying if we have errors or not
Throws:
java.lang.Exception - If any exception occurred

automaticValidation

private void automaticValidation(it.eng.spago.base.SourceBean serviceRequest,
                                 it.eng.spago.error.EMFErrorHandler errorHandler)
For each input field type (Numeric, URL, extc:), this method applies validation. Every time a validation fails, an error is added to the errorHandler errors stack.

Parameters:
serviceRequest - The request Source Bean
errorHandler - The errors Stack
Throws:
java.lang.Exception - If any exception occurs.