PSE 2000 Group 4

jobmatch.data
Class PictureBDO

java.lang.Object
  |
  +--jobmatch.data.PictureBDO

public class PictureBDO
extends Object
implements Serializable

PictureBDO contains the same set and get methods as the PictureDO class. Business Object (BO) classes typically need these set and get methods. So by deriving a BO from a BDO, or by implementing a BO that contains a BDO, the developer of the BO is spared some work.

Version:
$Revision: 1.2 $
See Also:
Serialized Form

Field Summary
protected  PictureDO DO
          The PictureDO object upon which the set and get methods operate.
 
Constructor Summary
PictureBDO()
          Constructor required by PictureBDO.create methods.
PictureBDO(PictureDO DO)
          Constructor for use by classes derived from PictureBDO.
 
Method Summary
protected  void afterAnySet()
           
protected  void beforeAnyGet()
          The developer of a Business Object that derives from this class can override the methods: beforeAnyGet beforeAnySet afterAnySet to handle any general assertions or cleanup needed for get and set methods.
protected  void beforeAnySet()
           
 void commit()
          Inserts/Updates the DO into its table.
 void commit(jobmatch.data.DBTransaction dbt)
          Inserts/Updates the DO into its table.
static PictureBDO createExisting(PictureDO DO)
          The createExisting method is used to create a PictureBDO from a PictureDO that was returned by the PictureQuery class.
static PictureBDO createVirgin()
          Like the class PictureDO, this class acts as a factory.
 void delete()
          Deletes the DO from its table.
 void delete(jobmatch.data.DBTransaction dbt)
          Deletes the DO from its table.
static PictureBDO[] getBDOarray()
          The getBDOarray method performs a database query to return an array of PictureBDO objects representing all the rows in the Picture table.
 byte[] getData()
          Get Data of the PictureDO
 PictureDO getDO()
          Note: This method is intended for use only by other BDO classes.
 String getHandle()
          The methods getHandle hasMatchingHandle are used by Presentation Objects that need to populate HTML select lists with PictureBDO objects as options.
 String getMimeType()
          Get MimeType of the PictureDO
 boolean hasMatchingHandle(String handle)
           
protected  void modifyDO(jobmatch.data.DBTransaction dbt, boolean delete)
          Modifies the DO within its table.
 void setData(byte[] Data)
          Set Data of the PictureDO
 void setMimeType(String MimeType)
          Set MimeType of the PictureDO
 String toString()
          for debugging
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DO

protected PictureDO DO
The PictureDO object upon which the set and get methods operate. This member is protected so that classes derived from PictureBDO can access the underlying Data Object.
Constructor Detail

PictureBDO

