com.ibm.itim.common
Class AttributeValue

java.lang.Object
  extended by com.ibm.itim.common.ValueObject
      extended by com.ibm.itim.common.AttributeValue
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
EntitlementAttributeValue, PolicyMembershipAttributeValue, PolicyScopeAttributeValue

public class AttributeValue
extends ValueObject

This class holds a single or multi-valued attribute. An attribute consists of a name and one or more values.

See Also:
Serialized Form

Constructor Summary
AttributeValue()
          Default constructor.
AttributeValue(java.lang.String name, boolean value)
          Constructs with a name and a single boolean value.
AttributeValue(java.lang.String name, byte[] value)
          Constructs with a name and a single byte array value.
AttributeValue(java.lang.String name, java.util.Collection values)
          Constructs with a name and a collection of Objects for values.
AttributeValue(java.lang.String name, java.util.Date value)
          Constructs with a name and a single date value.
AttributeValue(java.lang.String name, java.util.Date value, boolean convertToString)
          Constructs with a name and a single date value.
AttributeValue(java.lang.String name, int value)
          Constructs with a name and a single integer value.
AttributeValue(java.lang.String name, long value)
          Constructs with a name and a single long value.
AttributeValue(java.lang.String name, java.util.Map mapValue)
          Deprecated. This will no longer be supported. Clients with this need must perform this parsing first and use the collection-based contstructor. Since 4.6
AttributeValue(java.lang.String name, java.lang.Object value)
          Constructs with a name and a single Object as a value.
 
Method Summary
 void addValue(java.lang.Object value)
          Adds the provided Object to the values of the attribute.
 void addValues(java.util.Collection morevalues)
          Adds the given values to the attribute.
 java.lang.Object clone()
          This method returns a deep copy of the underlying map of AttributeValue objects
 boolean equals(java.lang.Object obj)
          Compare this object against specified object for equality, using simple String equality.
 boolean equals(java.lang.String syntaxId, java.lang.Object obj)
          Compare this object against specified object for equality, using the DirectoryAttributeEqualityComparator class and the attribute Sytax for the comparison.
 java.lang.String getBinaryString()
          Retrieves the single binary string value of the attribute as a String.
 boolean getBoolean()
          Retrieves the single value of the attribute as a boolean.
 byte[] getBytes()
          Retrieves the single value of the attribute as a byte array.
 java.util.Date getDate()
          Retrieves the single value of the attribute as a Date.
 int getInt()
          Retrieves the single value of the attribute as an integer.
 long getLong()
          Retrieves the single value of the attribute as an long.
 java.util.Map getMapValue()
          Deprecated. This will no longer be supported. Clients with this need must retrieve the Objects and parse them themselves.
 java.lang.String getName()
          Returns the name of the attribute.
 java.lang.Object getSingleValue()
          Returns the single value of an attribute as an Object.
 java.lang.String getString()
          Retrieves the single value of the attribute as a String.
 java.lang.String getSyntaxId()
          get the SytaxId (LDAP data type) for this attribute
 java.util.Collection getValues()
          Returns the values of the attribute in a collection.
 java.lang.String getValueString()
          Returns the values of the attribute as a comma separated string.
 int hashCode()
          Overwrite the hashCode() method of Object
 boolean isValueEmpty()
          Returns whether the attribute has no value or the empty string as a value.
 boolean isValueExist(java.lang.Object value)
          Returns whether the given value is present in this attribute.
 void removeValue(java.lang.Object value)
          Removes the given value from the attribute.
 void removeValues(java.util.Collection morevalues)
          Removes the given values from the attribute.
 void replaceSingleValue(java.lang.Object value)
          Will replace the current single value with the given Object or initialize the value with the Object if no previous value is present.
 void setBoolean(boolean boolValue)
          Sets the single value of the attribute as a boolean.
 void setBytes(byte[] byteValue)
          Sets the single value of the attribute as a byte array.
 void setInt(int intValue)
          Sets the single value of the attribute as an integer.
 void setLong(long longValue)
          Sets the single value of the attribute as an long.
 void setMapValue(java.util.Map map)
          Deprecated. This will no longer be supported. Clients with this need must perform this parsing first and use the setValues method that uses a Collection.
 void setName(java.lang.String name)
          Changes the name of the attribute.
 void setSingleValue(java.lang.Object value)
          Will replace the current single value with the given Object or initialize the value with the Object if no previous value is present.
 void setValue(java.util.Collection values)
          Replaces the current values with a new collection of Objects.
 void setValues(java.util.Collection newValues)
          Sets the values of the attribute.
 java.lang.String toString()
          Method will print a textual representation of this object in a secure way.
 java.lang.String toXML()
          Returns an XML String representation of the attribute.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeValue

