Class AttributesAccessor
- java.lang.Object
-
- org.identityconnectors.framework.common.objects.AttributesAccessor
-
public class AttributesAccessor extends Object
Attributes Accessor convenience methods for accessing attributes. This class wraps a set of attributes to make lookup faster than theAttributeUtil.find(String, Set)method, since that method must re-create the map each time.- Author:
- Warren Strange
-
-
Constructor Summary
Constructors Constructor Description AttributesAccessor(Set<Attribute> attrs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attributefind(String name)Find the named attribute.BigDecimalfindBigDecimal(String name)Get the big decimal value from the specified (single-valued) attribute.BigIntegerfindBigInteger(String name)Get the big integer value from the specified (single-valued) attribute.BooleanfindBoolean(String name)Get the boolean value from the specified (single-valued) attribute.BytefindByte(String name)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.CharacterfindCharacter(String name)Get the character value from the specified (single-valued) attribute.DatefindDate(String name)Get the date value from the specified (single-valued) attribute that contains a long.DoublefindDouble(String name)Get the double value from the specified (single-valued) attribute.FloatfindFloat(String name)Get the float value from the specified (single-valued) attribute.GuardedByteArrayfindGuardedByteArray(String name)Get the guarded byte array value from the specified (single-valued) attribute.GuardedStringfindGuardedString(String name)Get the guarded string value from the specified (single-valued) attribute.IntegerfindInteger(String name)Get the integer value from the specified (single-valued) attribute.List<Object>findList(String name)Return a list of attributes.LongfindLong(String name)Get the long value from the specified (single-valued) attribute.Map<String,Object>findMap(String name)Get the map value from the specified (single-valued) attribute.StringfindString(String name)Get the string value from the specified (single-valued) attribute.List<String>findStringList(String name)Return the multivalued attribute as a list of strings.booleangetEnabled(boolean defaultTo)Return the enabled status of the account.NamegetName()Get theNameattribute from the set of attributes.GuardedStringgetPassword()Get the password as a GuardeString.UidgetUid()Get theUidattribute from the set of attributes.booleanhasAttribute(String name)Determines if the set as the attribute specified.Set<String>listAttributeNames()Get the name of attributes this Accessor was created with.
-
-
-
Method Detail
-
find
public Attribute find(String name)
Find the named attribute.- Parameters:
name- the attribute name to search for- Returns:
- the Attribute, or null if not found.
-
getName
public Name getName()
Get theNameattribute from the set of attributes.- Returns:
- the
Nameattribute in the set.
-
getUid
public Uid getUid()
Get theUidattribute from the set of attributes.- Returns:
- the
Uidattribute 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
public GuardedString getPassword()
Get the password as a GuardeString.- Returns:
- the password as a guarded String
-
findList
public List<Object> findList(String name)
Return a list of attributes.- Parameters:
name- name of attribute to search for.- Returns:
- The List (generic object) if it exists otherwise null.
-
findStringList
public List<String> findStringList(String name)
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
public Set<String> 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
public boolean hasAttribute(String name)
Determines if the set as the attribute specified.- Parameters:
name- attribute name- Returns:
- true if the named attribute exists, false otherwise
-
findString
public String findString(String name)
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
public Character findCharacter(String name)
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
public Integer findInteger(String name)
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
public Long findLong(String name)
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
public Date findDate(String name)
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
public Double findDouble(String name)
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
public Float findFloat(String name)
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
public BigDecimal findBigDecimal(String name)
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
public Boolean findBoolean(String name)
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
public Byte findByte(String name)
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
public Byte[] findByteArray(String name)
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
public BigInteger findBigInteger(String name)
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
public GuardedByteArray findGuardedByteArray(String name)
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
public GuardedString findGuardedString(String name)
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
public Map<String,Object> findMap(String name)
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
-
-