public PictureBDO(PictureDO DO)
Constructor for use by classes derived from PictureBDO. Example usage: class CustomerBO extends CustomerBDO { // a BDO class is commonly extended in order to implement: public void beforeAnySet() throws Exception { if ( CustomerDO should not be altered ) throw new ApplicationException( "ERROR" ); } public CustomerBO( CustomerDO DO ) { super( DO ); } } class SomePresentationLayerClass { public CustomerBO findCustomer( String name ) { CustomerQuery q = new CustomerQuery(); q.setQueryName( name ); CustomerDO DO = q.getNextDO(); // Here the CustomerBO ctor fires the CustomerBDO ctor. return new CustomerBO( DO ); } }

PictureBDO

public PictureBDO()
           throws Exception
Constructor required by PictureBDO.create methods.
Method Detail

getDO

public PictureDO getDO()
Note: This method is intended for use only by other BDO classes. Presentation Layer classes should (theoretically) always use the Business Layer (BDO) to create/access Data Layer (DO) objects. The overhead for using BDO objects is small (the BDO classes are fairly lightweight.)
Returns:
The DO object held by this BDO object.

createVirgin

public static PictureBDO createVirgin()
                               throws Exception
Like the class PictureDO, this class acts as a factory. Business Object (BO) classes typically need these set and get methods. So by deriving a BO from a BDO, or by implementing a BO that contains one or more BDOs, the developer of the BO is spared some work.
Throws:
Exception - If an error occurs.

createExisting

public static PictureBDO createExisting(PictureDO DO)
The createExisting method is used to create a PictureBDO from a PictureDO that was returned by the PictureQuery class.

getBDOarray

public static PictureBDO[] getBDOarray()
                                throws jobmatch.data.DataObjectException
The getBDOarray method performs a database query to return an array of PictureBDO objects representing all the rows in the Picture table. This method is a minimal example of using a Query class. To restrict the set of objects returned, you could invoke query.setXxx(), where Xxx is an Attribute of PictureDO which was marked as "Can be queried" in the DODS Attribute Editor.
Throws:
jobmatch.data.DataObjectException - If an object is not found in the database.

beforeAnyGet

protected void beforeAnyGet()
The developer of a Business Object that derives from this class can override the methods: beforeAnyGet beforeAnySet afterAnySet to handle any general assertions or cleanup needed for get and set methods.

beforeAnySet

protected void beforeAnySet()
                     throws Exception

afterAnySet

protected void afterAnySet()

getHandle

public String getHandle()
                 throws jobmatch.data.DatabaseManagerException
The methods getHandle hasMatchingHandle are used by Presentation Objects that need to populate HTML select lists with PictureBDO objects as options. The getHandle() method is used to set the value for each option, and the hasMatchingHandle() methods are used to lookup the Data Object when the selection has been made. This PictureBDO object holds a reference to a PictureDO object. The id of this PictureBDO is the id of its PictureDO.
Returns:
id of this BDO as a string If an object id can't be allocated for this object.
Throws:
jobmatch.data.DatabaseManagerException - If a connection to the database cannot be established, etc.

hasMatchingHandle

public boolean hasMatchingHandle(String handle)
Parameters:
handle - String representation of the id for this BDO
Returns:
boolean True if the string version of the id of this DO matches passed handle
See Also:
getHandle

toString

public String toString()
for debugging
Overrides:
toString in class Object

getMimeType

public String getMimeType()
                   throws jobmatch.data.DataObjectException
Get MimeType of the PictureDO
Returns:
MimeType of the PictureDO
Throws:
jobmatch.data.DataObjectException - If the object is not found in the database.

setMimeType

public void setMimeType(String MimeType)
                 throws jobmatch.data.DataObjectException
Set MimeType of the PictureDO
Parameters:
MimeType - of the PictureDO
Throws:
jobmatch.data.DataObjectException - If the object is not found in the database.

getData

public byte[] getData()
               throws jobmatch.data.DataObjectException
Get Data of the PictureDO
Returns:
Data of the PictureDO
Throws:
jobmatch.data.DataObjectException - If the object is not found in the database.

setData

public void setData(byte[] Data)
             throws jobmatch.data.DataObjectException
Set Data of the PictureDO
Parameters:
Data - of the PictureDO
Throws:
jobmatch.data.DataObjectException - If the object is not found in the database.

commit

public void commit()
            throws SQLException,
                   jobmatch.data.DatabaseManagerException,
                   jobmatch.data.DataObjectException,
                   jobmatch.data.RefAssertionException,
                   jobmatch.data.DBRowUpdateException,
                   jobmatch.data.QueryException
Inserts/Updates the DO into its table.
Throws:
com.lutris.appserver.server.sql.DatabaseManagerException - if a Transaction can not be created.
jobmatch.data.RefAssertionException - thrown by okTo method.
SQLException - if any SQL errors occur.

commit

public void commit(jobmatch.data.DBTransaction dbt)
            throws SQLException,
                   jobmatch.data.DatabaseManagerException,
                   jobmatch.data.DataObjectException,
                   jobmatch.data.RefAssertionException,
                   jobmatch.data.DBRowUpdateException,
                   jobmatch.data.QueryException
Inserts/Updates the DO into its table. The transaction is likely provided by the commit() method of another BDO whose DO references this DO.
Parameters:
dbt - The transaction object to use for this operation.
Throws:
com.lutris.appserver.server.sql.DatabaseManagerException - if a Transaction can not be created.
jobmatch.data.RefAssertionException - thrown by okTo method.
SQLException - if any SQL errors occur.

delete

public void delete()
            throws SQLException,
                   jobmatch.data.DatabaseManagerException,
                   jobmatch.data.DataObjectException,
                   jobmatch.data.RefAssertionException,
                   jobmatch.data.DBRowUpdateException,
                   jobmatch.data.QueryException
Deletes the DO from its table.
Throws:
com.lutris.appserver.server.sql.DatabaseManagerException - if a Transaction can not be created.
jobmatch.data.RefAssertionException - thrown by okTo method.
SQLException - if any SQL errors occur.

delete

public void delete(jobmatch.data.DBTransaction dbt)
            throws SQLException,
                   jobmatch.data.DatabaseManagerException,
                   jobmatch.data.DataObjectException,
                   jobmatch.data.RefAssertionException,
                   jobmatch.data.DBRowUpdateException,
                   jobmatch.data.QueryException
Deletes the DO from its table. The transaction is likely provided by the delete() method of another BDO whose DO references this DO.
Parameters:
dbt - The transaction object to use for this operation.
Throws:
com.lutris.appserver.server.sql.DatabaseManagerException - if a Transaction can not be created.
jobmatch.data.RefAssertionException - thrown by okTo method.
SQLException - if any SQL errors occur.

modifyDO

protected void modifyDO(jobmatch.data.DBTransaction dbt,
                        boolean delete)
                 throws SQLException,
                        jobmatch.data.DatabaseManagerException,
                        jobmatch.data.DataObjectException,
                        jobmatch.data.RefAssertionException,
                        jobmatch.data.DBRowUpdateException,
                        jobmatch.data.QueryException
Modifies the DO within its table. Performs recursive commit/delete on referenced DOs; all operations occur within a single transaction to allow rollback in the event of error. Only the creator of the transaction releases it.
Parameters:
dbt - The transaction object to use for this operation.
delete - True if doing a delete, otherwise doing insert/update.
Throws:
com.lutris.appserver.server.sql.DatabaseManagerException - if a Transaction can not be created.
jobmatch.data.RefAssertionException - thrown by okTo method.
SQLException - if any SQL errors occur.

PSE 2000 Group 4