org.opends.server.types
Class DITContentRule

java.lang.Object
  extended by org.opends.server.types.DITContentRule
All Implemented Interfaces:
SchemaFileElement

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public final class DITContentRule
extends java.lang.Object
implements SchemaFileElement

This class defines a DIT content rule, which defines the set of allowed, required, and prohibited attributes for entries with a given structural objectclass, and also indicates which auxiliary classes that may be included in the entry.


Constructor Summary
DITContentRule(java.lang.String definition, ObjectClass structuralClass, java.util.Map<java.lang.String,java.lang.String> names, java.lang.String description, java.util.Set<ObjectClass> auxiliaryClasses, java.util.Set<AttributeType> requiredAttributes, java.util.Set<AttributeType> optionalAttributes, java.util.Set<AttributeType> prohibitedAttributes, boolean isObsolete, java.util.Map<java.lang.String,java.util.List<java.lang.String>> extraProperties)
          Creates a new DIT content rule definition with the provided information.
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this DIT content rule.
 java.util.Set<ObjectClass> getAuxiliaryClasses()
          Retrieves the set of auxiliary objectclasses that may be used for entries associated with this DIT content rule.
 java.lang.String getDefinition()
          Retrieves the definition string used to create this DIT content rule.
 java.lang.String getDescription()
          Retrieves the description for this DIT content rule.
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getExtraProperties()
          Retrieves a mapping between the names of any extra non-standard properties that may be associated with this DIT content rule and the value for that property.
 java.util.List<java.lang.String> getExtraProperty(java.lang.String propertyName)
          Retrieves the value of the specified "extra" property for this DIT content rule.
 java.lang.String getName()
          Retrieves the primary name to use to reference this DIT content rule.
 java.util.Map<java.lang.String,java.lang.String> getNames()
          Retrieves the set of names that may be used to reference this DIT content rule.
 java.util.Set<AttributeType> getOptionalAttributes()
          Retrieves the set of optional attributes for this DIT content rule.
 java.util.Set<AttributeType> getProhibitedAttributes()
          Retrieves the set of prohibited attributes for this DIT content rule.
 java.util.Set<AttributeType> getRequiredAttributes()
          Retrieves the set of required attributes for this DIT content rule.
 java.lang.String getSchemaFile()
          Retrieves the name of the schema file that contains the definition for this DIT content rule.
 ObjectClass getStructuralClass()
          Retrieves the structural objectclass for this DIT content rule.
 int hashCode()
          Retrieves the hash code for this DIT content rule.
 boolean hasName(java.lang.String lowerName)
          Indicates whether the provided lowercase name may be used to reference this DIT content rule.
 boolean isAllowedAuxiliaryClass(ObjectClass auxiliaryClass)
          Indicates whether the provided auxiliary objectclass is allowed for use by this DIT content rule.
 boolean isObsolete()
          Indicates whether this DIT content rule is declared "obsolete".
 boolean isOptional(AttributeType attributeType)
          Indicates whether the provided attribute type is included in the optional attribute list for this DIT content rule.
 boolean isProhibited(AttributeType attributeType)
          Indicates whether the provided attribute type is included in the prohibited attribute list for this DIT content rule.
 boolean isRequired(AttributeType attributeType)
          Indicates whether the provided attribute type is included in the required attribute list for this DIT content rule.
 boolean isRequiredOrOptional(AttributeType attributeType)
          Indicates whether the provided attribute type is in the list of required or optional attributes for this DIT content rule.
 boolean isRequiredOrOptional(AttributeType attributeType, boolean acceptEmpty)
          Indicates whether the provided attribute type is in the list of required or optional attributes for this DIT content rule.
 DITContentRule recreateFromDefinition()
          Creates a new instance of this DIT content rule based on the definition string.
 void setExtraProperty(java.lang.String name, java.util.List<java.lang.String> values)
          Specifies the provided "extra" property for this DIT content rule.
 void setExtraProperty(java.lang.String name, java.lang.String value)
          Specifies the provided "extra" property for this DIT content rule.
 void setSchemaFile(java.lang.String schemaFile)
          Specifies the name of the schema file that contains the definition for this DIT content rule.
 java.lang.String toString()
          Retrieves the string representation of this DIT content rule in the form specified in RFC 2252.
 void toString(java.lang.StringBuilder buffer, boolean includeFileElement)
          Appends a string representation of this attribute type in the form specified in RFC 2252 to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DITContentRule

