Class AttributeUtil
java.lang.Object
org.identityconnectors.framework.common.objects.AttributeUtil
Utility methods to retrieve values from instances of 
Attribute.- 
Method Summary
Modifier and TypeMethodDescriptionReturns a mutable copy of the original set with the uid attribute added.static StringcreateSpecialName(String name) Create a special name from the specified name.Returns a mutable copy of the original set with the uid attribute removed.static Attributestatic StringgetAsStringValue(Attribute attr) Get the string value from the specified (single-valued) attribute.getBasicAttributes(Set<Attribute> attrs) Filter out any special attribute from the specified set.static BigDecimalgetBigDecimalValue(Attribute attr) Get the big decimal value from the specified (single-valued) attribute.static BigIntegergetBigIntegerValue(Attribute attr) Get the big integer value from the specified (single-valued) attribute.static BooleangetBooleanValue(Attribute attr) Get the boolean value from the specified (single-valued) attribute.static Byte[]getByteArrayValue(Attribute attr) Get the byte array value from the specified (single-valued) attribute.static BytegetByteValue(Attribute attr) Get the byte value from the specified (single-valued) attribute.static CharactergetCharacterValue(Attribute attr) Get the character value from the specified (single-valued) attribute.static GuardedStringgetCurrentPasswordValue(Set<Attribute> attrs) Get the current password value from the provided set ofAttributes.static DategetDateValue(Attribute attr) Get the date value from the specified (single-valued) attribute that contains a long.static DoublegetDoubleValue(Attribute attr) Get the double value from the specified (single-valued) attribute.static DategetEnableDate(Set<Attribute> attrs) Get the enable date from the set of attributes.static FloatgetFloatValue(Attribute attr) Get the float value from the specified (single-valued) attribute.static GuardedByteArrayGet theGuardedByteArrayvalue from the specified (single-valued) attribute.static GuardedStringGet theGuardedStringvalue from the specified (single-valued) attribute.static IntegergetIntegerValue(Attribute attr) Get the integer value from the specified (single-valued) attribute.static LonggetLongValue(Attribute attr) Get the long value from the specified (single-valued) attribute.getMapValue(Attribute attr) Get the map value from the specified (single-valued) attribute.static NamegetNameFromAttributes(Set<Attribute> attrs) Get theNameattribute from the specified set of attributes.static DateRetrieve the password expiration date from theConnectorObject.static BooleangetPasswordExpired(Set<Attribute> attrs) Get the password expired attribute from aCollectionofAttributes.static GuardedStringgetPasswordValue(Set<Attribute> attrs) Get the password value from the provided set ofAttributes.static ObjectgetSingleValue(Attribute attr) Get theObjectvalue from the specified (single-valued) attribute.getSpecialAttributes(Set<Attribute> attrs) Filter out any basic attributes from the specified set, leaving only special attributes.static StringgetStringValue(Attribute attr) Get the string value from the specified (single-valued) attribute.static UidgetUidAttribute(Set<Attribute> attrs) Get theUidfrom the specified set of attributes.static BooleanisEnabled(ConnectorObject obj) Determine if theConnectorObjectis enable.static BooleanDetermine if theConnectorObjectis locked out.static BooleanDetermine if the password is expired for this object.static booleanDetermines whether the specified attribute is a special attribute.static booleanisSpecial(AttributeInfo attr) Determines whether the specified attribute info is for a special attribute.static booleanisSpecialName(String name) Determines whether the specified attribute name is special in the sense ofcreateSpecialName(java.lang.String).static booleannamesEqual(String name1, String name2) Compares two attribute names for equality.toMap(Collection<? extends Attribute> attributes)  
- 
Method Details
- 
getStringValue
Get the string value from the specified (single-valued) attribute.- Parameters:
 attr- Attribute from which to retrieve the string value.- Returns:
 - null if the value is null otherwise the string value for the attribute.
 - Throws:
 ClassCastException- if the object in the attribute is not a string.IllegalArgumentException- if the attribute is a multi-valued (rather than single-valued).
 - 
