Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.webapps.bean
Class SimpleDBFile  view SimpleDBFile download SimpleDBFile.java

java.lang.Object
  extended bycom.RuntimeCollective.webapps.bean.SimpleDBFile
All Implemented Interfaces:
DBFile, EntityBean, java.io.Serializable

public class SimpleDBFile
extends java.lang.Object
implements DBFile

Database entry which manages and refers to an file in the database

Version:
$Id: SimpleDBFile.java,v 1.6 2003/09/30 15:13:09 joe Exp $

Field Summary
static java.lang.String BLOB_COLUMN
           
static java.lang.String DATABASE_TABLE
          The name of the database table for this bean type.
static java.lang.String DELETE
           
private  byte[] fileData
          image file data.
static java.lang.String FROM_FILE
           
private  int id
          EntityBean id
private  java.lang.String mimeType
          image mime type.
private  java.lang.String name
          file name
static java.lang.String SELECT_ALL
           
static java.lang.String SELECT_BLOB_WHERE_ID_EQUALS
           
static java.lang.String SELECT_ID
           
static java.lang.String WHERE_BLOB_ID_EQUALS
           
static java.lang.String WHERE_ID_EQUALS
           
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
SimpleDBFile()
          Construct a new blank SimpleDBFile, giving it a new unique ID.
SimpleDBFile(int id)
          Get an existing SimpleDBFile from the RuntimeDataSource, given an id.
 
Method Summary
 void delete()
          Delete this bean from the database.
protected  void flushFileData()
           
 byte[] getFileData()
          get the file data.
 int getId()
          get the unique id of this EntityBean.
 java.lang.String getMimeType()
          get the mime type.
 java.lang.String getName()
          get the file name.
private  void load()
          Load the attributes of this File.
private  void loadFileData()
           
 void save()
          Save this bean to the database.
protected  void saveFile()
           
 void setFileData(byte[] fileData)
          set the file data.
 void setId(int id)
          set the id of this EntityBean.
 void setMimeType(java.lang.String mimeType)
          set the mime type.
 void setName(java.lang.String name)
          set the file name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_TABLE

public static final java.lang.String DATABASE_TABLE
The name of the database table for this bean type.

See Also:
Constant Field Values

id

private int id
EntityBean id


name

private java.lang.String name
file name


mimeType

private java.lang.String mimeType
image mime type.


fileData

private byte[] fileData
image file data.


SELECT_ALL

public static final java.lang.String SELECT_ALL
See Also:
Constant Field Values

SELECT_ID

public static final java.lang.String SELECT_ID
See Also:
Constant Field Values

FROM_FILE

public static final java.lang.String FROM_FILE
See Also:
Constant Field Values

WHERE_ID_EQUALS

public static final java.lang.String WHERE_ID_EQUALS
See Also:
Constant Field Values

DELETE

public static final java.lang.String DELETE
See Also:
Constant Field Values

WHERE_BLOB_ID_EQUALS

public static final java.lang.String WHERE_BLOB_ID_EQUALS
See Also:
Constant Field Values

BLOB_COLUMN

public static final java.lang.String BLOB_COLUMN
See Also:
Constant Field Values

SELECT_BLOB_WHERE_ID_EQUALS

public static final java.lang.String SELECT_BLOB_WHERE_ID_EQUALS
See Also:
Constant Field Values
Constructor Detail

SimpleDBFile

public SimpleDBFile()
             throws java.sql.SQLException
Construct a new blank SimpleDBFile, giving it a new unique ID.


SimpleDBFile

public SimpleDBFile(int id)
             throws java.sql.SQLException
Get an existing SimpleDBFile from the RuntimeDataSource, given an id.

Method Detail

save

public void save()
          throws java.sql.SQLException
Description copied from interface: EntityBean
Save this bean to the database.

Specified by:
save in interface EntityBean

delete

public void delete()
            throws java.sql.SQLException
Delete this bean from the database.

Specified by:
delete in interface EntityBean

getId

public int getId()
get the unique id of this EntityBean.

Specified by:
getId in interface EntityBean

setId

public void setId(int id)
set the id of this EntityBean.

Specified by:
setId in interface EntityBean

getName

public java.lang.String getName()
get the file name.

Specified by:
getName in interface DBFile

setName

public void setName(java.lang.String name)
set the file name.

Specified by:
setName in interface DBFile

getMimeType

public java.lang.String getMimeType()
get the mime type.

Specified by:
getMimeType in interface DBFile

setMimeType

public void setMimeType(java.lang.String mimeType)
set the mime type.

Specified by:
setMimeType in interface DBFile

getFileData

public byte[] getFileData()
get the file data.

Specified by:
getFileData in interface DBFile

setFileData

public void setFileData(byte[] fileData)
set the file data.

Specified by:
setFileData in interface DBFile

saveFile

protected void saveFile()
                 throws java.io.IOException

flushFileData

protected void flushFileData()

load

private void load()
           throws java.sql.SQLException
Load the attributes of this File.


loadFileData

private void loadFileData()