com.sap.portal.admin.wizard.validators
Class ObjectIdValidator

java.lang.Object
  |
  +--com.sap.portal.admin.wizard.validators.ObjectIdValidator
All Implemented Interfaces:
IValidator

public class ObjectIdValidator
extends java.lang.Object
implements IValidator

ObjectIdValidator checks the validity of the ID given to the new object to be created.


Constructor Summary
ObjectIdValidator()
           
 
Method Summary
 java.util.List getErrorKeyList(IWizardContext context)
          Get a list that holds the resource bundle keys for the collected errors in case the validity check failed.
protected  boolean idExceedMaxLen(java.lang.String id)
          Checks whether the given ID is too long and exceeds the permitted maximum length for object IDs.
protected  boolean idExists(java.lang.String id, IWizardContext context)
          Checks whether the provided ID already exists in the specified location (including the prefix).
protected  boolean idIsLegal(java.lang.String id, boolean isPrefix)
           Checks whether the object's ID is permitted according to the portal rules.
 boolean isValid(java.lang.Object key, IWizardContext context)
          Performs 2 checks for the object ID : Does the same ID (including prefix) already exist under the same folder.
 boolean isValid(java.lang.String prefix, java.lang.String id, IWizardContext context)
          Performs separate id check for the prefix and the id, allowing dots in the prefix and forbidding them in the ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectIdValidator

public ObjectIdValidator()
Method Detail

isValid

public boolean isValid(java.lang.Object key,
                       IWizardContext context)
Performs 2 checks for the object ID :
  1. Does the same ID (including prefix) already exist under the same folder.
  2. Does the length of the ID does not exceed the maximum allowed length.

Specified by:
isValid in interface IValidator
Parameters:
key - the object ID.
context - wizard context.
Returns:
True if everything is ok, false otherwise.

isValid

public boolean isValid(java.lang.String prefix,
                       java.lang.String id,
                       IWizardContext context)
Performs separate id check for the prefix and the id, allowing dots in the prefix and forbidding them in the ID. Then calls the API method to perform the other 2 checks.
Parameters:
prefix - the ID prefix
id - the ID
context - wizard context
Returns:
true if the fullId is ok, false otherwise.

getErrorKeyList

public java.util.List getErrorKeyList(IWizardContext context)
Description copied from interface: IValidator
Get a list that holds the resource bundle keys for the collected errors in case the validity check failed.
Specified by:
getErrorKeyList in interface IValidator
Following copied from interface: com.sap.portal.admin.wizard.validators.IValidator
Parameters:
context - wizard context
Returns:
Error list, empty list if no errors were found.

idIsLegal

protected boolean idIsLegal(java.lang.String id,
                            boolean isPrefix)

Checks whether the object's ID is permitted according to the portal rules.

Parameters:
id - the object ID.
isPrefix - specifies if the checked id is the prefix or not (prefix allows dots, ID doesn't)
Returns:
True if the ID is legal, false otherwise.

idExists

protected boolean idExists(java.lang.String id,
                           IWizardContext context)
Checks whether the provided ID already exists in the specified location (including the prefix).
Parameters:
id - the object ID.
context - wizard context.
Returns:
True if the ID already exist, false otherwise.

idExceedMaxLen

protected boolean idExceedMaxLen(java.lang.String id)
Checks whether the given ID is too long and exceeds the permitted maximum length for object IDs.
Parameters:
id - the object ID.
Returns:
True if the id exceeds the permitted maximum id length, false otherwise.