getCharacterValue
Get the character value from the specified (single-valued) attribute.- Parameters:
 attr- 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
 
 - 
getGuardedByteArrayValue
Get theGuardedByteArrayvalue from the specified (single-valued) attribute.- Parameters:
 attr- 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 GuardedByteArray.IllegalArgumentException- if the attribute is a multi-valued (rather than single-valued).- Since:
 - 1.4
 
 - 
getGuardedStringValue
Get theGuardedStringvalue from the specified (single-valued) attribute.- Parameters:
 attr- 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 GuardedString.IllegalArgumentException- if the attribute is a multi-valued (rather than single-valued).
 - 
getAsStringValue
Get the string value from the specified (single-valued) attribute.- Parameters:
 attr- Attribute from which to retrieve the string value.- Returns:
 - null if the value is null otherwise the string value for the attribute.
 - Throws:
 IllegalArgumentException- if the attribute is a multi-valued (rather than single-valued).
 - 
getByteValue
Get the byte value from the specified (single-valued) attribute.- Parameters:
 attr- 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
 
 - 
getByteArrayValue
Get the byte array value from the specified (single-valued) attribute.- Parameters:
 attr- 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 array.IllegalArgumentException- if the attribute is a multi-valued (rather than single-valued).- Since:
 - 1.4
 
 - 
getIntegerValue
Get the integer value from the specified (single-valued) attribute.- Parameters:
 attr- Attribute from which to retrieve the integer value.- Returns:
 - null if the value is null otherwise the integer value for the attribute.
 - Throws:
 ClassCastException- if the object in the attribute is not an integer.IllegalArgumentException- if the attribute is a multi-valued (rather than single-valued).
 - 
getLongValue
Get the long value from the specified (single-valued) attribute.- Parameters:
 attr- 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 a long.IllegalArgumentException- if the attribute is a multi-valued (rather than single-valued).
 - 
getFloatValue
Get the float value from the specified (single-valued) attribute.- Parameters:
 attr- 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
 
 - 
getDateValue
Get the date value from the specified (single-valued) attribute that contains a long.- Parameters:
 attr- 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 a long.IllegalArgumentException- if the attribute is a multi-valued (rather than single-valued).
 - 
getDoubleValue
Get the double value from the specified (single-valued) attribute.- Parameters:
 attr- 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)..
 - 
getBigDecimalValue
Get the big decimal value from the specified (single-valued) attribute.- Parameters:
 attr- 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 a big decimal.IllegalArgumentException- if the attribute is a multi-valued (rather than single-valued).
 - 
getBigIntegerValue
Get the big integer value from the specified (single-valued) attribute.- Parameters:
 attr- 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
 
 - 
getBooleanValue
Get the boolean value from the specified (single-valued) attribute.- Parameters:
 attr- 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).
 - 
getMapValue
Get the map value from the specified (single-valued) attribute.- Parameters:
 attr- 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 anMap.IllegalArgumentException- if the attribute is a multi-valued (rather than single-valued).
 - 
getSingleValue
Get theObjectvalue from the specified (single-valued) attribute.- Returns:
 nullif the attribute's list of values isnullor empty.
 - 
toMap
Transform aCollectionofAttributeinstances into aMap. The key to each element in the map is the name of anAttribute. The value of each element in the map is theAttributeinstance with that name.- Parameters:
 attributes- set of attribute to transform to a map.- Returns:
 - a map of string and attribute.
 - Throws:
 NullPointerException- if the parameter attributes is null.
 - 
getUidAttribute
Get theUidfrom the specified set of attributes. - 
getBasicAttributes
Filter out any special attribute from the specified set. Special attributes includeName,Uid, andOperationalAttributes.- Parameters:
 attrs- set ofAttributes to filter out the operational and default attributes.- Returns:
 - a set that only contains plain attributes or empty.
 
 - 
getSpecialAttributes
Filter out any basic attributes from the specified set, leaving only special attributes. Special attributes includeName,Uid, andOperationalAttributes.- Parameters:
 attrs- set ofAttributes to filter out the basic attributes- Returns:
 - a set that only contains special attributes or an empty set if there are none.
 
 - 
