dataabstraction
Class PersistentDefect

java.lang.Object
  |
  +--businessmodel.Defect
        |
        +--dataabstraction.PersistentDefect

public class PersistentDefect
extends Defect
implements Persistent

PersistentDefect is the foundation of the BugTracker application, and is the class of object that is "remoted" through CORBA to the bugtracker client and servlet. This class provides the object-relational / relational-object mapping; the clients of this class' objects need not know any details regarding the storage implementation.


Field Summary
static java.lang.String DROPBYKEY
           
static java.lang.String GETMAXDEFECTID
           
static java.lang.String INSERTDEFECT
           
static java.lang.String QUERYBYKEY
           
static java.lang.String UPDATEDEFECT
           
 
Fields inherited from class businessmodel.Defect
m_assignedTo, m_changedMailList, m_changedModules, m_dateLastChanged, m_dateReported, m_defectDetails, m_defectID, m_defectSummary, m_ExternalId, m_priority, m_product, m_reportedBy, m_resolutionNotes, m_resolvedMailList, m_severity, m_state, m_subsystem, m_versionReported, m_versionResolved
 
Constructor Summary
PersistentDefect()
          Default constructor.
 
Method Summary
 void commit(java.lang.String userid)
          Attempt to store updates made to a defect
 void drop()
          Drops the defect data from the relational table(s)
 void fetch()
          Fetch the user object from the persistent store based on the user id
protected  void getDatabaseConnection()
          This method ensures that the JDBC driver is loaded and we have a connection to the database.
 int getMaxDefectID()
          Determines the highest number defect in database.
 void insert()
          Inserts the defect data into the relational tables
 boolean rowExists()
          indicates whether the defect is stored in the database or not
 void setPolicy(DefectPolicy policy)
          sets the policy object for this defect
 boolean TestUnit()
          TestUnit implemented to support test harness
 java.lang.String toString()
           
 void update()
          Updates the defect information in the relational tables
 
Methods inherited from class businessmodel.Defect
exportToXML, getAssignedTo, getChangedMailList, getChangedModules, getDateLastChanged, getDateReported, getDefectDetails, getDefectID, getDefectSummary, getExternalId, getPriority, getProduct, getReportedBy, getResolutionNotes, getResolvedMailList, getSeverity, getState, getSubsystem, getVersionReported, getVersionResolved, setAssignedTo, setChangedMailList, setChangedModules, setDateLastChanged, setDateLastChanged, setDateReported, setDateReported, setDefectDetails, setDefectID, setDefectSummary, setExternalId, setPriority, setProduct, setReportedBy, setResolutionNotes, setResolvedMailList, setSeverity, setState, setSubsystem, setVersionReported, setVersionResolved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERYBYKEY

public static final java.lang.String QUERYBYKEY

DROPBYKEY

public static final java.lang.String DROPBYKEY

INSERTDEFECT

public static final java.lang.String INSERTDEFECT

UPDATEDEFECT

public static final java.lang.String UPDATEDEFECT

GETMAXDEFECTID

public static final java.lang.String GETMAXDEFECTID
Constructor Detail

PersistentDefect

public PersistentDefect()
Default constructor. Ensures that there is a connection to the data source.
Method Detail

getDatabaseConnection

protected void getDatabaseConnection()
                              throws java.sql.SQLException
This method ensures that the JDBC driver is loaded and we have a connection to the database. The first time it's called, it gets the driver name and datasource URL from the application properties and loads the database connection. Subsequent calls to this method are essentially no-ops since the connection has already been established.

getMaxDefectID

public int getMaxDefectID()
                   throws java.sql.SQLException
Determines the highest number defect in database.
Returns:
maximum defect id

rowExists

public boolean rowExists()
indicates whether the defect is stored in the database or not
Specified by:
rowExists in interface Persistent
Returns:
boolean value indicating whether the defect exists in the database or not

fetch

public void fetch()
           throws java.sql.SQLException
Fetch the user object from the persistent store based on the user id
Specified by:
fetch in interface Persistent
Throws:
java.sql.SQLException -  

drop

public void drop()
          throws java.sql.SQLException
Drops the defect data from the relational table(s)
Specified by:
drop in interface Persistent

insert

public void insert()
            throws java.sql.SQLException
Inserts the defect data into the relational tables
Specified by:
insert in interface Persistent

update

public void update()
            throws java.sql.SQLException
Updates the defect information in the relational tables
Specified by:
update in interface Persistent

setPolicy

public void setPolicy(DefectPolicy policy)
sets the policy object for this defect
Parameters:
policy - a DefectPolicy object

commit

public void commit(java.lang.String userid)
            throws UpdateException,
                   AppSecurityException
Attempt to store updates made to a defect
Parameters:
userid - the identity of the user requesting the change to be made
Throws:
UpdateException - thrown if the defect cannot be written
AppSecurityException - thrown if the user does not have sufficient privileges for this operation
Overrides:
commit in class Defect

toString

public java.lang.String toString()
Overrides:
toString in class Defect

TestUnit

public boolean TestUnit()
TestUnit implemented to support test harness
Overrides:
TestUnit in class Defect