org.pentaho.di.job.entry.validator
Class JobEntryValidatorUtils

java.lang.Object
  extended by org.pentaho.di.job.entry.validator.JobEntryValidatorUtils

public class JobEntryValidatorUtils
extends Object

Methods in this class are referenced in validator definitions within the validator resources file (e.g. validator.xml).

Modeled after org.apache.struts.validator.FieldChecks and org.apache.commons.collections.PredicateUtils.

Author:
mlowery

Field Summary
static int LEVEL_FAILURE_DEFAULT
           
 
Constructor Summary
JobEntryValidatorUtils()
           
 
Method Summary
static void addExceptionRemark(CheckResultSourceInterface source, String propertyName, String validatorName, List<CheckResultInterface> remarks, Exception e)
           
static void addFailureRemark(CheckResultSourceInterface source, String propertyName, String validatorName, List<CheckResultInterface> remarks, int level)
           
static void addGeneralRemark(CheckResultSourceInterface source, String propertyName, String validatorName, List<CheckResultInterface> remarks, String key, int level)
           
static void addOkRemark(CheckResultSourceInterface source, String propertyName, List<CheckResultInterface> remarks)
           
static AndValidator andValidator()
          Returns a AndValidator singleton.
static EmailValidator emailValidator()
          Returns a EmailValidator singleton.
static FileDoesNotExistValidator fileDoesNotExistValidator()
          Returns a FileDoesNotExistValidator singleton.
static FileExistsValidator fileExistsValidator()
          Returns a FileExistsValidator singleton.
static String getKeyLevelOnFail(String validatorName)
           
static int getLevelOnFail(ValidatorContext context, String validatorName)
          Gets the levelOnFail type for given validatorName.
static IntegerValidator integerValidator()
          Returns a IntegerValidator singleton.
static LongValidator longValidator()
          Returns a LongValidator singleton.
static NotBlankValidator notBlankValidator()
          Returns a NotBlankValidator singleton.
static NotNullValidator notNullValidator()
          Returns a NotNullValidator singleton.
static void putLevelOnFail(Map<String,Object> map, int levelOnFail)
           
static void putLevelOnFail(Map<String,Object> map, String validatorName, int levelOnFail)
           
static boolean validateMask(CheckResultSourceInterface source, String propertyName, int levelOnFail, List<CheckResultInterface> remarks, String mask)
          Fails if a field's value does not match the given mask.
static boolean validateMask(CheckResultSourceInterface source, String propertyName, List<CheckResultInterface> remarks, String mask, int levelOnFail)
          Fails if a field's value does not match the given mask.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL_FAILURE_DEFAULT

public static final int LEVEL_FAILURE_DEFAULT
See Also:
Constant Field Values
Constructor Detail

JobEntryValidatorUtils

public JobEntryValidatorUtils()
Method Detail

andValidator

public static AndValidator andValidator()
Returns a AndValidator singleton.


notBlankValidator

public static NotBlankValidator notBlankValidator()
Returns a NotBlankValidator singleton.


notNullValidator

public static NotNullValidator notNullValidator()
Returns a NotNullValidator singleton.


fileExistsValidator

public static FileExistsValidator fileExistsValidator()
Returns a FileExistsValidator singleton.


integerValidator

public static IntegerValidator integerValidator()
Returns a IntegerValidator singleton.


longValidator

public static LongValidator longValidator()
Returns a LongValidator singleton.


fileDoesNotExistValidator

public static FileDoesNotExistValidator fileDoesNotExistValidator()
Returns a FileDoesNotExistValidator singleton.


emailValidator

public static EmailValidator emailValidator()
Returns a EmailValidator singleton.


getLevelOnFail

public static int getLevelOnFail(ValidatorContext context,
                                 String validatorName)
Gets the levelOnFail type for given validatorName. If that is not found, returns generic levelOnFail type. If that fails, returns CheckResultInterface.TYPE_RESULT_ERROR.


putLevelOnFail

public static void putLevelOnFail(Map<String,Object> map,
                                  String validatorName,
                                  int levelOnFail)

putLevelOnFail

public static void putLevelOnFail(Map<String,Object> map,
                                  int levelOnFail)

getKeyLevelOnFail

public static String getKeyLevelOnFail(String validatorName)

validateMask

public static boolean validateMask(CheckResultSourceInterface source,
                                   String propertyName,
                                   List<CheckResultInterface> remarks,
                                   String mask,
                                   int levelOnFail)
Fails if a field's value does not match the given mask.


validateMask

public static boolean validateMask(CheckResultSourceInterface source,
                                   String propertyName,
                                   int levelOnFail,
                                   List<CheckResultInterface> remarks,
                                   String mask)
Fails if a field's value does not match the given mask.


addFailureRemark

public static void addFailureRemark(CheckResultSourceInterface source,
                                    String propertyName,
                                    String validatorName,
                                    List<CheckResultInterface> remarks,
                                    int level)

addExceptionRemark

public static void addExceptionRemark(CheckResultSourceInterface source,
                                      String propertyName,
                                      String validatorName,
                                      List<CheckResultInterface> remarks,
                                      Exception e)

addGeneralRemark

public static void addGeneralRemark(CheckResultSourceInterface source,
                                    String propertyName,
                                    String validatorName,
                                    List<CheckResultInterface> remarks,
                                    String key,
                                    int level)

addOkRemark

public static void addOkRemark(CheckResultSourceInterface source,
                               String propertyName,
                               List<CheckResultInterface> remarks)