Package com.iplanet.ums
Class CreationTemplate
- java.lang.Object
-
- com.iplanet.ums.Template
-
- com.iplanet.ums.CreationTemplate
-
- All Implemented Interfaces:
Serializable,Cloneable
public class CreationTemplate extends Template
Represents templates for creating objects in UMS. CreationTemplate is used to aid in creating objects in which it serves as reusable guidelines to instantiate UMS objects properly at runtime. The guidelines are used to instantiate objects in memory correctly so that subsequent storage in persistent storage can be done successfully. It is the intention that CreationTemplate allows applications to determine what is correct so that some control is given in the application for early detection of problems of UMS object creations. Reusability and flexibility are two desired goals of CreationTemplate.- See Also:
Template,SearchTemplate, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CreationTemplate()Default constructor for deserializationCreationTemplate(String name, AttrSet required, AttrSet optional)Creates a template with required and optional attributes.CreationTemplate(String name, AttrSet required, AttrSet optional, Class cls)Creates a template with required and optional attributes.CreationTemplate(String name, AttrSet required, AttrSet optional, ArrayList classes)Creates a template with required and optional attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOptionalAttribute(Attr attr)Adds the attribute to the optional attributes.voidaddRequiredAttribute(Attr attr)Adds the attribute to the required attributes.voidaddValidation(String attrName, String validatorClass, String rule)Adds the validator and the rule for the attribute name.Objectclone()Returns a copy of the template.AttrgetAttribute(String attributeName)Gets the value of a given attribute in the template.EnumerationgetAttributes()Gets enumeration of attributes for object creation.ArrayListgetCreationClasses()Get the classes that the CreationTemplate is associated with.StringgetNamingAttribute()Gets the naming attribute.String[]getOptionalAttributeNames()Gets a list of optional attribute names defined in the object.AttrSetgetOptionalAttributeSet()Gets the optional attributes for object creation.String[]getRequiredAttributeNames()Gets a list of required attribute names defined in the object.AttrSetgetRequiredAttributeSet()Gets the required attributes for object creation.String[]getValidatedAttributeNames()Gets a list of attribute names registered for validation.EnumerationgetValidation(String attrName)Gets enumeration of ValidationElement for the attribute namevoidremoveValidation(String attrName)Removes all validations from the attribute.voidsetCreationClasses(ArrayList classes)Set the class that the CreationTemplate is associated with.voidsetOptionalAttributeSet(AttrSet attrSet)Sets the optional attributes.voidsetRequiredAttributeSet(AttrSet attrSet)Sets the required attributes.StringtoString()Render the object.
-
-
-
Constructor Detail
-
CreationTemplate
public CreationTemplate()
Default constructor for deserialization
-
CreationTemplate
public CreationTemplate(String name, AttrSet required, AttrSet optional, ArrayList classes)
Creates a template with required and optional attributes.- Parameters:
name- Template namerequired- Set of required attributesoptional- Set of optional attributesclasses- Array of classes that this CreationTemplate is associated with for object creation
-
CreationTemplate
public CreationTemplate(String name, AttrSet required, AttrSet optional, Class cls)
Creates a template with required and optional attributes.- Parameters:
name- Template namerequired- Set of required attributesoptional- Set of optional attributescls- Class that this CreationTemplate is associated with for object creation
-
-
Method Detail
-
getAttribute
public Attr getAttribute(String attributeName)
Gets the value of a given attribute in the template.- Parameters:
attributeName- Name of attribute for which to return values- Returns:
- The attribute with the specified name, or
nullif attributeName isnull, or the attribute is not found.
-
getRequiredAttributeNames
public String[] getRequiredAttributeNames()
Gets a list of required attribute names defined in the object.- Returns:
- Names of all required attributes defined
-
getOptionalAttributeNames
public String[] getOptionalAttributeNames()
Gets a list of optional attribute names defined in the object.- Returns:
- Names of all optional attributes defined
-
getRequiredAttributeSet
public AttrSet getRequiredAttributeSet()
Gets the required attributes for object creation.- Returns:
- set of required attributes
-
getOptionalAttributeSet
public AttrSet getOptionalAttributeSet()
Gets the optional attributes for object creation.- Returns:
- set of optional attributes
-
getCreationClasses
public ArrayList getCreationClasses()
Get the classes that the CreationTemplate is associated with.- Returns:
- classes associated with this template
-
getValidation
public Enumeration getValidation(String attrName)
Gets enumeration of ValidationElement for the attribute name- Parameters:
attrName- Attribute name- Returns:
- Enumeration of ValidationElement
-
getValidatedAttributeNames
public String[] getValidatedAttributeNames()
Gets a list of attribute names registered for validation.- Returns:
- a list of attribute names registered for validation
-
getAttributes
public Enumeration getAttributes()
Gets enumeration of attributes for object creation.- Returns:
- enumeration of required and optional attributes
-
setRequiredAttributeSet
public void setRequiredAttributeSet(AttrSet attrSet)
Sets the required attributes.- Parameters:
attrSet- set of required attributes
-
setOptionalAttributeSet
public void setOptionalAttributeSet(AttrSet attrSet)
Sets the optional attributes.- Parameters:
attrSet- set of optional attributes
-
setCreationClasses
public void setCreationClasses(ArrayList classes)
Set the class that the CreationTemplate is associated with.- Parameters:
classes- Classes associated with this template
-
addRequiredAttribute
public void addRequiredAttribute(Attr attr)
Adds the attribute to the required attributes.- Parameters:
attr- The attribute to be added
-
addOptionalAttribute
public void addOptionalAttribute(Attr attr)
Adds the attribute to the optional attributes.- Parameters:
attr- The attribute to be added
-
addValidation
public void addValidation(String attrName, String validatorClass, String rule)
Adds the validator and the rule for the attribute name.- Parameters:
attrName- Attribute name to validate.validatorClass- Validator class name used for validation.rule- The optional rule used by the validator.
-
removeValidation
public void removeValidation(String attrName)
Removes all validations from the attribute.- Parameters:
attrName- attribute name of the validations to be removed
-
getNamingAttribute
public String getNamingAttribute()
Gets the naming attribute.- Returns:
- the naming attribute
-
clone
public Object clone()
Returns a copy of the template.
-
-