filterUid
Returns a mutable copy of the original set with the uid attribute removed.- Parameters:
 attrs- The original set. Must not be null.- Returns:
 - A mutable copy of the original set with the uid attribute removed.
 
 - 
addUid
Returns a mutable copy of the original set with the uid attribute added.- Parameters:
 attrs- The original set. Must not be null.uid- The uid. Must not be null.- Returns:
 - A mutable copy of the original set with the uid attribute added.
 
 - 
isSpecial
Determines whether the specified attribute is a special attribute. Special attributes includeUid,ObjectClassandOperationalAttributes.- Parameters:
 attr-Attributeto test for against.- Returns:
 - true if the attribute value is a 
Uid,ObjectClassor one of theOperationalAttributes. - Throws:
 NullPointerException- if the attribute parameter is null.
 - 
isSpecial
Determines whether the specified attribute info is for a special attribute. Special attributes includeUid,ObjectClassandOperationalAttributes.- Parameters:
 attr-AttributeInfoto test for against.- Returns:
 - true if the attribute value is a 
Uid,ObjectClassor one of theOperationalAttributes. - Throws:
 NullPointerException- if the attribute parameter is null.
 - 
isSpecialName
Determines whether the specified attribute name is special in the sense ofcreateSpecialName(java.lang.String).- Parameters:
 name- the attribute name to test against.- Returns:
 - true if the attribute name is special.
 
 - 
createSpecialName
Create a special name from the specified name. Add the__string as both prefix and suffix. This indicates that an attribute name identifies a "special attribute" such asUid,ObjectClassor one of theOperationalAttributes. - 
namesEqual
Compares two attribute names for equality.- Parameters:
 name1- the first attribute name.name2- the second attribute name.- Returns:
 - true if the two attribute names are equal.
 
 - 
getNameFromAttributes
Get theNameattribute from the specified set of attributes.- Parameters:
 attrs- set of attributes to search against.- Returns:
 - the 
Nameattribute it if exsist otherwisenull. 
 - 
find
 - 
getPasswordValue
Get the password value from the provided set ofAttributes. - 
getCurrentPasswordValue
Get the current password value from the provided set ofAttributes.- Parameters:
 attrs- Set ofAttributes that may contain the current passwordOperationalAttributes.CURRENT_PASSWORD_NAMEAttribute.- Returns:
 nullif it does not exist in theSetelse the value.
 - 
isLockedOut
Determine if theConnectorObjectis locked out. By getting the value of theOperationalAttributes.LOCK_OUT_NAME.- Parameters:
 obj-ConnectorObjectobject to inspect.- Returns:
 nullif the attribute does not exist otherwise to value of theAttribute.- Throws:
 NullPointerException- if the parameter 'obj' isnull.
 - 
isEnabled
Determine if theConnectorObjectis enable. By getting the value of theOperationalAttributes.ENABLE_NAME.- Parameters:
 obj-ConnectorObjectobject to inspect.- Returns:
 nullif the attribute does not exist otherwise to value of theAttribute.- Throws:
 IllegalStateException- if the object does not contain attribute in question.NullPointerException- if the parameter 'obj' isnull.
 - 
getPasswordExpirationDate
Retrieve the password expiration date from theConnectorObject.- Parameters:
 obj-ConnectorObjectobject to inspect.- Returns:
 nullif theAttributedoes not exist otherwise the value of theAttribute.- Throws:
 IllegalStateException- if the object does not contain attribute in question.NullPointerException- if the parameter 'obj' isnull.
 - 
getPasswordExpired
Get the password expired attribute from aCollectionofAttributes. - 
isPasswordExpired
Determine if the password is expired for this object.- Parameters:
 obj-ConnectorObjectthat should contain a password expired attribute.- Returns:
 nullif the attribute does not exist and the value of theAttributeif it does.
 - 
getEnableDate
Get the enable date from the set of attributes. 
 -