Class AttributesAccessor
java.lang.Object
org.identityconnectors.framework.common.objects.AttributesAccessor
Attributes Accessor convenience methods for accessing attributes.
This class wraps a set of attributes to make lookup faster than the
AttributeUtil.find(String, Set)
method, since that method must
re-create the map each time.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionFind the named attribute.findBigDecimal
(String name) Get the big decimal value from the specified (single-valued) attribute.findBigInteger
(String name) Get the big integer value from the specified (single-valued) attribute.findBoolean
(String name) Get the boolean value from the specified (single-valued) attribute.Get the byte value from the specified (single-valued) attribute.Byte[]
findByteArray
(String name) Get the byte array value from the specified (single-valued) attribute.findCharacter
(String name) Get the character value from the specified (single-valued) attribute.Get the date value from the specified (single-valued) attribute that contains a long.findDouble
(String name) Get the double value from the specified (single-valued) attribute.Get the float value from the specified (single-valued) attribute.findGuardedByteArray
(String name) Get the guarded byte array value from the specified (single-valued) attribute.findGuardedString
(String name) Get the guarded string value from the specified (single-valued) attribute.findInteger
(String name) Get the integer value from the specified (single-valued) attribute.Return a list of attributes.Get the long value from the specified (single-valued) attribute.Get the map value from the specified (single-valued) attribute.findString
(String name) Get the string value from the specified (single-valued) attribute.findStringList
(String name) Return the multivalued attribute as a list of strings.boolean
getEnabled
(boolean defaultTo) Return the enabled status of the account.getName()
Get theName
attribute from the set of attributes.Get the password as a GuardeString.getUid()
Get theUid
attribute from the set of attributes.boolean
hasAttribute
(String name) Determines if the set as the attribute specified.Get the name of attributes this Accessor was created with.
-
Constructor Details
-
AttributesAccessor
-
-
Method Details
-
find
Find the named attribute.- Parameters:
name
- the attribute name to search for- Returns:
- the Attribute, or null if not found.
-
getName
Get theName
attribute from the set of attributes.- Returns:
- the
Name
attribute in the set.
-
getUid
Get theUid
attribute from the set of attributes.- Returns:
- the
Uid
attribute in the set.
-
getEnabled
public boolean getEnabled(boolean defaultTo) Return the enabled status of the account. If the ENABLE operational attribute is present, it's value takes precedence over the current value. If it is missing, the currentlyEnabled status is returned instead.- Parameters:
defaultTo
- the default state if enable is not found.- Returns:
- true if the account is enabled, false otherwise
-
getPassword
Get the password as a GuardeString.- Returns:
- the password as a guarded String
-
findList
Return a list of attributes.- Parameters:
name
- name of attribute to search for.- Returns:
- The List (generic object) if it exists otherwise null.
-
findStringList
Return the multivalued attribute as a list of strings. This will throw a ClassCastException if the underlying attribute list is not of type String.- Parameters:
name
- the name of the attribute to search for- Returns:
- a List of String values for the attribute
-
listAttributeNames
Get the name of attributes this Accessor was created with.- Returns:
- new Case Insensitive ReadOnly Set of attribute name the access has access to.
- Since:
- 1.4
-
hasAttribute
Determines if the set as the attribute specified.- Parameters:
name
- attribute name- Returns:
- true if the named attribute exists, false otherwise
-
findString
Get the string value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the long value.- Returns:
- null if the value is null otherwise the long value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not an long.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).
-
findCharacter
Get the character value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the character value.- Returns:
- null if the value is null otherwise the character value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not a character.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).- Since:
- 1.4
-
findInteger
Get the integer value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the long value.- Returns:
- null if the value is null otherwise the long value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not an long.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).
-
findLong
Get the long value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the long value.- Returns:
- null if the value is null otherwise the long value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not an long.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).
-
findDate
Get the date value from the specified (single-valued) attribute that contains a long.- Parameters:
name
- Attribute from which to retrieve the date value.- Returns:
- null if the value is null otherwise the date value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not an long.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).
-
findDouble
Get the double value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the double value.- Returns:
- null if the value is null otherwise the double value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not a double.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued)..
-
findFloat
Get the float value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the float value.- Returns:
- null if the value is null otherwise the float value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not a float.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).- Since:
- 1.4
-
findBigDecimal
Get the big decimal value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the big decimal value.- Returns:
- null if the value is null otherwise the big decimal value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not an big decimal.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).
-
findBoolean
Get the boolean value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the boolean value.- Returns:
- null if the value is null otherwise the boolean value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not anBoolean
.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).
-
findByte
Get the byte value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the byte value.- Returns:
- null if the value is null otherwise the byte value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not a byte.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).- Since:
- 1.4
-
findByteArray
Get the byte array value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the byte array value.- Returns:
- null if the value is null otherwise the byte array value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not a byte.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).- Since:
- 1.4
-
findBigInteger
Get the big integer value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the big integer value.- Returns:
- null if the value is null otherwise the big integer value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not a big integer.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).- Since:
- 1.4
-
findGuardedByteArray
Get the guarded byte array value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the guarded byte array value.- Returns:
- null if the value is null otherwise the guarded byte array value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not a guarded byte array.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).- Since:
- 1.4
-
findGuardedString
Get the guarded string value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the guarded string value.- Returns:
- null if the value is null otherwise the guarded string value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not a guarded string.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).- Since:
- 1.4
-
findMap
Get the map value from the specified (single-valued) attribute.- Parameters:
name
- Attribute from which to retrieve the map value.- Returns:
- null if the value is null otherwise the map value for the attribute.
- Throws:
ClassCastException
- if the object in the attribute is not a map.IllegalArgumentException
- if the attribute is a multi-valued (rather than single-valued).- Since:
- 1.4
-