com.novell.admin.ns
Class ObjectAttribute

java.lang.Object
  |
  +--com.novell.admin.ns.ObjectAttribute
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable
Direct Known Subclasses:
NDSObjectAttribute

public class ObjectAttribute
extends java.lang.Object
implements java.lang.Cloneable, java.beans.PropertyChangeListener, java.io.Serializable

Model for object attibutes that have associated values.


Inner Class Summary
 class ObjectAttribute.ModifyValue
          Model for a modified attribute value.
 
Field Summary
protected  java.util.Vector addedValues
           
protected  AttributeDefinition attrDefinition
          The attribute definition associated with this attribute.
protected  java.util.Vector deletedValues
           
protected  java.util.Vector modifiedValues
           
protected  java.util.Vector values
          All values that are associated with this attribute.
 
Constructor Summary
ObjectAttribute(AttributeDefinition attrDef)
          Constructor that does not initialize its list of values.
ObjectAttribute(AttributeDefinition attrDef, ValueComponent[] comps)
          Constructor that initializes its list of values.
 
Method Summary
 void addComponent(ValueComponent comp)
          Adds a ValueComponent to this attribute.
 void addComponents(ValueComponent[] comp)
          Adds a ValueComponent to this attribute.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          This method is used to register a listener for changes to this attribute.
 void clearAddedAttributeValues()
          This method removes all the values intended to be added to this attribute.
 void clearDeletedAttributeValues()
          This method removes all the values intended to be deleted from this attribute.
 void clearModifiedAttributeValues()
          This method removes all the values intended to be modified for this attribute.
 java.lang.Object clone()
          Creates an exact duplicate of this ObjectAttribute.
 boolean contains(ValueComponent comp)
          Tests if the attribute contains a specifed ValueComponent.
 ValueComponent[] getAddedComponents()
          Returns all value components added to this attribute.
 AttributeDefinition getAttributeDefinition()
          Returns the associated attribute definition.
 ValueComponent[] getBeginingComponents()
          Returns all value components at the initialization of this attribute.
 int getComponentCount()
          Returns a count of all components associated with this attribute.
 ValueComponent[] getDeletedComponents()
          Returns all value components deleted from this attribute.
 ObjectAttribute.ModifyValue[] getModifiedComponents()
          Returns all value components modified in this attribute.
 java.lang.String getName()
          Returns the name of this attribute.
 java.util.Enumeration getValueComponents()
          Returns all components associated with this attribute.
protected  void notifyPropertyChangeListeners(java.beans.PropertyChangeEvent event)
          Helper method that notifies all listeners of this attribute that the attribute has changed.
 void propertyChange(java.beans.PropertyChangeEvent event)
          This method is called when an property change event occurs.
 void removeAllComponents()
          Removes all ValueComponents from this attribute if the attribute is not read-only.
 boolean removeComponent(ValueComponent comp)
          Removes a specific ValueComponent from this attribute.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          This method is used to remove a listener from being notified when changes are made to this attribute.
 void replaceComponent(ValueComponent oldComp, ValueComponent newComp)
          Replaces one ValueComponent with another.
 void resetBeginingAttributeValues()
          This method sets the initial values to the values intended for the attribue after the attribute update.
 java.lang.String toString()
          Converts an attribute to a String.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attrDefinition

protected AttributeDefinition attrDefinition
The attribute definition associated with this attribute.

values

protected java.util.Vector values
All values that are associated with this attribute.

addedValues

protected java.util.Vector addedValues

deletedValues

protected java.util.Vector deletedValues

modifiedValues

protected java.util.Vector modifiedValues
Constructor Detail

ObjectAttribute

public ObjectAttribute(AttributeDefinition attrDef)
Constructor that does not initialize its list of values.

Do not use this constructor if this is a read-only attribute because the attribute value(s) will not be initialized.

Parameters:
attrDef - Attribute definition.

ObjectAttribute

public ObjectAttribute(AttributeDefinition attrDef,
                       ValueComponent[] comps)
                throws NamespaceException
Constructor that initializes its list of values.

This constructor may be used for attributes including read-only. It ensures that only one value is added for single-valued attributes, as determined by the attribute syntax. This method also ensures that if the values are sized they will only be added to the attribute if they are within the limits. You should call getComponentCount to ensure that all ValueComponents were added because no error is returned when they are not added.

Parameters:
attrDef - Attribute definition.
comps - Value(s) to put in the attribute.
Throws:
NamespaceException - A condition occured that prevented the add:
  • NamespaceException.VALUE_NOT_WITHIN_BOUNDS
Method Detail

clearAddedAttributeValues

public final void clearAddedAttributeValues()
This method removes all the values intended to be added to this attribute.

This method is used by the namespace. When the values to add are written out the namespace calls this method to prevent the values from being added again on the next write.


clearDeletedAttributeValues

public final void clearDeletedAttributeValues()
This method removes all the values intended to be deleted from this attribute.

This method is used by the namespace. When the values to delete are written out the namespace calls this method to prevent the values from being deleted again on the next write.


clearModifiedAttributeValues

public final void clearModifiedAttributeValues()
This method removes all the values intended to be modified for this attribute.

This method is used by the namespace. When the values to be modified are written out the namespace calls this method to prevent the values from being modified again on the next write.


resetBeginingAttributeValues

public final void resetBeginingAttributeValues()
This method sets the initial values to the values intended for the attribue after the attribute update.

This method is used by the namespace. When the values are all written out this method sets the initial values to the current state of the attribute that exists after the write.


contains

public boolean contains(ValueComponent comp)
Tests if the attribute contains a specifed ValueComponent.
Parameters:
comp - ValueComponent to test for.
Returns:
True if comp was found, false otherwise.

