@PublicAPI(stability=VOLATILE, mayInstantiate=false, mayExtend=false, mayInvoke=true) public abstract class CommonSchemaElements extends Object implements SchemaFileElement
This class defines common properties and behaviour of the various types of schema definitions (e.g. object class definitions, and attribute type definitions).
Any methods which accesses the set of names associated with this
definition, will retrieve the primary name as the first name,
regardless of whether or not it was contained in the original set
of names
passed to the constructor.
Where ordered sets of names, or extra properties are provided, the
ordering will be preserved when the associated fields are accessed
via their getters or via the Object.toString()
methods.
Note that these schema elements are not completely immutable, as the set of extra properties for the schema element may be altered after the element is created. Among other things, this allows the associated schema file to be edited so that an element created over protocol may be associated with a particular schema file.
Modifier | Constructor and Description |
---|---|
protected |
CommonSchemaElements(String primaryName,
Collection<String> names,
String oid,
String description,
boolean isObsolete,
Map<String,List<String>> extraProperties)
Creates a new definition with the provided information.
|
Modifier and Type | Method and Description |
---|---|
static void |
checkSafeProperties(Map<String,List<String>> extraProperties)
Check if the extra schema properties contain safe filenames.
|
boolean |
equals(Object o)
Indicates whether the provided object is equal to this attribute
type.
|
static String |
getDefinitionWithFileName(SchemaFileElement elem)
Retrieves the definition string used to create this attribute
type and including the X-SCHEMA-FILE extension.
|
String |
getDescription()
Retrieves the description for this schema definition.
|
Map<String,List<String>> |
getExtraProperties()
Retrieves the "extra" properties for this schema definition.
|
String |
getNameOrOID()
Retrieves the name or OID for this schema definition.
|
Set<String> |
getNormalizedNames()
Retrieves an iterable over the set of normalized names that may
be used to reference this schema definition.
|
String |
getNormalizedPrimaryName()
Retrieve the normalized primary name for this schema definition.
|
String |
getNormalizedPrimaryNameOrOID()
Retrieves the normalized primary name or OID for this schema
definition.
|
String |
getOID()
Retrieves the OID for this schema definition.
|
String |
getPrimaryName()
Retrieves the primary name for this schema definition.
|
static String |
getSchemaFile(SchemaFileElement elem)
Retrieves the name of the schema file that contains the
definition for this schema definition.
|
static String |
getSingleValueProperty(SchemaFileElement elem,
String propertyName)
Retrieves the name of a single value property for this schema element.
|
Iterable<String> |
getUserDefinedNames()
Retrieves an iterable over the set of user-defined names that may
be used to reference this schema definition.
|
int |
hashCode()
Retrieves the hash code for this schema definition.
|
boolean |
hasName(String lowerName)
Indicates whether this schema definition has the specified name.
|
boolean |
hasNameOrOID(String lowerValue)
Indicates whether this schema definition has the specified name
or OID.
|
boolean |
isObsolete()
Indicates whether this schema definition is declared "obsolete".
|
static void |
setExtraProperty(SchemaFileElement elem,
String name,
String value)
Sets the value for an "extra" property for this schema element.
|
void |
setExtraProperty(String name,
List<String> values)
Sets the values for an "extra" property for this schema element.
|
static void |
setSchemaFile(SchemaFileElement elem,
String schemaFile)
Specifies the name of the schema file that contains the
definition for this schema element.
|
protected CommonSchemaElements(String primaryName, Collection<String> names, String oid, String description, boolean isObsolete, Map<String,List<String>> extraProperties) throws NullPointerException
If no primaryName
is specified, but a set of
names
is specified, then the first name retrieved
from the set of names
will be used as the primary
name.
primaryName
- The primary name for this definition, or
null
if there is no primary name.names
- The full set of names for this definition, or
null
if there are no names.oid
- The OID for this definition (must not be
null
).description
- The description for the definition, or null
if there is no description.isObsolete
- Indicates whether this definition is declared
"obsolete".extraProperties
- A set of extra properties for this definition, or
null
if there are no extra properties.NullPointerException
- If the provided OID was null
.public static void checkSafeProperties(Map<String,List<String>> extraProperties) throws DirectoryException
extraProperties
- The schema properties to check.DirectoryException
- If a provided value was unsafe.public final String getPrimaryName()
null
if there is no primary name.public final String getNormalizedPrimaryName()
null
if there is no primary name.public final Set<String> getNormalizedNames()
public final Iterable<String> getUserDefinedNames()
public final boolean hasName(String lowerName)
lowerName
- The lowercase name for which to make the determination.true
if the specified name is assigned to
this schema definition, or false
if not.public final String getOID()
public final String getNameOrOID()
public final String getNormalizedPrimaryNameOrOID()
public final boolean hasNameOrOID(String lowerValue)
lowerValue
- The lowercase value for which to make the determination.true
if the provided value matches the OID
or one of the names assigned to this schema definition,
or false
if not.public static String getSchemaFile(SchemaFileElement elem)
elem
- The element where to get the schema file fromnull
if it
is not known or if it is not stored in any schema file.public static String getSingleValueProperty(SchemaFileElement elem, String propertyName)
elem
- The element where to get the single value property frompropertyName
- The name of the property to getnull
if it
is this property is not set.public static void setSchemaFile(SchemaFileElement elem, String schemaFile)
null
,
then any existing schema file definition will be removed.elem
- The element where to set the schema fileschemaFile
- The name of the schema file that contains the
definition for this schema element.public final String getDescription()
null
if there is no description.public final boolean isObsolete()
true
if this schema definition is declared
"obsolete", or false
if not.public final Map<String,List<String>> getExtraProperties()
SchemaFileElement
FIXME Contrary to the SDK, this method returns a modifiable Map.
getExtraProperties
in interface SchemaFileElement
public static void setExtraProperty(SchemaFileElement elem, String name, String value)
null
, then any
existing property with the given name will be removed.elem
- The element where to set the extra propertyname
- The name for the "extra" property. It must not be
null
.value
- The value for the "extra" property. If it is
null
, then any existing definition will be removed.public final void setExtraProperty(String name, List<String> values)
null
or
empty, then any existing property with the given name will be
removed.name
- The name for the "extra" property. It must not
be null
.values
- The set of values for the "extra" property. If
it is null
or empty, then any existing
definition will be removed.public final boolean equals(Object o)
public final int hashCode()
public static String getDefinitionWithFileName(SchemaFileElement elem)
elem
- The element where to get definition fromCopyright © 2010-2015 ForgeRock AS. All Rights Reserved.