Class AttributeDeltaUtil
- java.lang.Object
-
- org.identityconnectors.framework.common.objects.AttributeDeltaUtil
-
public final class AttributeDeltaUtil extends Object
Utility methods to retrieve values from instances ofAttributeDelta.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 AttributeDeltafind(String name, Set<AttributeDelta> attrsDelta)Find theAttributeDeltaof the given name in theSet.static StringgetAsStringValue(AttributeDelta attrDelta)Get the string value from the specified (single-valued) attributeDelta.static AttributeDeltagetAttributeDeltaForName(Set<AttributeDelta> attrsDelta)Get theAttributeDeltaattributeDelta 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 BigDecimalgetBigDecimalValue(AttributeDelta attrDelta)Get the big decimal value from the specified (single-valued) attributeDelta.static BigIntegergetBigIntegerValue(AttributeDelta attrDelta)Get the big integer value from the specified (single-valued) attributeDelta.static BooleangetBooleanValue(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 BytegetByteValue(AttributeDelta attrDelta)Get the byte value from the specified (single-valued) attributeDelta.static CharactergetCharacterValue(AttributeDelta attrDelta)Get the character value from the specified (single-valued) attributeDelta.static GuardedStringgetCurrentPasswordValue(Set<AttributeDelta> attrsDelta)Get the current password value from the provided set ofAttributeDeltas.static DategetDateValue(AttributeDelta attrDelta)Get the date value from the specified (single-valued) attributeDelta that contains a long.static DoublegetDoubleValue(AttributeDelta attrDelta)Get the double value from the specified (single-valued) attributeDelta.static AttributegetEmptyAttribute(AttributeDelta attrDelta)Get theAttributeDeltawith name specific attributesDelta.static DategetEnableDate(Set<AttributeDelta> attrsDelta)Get the enable date from the set of attributesDelta.static FloatgetFloatValue(AttributeDelta attrDelta)Get the float value from the specified (single-valued) attributeDelta.static GuardedByteArraygetGuardedByteArrayValue(AttributeDelta attrDelta)Get theGuardedByteArrayvalue from the specified (single-valued) attributeDelta.static GuardedStringgetGuardedStringValue(AttributeDelta attrDelta)Get theGuardedStringvalue from the specified (single-valued) attributeDelta.static IntegergetIntegerValue(AttributeDelta attrDelta)Get the integer value from the specified (single-valued) attributeDelta.static LonggetLongValue(AttributeDelta attrDelta)Get the long value from the specified (single-valued) attributeDelta.static Map<String,Object>getMapValue(AttributeDelta attrDelta)Get the map value from the specified (single-valued) attributeDelta.static BooleangetPasswordExpired(Set<AttributeDelta> attrsDelta)Get the password expired attributeDelta from aCollectionofAttributeDeltas.static GuardedStringgetPasswordValue(Set<AttributeDelta> attrsDelta)Get the password value from the provided set ofAttributeDeltas.static ObjectgetSingleValue(AttributeDelta attr)Get theObjectvalue 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 StringgetStringValue(AttributeDelta attrDelta)Get the string value from the specified (single-valued) attributeDelta.static AttributeDeltagetUidAttributeDelta(Set<AttributeDelta> attrsDelta)Get theAttributeDeltafrom the specified set of attributesDelta.static booleanisSpecial(AttributeDelta attrDelta)Determines whether the specified name of attribute info is for a special attribute.static booleanisSpecialName(String name)Determines whether the specified attribute name is special in the sense of#createSpecialName.static booleannamesEqual(String name1, String name2)Compares two attributeDelta names for equality.static Map<String,AttributeDelta>toMap(Collection<? extends AttributeDelta> attributesDelta)
-
-
-
Method Detail
-
getStringValue
public static String getStringValue(AttributeDelta attrDelta)
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
public static Character getCharacterValue(AttributeDelta attrDelta)
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
public static GuardedByteArray getGuardedByteArrayValue(AttributeDelta attrDelta)
Get theGuardedByteArrayvalue 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
public static GuardedString getGuardedStringValue(AttributeDelta attrDelta)
Get theGuardedStringvalue 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
public static String getAsStringValue(AttributeDelta attrDelta)
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
public static Byte getByteValue(AttributeDelta attrDelta)
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
public static Byte[] getByteArrayValue(AttributeDelta attrDelta)
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
public static Integer getIntegerValue(AttributeDelta attrDelta)
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
public static Long getLongValue(AttributeDelta attrDelta)
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
public static Float getFloatValue(AttributeDelta attrDelta)
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
public static Date getDateValue(AttributeDelta attrDelta)
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
public static Double getDoubleValue(AttributeDelta attrDelta)
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
public static BigDecimal getBigDecimalValue(AttributeDelta attrDelta)
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
public static BigInteger getBigIntegerValue(AttributeDelta attrDelta)
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
public static Boolean getBooleanValue(AttributeDelta attrDelta)
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
public static Map<String,Object> getMapValue(AttributeDelta attrDelta)
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
public static Object getSingleValue(AttributeDelta attr)
Get theObjectvalue from the specified (single-valued) attributeDelta.- Returns:
nullif the attributeDelta's list of valuesToReplace isnullor empty.
-
toMap
public static Map<String,AttributeDelta> toMap(Collection<? extends AttributeDelta> attributesDelta)
Transform aCollectionofAttributeDeltainstances into aMap. The key to each element in the map is the name of anAttributeDelta. The value of each element in the map is theAttributeDeltainstance 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
public static AttributeDelta getUidAttributeDelta(Set<AttributeDelta> attrsDelta)
Get theAttributeDeltafrom the specified set of attributesDelta.- Parameters:
attrsDelta- set ofAttributeDeltas that may contain aAttributeDeltawithUid.NAME.- Returns:
- null if the set does not contain a
AttributeDeltawithUid.NAMEor object the first one found.
-
getEmptyAttribute
public static Attribute getEmptyAttribute(AttributeDelta attrDelta)
Get theAttributeDeltawith name specific attributesDelta.- Parameters:
attrDelta-AttributeDeltawith name from which createAttributeDelta.
-
getBasicAttributes
public static Set<AttributeDelta> getBasicAttributes(Set<AttributeDelta> attrsDelta)
Filter out any special attributeDelta from the specified set. Special attributes includeName,Uid, andOperationalAttributes.- Parameters:
attrsDelta- set ofAttributeDeltas to filter out the operational and default attributes.- Returns:
- a set that only contains plain attributesDelta or empty.
-
getSpecialAttributes
public static Set<AttributeDelta> getSpecialAttributes(Set<AttributeDelta> attrsDelta)
Filter out any basic attributes from the specified set, leaving only special attributes. Special attributes includeName,Uid, andOperationalAttributes.- Parameters:
attrsDelta- set ofAttributeDeltas to filter out the basic attributes- Returns:
- a set that only contains special attributes or an empty set if there are none.
-
filterUid
public static Set<AttributeDelta> filterUid(Set<AttributeDelta> attrsDelta)
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
public static Set<AttributeDelta> addUid(Set<AttributeDelta> attrsDelta, Object... values)
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
public static boolean isSpecial(AttributeDelta attrDelta)
Determines whether the specified name of attribute info is for a special attribute. Special attributes includeUid,ObjectClassandOperationalAttributes.- Parameters:
attr-AttributeInfoto test for against.- Returns:
- true if the attributeDelta name is name of a
Uid,ObjectClassor one of theOperationalAttributes. - Throws:
NullPointerException- if the attribute parameter is null.
-
isSpecialName
public static boolean isSpecialName(String name)
Determines whether the specified attribute name is special in the sense of#createSpecialName.- Parameters:
name- the attribute name to test against.- Returns:
- true if the attribute name is special.
-
namesEqual
public static boolean namesEqual(String name1, String name2)
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
public static AttributeDelta getAttributeDeltaForName(Set<AttributeDelta> attrsDelta)
Get theAttributeDeltaattributeDelta for attribute Name from the specified set of attributesDelta.- Parameters:
attrsDelta- set of attributesDelta to search against.- Returns:
- the
AttributeDeltaattributeDelta for attribute Name if it exist otherwisenull.
-
find
public static AttributeDelta find(String name, Set<AttributeDelta> attrsDelta)
Find theAttributeDeltaof the given name in theSet.- Parameters:
name-AttributeDelta's name to search for.attrsDelta-Setof attributeDelta to search.- Returns:
AttributeDeltawith the specified otherwisenull.
-
getPasswordValue
public static GuardedString getPasswordValue(Set<AttributeDelta> attrsDelta)
Get the password value from the provided set ofAttributeDeltas.
-
getCurrentPasswordValue
public static GuardedString getCurrentPasswordValue(Set<AttributeDelta> attrsDelta)
Get the current password value from the provided set ofAttributeDeltas.- Parameters:
attrsDelta- Set ofAttributeDeltas that may contain the current passwordOperationalAttributes.CURRENT_PASSWORD_NAMEAttributeDelta.- Returns:
nullif it does not exist in theSetelse the value.
-
getPasswordExpired
public static Boolean getPasswordExpired(Set<AttributeDelta> attrsDelta)
Get the password expired attributeDelta from aCollectionofAttributeDeltas.- Parameters:
attrsDelta- set of attributeDelta to find the expired passwordAttributeDelta.- Returns:
nullif the attributeDelta does not exist and the value of theAttributeDeltaif it does.
-
getEnableDate
public static Date getEnableDate(Set<AttributeDelta> attrsDelta)
Get the enable date from the set of attributesDelta.- Parameters:
attrsDelta- set of attributeDelta to find the enable dateAttributeDelta.- Returns:
nullif the attributeDelta does not exist and the value of theAttributeDeltaif it does.
-
-