public final class VUtil extends Object implements ConstraintValidator
ValidationException
for failures.Modifier and Type | Class and Description |
---|---|
static class |
VUtil.ConstraintType
enum specifies what type of constraint is being targeted - User or Rold.
|
Modifier and Type | Method and Description |
---|---|
static void |
assertNotNull(Object obj,
int errorCode,
String method)
Method will throw exception with supplied error id and object.method name if object reference is null.
|
static void |
assertNotNullOrEmpty(char[] value,
int errorCode,
String method)
Method will throw exception with supplied error id and object.method name if string reference is null or empty.
|
static void |
assertNotNullOrEmpty(String value,
int errorCode,
String method)
Method will throw exception with supplied error id and object.method name if string reference is null or empty.
|
void |
beginDate(String beginDate)
Perform simple reasonability check on contraint beginDate value.
|
void |
beginTime(String beginTime)
Perform simple reasonability check on contraint beginTime value.
|
void |
dayMask(String dayMask)
Perform simple reasonability check on contraint dayMask value.
|
static void |
description(String value)
Simple length check and safe text validation on description field that uses
GlobalIds.DESC_LEN . |
void |
endDate(String endDate)
Perform simple reasonability check on contraint endDate value.
|
void |
endTime(String endTime)
Perform simple reasonability check on contraint endTime value.
|
static ConstraintValidator |
getConstraintValidator()
This class is an implementation of ConstraintValidator.
|
static VUtil |
getInstance() |
static void |
orgUnit(String orgUnitId)
Simple length check on orgunit that uses
GlobalIds.OU_LEN . |
static void |
password(char[] password)
Simple length check on User password that uses
GlobalIds.PASSWORD_LEN . |
static void |
properties(Properties props)
Perform simple length and safe text validations on collection of name-value pairs.
|
static void |
safeText(String value,
int validLen)
Perform a simple length and safe text validation.
|
void |
timeout(Integer timeout)
Perform simple reasonability check on contraint timeout value.
|
static void |
userId(String userId)
Simple null,
GlobalErrIds.USER_ID_NULL , and length checks, GlobalErrIds.CONST_INVLD_FIELD_LEN , on userId. |
void |
validateConstraints(Session session,
VUtil.ConstraintType type,
boolean checkDsd)
This utility iterates over all of the Validators initialized for runtime and calls them passing the
Constraint contained within the
targeted entity. |
public static VUtil getInstance()
public static ConstraintValidator getConstraintValidator()
public static void orgUnit(String orgUnitId) throws ValidationException
GlobalIds.OU_LEN
.orgUnitId
- contains the ou name.ValidationException
- in the event of failure, GlobalErrIds.ORG_LEN_INVLD
.public static void password(char[] password) throws ValidationException
GlobalIds.PASSWORD_LEN
.password
- contains the User's password.ValidationException
- in the event of failure, GlobalErrIds.USER_PW_INVLD_LEN
.public static void description(String value) throws ValidationException
GlobalIds.DESC_LEN
.value
- contains the entity description.ValidationException
- in the event of failure, GlobalErrIds.CONST_DESC_LEN_INVLD
.public static void safeText(String value, int validLen) throws ValidationException
value
- contains the attribute to check.validLen
- contains the length to use.ValidationException
- in the event of length GlobalErrIds.CONST_INVLD_FIELD_LEN
or regex failure.public static void userId(String userId) throws ValidationException
GlobalErrIds.USER_ID_NULL
, and length checks, GlobalErrIds.CONST_INVLD_FIELD_LEN
, on userId.userId
- contains the userId, maps to User.userId
.ValidationException
- in the event of failure, GlobalErrIds.CONST_INVLD_FIELD_LEN
.public static void properties(Properties props) throws ValidationException
props
- contains name-value pairs in name:value
format.ValidationException
- in the event of failure.public void timeout(Integer timeout) throws ValidationException
timeout
in interface ConstraintValidator
timeout
- must be greater than 0 and less than max value for Integer.MAX_VALUE
ValidationException
- in the event value falls out of range.public void beginTime(String beginTime) throws ValidationException
beginTime
in interface ConstraintValidator
beginTime
- if set, must be equal to TIME_LEN
.ValidationException
- in the event value falls out of range.public void endTime(String endTime) throws ValidationException
endTime
in interface ConstraintValidator
endTime
- if set, must be equal to TIME_LEN
.ValidationException
- in the event value falls out of range.public void beginDate(String beginDate) throws ValidationException
beginDate
in interface ConstraintValidator
beginDate
- if set, must be equal to DATE_LEN
.ValidationException
- in the event value falls out of range.public void endDate(String endDate) throws ValidationException
endDate
in interface ConstraintValidator
endDate
- if set, must be equal to DATE_LEN
.ValidationException
- in the event value falls out of range.public void dayMask(String dayMask) throws ValidationException
dayMask
in interface ConstraintValidator
dayMask
- if set, will be validated.ValidationException
- in the event value falls out of range.public static void assertNotNull(Object obj, int errorCode, String method) throws ValidationException
obj
- contains the reference to check.errorCode
- contains the error id to use if null.method
- contains the method name of caller.ValidationException
- in the event object is null.public static void assertNotNullOrEmpty(String value, int errorCode, String method) throws ValidationException
value
- contains the reference to check.errorCode
- contains the error id to use if null.method
- contains the method name of caller.ValidationException
- in the event supplied string is null or empty.public static void assertNotNullOrEmpty(char[] value, int errorCode, String method) throws ValidationException
value
- contains the reference to check.errorCode
- contains the error id to use if null.method
- contains the method name of caller.ValidationException
- in the event supplied string is null or empty.public void validateConstraints(Session session, VUtil.ConstraintType type, boolean checkDsd) throws SecurityException
Constraint
contained within the
targeted entity. If a particular UserRole
violates constraint it will not be activated. If User
validation fails a ValidationException will be thrown thus preventing User logon.session
- contains User
and UserRole
constraints Constraint
to be checked.type
- specifies User VUtil.ConstraintType.USER
or rOLE VUtil.ConstraintType.ROLE
.checkDsd
- will check DSD constraints if trueSecurityException
- in the event validation fails for User or system error occurs.Copyright © 2003-2016, The Apache Software Foundation. All Rights Reserved. Generated 20160718-1621