wt.iba.value
Class DefaultAttributeContainer

java.lang.Object
  extended bywt.iba.value.DefaultAttributeContainer
All Implemented Interfaces:
AttributeContainer, Cloneable, Externalizable, Serializable

public class DefaultAttributeContainer
extends Object
implements AttributeContainer, Externalizable

Default mplementation of AttributeContainer. Any attempts to add/remove/ delete/update value to the container must first pass validation by calling each respective validation method. All accessor mehods return cloned value(s) rather than reference the original value(s). This is to ensure attribute value data integrity, such that changes to the value outside of the container does not automatically reflected in the container without passing constraint validations.

Supported API: false

Extendable: false

See Also:
AttributeContainer, Serialized Form

Field Summary
static int ALL_STATE
           
private static String CLASSNAME
           
private  Vector constraintGroups
           
private  Object constraintParameter
           
static int DIRTY_STATE
           
static long EXTERNALIZATION_VERSION_UID
           
static String FROM_SERVER
           
private  String fromServer
           
static int NOT_DELETED_STATE
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private  Vector values
           
 
Constructor Summary
DefaultAttributeContainer()
          

Supported API: false
DefaultAttributeContainer(Vector constraintGrps)
          

Supported API: false
 
Method Summary
 void addAttributeValue(AbstractValueView value)
          If value exists, throws IBAConstraintException.
 void clearContainer()
          Delete all attribute values permanently from storage without constraint validations.
 Object clone()
          Clones this container and all its components.
protected  LiteIBAReferenceable cloneLiteIBAReferenceable(LiteIBAReferenceable referenceable)
           
protected  AbstractValueView cloneValueView(AbstractValueView value)
           
protected  void copyValue(AbstractValueView from, AbstractValueView to)
           
 void deleteAttributeValue(AbstractValueView value)
          If value does not exist, throws IBACosntraintsExceptin otherwise, deletes the value.
 void deleteAttributeValues(AttributeDefDefaultView attributeDefinition)
          Deletes all the values associate with the given attribute definition, by setting the state of the value to DELETE.
protected  void deleteValuesByReference(ReferenceValueDefaultView a_value)
           
protected  AttributeDefDefaultView getAttrDefinition(AbstractValueView value)
           
 AttributeDefDefaultView[] getAttributeDefinitions()
          Returns an array of attribute definitions associate with this container.
 AbstractValueView[] getAttributeValues()
          Returns a cloned array of values (not including the values of DELETED state) associate with this container.
 AbstractValueView[] getAttributeValues(AttributeDefDefaultView attributeDefinition)
          Returns a cloned array of values associate with this container.
 AbstractValueView[] getChangedAttributeValues()
          Returns a cloned array of values associate with this container of state CHANGED.
 ConstraintDescriptor[] getConstraintDescriptors(AttributeDefDefaultView attributeDefinition, Locale locale)
          

Supported API: false
 Vector getConstraintGroups()
          Gets the value of the attribute: constraintGroups.
 Object getConstraintParameter()
          Gets the value of the attribute: constraintParameter.
 AbstractValueView[] getDeletedAttributeValues()
          Returns a cloned array of values associate with this container of state DELETED.
 AbstractValueView[] getDirtyAttributeValues()
          Returns a cloned array of values associate with this container of state NEW, CHANGED, and DELETED.
protected  ReferenceValueDefaultView getEquavilentReferenceValue(ReferenceValueDefaultView a_value)
           
 String getFromServer()
          Gets the value of the attribute: fromServer.
 AbstractValueView[] getNewAttributeValues()
          Returns a cloned array of values associate with this container of state NEW.
protected  AbstractValueView[] getUnclonedAttributeValues(AttributeDefDefaultView attributeDefinition)
           
protected  AbstractValueView[] getUnclonedAttributeValues(int state)
           
protected  Vector getValues()
          Gets the value of the attribute: values.
 boolean isAddValid(AbstractValueView value)
          

Supported API: false
 boolean isContainerDirty()
          

Supported API: false
 boolean isContainerValid(AttributeContainer attrContainer)
          

Supported API: false
protected  boolean isDefinitionExist(Vector defs, AttributeDefDefaultView def)
           
 boolean isDeleteValid(AbstractValueView value)
          

Supported API: false
 boolean isUpdateValid(AbstractValueView value)
          

