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 the AttributeUtil.find(String, Set) method, since that method must re-create the map each time.
Author:
Warren Strange
  • Constructor Details Link icon

    • AttributesAccessor Link icon

      public AttributesAccessor(Set<Attribute> attrs)
  • Method Details Link icon

    • find Link icon

      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 Link icon

      public Name getName()
      Get the Name attribute from the set of attributes.
      Returns:
      the Name attribute in the set.
    • getUid Link icon

      public Uid getUid()
      Get the Uid attribute from the set of attributes.
      Returns:
      the Uid attribute in the set.
    • getEnabled Link icon

      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 Link icon

      public GuardedString getPassword()
      Get the password as a GuardeString.
      Returns:
      the password as a guarded String
    • findList Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 an Boolean.
      IllegalArgumentException - if the attribute is a multi-valued (rather than single-valued).
    • findByte Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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