Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.util.validator.common
Class CommonValidatorUtil

    java.lang.Object
      org.hyperic.util.validator.common.CommonValidatorUtil

    public class CommonValidatorUtil

extends java.lang.Object

Contains validation utility methods for different types of fields. Methods "validateRequired" and "validateEmail" were "borrowed" from Jakarta's validation samples.

Field Summary
`static java.lang.String` | `FIELD_TEST_EQUAL`
`static java.lang.String` | `FIELD_TEST_NOTNULL`
`static java.lang.String` | `FIELD_TEST_NULL`
`static int` | `PASSWORD_MAX_LENGTH` Default password maximum length is 24
`static int` | `PASSWORD_MIN_LENGTH` Default password minimum length is 3
`static int` | `USERNAME_MAX_LENGTH` Default maximum length for a username is 24
`static int` | `USERNAME_MIN_LENGTH` Default minimum length for a username is 3
`static java.lang.String` | `USERNAME_VALID_REGEXP` Default character set for username is ^[A-Za-z0-9_-]$

Constructor Summary
`CommonValidatorUtil()`

Method Summary
`static boolean` | `validateEmail(java.lang.Object bean, org.apache.commons.validator.Field field)` Checks if the field is an e-mail address.
`static boolean` | `validatePassword(java.lang.Object bean, org.apache.commons.validator.Field field)` Validates a password field which restricts the length between PASSWORD_MIN_LENGTH and PASSWORD_MAX_LENGTH
`static boolean` | `validatePasswordVerification(java.lang.Object bean, org.apache.commons.validator.Field field)` Validates a password verification field which requires that the value exactly match the String value of the bean property referenced by property argument 1 (probably "password").
`static boolean` | `validatePrincipal(java.lang.Object bean, org.apache.commons.validator.Field field)` Validates the principal (Username) field based on default regular expression.
`static boolean` | `validateRequired(java.lang.Object bean, org.apache.commons.validator.Field field)` Checks if the field is required.
`static boolean` | `validateRequiredIf(java.lang.Object bean, org.apache.commons.validator.Field field, org.apache.commons.validator.Validator validator)` Conditional validation method.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### USERNAME_MIN_LENGTH

    public static final int USERNAME_MIN_LENGTH

  Default minimum length for a username is 3

  See Also:
    Constant Field Values

### USERNAME_MAX_LENGTH

    public static final int USERNAME_MAX_LENGTH

  Default maximum length for a username is 24

  See Also:
    Constant Field Values

### USERNAME_VALID_REGEXP

    public static final java.lang.String USERNAME_VALID_REGEXP

  Default character set for username is ^[A-Za-z0-9_-]$

  See Also:
    Constant Field Values

### PASSWORD_MIN_LENGTH

    public static final int PASSWORD_MIN_LENGTH

  Default password minimum length is 3

  See Also:
    Constant Field Values

### PASSWORD_MAX_LENGTH

    public static final int PASSWORD_MAX_LENGTH

  Default password maximum length is 24

  See Also:
    Constant Field Values

### FIELD_TEST_NULL

    public static final java.lang.String FIELD_TEST_NULL

See Also:
  Constant Field Values

### FIELD_TEST_NOTNULL

    public static final java.lang.String FIELD_TEST_NOTNULL

See Also:
  Constant Field Values

### FIELD_TEST_EQUAL

    public static final java.lang.String FIELD_TEST_EQUAL

See Also:
  Constant Field Values

Constructor Detail

### CommonValidatorUtil

    public CommonValidatorUtil()

Method Detail

### validateRequired

    public static boolean validateRequired(java.lang.Object bean,
                                           org.apache.commons.validator.Field field)

  Checks if the field is required.

  Parameters:
    `value` - The value validation is being performed on.
  Returns:
    boolean If the field isn't `null` and has a length greater than zero, `true` is returned. Otherwise `false`.

### validateEmail

    public static boolean validateEmail(java.lang.Object bean,
                                        org.apache.commons.validator.Field field)

  Checks if the field is an e-mail address.

  Parameters:
    `value` - The value validation is being performed on.
  Returns:
    boolean If the field is an e-mail address `true` is returned. Otherwise `false`.

### validatePrincipal

    public static boolean validatePrincipal(java.lang.Object bean,
                                            org.apache.commons.validator.Field field)

  Validates the principal (Username) field based on default regular expression.

  Parameters:
    `bean` - The bean containing the field to validate.
    `field` - The Field property info from the mapping file.
  Returns:
    boolean If the field contains valid data `true` is returned, otherwise `false`.

### validatePassword

    public static boolean validatePassword(java.lang.Object bean,
                                           org.apache.commons.validator.Field field)

  Validates a password field which restricts the length between PASSWORD_MIN_LENGTH and PASSWORD_MAX_LENGTH

  Parameters:
    `bean` - containing the fields to validate.
    `Field` - object containing the property resource info.

### validatePasswordVerification

    public static boolean validatePasswordVerification(java.lang.Object bean,
                                                       org.apache.commons.validator.Field field)

  Validates a password verification field which requires that the value exactly match the String value of the bean property referenced by property argument 1 (probably "password").

  Parameters:
    `bean` - containing the fields to validate.
    `Field` - object containing the property resource info.

### validateRequiredIf

    public static boolean validateRequiredIf(java.lang.Object bean,
                                             org.apache.commons.validator.Field field,
                                             org.apache.commons.validator.Validator validator)

  Conditional validation method.

  Parameters:
    `bean` - to be tested
    `bean's` - field to be tested.
    `current` - validator
  Returns:
    true if condition satisfied, false otherwise.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.