Supported API: false
 void purgeValue(AbstractValueView a_value)
           
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(DefaultAttributeContainer thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
protected  void replaceValue(AbstractValueView a_value)
           
 void setConstraintGroups(Vector a_ConstraintGroups)
          Sets the value of the attribute: constraintGroups.
 void setConstraintParameter(Object a_ConstraintParameter)
          Sets the value of the attribute: constraintParameter.
 void setFromServer(String a_FromServer)
          Sets the value of the attribute: fromServer.
protected  void setValues(Vector a_Values)
          Sets the value of the attribute: values.
 String toString()
           
 void updateAttributeValue(AbstractValueView value)
          if value.state == UINITIALIZED_STATE or value.state == NEW_STATE update the value; if value.state == UNCHANGED_STATE or value.state == DELETED_STATE set value.state == CHANGED_STATE; update the value;

Supported API: false
protected  boolean valueExists(AbstractValueView a_value)
           
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

values

private Vector values

constraintGroups

private Vector constraintGroups

constraintParameter

private Object constraintParameter

fromServer

private String fromServer

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

ALL_STATE

public static final int ALL_STATE
See Also:
Constant Field Values

NOT_DELETED_STATE

public static final int NOT_DELETED_STATE
See Also:
Constant Field Values

DIRTY_STATE

public static final int DIRTY_STATE
See Also:
Constant Field Values

FROM_SERVER

public static final String FROM_SERVER
See Also:
Constant Field Values
Constructor Detail

DefaultAttributeContainer

public DefaultAttributeContainer()


Supported API: false


DefaultAttributeContainer

public DefaultAttributeContainer(Vector constraintGrps)


Supported API: false

Parameters:
constraintGrps -
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(DefaultAttributeContainer thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

getValues

protected Vector getValues()
Gets the value of the attribute: values.

Supported API: false

Returns:
Vector

setValues

protected void setValues(Vector a_Values)
                  throws WTPropertyVetoException
Sets the value of the attribute: values.

Supported API: false

Parameters:
a_Values -
Throws:
WTPropertyVetoException

getConstraintGroups

public Vector getConstraintGroups()
Gets the value of the attribute: constraintGroups.

Supported API: false

Returns:
Vector

setConstraintGroups

public void setConstraintGroups(Vector a_ConstraintGroups)
                         throws WTPropertyVetoException
Sets the value of the attribute: constraintGroups.

Supported API: false

Parameters:
a_ConstraintGroups -
Throws:
WTPropertyVetoException

getConstraintParameter

public Object getConstraintParameter()
Gets the value of the attribute: constraintParameter.

Supported API: false

Returns:
Object

setConstraintParameter

public void setConstraintParameter(Object a_ConstraintParameter)
                            throws WTPropertyVetoException
Sets the value of the attribute: constraintParameter.

Supported API: false

Parameters:
a_ConstraintParameter -
Throws:
WTPropertyVetoException

getFromServer

public String getFromServer()
Gets the value of the attribute: fromServer.

Supported API: false

Returns:
String

setFromServer

public void setFromServer(String a_FromServer)
Sets the value of the attribute: fromServer.

Supported API: false

Parameters:
a_FromServer -

addAttributeValue

public void addAttributeValue(AbstractValueView value)
                       throws IBAConstraintException
If value exists, throws IBAConstraintException. if value.state() != NINITIALIZED_STATE && value.state() != NEW_STATE throws IBAConstraintException Otherwise, add the value

Supported API: false

Parameters:
value -
Throws:
IBAConstraintException

clone

public Object clone()
Clones this container and all its components.

Supported API: false

Specified by:
clone in interface AttributeContainer
Returns:
Object

clearContainer

public void clearContainer()
Delete all attribute values permanently from storage without constraint validations.

Supported API: false


deleteAttributeValue

public void deleteAttributeValue(AbstractValueView value)
                          throws IBAConstraintException
If value does not exist, throws IBACosntraintsExceptin otherwise, deletes the value.

Supported API: false

Parameters:
value -
Throws:
IBAConstraintException

deleteAttributeValues

public void deleteAttributeValues(AttributeDefDefaultView attributeDefinition)
                           throws IBAConstraintException
Deletes all the values associate with the given attribute definition, by setting the state of the value to DELETE.

Supported API: false

Parameters:
attributeDefinition -
Throws:
IBAConstraintException

getAttributeValues

public AbstractValueView[] getAttributeValues()
Returns a cloned array of values (not including the values of DELETED state) associate with this container.

Supported API: false

Returns:
AbstractValueView[]

getAttributeValues

public AbstractValueView[] getAttributeValues(AttributeDefDefaultView attributeDefinition)
Returns a cloned array of values associate with this container.

Supported API: false

Parameters:
attributeDefinition -
Returns:
AbstractValueView[]

getAttributeDefinitions

public AttributeDefDefaultView[] getAttributeDefinitions()
Returns an array of attribute definitions associate with this container.

Supported API: false

Returns:
AttributeDefDefaultView[]

getChangedAttributeValues

public AbstractValueView[] getChangedAttributeValues()
Returns a cloned array of values associate with this container of state CHANGED.

Supported API: false

Returns:
AbstractValueView[]

getDeletedAttributeValues

public AbstractValueView[] getDeletedAttributeValues()
Returns a cloned array of values associate with this container of state DELETED.

Supported API: false

Returns:
AbstractValueView[]

getDirtyAttributeValues

public AbstractValueView[] getDirtyAttributeValues()
Returns a cloned array of values associate with this container of state NEW, CHANGED, and DELETED.

Supported API: false

Returns:
AbstractValueView[]

getNewAttributeValues

public AbstractValueView[] getNewAttributeValues()
Returns a cloned array of values associate with this container of state NEW.

Supported API: false

Returns:
AbstractValueView[]

isContainerDirty

public boolean isContainerDirty()


Supported API: false

Specified by:
isContainerDirty in interface AttributeContainer
Returns:
boolean

isAddValid

public boolean isAddValid(AbstractValueView value)
                   throws IBAConstraintException


Supported API: false

Parameters:
value -
Returns:
boolean
Throws:
IBAConstraintException

isUpdateValid

public boolean isUpdateValid(AbstractValueView value)
                      throws IBAConstraintException


Supported API: false

Parameters:
value -
Returns:
boolean
Throws:
IBAConstraintException

isDeleteValid

public boolean isDeleteValid(AbstractValueView value)
                      throws IBAConstraintException


Supported API: false

Parameters:
value -
Returns:
boolean
Throws:
IBAConstraintException

isContainerValid

public boolean isContainerValid(AttributeContainer attrContainer)
                         throws IBAConstraintException


Supported API: false

Parameters:
attrContainer -
Returns:
boolean
Throws:
IBAConstraintException

getConstraintDescriptors

public ConstraintDescriptor[] getConstraintDescriptors(AttributeDefDefaultView attributeDefinition,
                                                       Locale locale)


Supported API: false

Parameters:
attributeDefinition -
locale -
Returns:
ConstraintDescriptor []

updateAttributeValue

public void updateAttributeValue(AbstractValueView value)
                          throws IBAConstraintException
if value.state == UINITIALIZED_STATE or value.state == NEW_STATE update the value; if value.state == UNCHANGED_STATE or value.state == DELETED_STATE set value.state == CHANGED_STATE; update the value;

Supported API: false

Parameters:
value -
Throws:
IBAConstraintException

toString

public String toString()

getAttrDefinition

protected AttributeDefDefaultView getAttrDefinition(AbstractValueView value)

cloneValueView

protected AbstractValueView cloneValueView(AbstractValueView value)

getUnclonedAttributeValues

protected AbstractValueView[] getUnclonedAttributeValues(AttributeDefDefaultView attributeDefinition)

isDefinitionExist

protected boolean isDefinitionExist(Vector defs,
                                    AttributeDefDefaultView def)

getUnclonedAttributeValues

protected AbstractValueView[] getUnclonedAttributeValues(int state)

valueExists

protected boolean valueExists(AbstractValueView a_value)

replaceValue

protected void replaceValue(AbstractValueView a_value)
                     throws WTPropertyVetoException
Throws:
WTPropertyVetoException

copyValue

protected void copyValue(AbstractValueView from,
                         AbstractValueView to)
                  throws WTPropertyVetoException
Throws:
WTPropertyVetoException

deleteValuesByReference

protected void deleteValuesByReference(ReferenceValueDefaultView a_value)
                                throws WTPropertyVetoException
Throws:
WTPropertyVetoException

getEquavilentReferenceValue

protected ReferenceValueDefaultView getEquavilentReferenceValue(ReferenceValueDefaultView a_value)

cloneLiteIBAReferenceable

protected LiteIBAReferenceable cloneLiteIBAReferenceable(LiteIBAReferenceable referenceable)

purgeValue

public void purgeValue(AbstractValueView a_value)