com.novell.nds.dirxml.engine.gcv
Class GCListValue

java.lang.Object
  extended bycom.novell.nds.dirxml.engine.gcv.GCValue
      extended bycom.novell.nds.dirxml.engine.gcv.GCListValue
All Implemented Interfaces:
ConfigElement

public class GCListValue
extends GCValue

Class representing "list" type Global Configuration Values.

GCVs of type "list" have a value that corresponds to the items in the list.

The value is represented in different ways depending on where the GCV is referenced. In text-replacement, the list is represented in one of two ways:

Items in the list have a defined order based on the order in which the items appear in the definition.


Field Summary
static String DEFAULT_SEPARATOR
           
 
Fields inherited from class com.novell.nds.dirxml.engine.gcv.GCValue
modified, parent, TYPE_BOOLEAN, TYPE_DN, TYPE_DN_REF, TYPE_ENUM, TYPE_GCV_REF, TYPE_GROUP, TYPE_HEADER, TYPE_INTEGER, TYPE_LIST, TYPE_PASSWORD_REF, TYPE_REAL, TYPE_STRING, TYPE_SUBORDINATES
 
Method Summary
 void appendListItem(String item)
          Append a new list item.
 String getSeparator()
          Return the separator string for this list.
 String getValue()
          Return the current value of this instance.
 Node getXMLValue(Document document)
          Return an XML node representing this GCV's value.
 void insertListItem(String item, int insertionPoint)
          Insert a new item into this list.
 Iterator iterator()
          Return an Iterator for use in iterating through the list item Strings in this instance.
 void parseValue(String value)
          Parse the passed value based on the type and instance rules for "list" GCVs.
 boolean removeListItem(int index)
          Remove an item from this list
 boolean removeListItem(String item, boolean removeAll)
          Remove an item from this list
 void setSeparator(String separator)
          Set the separator string for this list.
 void setTypeHint(String hint)
          Programmatically set the type-hint value.
 void setValue(String value)
          Set the value for this instance.
 
Methods inherited from class com.novell.nds.dirxml.engine.gcv.GCValue
construct, construct, constructGCVRef, constructGroup, constructHeader, constructSubordinates, getDescription, getDescriptionRef, getDisplayName, getDisplayNameRef, getHidden, getName, getType, getTypeString, hasBeenModified, localize, resetModified, setDescription, setDescriptionRef, setDisplayName, setDisplayNameRef, setHidden, toXML, typeFromString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEPARATOR

public static final String DEFAULT_SEPARATOR
See Also:
Constant Field Values
Method Detail

setTypeHint

public void setTypeHint(String hint)
Programmatically set the type-hint value.

Parameters:
hint - null, or one of GCVDtd.VAL_STRING, GCVDtd.VAL_BOOLEAN, GCVDtd.VAL_INTEGER, GCVDtd.VAL_REAL, GCVDtd.VAL_DN
Throws:
IllegalArgumentException - thrown if hint isn't null or one of the allowed values.

parseValue

public void parseValue(String value)
                throws GCVException
Parse the passed value based on the type and instance rules for "list" GCVs.

The passed value must be in the form <item><separator><item>, etc.

Specified by:
parseValue in class GCValue
Parameters:
value - Value String to parse
Throws:
GCVException - thrown if value is not correct for this value instance.

getValue

public String getValue()
Return the current value of this instance.

This will return a string containing all of the list items, each separated by the separator string.

Specified by:
getValue in class GCValue
Returns:
Value String.

getXMLValue

public Node getXMLValue(Document document)
Return an XML node representing this GCV's value. The default implementation simply returns a Text node containing the value returned by getValue(). Certain GCV types (e.g., list) may return more structured data.

Overrides:
getXMLValue in class GCValue
Parameters:
document - the Document to use to create nodes.
Returns:
the Node that is the root of the XML representation.

setValue

public void setValue(String value)
              throws GCVException
Set the value for this instance.

The passed value must be in the form <item><separator><item>, etc.

Specified by:
setValue in class GCValue
Parameters:
value - Value string for this instance.
Throws:
GCVException - thrown if value is not correct for this value instance.

getSeparator

public String getSeparator()
Return the separator string for this list.

Returns:
String containing separator used to separate items in single-string representation of the list.

setSeparator

public void setSeparator(String separator)
Set the separator string for this list.

The separator string separates list items in the flat, single-string representation of the list.

Parameters:
separator - The separator string.

appendListItem

public void appendListItem(String item)
Append a new list item. The item may be empty or null, which will result in an empty list item.

Parameters:
item - The String value of the item.

insertListItem

public void insertListItem(String item,
                           int insertionPoint)
Insert a new item into this list.

Parameters:
item - The item to insert.
insertionPoint - the index at which to insert the new item.

removeListItem

public boolean removeListItem(int index)
Remove an item from this list

Parameters:
index - The index of the item to remove.
Returns:
true if an item existed at the passed index and was removed.

removeListItem

public boolean removeListItem(String item,
                              boolean removeAll)
Remove an item from this list

Parameters:
item - The string value of the item to remove.
removeAll - if true, remove all items with the passed value.
Returns:
true if one or more items was removed.

iterator

public Iterator iterator()
Return an Iterator for use in iterating through the list item Strings in this instance.

Returns:
Iterator that returns String objects.