Package com.isode.dsapi
Class AttributeType
java.lang.Object
com.isode.dsapi.AttributeType
Representation of an attribute type.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Used by the native library when creating a new empty object.AttributeType
(String attrName) Construct a new AttributeType using the specified attribute name or OID string, allowing only types that are recognised by the local schema.AttributeType
(String attrName, boolean allow_unknown) Construct a new AttributeType using the specified attribute name or OID string, optionally permitting unknown attribute-types. -
Method Summary
Modifier and TypeMethodDescriptionboolean
equals
(AttributeType type) Compare attribute types for equality.boolean
Compares this AttributeType with another one for equality.protected void
finalize()
Releases any native structures associated with this object.static String
Fetch the alternative name of an attribute, if it has one.Return attribute type alias, if the attribute-type has one.Return attribute type name (for example, the String "cn").static String[]
getCompletions
(String partial_name) Return an array containing all the attribute names and aliases that start with the given string (matching case-insensitively).static String
Fetch the OID of the named attribute type.int
Return the integer identifier of this type's syntax.Return a String representation of this object's syntax.int
hashCode()
Overrides Object.hashCode in order to be consistent with the equals(Object) method.boolean
Determine whether the local schema regards this AttributeType as a 'collective' type.boolean
Test whether this is a file-based attribute according to the local schema.boolean
Determine whether the local schema regards this AttributeType as being marked 'no user modification'.boolean
Determine whether the local schema regards this AttributeType as being marked 'obsolete'.boolean
Determine whether the local schema regards this AttributeType as being marked 'operational'.boolean
Determine whether values of this AttributeType have a printable string representation.boolean
Determine whether this AttributeType is one which has a String representation that is likely to be a DN.boolean
Determine whether the local schema regards this AttributeType as single-valued.boolean
Check to see if the attribute-type is unknown to the loaded schema.protected void
setAttributeType
(String attrName, boolean allow_unknown) Used by the native library to set an attribute type from the attribute name or OID string.toString()
Returns a string representation of this AttributeType.
-
Constructor Details
-
AttributeType
protected AttributeType()Used by the native library when creating a new empty object. -
AttributeType
Construct a new AttributeType using the specified attribute name or OID string, allowing only types that are recognised by the local schema. Note that either the short or long attribute-type name may be used to construct the object (e.g. "cn" and "commonname" would be equivalent).- Parameters:
attrName
- Attribute type name or OID- Throws:
BadAttributeTypeException
- if name is null or not recognised.NativeLibraryException
- if an unrecoverable error was detected by the native library- See Also:
-
AttributeType
public AttributeType(String attrName, boolean allow_unknown) throws BadAttributeTypeException, NativeLibraryException Construct a new AttributeType using the specified attribute name or OID string, optionally permitting unknown attribute-types. Note that either the short or long attribute-type name may be used to construct the object (e.g. "cn" and "commonname" would be equivalent). Unknown attribute-types always have 'octetstring' syntax and can be written to LDIF or sent over LDAP, but not sent over DAP.- Parameters:
attrName
- Attribute type name or OIDallow_unknown
- true to allow unknown attribute types, false to disallow them (which may result in BadAttributeTypeException being thrown).- Throws:
BadAttributeTypeException
- if name is null or not recognised.NativeLibraryException
- if an unrecoverable error was detected by the native library- See Also:
-
-
Method Details
-
setAttributeType
protected void setAttributeType(String attrName, boolean allow_unknown) throws BadAttributeTypeException, NativeLibraryException Used by the native library to set an attribute type from the attribute name or OID string.- Parameters:
attrName
- Attribute type name or OID.allow_unknown
- Allow unknown attribute-types?- Throws:
BadAttributeTypeException
- if attribute name is null or not recognised.NativeLibraryException
- if an unrecoverable error was detected by the native library
-
finalize
Releases any native structures associated with this object. -
isUnknown
public boolean isUnknown()Check to see if the attribute-type is unknown to the loaded schema. Unknown attribute-types can be created with the 'allow-unknown' flag set on the LDAP session, the LDIF stream, or on the AttributeType constructor. -
equals
Compare attribute types for equality.- Parameters:
type
- Attribute type to compare.- Returns:
- true if the same, false otherwise.
-
equals
Compares this AttributeType with another one for equality. -
hashCode
public int hashCode()Overrides Object.hashCode in order to be consistent with the equals(Object) method. -
getAttributeTypeName
Return attribute type name (for example, the String "cn"). This is the LDAP representation of the type name. See also getAttributeTypeAlias() to fetch the alternative name for the attribute type, if it has one.- Returns:
- Attribute type name. Returns a string representation of the underlying OID of no name present.
- Throws:
NativeLibraryException
- if an unrecoverable error was detected by the native library- See Also:
-
getAttributeTypeAlias
Return attribute type alias, if the attribute-type has one. This is an alternative name for the attribute-type.- Returns:
- Attribute type alias, or null if not present.
- Throws:
NativeLibraryException
- if an unrecoverable error was detected by the native library- See Also:
-
toString
Returns a string representation of this AttributeType. The string representation is equivalent to that returned by getAttributeTypeName.- Overrides:
toString
in classObject
- Returns:
- Attribute type name. Returns a string representation of the underlying OID of no name present.
- Throws:
NativeLibraryException
- if an unrecoverable error was detected by the native library
-
getSyntaxID
Return the integer identifier of this type's syntax. This is the pure syntax-ID integer, without any file-based offset.- Returns:
- Syntax identifier.
- Throws:
NativeLibraryException
- if an unrecoverable error was detected by the native library- See Also:
-
isFileBased
Test whether this is a file-based attribute according to the local schema.- Returns:
- 'true' if this is a file-based attribute, else 'false'
- Throws:
NativeLibraryException
- if an unrecoverable error was detected by the native library- Since:
- R15.0
- See Also:
-
getSyntaxName
Return a String representation of this object's syntax. For example, "caseignorestring" or "GeneralizedTime".- Returns:
- the syntax of the AttributeType
- Throws:
NativeLibraryException
- if an unrecoverable error was detected by the native library- See Also:
-
isPrintable
Determine whether values of this AttributeType have a printable string representation.- Returns:
- true if values of this AttributeType have a printable string representation, false otherwise.
- Throws:
NativeLibraryException
- if an unrecoverable error was detected by the native library- Since:
- 14.6
- See Also:
-
isSingleValue
public boolean isSingleValue()Determine whether the local schema regards this AttributeType as single-valued.- Returns:
- true if the Attribute is single-valued, false otherwise.
-
isCollective
public boolean isCollective()Determine whether the local schema regards this AttributeType as a 'collective' type.- Returns:
- true if the Attribute is collective, false otherwise.
-
isNoUserModification
public boolean isNoUserModification()Determine whether the local schema regards this AttributeType as being marked 'no user modification'.- Returns:
- true if the Attribute is no user modification, false otherwise.
-
isObsolete
public boolean isObsolete()Determine whether the local schema regards this AttributeType as being marked 'obsolete'.- Returns:
- true if the Attribute is obsolete, false otherwise.
-
isOperational
public boolean isOperational()Determine whether the local schema regards this AttributeType as being marked 'operational'.- Returns:
- true if the Attribute is operational, false otherwise.
-
getAlias
Fetch the alternative name of an attribute, if it has one. This converts the short name to the long name, or vice versa. It also converts the OID to the default name.- Returns:
- alternative attribute-type name, or 'null' if there isn't an alias, or for any other problem
-
getOID
Fetch the OID of the named attribute type.- Returns:
- OID of the attribute-type, or 'null' if there isn't one or if the type isn't known
- Since:
- 14.4
-
getCompletions
Return an array containing all the attribute names and aliases that start with the given string (matching case-insensitively). This is intended for getting a list of all possible attribute-types (passing ""), or doing attribute-type auto-completion (passing user's current input).- Parameters:
partial_name
- Initial part of name to match- Returns:
- Array of names, maybe zero-length
-
isPseudoDN
public boolean isPseudoDN()Determine whether this AttributeType is one which has a String representation that is likely to be a DN. This method was specifically added to cope with atnAmhsmdNamingcontext, which had previously been defined as DN, until a change in schema for ATN compatibility meant that it became a PrintableString.- Returns:
- true if this kind of Attribute holds values that may well be treatable as DNs, false otherwise.
-