Constructor and Description |
---|
AttributeUtil() |
Modifier and Type | Method and Description |
---|---|
static Set<Attribute> |
addUid(Set<Attribute> attrs,
Uid uid)
Returns a mutable copy of the original set with the uid attribute added.
|
static String |
createSpecialName(String name)
Create a special name from the specified name.
|
static Set<Attribute> |
filterUid(Set<Attribute> attrs)
Returns a mutable copy of the original set with the uid attribute removed.
|
static Attribute |
find(String name,
Set<Attribute> attrs)
|
static String |
getAsStringValue(Attribute attr)
Get the string value from the specified (single-valued) attribute.
|
static Set<Attribute> |
getBasicAttributes(Set<Attribute> attrs)
Filter out any special attribute from the specified set.
|
static BigDecimal |
getBigDecimalValue(Attribute attr)
Get the big decimal value from the specified (single-valued) attribute.
|
static Boolean |
getBooleanValue(Attribute attr)
Get the boolean value from the specified (single-valued) attribute.
|
static GuardedString |
getCurrentPasswordValue(Set<Attribute> attrs)
Get the current password value from the provided set of
Attribute s. |
static Date |
getDateValue(Attribute attr)
Get the date value from the specified (single-valued) attribute that contains a long.
|
static Double |
getDoubleValue(Attribute attr)
Get the integer value from the specified (single-valued) attribute.
|
static Date |
getEnableDate(Set<Attribute> attrs)
Get the enable date from the set of attributes.
|
static GuardedString |
getGuardedStringValue(Attribute attr)
Get the
GuardedString value from the specified (single-valued) attribute. |
static Integer |
getIntegerValue(Attribute attr)
Get the integer value from the specified (single-valued) attribute.
|
static Long |
getLongValue(Attribute attr)
Get the long value from the specified (single-valued) attribute.
|
static Name |
getNameFromAttributes(Set<Attribute> attrs)
Get the
Name attribute from the specified set of attributes. |
static Date |
getPasswordExpirationDate(ConnectorObject obj)
Retrieve the password expiration date from the
ConnectorObject . |
static Boolean |
getPasswordExpired(Set<Attribute> attrs)
Get the password expired attribute from a
Collection of Attribute s. |
static GuardedString |
getPasswordValue(Set<Attribute> attrs)
Get the password value from the provided set of
Attribute s. |
static Object |
getSingleValue(Attribute attr)
Get the
Object value from the specified (single-valued) attribute. |
static Set<Attribute> |
getSpecialAttributes(Set<Attribute> attrs)
Filter out any basic attributes from the specified set, leaving only special attributes.
|
static String |
getStringValue(Attribute attr)
Get the string value from the specified (single-valued) attribute.
|
static Uid |
getUidAttribute(Set<Attribute> attrs)
Get the
Uid from the specified set of attributes. |
static Boolean |
isEnabled(ConnectorObject obj)
Determine if the
ConnectorObject is enable. |
static Boolean |
isLockedOut(ConnectorObject obj)
Determine if the
ConnectorObject is locked out. |
static Boolean |
isPasswordExpired(ConnectorObject obj)
Determine if the password is expired for this object.
|
static boolean |
isSpecial(Attribute attr)
Determines whether the specified attribute is a special attribute.
|
static boolean |
isSpecial(AttributeInfo attr)
Determines whether the specified attribute info is for a special attribute.
|
static boolean |
isSpecialName(String name)
Determines whether the specified attribute name is special in the sense of
createSpecialName(java.lang.String) . |
static boolean |
namesEqual(String name1,
String name2)
Compares two attribute names for equality.
|
static Map<String,Attribute> |
toMap(Collection<? extends Attribute> attributes)
|
public static String getStringValue(Attribute attr)
attr
- Attribute from which to retrieve the string value.ClassCastException
- iff the object in the attribute is not an string.IllegalArgumentException
- iff the attribute is a multi-valued (rather than single-valued).public static GuardedString getGuardedStringValue(Attribute attr)
GuardedString
value from the specified (single-valued) attribute.attr
- Attribute from which to retrieve the string value.ClassCastException
- iff the object in the attribute is not an GuardedString.IllegalArgumentException
- iff the attribute is a multi-valued (rather than single-valued).public static String getAsStringValue(Attribute attr)
attr
- Attribute from which to retrieve the string value.IllegalArgumentException
- iff the attribute is a multi-valued (rather than single-valued).public static Integer getIntegerValue(Attribute attr)
attr
- Attribute from which to retrieve the integer value.ClassCastException
- iff the object in the attribute is not an integer.IllegalArgumentException
- iff the attribute is a multi-valued (rather than single-valued).public static Long getLongValue(Attribute attr)
attr
- Attribute from which to retrieve the long value.ClassCastException
- iff the object in the attribute is not an long.IllegalArgumentException
- iff the attribute is a multi-valued (rather than single-valued).public static Date getDateValue(Attribute attr)
attr
- Attribute from which to retrieve the date value.ClassCastException
- iff the object in the attribute is not an long.IllegalArgumentException
- iff the attribute is a multi-valued (rather than single-valued).public static Double getDoubleValue(Attribute attr)
attr
- Attribute from which to retrieve the integer value.ClassCastException
- iff the object in the attribute is not an integer.IllegalArgumentException
- iff the attribute is a multi-valued (rather than single-valued)..public static BigDecimal getBigDecimalValue(Attribute attr)
attr
- Attribute from which to retrieve the big decimal value.ClassCastException
- iff the object in the attribute is not an big decimal.IllegalArgumentException
- iff the attribute is a multi-valued (rather than single-valued).public static Boolean getBooleanValue(Attribute attr)
attr
- Attribute from which to retrieve the boolean value.ClassCastException
- iff the object in the attribute is not an Boolean
.IllegalArgumentException
- iff the attribute is a multi-valued (rather than single-valued).public static Object getSingleValue(Attribute attr)
Object
value from the specified (single-valued) attribute. Return
null
if the attribute's list of values is
null
or empty.public static Map<String,Attribute> toMap(Collection<? extends Attribute> attributes)
Collection
of Attribute
instances into a Map
. The key to each element in the map is
the name of an
Attribute
. The value of each element in the map is the
Attribute
instance with that name.attributes
- set of attribute to transform to a map.NullPointerException
- iff the parameter attributes is null.public static Uid getUidAttribute(Set<Attribute> attrs)
Uid
from the specified set of attributes.public static Set<Attribute> getBasicAttributes(Set<Attribute> attrs)
Name
, Uid
,
and OperationalAttributes
.attrs
- set of Attribute
s to filter out the operational and default attributes.public static Set<Attribute> getSpecialAttributes(Set<Attribute> attrs)
Name
, Uid
, and OperationalAttributes
.attrs
- set of Attribute
s to filter out the basic attributespublic static Set<Attribute> filterUid(Set<Attribute> attrs)
attrs
- The original set. Must not be null.public static Set<Attribute> addUid(Set<Attribute> attrs, Uid uid)
attrs
- The original set. Must not be null.uid
- The uid. Must not be null.public static boolean isSpecial(Attribute attr)
Uid
, ObjectClass
and OperationalAttributes
.attr
- Attribute
to test for against.Uid
,
ObjectClass
or one of the OperationalAttributes
.NullPointerException
- iff the attribute parameter is null.public static boolean isSpecial(AttributeInfo attr)
Uid
, ObjectClass
and OperationalAttributes
.attr
- AttributeInfo
to test for against.Uid
,
ObjectClass
or one of the OperationalAttributes
.NullPointerException
- iff the attribute parameter is null.public static boolean isSpecialName(String name)
createSpecialName(java.lang.String)
.name
- the attribute name to test against.public static String createSpecialName(String name)
__
string as both prefix and suffix. This indicates that an attribute name identifies a "special
attribute" such as Uid
,
ObjectClass
or one of the OperationalAttributes
.public static boolean namesEqual(String name1, String name2)
name1
- the first attribute name.name2
- the second attribute name.public static Name getNameFromAttributes(Set<Attribute> attrs)
Name
attribute from the specified set of attributes.attrs
- set of attributes to search against.Name
attribute it if exsist otherwise null
.public static GuardedString getPasswordValue(Set<Attribute> attrs)
Attribute
s.public static GuardedString getCurrentPasswordValue(Set<Attribute> attrs)
Attribute
s.public static Boolean isLockedOut(ConnectorObject obj)
ConnectorObject
is locked out. By getting the value of the
OperationalAttributes.LOCK_OUT_NAME
.obj
- ConnectorObject
object to inspect.null
if the attribute does not exist otherwise to value of the Attribute
.NullPointerException
- iff the parameter 'obj' is null
.public static Boolean isEnabled(ConnectorObject obj)
ConnectorObject
is enable. By getting the value of the
OperationalAttributes.ENABLE_NAME
.obj
- ConnectorObject
object to inspect.null
if the attribute does not exist otherwise to value of the Attribute
.IllegalStateException
- if the object does not contain attribute in question.NullPointerException
- iff the parameter 'obj' is null
.public static Date getPasswordExpirationDate(ConnectorObject obj)
ConnectorObject
.obj
- ConnectorObject
object to inspect.null
if the Attribute
does not exist otherwise the value of the Attribute
.IllegalStateException
- if the object does not contain attribute in question.NullPointerException
- iff the parameter 'obj' is null
.public static Boolean getPasswordExpired(Set<Attribute> attrs)
Collection
of Attribute
s.public static Boolean isPasswordExpired(ConnectorObject obj)
obj
- ConnectorObject
that should contain a password expired attribute.null
if the attribute does not exist and the value of the Attribute
if it does.Copyright © 2013. All Rights Reserved.