public DITContentRule(java.lang.String definition,
                      ObjectClass structuralClass,
                      java.util.Map<java.lang.String,java.lang.String> names,
                      java.lang.String description,
                      java.util.Set<ObjectClass> auxiliaryClasses,
                      java.util.Set<AttributeType> requiredAttributes,
                      java.util.Set<AttributeType> optionalAttributes,
                      java.util.Set<AttributeType> prohibitedAttributes,
                      boolean isObsolete,
                      java.util.Map<java.lang.String,java.util.List<java.lang.String>> extraProperties)
Creates a new DIT content rule definition with the provided information.

Parameters:
definition - The definition string used to create this DIT content rule. It must not be null.
structuralClass - The structural objectclass for this DIT content rule. It must not be null.
names - The set of names that may be used to reference this DIT content rule.
description - The description for this DIT content rule.
auxiliaryClasses - The set of auxiliary classes for this DIT content rule
requiredAttributes - The set of required attribute types for this DIT content rule.
optionalAttributes - The set of optional attribute types for this DIT content rule.
prohibitedAttributes - The set of prohibited attribute types for this DIT content rule.
isObsolete - Indicates whether this DIT content rule is declared "obsolete".
extraProperties - A set of extra properties for this DIT content rule.
Method Detail

getDefinition

public java.lang.String getDefinition()
Retrieves the definition string used to create this DIT content rule.

Specified by:
getDefinition in interface SchemaFileElement
Returns:
The definition string used to create this DIT content rule.

recreateFromDefinition

public DITContentRule recreateFromDefinition()
                                      throws DirectoryException
Creates a new instance of this DIT content rule based on the definition string. It will also preserve other state information associated with this DIT content rule that is not included in the definition string (e.g., the name of the schema file with which it is associated).

Specified by:
recreateFromDefinition in interface SchemaFileElement
Returns:
The new instance of this DIT content rule based on the definition string.
Throws:
DirectoryException - If a problem occurs while attempting to create a new DIT content rule instance from the definition string.

getStructuralClass

public ObjectClass getStructuralClass()
Retrieves the structural objectclass for this DIT content rule.

Returns:
The structural objectclass for this DIT content rule.

getNames

public java.util.Map<java.lang.String,java.lang.String> getNames()
Retrieves the set of names that may be used to reference this DIT content rule. The returned object will be a mapping between each name in all lowercase characters and that name in a user-defined form (which may include mixed capitalization).

Returns:
The set of names that may be used to reference this DIT content rule.

getName

public java.lang.String getName()
Retrieves the primary name to use to reference this DIT content rule.

Returns:
The primary name to use to reference this DIT content rule, or null if there is none.

hasName

public boolean hasName(java.lang.String lowerName)
Indicates whether the provided lowercase name may be used to reference this DIT content rule.

Parameters:
lowerName - The name for which to make the determination, in all lowercase characters.
Returns:
true if the provided lowercase name may be used to reference this DIT content rule, or false if not.

getSchemaFile

public java.lang.String getSchemaFile()
Retrieves the name of the schema file that contains the definition for this DIT content rule.

Specified by:
getSchemaFile in interface SchemaFileElement
Returns:
The name of the schema file that contains the definition for this DIT content rule, or null if it is not known or if it is not stored in any schema file.

setSchemaFile

public void setSchemaFile(java.lang.String schemaFile)
Specifies the name of the schema file that contains the definition for this DIT content rule.

Specified by:
setSchemaFile in interface SchemaFileElement
Parameters:
schemaFile - The name of the schema file that contains the definition for this DIT content rule.

getDescription

public java.lang.String getDescription()
Retrieves the description for this DIT content rule.

Returns:
The description for this DIT content rule, or null if there is none.

getAuxiliaryClasses

public java.util.Set<ObjectClass> getAuxiliaryClasses()
Retrieves the set of auxiliary objectclasses that may be used for entries associated with this DIT content rule.

Returns:
The set of auxiliary objectclasses that may be used for entries associated with this DIT content rule.

isAllowedAuxiliaryClass

public boolean isAllowedAuxiliaryClass(ObjectClass auxiliaryClass)
Indicates whether the provided auxiliary objectclass is allowed for use by this DIT content rule.

Parameters:
auxiliaryClass - The auxiliary objectclass for which to make the determination.
Returns:
true if the provided auxiliary objectclass is allowed for use by this DIT content rule, or false if not.

getRequiredAttributes

public java.util.Set<AttributeType> getRequiredAttributes()
Retrieves the set of required attributes for this DIT content rule.

Returns:
The set of required attributes for this DIT content rule.

isRequired

public boolean isRequired(AttributeType attributeType)
Indicates whether the provided attribute type is included in the required attribute list for this DIT content rule.

