org.dbforms.event
Class BlobInterceptor

java.lang.Object
  extended by org.dbforms.event.DbEventInterceptorSupport
      extended by org.dbforms.event.BlobInterceptor
All Implemented Interfaces:
IDbEventInterceptor

public class BlobInterceptor
extends DbEventInterceptorSupport

This Interceptor can be used to automatically store the filenames, content types and file sizes of BLOBS in some table column specified, so that it is not lost. Currently, the interceptor must be configured manually in dbforms-config.xml inside the adequate table definition (see user guide) The interceptor MUST be initialized with the following parameters:

Optionaly may be specified: if the table contains multiple BLOBs, then a unique integer n has to be appended to blob-column and blob-name to associate the correct pairs of BLOB, NAME, MIME and SIZE fields. Usage Examples:

if one BLOB:

<interceptor className="org.dbforms.event.BlobInterceptor">
  <param name="blob-column" value="file"/>
  <param name="name-column" value="filename"/>
  <param name="mime-column" value="mime_type"/>
  <param name="size-column" value="file_size"/>
</interceptor>

if mulitple BLOBs:

<interceptor className="org.dbforms.event.BlobInterceptor">
  <param name="blob-column1" value="file"/>
  <param name="name-column1" value="filename"/>
  <param name="mime-column1" value="mime_type"/>
  <param name="size-column1" value="file_size"/>
  <param name="blob-column2" value="otherfile"/>
  <param name="name-column2" value="otherfilename"/>
  <param name="mime-column2" value="other_mime_type"/>
  <param name="size-column2" value="other_file_size"/>
  <param name="blob-column3" value="foofile"/>
  <param name="name-column3" value="foofilename"/>
  <param name="mime-column3" value="foo_mime_type"/>
  <param name="size-column3" value="foo_file_size"/>
</interceptor>

Author:
Joe Peer

Field Summary
 
Fields inherited from interface org.dbforms.interfaces.IDbEventInterceptor
DENY_OPERATION, GRANT_OPERATION, IGNORE_OPERATION, POST_ADDROW, POST_DELETE, POST_INSERT, POST_SELECT, POST_UPDATE, PRE_ADDROW, PRE_DELETE, PRE_INSERT, PRE_SELECT, PRE_UPDATE
 
Constructor Summary
BlobInterceptor()
           
 
Method Summary
 int preInsert(HttpServletRequest request, Table table, FieldValues fieldValues, DbFormsConfig config, Connection con)
          stores filenames, content types and file sizes of all blobs in the NAME_COLUMNs, MIME_COLUMNs and SIZE_COLUMNs specified
 int preUpdate(HttpServletRequest request, Table table, FieldValues fieldValues, DbFormsConfig config, Connection con)
          stores filenames, content types and file sizes of all blobs in the NAME_COLUMNs, MIME_COLUMNs and SIZE_COLUMNs specified
 void setParameterMap(Map params)
          takes params, sorts/groups and stores for later use
 
Methods inherited from class org.dbforms.event.DbEventInterceptorSupport
getParameter, getParameterMap, postAddRow, postDelete, postDelete, postInsert, postInsert, postSelect, postSelect, postUpdate, postUpdate, preAddRow, preDelete, preDelete, preInsert, preSelect, preSelect, preUpdate, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlobInterceptor

public BlobInterceptor()
Method Detail

setParameterMap

public void setParameterMap(Map params)
takes params, sorts/groups and stores for later use

Specified by:
setParameterMap in interface IDbEventInterceptor
Overrides:
setParameterMap in class DbEventInterceptorSupport
Parameters:
params - DOCUMENT ME!

preInsert

public int preInsert(HttpServletRequest request,
                     Table table,
                     FieldValues fieldValues,
                     DbFormsConfig config,
                     Connection con)
              throws ValidationException
stores filenames, content types and file sizes of all blobs in the NAME_COLUMNs, MIME_COLUMNs and SIZE_COLUMNs specified

Overrides:
preInsert in class DbEventInterceptorSupport
Parameters:
request - DOCUMENT ME!
table - DOCUMENT ME!
fieldValues - DOCUMENT ME!
config - DOCUMENT ME!
con - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
ValidationException - DOCUMENT ME!

preUpdate

public int preUpdate(HttpServletRequest request,
                     Table table,
                     FieldValues fieldValues,
                     DbFormsConfig config,
                     Connection con)
              throws ValidationException
stores filenames, content types and file sizes of all blobs in the NAME_COLUMNs, MIME_COLUMNs and SIZE_COLUMNs specified

Overrides:
preUpdate in class DbEventInterceptorSupport
Parameters:
request - DOCUMENT ME!
table - DOCUMENT ME!
fieldValues - DOCUMENT ME!
config - DOCUMENT ME!
con - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
ValidationException - DOCUMENT ME!


Copyright © 2002-2006 DbForms. All Rights Reserved.