edu.iris.dmc.pdcc.container
Class PdccTableRecord

java.lang.Object
  extended byedu.iris.Fissures.seed.container.SeedObject
      extended byedu.iris.dmc.pdcc.container.PdccTableRecord
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class PdccTableRecord
extends SeedObject

Version:
5/21/2003
Author:
Robert Casey, IRIS DMC
See Also:
Serialized Form

Field Summary
 PdccTableRecord parentTemp
           
 
Constructor Summary
PdccTableRecord(java.lang.String tableName, PdccTableInfo info)
          construct with association to a database tablename and pointer to table information object.
 
Method Summary
 void flush()
          clear all table contents and reset update flags
 java.lang.String generateSQL()
          generate an SQL string for updating the database returns an empty String if no operation is to take place
 java.lang.String getFieldName(int fieldNum)
          Get the field name for the indicated db field number
 java.lang.Object getFieldVal(int fieldNum)
          returns object at the Vector index for the field values.
 java.util.Vector getFieldValues()
          Return a vector of objects representing the values stored in the table's fields
 int getLookupId()
          return the lookupId of the Blockette that this object is associated with.
 int getNumFields()
          get number of db fields for the table this object represents
 java.lang.String getOperation()
          Get the current SQL operation for this table record.
 int getParent()
          get the PKEY of this Record's parent record, which is in the FKEY field.
 int getPKey()
          Get the assigned primary key id for this table record.
 int getSeq()
          Get the current sequence number for this table record.
 PdccTableInfo getTableInfo()
          Get table information lookup object that describes the schema this object associates to.
 java.lang.String getTableName()
          return this object's associated db table name
 int getType()
          return the blockette type that this table record is associated with.
 boolean isUpdated(int fieldNum)
          Return true if the indicated db field number has been flagged for UPDATE to the db
 void setFieldVal(int fieldNum, java.lang.String stringValue)
          Set the indicated value, in string form, to the indicated db field
 void setLookupId(int lookupId)
          set the lookup ID value for this table record indicating the blockette object this record is associated with.
 void setOperation(char c)
          Set the current SQL operation for this table record, encoded as a single character.
 void setParent(int parentId, java.lang.String parentTableName)
          set this record's FKEY field to the PKEY value of this Record's parent record.
 void setPKey(int pKey)
          Set the primary key id for this table record.
 void setSeq(int seqVal)
          Set the current sequence number for this table record.
 void setUpdated(boolean flag)
          mark all of the update boolean flags to the indicated value.
 void setUpdated(int fieldNum, boolean flag)
          externally mark the indicated field's update flag with the provided boolean flag.
 java.lang.String toString()
          return the SQL string representation of this table record.
 
Methods inherited from class edu.iris.Fissures.seed.container.SeedObject
compareTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parentTemp

public PdccTableRecord parentTemp
Constructor Detail

PdccTableRecord

public PdccTableRecord(java.lang.String tableName,
                       PdccTableInfo info)
construct with association to a database tablename and pointer to table information object.

Method Detail

generateSQL

public java.lang.String generateSQL()
generate an SQL string for updating the database returns an empty String if no operation is to take place


getTableName

public java.lang.String getTableName()
return this object's associated db table name

Returns:

getNumFields

public int getNumFields()
get number of db fields for the table this object represents

Returns:

getTableInfo

public PdccTableInfo getTableInfo()
Get table information lookup object that describes the schema this object associates to.

Returns:

isUpdated

public boolean isUpdated(int fieldNum)
Return true if the indicated db field number has been flagged for UPDATE to the db

Parameters:
fieldNum -
Returns:

setUpdated

public void setUpdated(int fieldNum,
                       boolean flag)
                throws java.lang.Exception
externally mark the indicated field's update flag with the provided boolean flag. this flag is not changed internally and must be toggled externally. fieldNum is the db table field num, counting from 0, not the blockette field num.

Throws:
java.lang.Exception

setUpdated

public void setUpdated(boolean flag)
                throws java.lang.Exception
mark all of the update boolean flags to the indicated value.

Throws:
java.lang.Exception

getFieldName

public java.lang.String getFieldName(int fieldNum)
                              throws PdccDbException
Get the field name for the indicated db field number

Parameters:
fieldNum - database field number which counts from 0
Returns:
Throws:
PdccDbException

getFieldValues

public java.util.Vector getFieldValues()
Return a vector of objects representing the values stored in the table's fields

Returns:

getFieldVal

public java.lang.Object getFieldVal(int fieldNum)
                             throws PdccDbException
returns object at the Vector index for the field values. returns null if no value in that field.

Throws:
PdccDbException

setFieldVal

public void setFieldVal(int fieldNum,
                        java.lang.String stringValue)
                 throws PdccDbException
Set the indicated value, in string form, to the indicated db field

Parameters:
fieldNum - db field counting from 0
stringValue - string representation of value to store
Throws:
PdccDbException

getParent

public int getParent()
              throws PdccDbException
get the PKEY of this Record's parent record, which is in the FKEY field. Though there can be more than one FKEY field in a table, only one of them should be non-zero, which means there is only one parent. Return -1 if there is not an FKEY value.

Throws:
PdccDbException

setParent

public void setParent(int parentId,
                      java.lang.String parentTableName)
               throws PdccDbException
set this record's FKEY field to the PKEY value of this Record's parent record. The parent PKEY value is parentId. The parent table name must also be included.

Throws:
PdccDbException

getPKey

public int getPKey()
            throws PdccDbException
Get the assigned primary key id for this table record.

Returns:
Throws:
PdccDbException

setPKey

public void setPKey(int pKey)
             throws PdccDbException
Set the primary key id for this table record.

Parameters:
pKey -
Throws:
PdccDbException

getSeq

public int getSeq()
           throws PdccDbException
Get the current sequence number for this table record.

Returns:
Throws:
PdccDbException

setSeq

public void setSeq(int seqVal)
            throws PdccDbException
Set the current sequence number for this table record.

Parameters:
seqVal -
Throws:
PdccDbException

setLookupId

public void setLookupId(int lookupId)
set the lookup ID value for this table record indicating the blockette object this record is associated with.


getOperation

public java.lang.String getOperation()
Get the current SQL operation for this table record.

Returns:
string SQL keyword or NONE or UNKNOWN.

setOperation

public void setOperation(char c)
Set the current SQL operation for this table record, encoded as a single character.

Parameters:
c - n=NONE, i=INSERT, u=UPDATE, d=DELETE

flush

public void flush()
           throws PdccDbException
clear all table contents and reset update flags

Throws:
PdccDbException

getType

public int getType()
return the blockette type that this table record is associated with.

Specified by:
getType in class SeedObject

toString

public java.lang.String toString()
return the SQL string representation of this table record.

Specified by:
toString in class SeedObject

getLookupId

public int getLookupId()
return the lookupId of the Blockette that this object is associated with.

Specified by:
getLookupId in class SeedObject


brought to you by Incorporated Research Institutions for Seismology
June 29 2006