pt.digitalis.dif.dem.objects.parameters.constraints
Class AbstractParameterConstraint

java.lang.Object
  extended by pt.digitalis.dif.dem.objects.parameters.constraints.AbstractParameterConstraint
All Implemented Interfaces:
IParameterConstraint
Direct Known Subclasses:
AbstractNumericParameterConstraint, ParameterConstraintAlphabeticImpl, ParameterConstraintDateImpl, ParameterConstraintMaxSizeImpl, ParameterConstraintMinSizeImpl, ParameterConstraintRegexImpl

public abstract class AbstractParameterConstraint
extends Object
implements IParameterConstraint

Base implementation for all parameter constraints. Will provide common features and resources.

Author:
Pedro Viegas pviegas@digitalis.pt
Created on:
Nov 16, 2007

Constructor Summary
AbstractParameterConstraint()
           
 
Method Summary
protected  List<String> getErrorIDs()
          Get the error IDs
protected abstract  Map<String,String> getErrorMessageValues(boolean parseValues)
          Compiles all values to be parsed in the error message to be generated on request
protected static MessageList getMessages()
          Lazy loading getter of messages
 ParameterConstraintResult getValidationResult(Object value, IStageInstance stageInstance)
          Get the Validation result, Validates the parameter value passed in it's native type
 boolean validateConstraint(Object value, IStageInstance stageInstance)
          Validates the parameter value passed in it's native type
 String validationErrorMessage()
          Get a description on why the validation fails
 String validationErrorMessage(boolean parseValues)
          Get a description on why the validation fails
 String validationErrorMessage(boolean parseValues, String language)
          Get a description on why the validation fails
 String validationErrorMessage(String language)
          Get a description on why the validation fails
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pt.digitalis.dif.dem.objects.parameters.constraints.IParameterConstraint
configureConstraint, getJavaScriptValidationCondition, isSupportedClass, validateConstraint
 

Constructor Detail

AbstractParameterConstraint

public AbstractParameterConstraint()
Method Detail

getMessages

protected static MessageList getMessages()
Lazy loading getter of messages

Returns:
the messages

getErrorIDs

protected List<String> getErrorIDs()
Get the error IDs

Returns:
List of error IDs

getErrorMessageValues

protected abstract Map<String,String> getErrorMessageValues(boolean parseValues)
Compiles all values to be parsed in the error message to be generated on request

Parameters:
parseValues - if T will replace the current parameter value in the message. Otherwise return the untouched message for custom parsing
Returns:
the list of key/values to replace in the error message

getValidationResult

public ParameterConstraintResult getValidationResult(Object value,
                                                     IStageInstance stageInstance)
Description copied from interface: IParameterConstraint
Get the Validation result, Validates the parameter value passed in it's native type

Specified by:
getValidationResult in interface IParameterConstraint
Parameters:
value - the value to validate
stageInstance - the current stage in execution
Returns:
T if the validation succeded
See Also:
IParameterConstraint.getValidationResult(java.lang.Object, pt.digitalis.dif.dem.interfaces.IStageInstance)

validateConstraint

public boolean validateConstraint(Object value,
                                  IStageInstance stageInstance)
Description copied from interface: IParameterConstraint
Validates the parameter value passed in it's native type

Specified by:
validateConstraint in interface IParameterConstraint
Parameters:
value - the value to validate
stageInstance - the current stage in execution
Returns:
T if the validation succeeded
See Also:
IParameterConstraint.validateConstraint(java.lang.Object, pt.digitalis.dif.dem.interfaces.IStageInstance)

validationErrorMessage

public String validationErrorMessage()
Description copied from interface: IParameterConstraint
Get a description on why the validation fails

Specified by:
validationErrorMessage in interface IParameterConstraint
Returns:
the validation error message in the default language
See Also:
IParameterConstraint.validationErrorMessage()

validationErrorMessage

public String validationErrorMessage(boolean parseValues)
Description copied from interface: IParameterConstraint
Get a description on why the validation fails

Specified by:
validationErrorMessage in interface IParameterConstraint
Parameters:
parseValues - if T will replace the current parameter value in the message. Otherwise return the untouched message for custom parsing
Returns:
the validation error message in the default language
See Also:
IParameterConstraint.validationErrorMessage(boolean)

validationErrorMessage

public String validationErrorMessage(boolean parseValues,
                                     String language)
Description copied from interface: IParameterConstraint
Get a description on why the validation fails

Specified by:
validationErrorMessage in interface IParameterConstraint
Parameters:
parseValues - if T will replace the current parameter value in the message. Otherwise return the untouched message for custom parsing
language - the language on witch to create the error message
Returns:
the validation error message
See Also:
IParameterConstraint.validationErrorMessage(boolean, java.lang.String)

validationErrorMessage

public String validationErrorMessage(String language)
Description copied from interface: IParameterConstraint
Get a description on why the validation fails

Specified by:
validationErrorMessage in interface IParameterConstraint
Parameters:
language - the language on witch to create the error message
Returns:
the validation error message
See Also:
IParameterConstraint.validationErrorMessage(java.lang.String)


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.