getAttributeDefinition

public final AttributeDefinition getAttributeDefinition()
Returns the associated attribute definition.
Returns:
The AttributeDefinition for this attribute.

addComponent

public void addComponent(ValueComponent comp)
                  throws NamespaceException
Adds a ValueComponent to this attribute.

This method may or may not add the specified ValueComponent to the attribute depending certain criteria. In order to successfully add a ValueComponent to this attribute the following criteria must be met:

Parameters:
comp - The ValueComponent to be added.
Returns:
True if comp was added to this attribute, otherwise false.
Throws:
NamespaceException - A condition occured that disallowed the add:
  • NamespaceException.READONLY_ATTRIBUTE
  • NamespaceException.WRONG_SYNTAX
  • NamespaceException.VALUE_NOT_WITHIN_BOUNDS
  • NamespaceException.SINGLE_VALUED_ATTRIBUTE
  • NamespaceException.DUPLICATE_VALUE

addComponents

public void addComponents(ValueComponent[] comp)
                   throws NamespaceException
Adds a ValueComponent to this attribute.

This method may or may not add a specified ValueComponent to the attribute depending certain criteria. Id doesn't check for duplicate values in the ValueComponent array passed in. You should call getComponentCount to make sure all the ValueComponents were added because no error is returned when they aren't. In order to successfully add a ValueComponent to this attribute the following criteria must be met.

Parameters:
comp - The ValueComponents to be added.
Throws:
NamespaceException - A condition occured that disallowed the add.

One of the following conditions.

  • NamespaceException.READONLY_ATTRIBUTE
  • NamespaceException.WRONG_SYNTAX
  • NamespaceException.VALUE_NOT_WITHIN_BOUNDS
  • NamespaceException.SINGLE_VALUED_ATTRIBUTE
  • NamespaceException.DUPLICATE_VALUE

  • replaceComponent

    public void replaceComponent(ValueComponent oldComp,
                                 ValueComponent newComp)
                          throws NamespaceException
    Replaces one ValueComponent with another.

    A component can only be replaced under the following conditions:

    Parameters:
    oldComp - A currently associated ValueComponent.
    newComp - The replacement ValueComponent.
    Returns:
    true if oldComp was replaced by newComp. false otherwise.
    Throws:
    NamespaceException - A condition occured which disallowed the replacement:
    • NamespaceException.READONLY_ATTRIBUTE
    • NamespaceException.WRONG_SYNTAX
    • NamespaceException.VALUE_NOT_WITHIN_BOUNDS
    • NamespaceException.VALUE_NOT_FOUND

    getAddedComponents

    public final ValueComponent[] getAddedComponents()
    Returns all value components added to this attribute.

    This method is used by the namespace to retrieve the values to add to the attribute when written out.

    Returns:
    Array of ValueComponents.

    getBeginingComponents

    public final ValueComponent[] getBeginingComponents()
    Returns all value components at the initialization of this attribute.
    Returns:
    Array of ValueComponents.

    getDeletedComponents

    public final ValueComponent[] getDeletedComponents()
    Returns all value components deleted from this attribute.

    This method is used by the namespace to retrieve the values to be deleted from the attribute when it is written out.

    Returns:
    Array of ValueComponents.

    getModifiedComponents

    public final ObjectAttribute.ModifyValue[] getModifiedComponents()
    Returns all value components modified in this attribute.

    This method is used by the namespace to retrieve the values to be modified in the attribute when it is written out.

    Returns:
    Array of ValueComponents.

    getValueComponents

    public java.util.Enumeration getValueComponents()
    Returns all components associated with this attribute.
    Returns:
    Enumeration of ValueComponents.

    getComponentCount

    public int getComponentCount()
    Returns a count of all components associated with this attribute.
    Returns:
    The number of components associated with this attribute.

    toString

    public java.lang.String toString()
    Converts an attribute to a String.
    Returns:
    A new String containing a concatenation of all ValueComponents toString() method. Max length is 256 characters.
    Overrides:
    toString in class java.lang.Object

    removeAllComponents

    public void removeAllComponents()
    Removes all ValueComponents from this attribute if the attribute is not read-only.

    removeComponent

    public boolean removeComponent(ValueComponent comp)
    Removes a specific ValueComponent from this attribute.
    Parameters:
    comp - The specific ValueComponent to remove from this attribute.
    Returns:
    True if comp was removed, false otherwise.

    getName

    public final java.lang.String getName()
    Returns the name of this attribute.
    Returns:
    Name of the attribute.

    clone

    public java.lang.Object clone()
    Creates an exact duplicate of this ObjectAttribute.
    Returns:
    A new ValueList as an Object type.
    Overrides:
    clone in class java.lang.Object

    propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent event)
    This method is called when an property change event occurs. If the event is a ValueListPropertyChangeEvent all listeners of this attribute are notified of the attribute change.
    Specified by:
    propertyChange in interface java.beans.PropertyChangeListener
    Parameters:
    event - The event.

    notifyPropertyChangeListeners

    protected void notifyPropertyChangeListeners(java.beans.PropertyChangeEvent event)
    Helper method that notifies all listeners of this attribute that the attribute has changed.
    Parameters:
    event - The event.

    addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
    This method is used to register a listener for changes to this attribute.
    Parameters:
    listener - The listener.

    removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
    This method is used to remove a listener from being notified when changes are made to this attribute.
    Parameters:
    listener - The listener.


    API Documentation Copyright © 1998-2003 Novell, Inc. All rights reserved.
    NDS is a registered trademark of Novell, Inc. in the United States and other countries.
    Generated December 17 2003 1746.