public class AttachmentJDBCHelperBean extends BaseJDBCHelper implements javax.ejb.SessionBean
Modifier and Type | Field and Description |
---|---|
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
|
autoFlush, DB_AS400, DB_DB2, DB_DB2_390, DB_DB2J, DB_ORACLE
Constructor and Description |
---|
AttachmentJDBCHelperBean() |
Modifier and Type | Method and Description |
---|---|
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 retrieve the oracle blob size.
|
javax.ejb.SessionContext |
getSessionContext() |
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.
|
buildCommaSeparatedWhereClause, convertResultSetToTable, flush, flush, getCharacterStreamFromResultSet, getDataSource, getDataSource, getInQueryClause, getObject, getObject, getObject, getSavedOptCounterInfoForDelete, getSavedOptCounterInfoForOptimisticSelect, getSavedOptCounterInfoForUpdate, init, init, useCloudscape, useDB2_390, useDB2_400, useDB2, useOracle, useOracle9
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
public int updateAttachmentContent(java.lang.Long aAttachmentId, java.io.InputStream aContent, int size, boolean flush) throws java.sql.SQLException, javax.naming.NamingException
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.java.rmi.EJBException
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()
com.ibm.commerce.base.helpers.BaseJDBCHelper#getSessionContext()
public void setSessionContext(javax.ejb.SessionContext ctx)
setSessionContext
in interface javax.ejb.SessionBean
SessionBean.setSessionContext(SessionContext)
public void ejbActivate()
ejbActivate
in interface javax.ejb.SessionBean
SessionBean.ejbActivate()
public void ejbCreate()
public void ejbPassivate()
ejbPassivate
in interface javax.ejb.SessionBean
SessionBean.ejbPassivate()
public void ejbRemove()
ejbRemove
in interface javax.ejb.SessionBean
SessionBean.ejbRemove()