Skip to main content
Version: latest 1.4.x

API - Restriction

The Restriction class provides validation constraints for attributes which are checked when saving. Additionally, violations of restrictions are directly displayed in the input forms of the UI.

Fields​

FieldTypeDescription
minTextLengthIntegerMinimum text length
maxTextLengthIntegerMaximum text length
minLongLongMinimum long value
minDecimalBigDecimalMinimum decimal value
maxLongLongMaximum long value
maxDecimalBigDecimalMaximum decimal value
regexStringRegular expression pattern
descriptionStringRegex description
allowedValuesList<String>Allowed values
emptyBooleanWhether restrictions are empty

Attribute description​

/**
* @return the description of the attribute shown in tooltips.
*/
String getDescription();

Text restrictions​

/**
* @return the minimum text length
*/
Integer getMinTextLength();

/**
* @return the maximum text length
*/
Integer getMaxTextLength();

/**
* Set the minimum text length
* @param pMinTextLength the minimum text length to set
* @throws DataAccessException if an error occurs while setting the value
*/
void setMinTextLength(Integer pMinTextLength) throws DataAccessException;

/**
* Set the maximum text length
* @param pMaxTextLength the maximum text length to set
* @throws DataAccessException if an error occurs while setting the value
*/
void setMaxTextLength(Integer pMaxTextLength) throws DataAccessException;

/**
* @return the regular expression pattern which needs to be matched for a valid value.
*/
String getRegex();

/**
*
* @param pRegex the regular expression pattern to set
* @param pDescription the description of the regex to set
* @throws DataAccessException
*/
void setRegex(String pRegex, String pDescription) throws DataAccessException;

Number restrictions​

/**
* @return the minimum long value
*/
Long getMinAsLong();

/**
* @return the minimum decimal value
*/
BigDecimal getMinAsDecimal();

/**
* @return the maximum long value
*/
Long getMaxAsLong();

/**
* @return the maximum decimal value
*/
BigDecimal getMaxAsDecimal();

/**
* Set the minimum long value
* @param pMinLong the minimum long value to set
* @throws DataAccessException if an error occurs while setting the value
*/
void setMinAsLong(Long pMinLong) throws DataAccessException;

/**
* Set the minimum decimal value
* @param pMinDecimal the minimum decimal value to set
* @throws DataAccessException if an error occurs while setting the value
*/
void setMinAsDecimal(BigDecimal pMinDecimal) throws DataAccessException;

/**
* Set the maximum long value
* @param pMaxLong the maximum long value to set
* @throws DataAccessException if an error occurs while setting the value
*/
void setMaxAsLong(Long pMaxLong) throws DataAccessException;

/**
* Set the maximum decimal value
* @param pMaxDecimal the maximum decimal value to set
* @throws DataAccessException if an error occurs while setting the value
*/
void setMaxAsDecimal(BigDecimal pMaxDecimal) throws DataAccessException;

Allowed values for value lists​

/**
* @return the list of allowed values for value lists
*/
List<String> getAllowedValues();

/**
* Set the allowed values for value lists
* @param pAllowedValues the allowed values to set
*/
void setAllowedValues(String ... pAllowedValues);

/**
* Set the allowed values for value lists
* @param pAllowedValues the allowed values to set
*/
void setAllowedValues(Collection<String> pAllowedValues);

Check if restrictions are empty​

To be able whether restrictions are set witout checking each field depending on the data type isEmpty method is provided.

/**
* @return true if no restrictions are set, false otherwise
*/
Boolean isEmpty();