Parameters:
attributeType - The attribute type for which to make the determination.
Returns:
true if the provided attribute type is required by this DIT content rule, or false if not.

getOptionalAttributes

public java.util.Set<AttributeType> getOptionalAttributes()
Retrieves the set of optional attributes for this DIT content rule.

Returns:
The set of optional attributes for this DIT content rule.

isOptional

public boolean isOptional(AttributeType attributeType)
Indicates whether the provided attribute type is included in the optional attribute list for this DIT content rule.

Parameters:
attributeType - The attribute type for which to make the determination.
Returns:
true if the provided attribute type is optional for this DIT content rule, or false if not.

isRequiredOrOptional

public boolean isRequiredOrOptional(AttributeType attributeType)
Indicates whether the provided attribute type is in the list of required or optional attributes for this DIT content rule.

Parameters:
attributeType - The attribute type for which to make the determination.
Returns:
true if the provided attribute type is required or allowed for this DIT content rule, or false if it is not.

isRequiredOrOptional

public boolean isRequiredOrOptional(AttributeType attributeType,
                                    boolean acceptEmpty)
Indicates whether the provided attribute type is in the list of required or optional attributes for this DIT content rule.

Parameters:
attributeType - The attribute type for which to make the determination.
acceptEmpty - Indicates whether an empty list of required or optional attributes should be taken to indicate that all attributes allowed for an objectclass will be acceptable.
Returns:
true if the provided attribute type is required or allowed for this DIT content rule, or false if it is not.

getProhibitedAttributes

public java.util.Set<AttributeType> getProhibitedAttributes()
Retrieves the set of prohibited attributes for this DIT content rule.

Returns:
The set of prohibited attributes for this DIT content rule.

isProhibited

public boolean isProhibited(AttributeType attributeType)
Indicates whether the provided attribute type is included in the prohibited attribute list for this DIT content rule.

Parameters:
attributeType - The attribute type for which to make the determination.
Returns:
true if the provided attribute type is prohibited for this DIT content rule, or false if not.

isObsolete

public boolean isObsolete()
Indicates whether this DIT content rule is declared "obsolete".

Returns:
true if this DIT content rule is declared "obsolete", or false if it is not.

getExtraProperties

public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getExtraProperties()
Retrieves a mapping between the names of any extra non-standard properties that may be associated with this DIT content rule and the value for that property.

Returns:
A mapping between the names of any extra non-standard properties that may be associated with this DIT content rule and the value for that property.

getExtraProperty

public java.util.List<java.lang.String> getExtraProperty(java.lang.String propertyName)
Retrieves the value of the specified "extra" property for this DIT content rule.

Parameters:
propertyName - The name of the "extra" property for which to retrieve the value.
Returns:
The value of the specified "extra" property for this DIT content rule, or null if no such property is defined.

setExtraProperty

public void setExtraProperty(java.lang.String name,
                             java.lang.String value)
Specifies the provided "extra" property for this DIT content rule.

Parameters:
name - The name for the "extra" property. It must not be null.
value - The value for the "extra" property, or null if the property is to be removed.

setExtraProperty

public void setExtraProperty(java.lang.String name,
                             java.util.List<java.lang.String> values)
Specifies the provided "extra" property for this DIT content rule.

Parameters:
name - The name for the "extra" property. It must not be null.
values - The set of value for the "extra" property, or null if the property is to be removed.

equals

public boolean equals(java.lang.Object o)
Indicates whether the provided object is equal to this DIT content rule. The object will be considered equal if it is a DIT content rule for the same structural objectclass and the same sets of names. For performance reasons, the set of auxiliary classes, and the sets of required, optional, and prohibited attribute types will not be checked, so that should be done manually if a more thorough equality comparison is required.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object for which to make the determination.
Returns:
true if the provided object is equal to this DIT content rule, or false if not.

hashCode

public int hashCode()
Retrieves the hash code for this DIT content rule. It will be equal to the hash code for the associated structural objectclass.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this DIT content rule.

toString

public java.lang.String toString()
Retrieves the string representation of this DIT content rule in the form specified in RFC 2252.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this DIT content rule in the form specified in RFC 2252.

toString

public void toString(java.lang.StringBuilder buffer,
                     boolean includeFileElement)
Appends a string representation of this attribute type in the form specified in RFC 2252 to the provided buffer.

Parameters:
buffer - The buffer to which the information should be appended.
includeFileElement - Indicates whether to include an "extra" property that specifies the path to the schema file from which this DIT content rule was loaded.