pt.digitalis.dif.dem.objects.parameters.constraints
Interface IParameterConstraint

All Known Implementing Classes:
AbstractNumericParameterConstraint, AbstractParameterConstraint, ParameterConstraintAlphabeticImpl, ParameterConstraintDateAbsoluteImpl, ParameterConstraintDateImpl, ParameterConstraintDateInFutureImpl, ParameterConstraintDateInPastImpl, ParameterConstraintDateRelativeImpl, ParameterConstraintEmailImpl, ParameterConstraintMaxImpl, ParameterConstraintMaxSizeImpl, ParameterConstraintMinImpl, ParameterConstraintMinSizeImpl, ParameterConstraintNumericImpl, ParameterConstraintRegexImpl

public interface IParameterConstraint

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

Method Summary
 void configureConstraint(String configurationString)
          Configures the constraint.
 String getJavaScriptValidationCondition()
          Builds a JavaScript boolean expression to check this constraint.
 ParameterConstraintResult getValidationResult(Object value, IStageInstance stageInstance)
          Get the Validation result, Validates the parameter value passed in it's native type
 boolean isSupportedClass(Class<?> clazz)
          Checks if the parameter attribute is of a supported class for this constraint to be used
 boolean validateConstraint(Object value, IStageInstance stageInstance)
          Validates the parameter value passed in it's native type
 boolean validateConstraint(String value, IStageInstance stageInstance)
          Validates the parameter value passed as a String
 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
 

Method Detail

configureConstraint

void configureConstraint(String configurationString)
Configures the constraint. Optional. The maximum value for max, or maskString for mask.

Parameters:
configurationString -

getJavaScriptValidationCondition

String getJavaScriptValidationCondition()
Builds a JavaScript boolean expression to check this constraint. Will assume there is a "value" variable with the current parameter value in context to get the parameter value from.

Returns:
the JS code to validate

getValidationResult

ParameterConstraintResult getValidationResult(Object value,
                                              IStageInstance stageInstance)
Get the Validation result, Validates the parameter value passed in it's native type

Parameters:
value - the value to validate
stageInstance - the current stage in execution
Returns:
T if the validation succeded

isSupportedClass

boolean isSupportedClass(Class<?> clazz)
Checks if the parameter attribute is of a supported class for this constraint to be used

Parameters:
clazz - the class of the attribute on witch the constraint has been applied
Returns:
T is it is a supported class

validateConstraint

boolean validateConstraint(Object value,
                           IStageInstance stageInstance)
Validates the parameter value passed in it's native type

Parameters:
value - the value to validate
stageInstance - the current stage in execution
Returns:
T if the validation succeeded

validateConstraint

boolean validateConstraint(String value,
                           IStageInstance stageInstance)
Validates the parameter value passed as a String

Parameters:
value - the value to validate
stageInstance - the current stage in execution
Returns:
T if the validation succeded

validationErrorMessage

String validationErrorMessage()
Get a description on why the validation fails

Returns:
the validation error message in the default language

validationErrorMessage

String validationErrorMessage(boolean parseValues)
Get a description on why the validation fails

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

validationErrorMessage

String validationErrorMessage(boolean parseValues,
                              String language)
Get a description on why the validation fails

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

validationErrorMessage

String validationErrorMessage(String language)
Get a description on why the validation fails

Parameters:
language - the language on witch to create the error message
Returns:
the validation error message


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