java.lang.Object | +--com.ibm.commerce.base.helpers.BaseJDBCHelper | +--com.ibm.commerce.contract.objects.AttachmentJDBCHelperBean
Provides methods to perform SQL actions on the database for the Attachment bean.
Field Summary | |
---|---|
static java.lang.String |
emptyAttachmentContentSQL SQL to set the BLOB content column in attachment table given an attachment_id |
static java.lang.String |
findAttachmentContentSQL SQL to get the BLOB content column from attachment table given an attachment_id where content is not NULL |
static java.lang.String |
findAttachmentIdsbyOwnerSQL SQL to find attachment_id,attachmentURL in attachment table given a member_id (owner) |
static java.lang.String |
findAttachmentIdsbySizeSQL SQL to find attachment_id,attachmentURL from attachment table given attachment filesize > size |
static java.lang.String |
findAttachmentIdsbyTypeSQL SQL to find attachment_id,attachmentURL from attachment table given mimetype |
static java.lang.String |
findAttachmentIdsbyUploadSQL SQL to find attachment_id,attachmentURL from attachment table given createMethod=1(upload) |
static java.lang.String |
findAttachmentIdsbyUsageSQL SQL to find attachment_id,attachmentURL from attachment table given attachusg_id |
static java.lang.String |
findAttachmentSQL SQL to get the BLOB content column in attachment table given an attachment_id |
static java.lang.String |
updateAttachmentContentSQL SQL to insert the BLOB content column in attachment table given an attachment_id |
Fields inherited from class com.ibm.commerce.base.helpers. BaseJDBCHelper |
autoFlush,
COPYRIGHT,
DATASOURCE,
dataSourceConfigData,
DB_DB2,
DB_DB2_390,
DB_DB2J,
DB_ORACLE,
DBTYPE,
mySessionCtx |
Constructor Summary | |
---|---|
AttachmentJDBCHelperBean() |
Method Summary | |
---|---|
void |
ejbActivate() |
void |
ejbCreate() Creates the AttachmentJDBCHelper bean. |
void |
ejbPassivate() |
void |
ejbRemove() |
java.sql.Blob |
findAttachmentContentinBLOB(java.lang.Long aContentId,
boolean flush) Retrieves the attachment content by the content ID. |
java.util.Hashtable |
getAttachmentIdsByContentType(java.lang.String type) Retrieves the attachment IDs associated with the specified content type. |
java.util.Hashtable |
getAttachmentIdsByOwner(java.lang.Long aOwnerId) Retrieves the attachment IDs associated with the specified owner. |
java.util.Hashtable |
getAttachmentIdsBySize(java.lang.Long aSize) Retrieves the attachment IDs by size. |
java.util.Hashtable |
getAttachmentIdsByUpload() Retrieves the attachment IDs of attachments created through upload. |
java.util.Hashtable |
getAttachmentIdsByUsage(java.lang.String usage) Retrieves the attachment IDs associated with the specified usage. |
int |
getBLOBSizeInSchema(java.lang.Long aContentId) Retrieves the size of the attachment content blob size in the attachment table for DB2 we use getPrecision() from ResultSetMetaData to get the blob size for oracle, we cannot use getPrecision() from ResultSetMetaData due to an Oracle bug the getPrecision() will return a value larger than an int canhold and a java exception will be thrown for oracle we will return 10000000 which is the out of the box schema blob size (for DB2) If your business logic(oracle) has a dependecy on the size , you may want to implement your own method to retireve the oralce blob size. |
javax.ejb.SessionContext |
getSessionContext() Gets the session context. |
void |
setSessionContext(javax.ejb.SessionContext ctx) |
int |
updateAttachmentContent(java.lang.Long aAttachmentId,
java.io.InputStream aContent, int size, boolean flush) Updates the attachment content to insert stream into column CONTENT (which is a Blob) of ATTACHMENT table. |
Methods inherited from class com.ibm.commerce.base.helpers. BaseJDBCHelper |
buildCommaSeparatedWhereClause,
closeConnection,
convertFirstRowToHashtable,
convertResultSetToTable,
convertRowFromHashtable,
debugInitConnection,
executeQuery,
executeUpdate,
flush,
getCallableStatement,
getCharacterStreamFromResultSet,
getConnection,
getDataSource,
getPreparedStatement,
getPreparedStatement,
init,
init,
makeConnection,
useCloudscape,
useDB2_390,
useDB2,
useOracle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll,
toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String updateAttachmentContentSQL
public static final java.lang.String findAttachmentContentSQL
public static final java.lang.String findAttachmentIdsbyOwnerSQL
public static final java.lang.String findAttachmentIdsbyTypeSQL
public static final java.lang.String findAttachmentIdsbyUsageSQL
public static final java.lang.String findAttachmentIdsbyUploadSQL
public static final java.lang.String findAttachmentIdsbySizeSQL
public static final java.lang.String findAttachmentSQL
public static final java.lang.String emptyAttachmentContentSQL
Constructor Detail |
---|
public AttachmentJDBCHelperBean()
Method Detail |
---|
public int updateAttachmentContent(java.lang.Long aAttachmentId, java.io.InputStream aContent, int size, boolean flush) throws javax.naming.NamingException, java.sql.SQLException
Updates the attachment content to insert stream into column CONTENT (which is a Blob) of ATTACHMENT table.
This method assumes that attachment object has already been created.
This should be the first time where the blob content is inserted.
aAttachmentId
- The ID of the attachment.aContent
- The InputStream data .size
- The size of the InputStream data.flush
- The flag indicating whether changes should be
committed immediately.javax.naming.NamingException
- The
javax.naming.NamingException exception.java.sql.SQLException
- The java.sql.SQLException
exception.public java.sql.Blob findAttachmentContentinBLOB(java.lang.Long aContentId, boolean flush) throws javax.naming.NamingException, java.sql.SQLException
aContentId
- The content ID.flush
- The flag indicating whether changes should be
committed immediately.javax.naming.NamingException
- The
javax.naming.NamingException exception.java.sql.SQLException
- The java.sql.SQLException
exception.public int getBLOBSizeInSchema(java.lang.Long aContentId) throws javax.naming.NamingException, java.sql.SQLException
aContentId
- The content ID.javax.naming.NamingException
- The
javax.naming.NamingException exception.java.sql.SQLException
- The java.sql.SQLException
exception.public java.util.Hashtable getAttachmentIdsByOwner(java.lang.Long aOwnerId) throws javax.naming.NamingException, java.sql.SQLException
aOwnerId
- The owner ID.javax.naming.NamingException
- The
javax.naming.NamingException exception.java.sql.SQLException
- The java.sql.SQLException
exception.public java.util.Hashtable getAttachmentIdsBySize(java.lang.Long aSize) throws javax.naming.NamingException, java.sql.SQLException
aSize
- The size of the attachment.javax.naming.NamingException
- The
javax.naming.NamingException exception.java.sql.SQLException
- The java.sql.SQLException
exception.public java.util.Hashtable getAttachmentIdsByUpload() throws javax.naming.NamingException, java.sql.SQLException
javax.naming.NamingException
- The
javax.naming.NamingException exception.java.sql.SQLException
- The java.sql.SQLException
exception.public java.util.Hashtable getAttachmentIdsByUsage(java.lang.String usage) throws javax.naming.NamingException, java.sql.SQLException
usage
- The usage of the attachment.javax.naming.NamingException
- The
javax.naming.NamingException exception.java.sql.SQLException
- The java.sql.SQLException
exception.public java.util.Hashtable getAttachmentIdsByContentType(java.lang.String type) throws javax.naming.NamingException, java.sql.SQLException
type
- The content type of the attachment.javax.naming.NamingException
- The
javax.naming.NamingException exception.java.sql.SQLException
- The java.sql.SQLException
exception.public javax.ejb.SessionContext getSessionContext()
BaseJDBCHelper
getSessionContext
in class
BaseJDBCHelper
BaseJDBCHelper.getSessionContext()
public void setSessionContext(javax.ejb.SessionContext ctx)
javax.ejb.SessionBean#setSessionContext(SessionContext)
public void ejbActivate()
javax.ejb.SessionBean#ejbActivate()
public void ejbCreate() throws javax.ejb.CreateException
javax.ejb.CreateException
- The javax.ejb.CreateException
exception.public void ejbPassivate()
javax.ejb.SessionBean#ejbPassivate()
public void ejbRemove()
javax.ejb.SessionBean#ejbRemove()