Class AttributeDeltaUtil
java.lang.Object
org.identityconnectors.framework.common.objects.AttributeDeltaUtil
Utility methods to retrieve values from instances of
AttributeDelta
.-
Method Summary
Modifier and TypeMethodDescriptionstatic Set
<AttributeDelta> addUid
(Set<AttributeDelta> attrsDelta, Object... values) Returns a mutable copy of the original set with the uid attributeDelta added.static Set
<AttributeDelta> filterUid
(Set<AttributeDelta> attrsDelta) Returns a mutable copy of the original set with the uid attributeDelta removed.static AttributeDelta
find
(String name, Set<AttributeDelta> attrsDelta) Find theAttributeDelta
of the given name in theSet
.static String
getAsStringValue
(AttributeDelta attrDelta) Get the string value from the specified (single-valued) attributeDelta.static AttributeDelta
getAttributeDeltaForName
(Set<AttributeDelta> attrsDelta) Get theAttributeDelta
attributeDelta for attribute Name from the specified set of attributesDelta.static Set
<AttributeDelta> getBasicAttributes
(Set<AttributeDelta> attrsDelta) Filter out any special attributeDelta from the specified set.static BigDecimal
getBigDecimalValue
(AttributeDelta attrDelta) Get the big decimal value from the specified (single-valued) attributeDelta.static BigInteger
getBigIntegerValue
(AttributeDelta attrDelta) Get the big integer value from the specified (single-valued) attributeDelta.static Boolean
getBooleanValue
(AttributeDelta attrDelta) Get the boolean value from the specified (single-valued) attributeDelta.static Byte[]
getByteArrayValue
(AttributeDelta attrDelta) Get the byte array value from the specified (single-valued) attributeDelta.static Byte
getByteValue
(AttributeDelta attrDelta) Get the byte value from the specified (single-valued) attributeDelta.static Character
getCharacterValue
(AttributeDelta attrDelta) Get the character value from the specified (single-valued) attributeDelta.static GuardedString
getCurrentPasswordValue
(Set<AttributeDelta> attrsDelta) Get the current password value from the provided set ofAttributeDelta
s.static Date
getDateValue
(AttributeDelta attrDelta) Get the date value from the specified (single-valued) attributeDelta that contains a long.static Double
getDoubleValue
(AttributeDelta attrDelta) Get the double value from the specified (single-valued) attributeDelta.static Attribute
getEmptyAttribute
(AttributeDelta attrDelta) Get theAttributeDelta
with name specific attributesDelta.static Date
getEnableDate
(Set<AttributeDelta> attrsDelta) Get the enable date from the set of attributesDelta.static Float
getFloatValue
(AttributeDelta attrDelta) Get the float value from the specified (single-valued) attributeDelta.static GuardedByteArray
getGuardedByteArrayValue
(AttributeDelta attrDelta) Get theGuardedByteArray
value from the specified (single-valued) attributeDelta.static GuardedString
getGuardedStringValue
(AttributeDelta attrDelta) Get theGuardedString
value from the specified (single-valued) attributeDelta.static Integer
getIntegerValue
(AttributeDelta attrDelta) Get the integer value from the specified (single-valued) attributeDelta.static Long
getLongValue
(AttributeDelta attrDelta) Get the long value from the specified (single-valued) attributeDelta.getMapValue
(AttributeDelta attrDelta) Get the map value from the specified (single-valued) attributeDelta.static Boolean
getPasswordExpired
(Set<AttributeDelta> attrsDelta) Get the password expired attributeDelta from aCollection
ofAttributeDelta
s.static GuardedString
getPasswordValue
(Set<AttributeDelta> attrsDelta) Get the password value from the provided set ofAttributeDelta
s.static Object
getSingleValue
(AttributeDelta attr) Get theObject
value from the specified (single-valued) attributeDelta.static Set
<AttributeDelta> getSpecialAttributes
(Set<AttributeDelta> attrsDelta) Filter out any basic attributes from the specified set, leaving only special attributes.static String
getStringValue
(AttributeDelta attrDelta) Get the string value from the specified (single-valued) attributeDelta.static AttributeDelta
getUidAttributeDelta
(Set<AttributeDelta> attrsDelta) Get theAttributeDelta
from the specified set of attributesDelta.static boolean
isSpecial
(AttributeDelta attrDelta) Determines whether the specified name of attribute info is for a special attribute.static boolean
isSpecialName
(String name) Determines whether the specified attribute name is special in the sense ofinvalid reference
#createSpecialName
static boolean
namesEqual
(String name1, String name2) Compares two attributeDelta names for equality.static Map
<String, AttributeDelta> toMap
(Collection<? extends AttributeDelta> attributesDelta)
-
Method Details
-
getStringValue
Get the string value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the string value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the string value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a string.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.
-
getCharacterValue
Get the character value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the character value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the character value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a character.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.- Since:
- 1.4
-
getGuardedByteArrayValue
Get theGuardedByteArray
value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the guarded byte array value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the guarded byte array value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a GuardedByteArray.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.- Since:
- 1.4
-
getGuardedStringValue
Get theGuardedString
value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the guarded string value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the guarded string value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a GuardedString.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.
-
getAsStringValue
Get the string value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the string value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the string value from list valuesToReplace for the attributeDelta.
- Throws:
IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.
-
getByteValue
Get the byte value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the byte value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the byte value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a byte.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.- Since:
- 1.4
-
getByteArrayValue
Get the byte array value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the byte array value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the byte array value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a byte array.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.- Since:
- 1.4
-
getIntegerValue
Get the integer value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the integer value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the integer value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not an integer.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.
-
getLongValue
Get the long value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the long value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the long value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a long.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.
-
getFloatValue
Get the float value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the float value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the float value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a float.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.- Since:
- 1.4
-
getDateValue
Get the date value from the specified (single-valued) attributeDelta that contains a long.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the date value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the date value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a long.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.
-
getDoubleValue
Get the double value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the double value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the double value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a double.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.
-
getBigDecimalValue
Get the big decimal value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the big decimal value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the big decimal value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a big decimal.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.
-
getBigIntegerValue
Get the big integer value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the big integer value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the big integer value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not a big integer.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.- Since:
- 1.4
-
getBooleanValue
Get the boolean value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the boolean value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the boolean value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not anBoolean
.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.
-
getMapValue
Get the map value from the specified (single-valued) attributeDelta.- Parameters:
attrDelta
- AttributeDelta from which to retrieve the map value.- Returns:
- null if the value is null or attributeDelta doesn't include valuesToReplace otherwise the map value from list valuesToReplace for the attributeDelta.
- Throws:
ClassCastException
- if the object in the attributeDelta is not anMap
.IllegalArgumentException
- if the attributeDelta is a multi-valued (rather than single-valued) or valuesToReplace is null.
-
getSingleValue
Get theObject
value from the specified (single-valued) attributeDelta.- Returns:
null
if the attributeDelta's list of valuesToReplace isnull
or empty.
-
toMap
public static Map<String,AttributeDelta> toMap(Collection<? extends AttributeDelta> attributesDelta) Transform aCollection
ofAttributeDelta
instances into aMap
. The key to each element in the map is the name of anAttributeDelta
. The value of each element in the map is theAttributeDelta
instance with that name.- Parameters:
attributesDelta
- set of attributesDelta to transform to a map.- Returns:
- a map of string and attributesDelta.
- Throws:
NullPointerException
- if the parameter attributesDelta is null.
-
getUidAttributeDelta
Get theAttributeDelta
from the specified set of attributesDelta.- Parameters:
attrsDelta
- set ofAttributeDelta
s that may contain aAttributeDelta
withinvalid reference
Uid.NAME
- Returns:
- null if the set does not contain a
AttributeDelta
withinvalid reference
Uid.NAME
-
getEmptyAttribute
Get theAttributeDelta
with name specific attributesDelta.- Parameters:
attrDelta
-AttributeDelta
with name from which createAttributeDelta
.
-
getBasicAttributes
Filter out any special attributeDelta from the specified set. Special attributes includeName
,Uid
, andOperationalAttributes
.- Parameters:
attrsDelta
- set ofAttributeDelta
s to filter out the operational and default attributes.- Returns:
- a set that only contains plain attributesDelta or empty.
-
getSpecialAttributes
Filter out any basic attributes from the specified set, leaving only special attributes. Special attributes includeName
,Uid
, andOperationalAttributes
.- Parameters:
attrsDelta
- set ofAttributeDelta
s 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 attributeDelta removed.- Parameters:
attrsDelta
- The original set. Must not be null.- Returns:
- A mutable copy of the original set with the uid attributeDelta removed.
-
addUid
Returns a mutable copy of the original set with the uid attributeDelta added.- Parameters:
attrsDelta
- The original set. Must not be null.values
- The uid's values. Must not be null.- Returns:
- A mutable copy of the original set with the uid attributeDelta added.
-
isSpecial
Determines whether the specified name of attribute info is for a special attribute. Special attributes includeUid
,ObjectClass
andOperationalAttributes
.- Parameters:
attr
-AttributeInfo
to test for against.- Returns:
- true if the attributeDelta name is name of a
Uid
,ObjectClass
or one of theOperationalAttributes
. - Throws:
NullPointerException
- if the attribute parameter is null.
-
isSpecialName
Determines whether the specified attribute name is special in the sense ofinvalid reference
#createSpecialName
- Parameters:
name
- the attribute name to test against.- Returns:
- true if the attribute name is special.
-
namesEqual
Compares two attributeDelta names for equality.- Parameters:
name1
- the first attributeDelta name.name2
- the second attributeDelta name.- Returns:
- true if the two attributeDelta names are equal.
-
getAttributeDeltaForName
Get theAttributeDelta
attributeDelta for attribute Name from the specified set of attributesDelta.- Parameters:
attrsDelta
- set of attributesDelta to search against.- Returns:
- the
AttributeDelta
attributeDelta for attribute Name if it exist otherwisenull
.
-
find
Find theAttributeDelta
of the given name in theSet
.- Parameters:
name
-AttributeDelta
's name to search for.attrsDelta
-Set
of attributeDelta to search.- Returns:
AttributeDelta
with the specified otherwisenull
.
-
getPasswordValue
Get the password value from the provided set ofAttributeDelta
s. -
getCurrentPasswordValue
Get the current password value from the provided set ofAttributeDelta
s.- Parameters:
attrsDelta
- Set ofAttributeDelta
s that may contain the current passwordOperationalAttributes.CURRENT_PASSWORD_NAME
AttributeDelta
.- Returns:
null
if it does not exist in theSet
else the value.
-
getPasswordExpired
Get the password expired attributeDelta from aCollection
ofAttributeDelta
s.- Parameters:
attrsDelta
- set of attributeDelta to find the expired passwordAttributeDelta
.- Returns:
null
if the attributeDelta does not exist and the value of theAttributeDelta
if it does.
-
getEnableDate
Get the enable date from the set of attributesDelta.- Parameters:
attrsDelta
- set of attributeDelta to find the enable dateAttributeDelta
.- Returns:
null
if the attributeDelta does not exist and the value of theAttributeDelta
if it does.
-