org.problets.lib.comm.database
Class DatabaseRecord

java.lang.Object
  extended by org.problets.lib.comm.database.DatabaseRecord

public class DatabaseRecord
extends java.lang.Object

A class holding a vector of all attribute objects

Author:
Atanas Frengov

Constructor Summary
DatabaseRecord()
           
 
Method Summary
 void addAttributeValue(AttributeValue attributeValue)
          Add a single value to the database record vector
 void addAttributeValue(java.util.Vector attributeValues)
          Add a whole vector to the database record vector
 DatabaseRecord addDatabaseRecord(DatabaseRecord a_DatabaseRecord)
          Add a whole database record
 java.lang.String getAttributesList()
          Return a list of the attribute names of the AttributeValue objecs in the database record of the class
 java.lang.String getAttributeValueList()
          Get a list of the values of the AttributeValue objects of the database record of the class
 java.lang.String getConditions(java.lang.String operator)
          Return the elements of a database record formatted as the condition part of an SQL statement
 AttributeValue getElement(int index)
          Return the correcsponding element from the database record vector
 java.lang.String getList()
          get a formated list of the AttributeValue objects in the class database record.
 int getSize()
          Return the size of the database record
static void main(java.lang.String[] args)
           
 void printDatabaseRecord()
          Print all AttributeValue objects n the database record
 java.lang.String query(java.util.Vector attributes)
          get a vector of attribute names and returns their values from the database record
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseRecord

public DatabaseRecord()
Method Detail

getAttributeValueList

public java.lang.String getAttributeValueList()
Get a list of the values of the AttributeValue objects of the database record of the class

Parameters:
none -
Returns:
a string containing values of the objects of the record. The values are separated by a comma and a space and are enclosed in parenthesis. The whole string ends with a semi-colon

getAttributesList

public java.lang.String getAttributesList()
Return a list of the attribute names of the AttributeValue objecs in the database record of the class

Parameters:
none -
Returns:
a string holding the names of the attributes of each AttributeValue object. The names are separated by a comma and a space and are enclosed in parenthesis

getList

public java.lang.String getList()
get a formated list of the AttributeValue objects in the class database record.

Parameters:
none -
Returns:
a string holding the data for the AttributeValue objects. The string is formated like a partial sql statement. It has two parts connected with the keyword values. The first part contains the names of the AttributeValue objects and the secon part contain their responding values

getSize

public int getSize()
Return the size of the database record

Returns:
an integer representing the number of Attribute value objects in the database record

getElement

public AttributeValue getElement(int index)
Return the correcsponding element from the database record vector

Parameters:
index - - an integer holding the position of the desired element
Returns:
the element at the specified position

getConditions

public java.lang.String getConditions(java.lang.String operator)
Return the elements of a database record formatted as the condition part of an SQL statement

Parameters:
operator - the operator used for the condtion (eg '=', '<', etc)
Returns:
a String representing the condtion

addAttributeValue

public void addAttributeValue(AttributeValue attributeValue)
Add a single value to the database record vector

Parameters:
attributeValue - - the object to be inserted

addAttributeValue

public void addAttributeValue(java.util.Vector attributeValues)
Add a whole vector to the database record vector

Parameters:
attibuteValue - - a vector of attribute value objects

addDatabaseRecord

public DatabaseRecord addDatabaseRecord(DatabaseRecord a_DatabaseRecord)
Add a whole database record

Parameters:
a_DatabaseRecord - the database record to be merged
Returns:
the old database record with the new database record added

query

public java.lang.String query(java.util.Vector attributes)
get a vector of attribute names and returns their values from the database record

Parameters:
attributes - a vector of attribute names to be checked in the database record
Returns:
a string containing the values of all attributes that are found in the database record. The values are separated by a comma and a space and are enclosed in parenthesis

printDatabaseRecord

public void printDatabaseRecord()
Print all AttributeValue objects n the database record


main

public static void main(java.lang.String[] args)