edu.uoc.pfc.j2ee.jalonsod.mtp.helper
Class Validator

java.lang.Object
  extended by edu.uoc.pfc.j2ee.jalonsod.mtp.helper.Validator

public class Validator
extends java.lang.Object

File: ContextFactory.java Created: 2012-04-28 Loads and validates the request parameters into formInstance and model instance.

Author:
José Alonso de Motta

Field Summary
private static java.util.logging.Logger logger
           
 
Constructor Summary
Validator()
           
 
Method Summary
 void setParameterValues(RequestDataPrivate requestData)
          Write the parameters from the request into the application modelInstance.
 void validateRequest(RequestDataPrivate requestData)
          Loads and validates the request parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger
Constructor Detail

Validator

public Validator()
Method Detail

validateRequest

public void validateRequest(RequestDataPrivate requestData)
Loads and validates the request parameters. The validation is done in four stages: Stage 1: Converts request data to Java types. Stage 2: Validates that required fields are present. Stage 3: Validates using Validation functions for single fields. Before next stage, loads parameters into the model instance. Stage 4: Validates entire model using validation function from model instance. It stops when a stage is finished and has any error. It records the validation state in the RequestData object.

Parameters:
requestData - the MTP requestData of the current request.

setParameterValues

public void setParameterValues(RequestDataPrivate requestData)
                        throws MTPException
Write the parameters from the request into the application modelInstance.

Parameters:
requestData - the MTP requestData of the current request.
Throws:
MTPException - throws when there is a problem setting the values into the application model.