public AttributeValue()
Default constructor. No name will be used and there will be no values.


AttributeValue

public AttributeValue(java.lang.String name,
                      java.util.Collection values)
Constructs with a name and a collection of Objects for values.

Parameters:
name - Name of the attribute.
values - Collection of Objects to be used as values.

AttributeValue

public AttributeValue(java.lang.String name,
                      java.lang.Object value)
Constructs with a name and a single Object as a value.

Parameters:
name - Name of the attribute.
value - Object to be used as single value.

AttributeValue

public AttributeValue(java.lang.String name,
                      int value)
Constructs with a name and a single integer value.

Parameters:
name - Name of the attribute.
value - int to be used as single value.

AttributeValue

public AttributeValue(java.lang.String name,
                      long value)
Constructs with a name and a single long value.

Parameters:
name - Name of the attribute.
value - long to be used as single value.
Since:
ITIM 4.6

AttributeValue

public AttributeValue(java.lang.String name,
                      boolean value)
Constructs with a name and a single boolean value.

Parameters:
name - Name of the attribute.
value - boolean to be used as single value.

AttributeValue

public AttributeValue(java.lang.String name,
                      byte[] value)
Constructs with a name and a single byte array value.

Parameters:
name - Name of the attribute.
value - byte[] to be used as single value.

AttributeValue

public AttributeValue(java.lang.String name,
                      java.util.Date value)
Constructs with a name and a single date value.

Parameters:
name - Name of the attribute.
value - Date to be used as single value.

AttributeValue

public AttributeValue(java.lang.String name,
                      java.util.Date value,
                      boolean convertToString)
Constructs with a name and a single date value.

Parameters:
name - Name of the attribute.
value - Date to be used as single value.

AttributeValue

public AttributeValue(java.lang.String name,
                      java.util.Map mapValue)
Deprecated. This will no longer be supported. Clients with this need must perform this parsing first and use the collection-based contstructor. Since 4.6

Constructs with a name and a map of keyed name-value pairs for values.

Parameters:
name - Name of the attribute.
mapValue - Map holding name-value pairs. These pairs will be stored as = strings.
Method Detail

getName

public java.lang.String getName()
Returns the name of the attribute.

Returns:
String name of the attribute.

setName

public void setName(java.lang.String name)
Changes the name of the attribute.

Parameters:
name - New name of the attribute.

setValue

public void setValue(java.util.Collection values)
Replaces the current values with a new collection of Objects.

Parameters:
values - Collection of Objects to be the new values.

getSingleValue

public java.lang.Object getSingleValue()
Returns the single value of an attribute as an Object.

Returns:
Object representing the value. If more than one value is present, the first one will be returned.
Throws:
java.lang.ArrayIndexOutOfBoundsException - Thrown if no values are present.

setSingleValue

public void setSingleValue(java.lang.Object value)
Will replace the current single value with the given Object or initialize the value with the Object if no previous value is present. If more than one value is present at the time of this call, only the first value will be replaced.

Parameters:
value - Object to set as single value.

replaceSingleValue

public void replaceSingleValue(java.lang.Object value)
Will replace the current single value with the given Object or initialize the value with the Object if no previous value is present.

Parameters:
value - Object to set as single value.

getInt

public int getInt()
Retrieves the single value of the attribute as an integer. If more than one value is present, only the first will be returned.

Returns:
int representing the single (or first) value of the attribute.

setInt

public void setInt(int intValue)
Sets the single value of the attribute as an integer.

Parameters:
intValue - int representing the new value.

getLong

public long getLong()
Retrieves the single value of the attribute as an long. If more than one value is present, only the first will be returned.

Returns:
long representing the single (or first) value of the attribute.

setLong

public void setLong(long longValue)
Sets the single value of the attribute as an long.

Parameters:
longValue - long representing the new value.

getBoolean

public boolean getBoolean()
Retrieves the single value of the attribute as a boolean. If more than one value is present, only the first will be returned.

Returns:
boolean representing the single (or first) value of the attribute.

setBoolean

public void setBoolean(boolean boolValue)
Sets the single value of the attribute as a boolean.

Parameters:
boolValue - boolean representing the new value.

getBytes

public byte[] getBytes()
Retrieves the single value of the attribute as a byte array. If more than one value is present, only the first will be returned.

Returns:
byte[] representing the single (or first) value of the attribute.

