us.openinternet.luge.valueobject
Class ValueObject

java.lang.Object
  |
  +--us.openinternet.luge.valueobject.ValueObject
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
GroupVO, PersonVO

public class ValueObject
extends java.lang.Object
implements java.io.Serializable

The ValueObject class is the abstract class that PersonVO and GroupVO extend

See Also:
Serialized Form

Constructor Summary
ValueObject()
           
ValueObject(java.util.Hashtable ht)
          Use this constructor to load initial attribute:value data or you can use the empty constructor and the method setAllAttributes(Hashtable ht)
 
Method Summary
 void addValueToAttribute(java.lang.String attrName, java.lang.String attrVal)
          Adds a value to the attribute specified.
 boolean appendAttributes(java.util.Hashtable newAttrs)
          Adds a Hashtable of attribute:value pairs wiping out the old attributes if they overlap.
 java.util.Hashtable getAllAttributes()
          This method returns a Hashtable of all the underlying attributes and values.
 java.util.ArrayList getAttributeNames()
          Obtain a sorted ArrayList with each attribute name present for this ValueObject.
 java.lang.String getAttributeValue(java.lang.String attrName)
          Use this method to return the value of a single-valued attribute.
 java.util.ArrayList getMultiValuedAttribute(java.lang.String attrName)
          Obtain an ArrayList of all the attribute values for the attribute named in the parameter.
 void setAllAttributes(java.util.Hashtable newAttrs)
          This method erases the underlying data, and sets all of the attributes for this object in one fell swoop.
 void setAttributeValue(java.lang.String attrName, java.lang.String attrVal)
          Set one attribute, with the name specified, to the value specified.
 void setAttributeValues(java.lang.String attrName, java.lang.Object attrVals)
          This method is used to handle multi-valued attributes.
 int size()
          Returns the number of attribute mappings present
 java.lang.String toString()
          This method prints the underlying attributes and values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueObject

public ValueObject()

ValueObject

public ValueObject(java.util.Hashtable ht)
Use this constructor to load initial attribute:value data or you can use the empty constructor and the method setAllAttributes(Hashtable ht)

Method Detail

getAttributeNames

public java.util.ArrayList getAttributeNames()
Obtain a sorted ArrayList with each attribute name present for this ValueObject.


getAttributeValue

public java.lang.String getAttributeValue(java.lang.String attrName)
Use this method to return the value of a single-valued attribute. If the value is multi-valued, this method returns the first value (at randowm). To get all the values from a multi-valued attribute, use the getMultiValuedAttribute method.

Parameters:
attrName - -- The attribute whose value you want to see
Returns:
-- Value of the attribute.

getMultiValuedAttribute

public java.util.ArrayList getMultiValuedAttribute(java.lang.String attrName)
Obtain an ArrayList of all the attribute values for the attribute named in the parameter.

Parameters:
attrName - -- The attribute whose values you wish to see.
Returns:
ArrayList of the attribute values

getAllAttributes

public java.util.Hashtable getAllAttributes()
This method returns a Hashtable of all the underlying attributes and values. The attribute names are the keys. All values are stored as Vectors of Strings, whether they are single or multi value.


setAllAttributes

public void setAllAttributes(java.util.Hashtable newAttrs)
This method erases the underlying data, and sets all of the attributes for this object in one fell swoop.


appendAttributes

public boolean appendAttributes(java.util.Hashtable newAttrs)
Adds a Hashtable of attribute:value pairs wiping out the old attributes if they overlap. If the value for a key in newAttrs is null, the attribute is removed.
(Note: with regards to attributes keys, this method is "append" and with regard to attribute values, it is "replace"...)


setAttributeValue

public void setAttributeValue(java.lang.String attrName,
                              java.lang.String attrVal)
Set one attribute, with the name specified, to the value specified. Note that this method is for Single Values attributes, and does not handle multi-valued attributes. Also, any previous values for attrName will be erased.

Parameters:
attrName - -- The name of the attribute to set
attrVal - -- The value to set in this attribute

setAttributeValues

public void setAttributeValues(java.lang.String attrName,
                               java.lang.Object attrVals)
This method is used to handle multi-valued attributes. Note: this method will eliminate any duplicate values in the ArrayList (this prevents the ldap server from throwing an error).

Parameters:
attrName - -- The name of the attribute to set.
attrVals - -- The values to set for this attribute. Post either ArrayList, ArrayList, String[] or String to set a value, or null to remove a value

addValueToAttribute

public void addValueToAttribute(java.lang.String attrName,
                                java.lang.String attrVal)
Adds a value to the attribute specified. Duplicate values are ignored. Note that this does not replace existing values in the attribute.

Parameters:
attrName - -- The name of the attribute to set
attrVal - -- The value to add to this attribute

size

public int size()
Returns the number of attribute mappings present


toString

public java.lang.String toString()
This method prints the underlying attributes and values. It is provided as a convenience for debugging purposes only.

Overrides:
toString in class java.lang.Object

Copyright 2003, Michael Schwartz All Rights Reserved.