Class UserValidationUtils
java.lang.Object
com.appiancorp.suiteapi.personalization.UserValidationUtils
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
changedSSN
(String ssn_, String un_) Returns true if the given ssn is different from the ssn currently associated with the given username.static int
Returns the max character size for the given name fieldstatic boolean
isEmptyField
(String str_) This returns true if a user field is empty.static boolean
isUniqueSSN
(String ssn_) Returns true is there is no existing user with this ssn.static boolean
isUniqueUsername
(String username_) Returns true if the username is valid and there is no existing user that has the same username (case-insensitive).static boolean
isValidEmail
(String email_) Returns true if the given email is valid.static boolean
isValidName
(String name_) Valid names can contains letters, numbers, underscores, hyphens, and whitespace.static boolean
isValidNameLength
(String name_, UserValidationUtils.NameField field_) Returns true if name is a valid lengthstatic boolean
isValidSSN
(String ssn_) Valid ssns consist of 9 digits.static boolean
isValidTitle
(String title) Valid titles can contain letters, underscores, hyphens, whitespace, and if specified numbers.static boolean
isValidUsername
(String username_) Valid usernames can contain letters, numbers, underscores, periods, hyphens, and at signs.
-
Constructor Details
-
UserValidationUtils
public UserValidationUtils()
-
-
Method Details
-
isValidName
Valid names can contains letters, numbers, underscores, hyphens, and whitespace. Names are not always required, so an empty field is also considered valid.- Parameters:
name_
-- Returns:
- true if the name is valid
-
isValidNameLength
Returns true if name is a valid length- Parameters:
name_
- The name string to validatefield_
- Which name field to validate. Should be one of the NameField enum constants.- Returns:
- true if the name is a valid length
-
getNameMaxSize
Returns the max character size for the given name field- Parameters:
field_
- Which name field to validate. Should be one of the constants XX_FIELD.- Returns:
- max size for field
-
isValidUsername
Valid usernames can contain letters, numbers, underscores, periods, hyphens, and at signs. Usernames are required and cannot be left empty.- Parameters:
username_
-- Returns:
- true if the username is valid
-
isUniqueUsername
Returns true if the username is valid and there is no existing user that has the same username (case-insensitive).- Parameters:
username_
-- Returns:
- returns
true
if there is no existing user with the givenusername_
and theusername_
is valid username, returns false otherwise.
-
isValidSSN
Valid ssns consist of 9 digits. No spaces or dashes allowed. SSNs are not required, so an empty field is considered valid.- Parameters:
ssn_
-- Returns:
- true if the ssn is in a valid format
-
isUniqueSSN
Returns true is there is no existing user with this ssn. SSNs are not required, so an empty field is considered valid.- Parameters:
ssn_
-- Returns:
- true if there is no existing user with this ssn
-
changedSSN
Returns true if the given ssn is different from the ssn currently associated with the given username.- Parameters:
ssn_
- social security numberun_
- username- Returns:
- Throws:
Exception
-
isValidEmail
Returns true if the given email is valid. The email address is required and cannot be left empty.- Parameters:
email_
-- Returns:
-
isValidTitle
Valid titles can contain letters, underscores, hyphens, whitespace, and if specified numbers. Titles are not required, so an empty field is also considered valid.- Parameters:
title
-- Returns:
- true if the title is valid
-
isEmptyField
This returns true if a user field is empty. This should only be used to validate whether a user field is empty, and not as a generic check for null or empty string.- Parameters:
str_
- the value to check- Returns:
- true if the value is empty
-