setBytes

public void setBytes(byte[] byteValue)
Sets the single value of the attribute as a byte array.

Parameters:
byteValue - byte[] representing the new value.

getString

public java.lang.String getString()
Retrieves the single value of the attribute as a String. If more than one value is present, only the first will be returned.

Returns:
String representing the single (or first) value of the attribute.

getDate

public java.util.Date getDate()
Retrieves the single value of the attribute as a Date. If more than one value is present, only the first will be returned.

Returns:
Date representing the single (or first) value of the attribute.

getBinaryString

public java.lang.String getBinaryString()
Retrieves the single binary string value of the attribute as a String. If more than one value is present, only the first will be returned.

Returns:
String representing the single (or first) binary string value of the attribute.

isValueExist

public boolean isValueExist(java.lang.Object value)
Returns whether the given value is present in this attribute.

Parameters:
value - Object representing the value to search for.
Returns:
true if value exists, false if not.

isValueEmpty

public boolean isValueEmpty()
Returns whether the attribute has no value or the empty string as a value.

Returns:
true if no value or empty string, false if not.

addValue

public void addValue(java.lang.Object value)
Adds the provided Object to the values of the attribute. Duplicates are not allowed.

Parameters:
value - Object to add.

addValues

public void addValues(java.util.Collection morevalues)
Adds the given values to the attribute.

Parameters:
morevalues - Collection of values to add.

removeValue

public void removeValue(java.lang.Object value)
Removes the given value from the attribute.

Parameters:
value - to remove.

removeValues

public void removeValues(java.util.Collection morevalues)
Removes the given values from the attribute.

Parameters:
morevalues - Collection of values to remove.

getValues

public java.util.Collection getValues()
Returns the values of the attribute in a collection.

Returns:
Collection of values.

setValues

public void setValues(java.util.Collection newValues)
Sets the values of the attribute.

Parameters:
newValues - Collection of values of the attribute.

getMapValue

public java.util.Map getMapValue()
Deprecated. This will no longer be supported. Clients with this need must retrieve the Objects and parse them themselves.

Returns the values of the attribute as a map of name-value pairs. The values of the attribute must be stored as strings with a = format.

Returns:
Values of attributes as a Map of name-value pairs.

setMapValue

public void setMapValue(java.util.Map map)
Deprecated. This will no longer be supported. Clients with this need must perform this parsing first and use the setValues method that uses a Collection.

Replaces the values of the attribute with a map of name-value pairs.

Parameters:
map - Map holding name-value pairs. These pairs will be stored as = strings.

getValueString

public java.lang.String getValueString()
Returns the values of the attribute as a comma separated string.

Returns:
Values of attributes as a comma separated string.

toString

public java.lang.String toString()
Method will print a textual representation of this object in a secure way. 1. All string values of an attribute resolved by by the system as secure will be printed int the following format: *[value's length]* For example value 'password' will be printed as: *8* 2. All binary values of an attribute including the non-secured ones will be printed int the following format: BINARY([value's length]) For example, binary value containing 6 bytes will be printed as: BINARY(6)

Overrides:
toString in class ValueObject
Returns:
String

toXML

public java.lang.String toXML()
Returns an XML String representation of the attribute.

Returns:
XML String representation of the attribute.

clone

public java.lang.Object clone()
This method returns a deep copy of the underlying map of AttributeValue objects

Overrides:
clone in class ValueObject
Returns:
exact copy of this object

hashCode

public int hashCode()
Description copied from class: ValueObject
Overwrite the hashCode() method of Object

Overrides:
hashCode in class ValueObject

getSyntaxId

public java.lang.String getSyntaxId()
get the SytaxId (LDAP data type) for this attribute

Returns:
SyntaxId / null if not found or error (implies String compare)
See Also:
SchemaAttribute

equals

public boolean equals(java.lang.String syntaxId,
                      java.lang.Object obj)
Compare this object against specified object for equality, using the DirectoryAttributeEqualityComparator class and the attribute Sytax for the comparison.

Parameters:
syntaxId - LDAP syntax Id (see )
obj - object to compare against
Returns:
true if object is equal to this
See Also:
getSyntaxId()

equals

public boolean equals(java.lang.Object obj)
Compare this object against specified object for equality, using simple String equality.

Overrides:
equals in class ValueObject
Parameters:
obj - object to compare against
Returns:
true if object is equal to this using String equals method


IBM Security Identity Manager 6.0.0
© Copyright International Business Machines Corporation 2007, 2012. All rights reserved. US Government Users Restricited Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.