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

Quick Search    Search Deep

com.jcorporate.expresso.core.dbobj
Class HistAuditSecuredDBObject  view HistAuditSecuredDBObject download HistAuditSecuredDBObject.java

java.lang.Object
  extended bycom.jcorporate.expresso.core.dataobjects.BaseDataObject
      extended bycom.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
          extended bycom.jcorporate.expresso.core.dbobj.DBObject
              extended bycom.jcorporate.expresso.core.dbobj.SecuredDBObject
                  extended bycom.jcorporate.expresso.core.dbobj.AuditedSecuredDBObject
                      extended bycom.jcorporate.expresso.core.dbobj.HistAuditSecuredDBObject
All Implemented Interfaces:
com.jcorporate.expresso.core.cache.Cacheable, com.jcorporate.expresso.core.dataobjects.ContextNested, com.jcorporate.expresso.core.dataobjects.DataObject, LookupInterface, com.jcorporate.expresso.core.dataobjects.Securable, java.io.Serializable

public class HistAuditSecuredDBObject
extends AuditedSecuredDBObject

HistAuditSecuredDBObject is an object that is audited (as in the AuditedSecuredDBObject) and is also archived in a history table that stores the entire record on either ADD or UPDATE.

A HistAuditSecuredDBObject MUST have the following fields defined:

... AUDITLOG_ID HISTORY_DATE

So for example, if you have a table called Vendor that you want to have history kept for, you would do this:

HistAuditSecuredDBObject Vendor fields:

VENDOR_ID VENDOR_NAME AUDITLOG_ID (because this is also a AuditedSecuredDBObject).

There must then be a DBObject called "VendorHistory" with the following fields:

VENDOR_HISTORY_ID (auto-inc) VENDOR_ID VENDOR_NAME AUDITLOG_ID HISTORY_DATE

It is a good idea to set all of the fields in the VendorHistory object as readonly, and do not have any referential integrity set on any of the fields (for example, the VENDOR_ID column is the key in the Vendor object, but will probably repeat in the VendorHistory table).

We should probably enhance this by creating a base HISTORY table DBObject that enforces/automates this.


Nested Class Summary
 
Nested classes inherited from class com.jcorporate.expresso.core.dbobj.DBObject
DBObject.FieldError, DBObject.FieldUpdate
 
Field Summary
 
Fields inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject
ADD, ALL_FUNCTIONS, CACHE_NAME, CACHE_TTY, DELETE, SEARCH, SYSTEM_ACCOUNT, SYSTEM_ACCOUNT_NAME, UPDATE
 
Fields inherited from class com.jcorporate.expresso.core.dbobj.DBObject
anyFieldsToRetrieveMulti, ATTRIBUTE_ERROR, ATTRIBUTE_ERROR_MESSAGE, ATTRIBUTE_PAGE_LIMIT, BIG_DECIMAL_ZERO, EMAIL_MASK, EVENT_ADD, EVENT_DELETE, EVENT_UPDATE, FLOAT_MASK, INT_MASK, IS_CHECK_RELATIONAL_INTEGRITY, UPDATE_CHANGED_ONLY, WHERE_KEYWORD
 
Fields inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
anyFieldsDistinct, anyFieldsToRetrieve, appendCustomWhere, caseSensitiveQuery, customWhereClause, dbKey, distinctFields, localConnection, LONGBINARY_READ_DEFAULT_SIZE, maxRecords, myClassName, myUpdates, offsetRecord, recordSet, retrieveFields, sMetadataMap, sortKeys
 
Fields inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject
currentStatus, globalMask
 
Fields inherited from interface com.jcorporate.expresso.core.dataobjects.DataObject
STATUS_CURRENT, STATUS_DELETED, STATUS_NEW, STATUS_UPDATED
 
Constructor Summary
HistAuditSecuredDBObject()
          Construct an audit secured DBObject
HistAuditSecuredDBObject(com.jcorporate.expresso.core.db.DBConnection theConnection)
          Constructor
 
Method Summary
 void add()
          On the add method, always write an entry to the history table.
 java.lang.String getHistoryTableClassName()
          The assumption here is that the history table DBObject is called objectname + "History", such as "VendorHistory" for the DBObject "Vendor".
 void update()
          On the update method, always write an entry to the history table.
private  void writeRecordToHistory()
          Method to write an entry to the History table.
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.AuditedSecuredDBObject
delete
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject
canRequesterAdd, canRequesterDelete, canRequesterRead, canRequesterUpdate, checkAllowed, copyAttributes, count, createSecurityCache, deleteAll, find, getRequestingUid, getString, getString, getString, getString, getString, getString, getSystemUid, instantiate, isAllowed, retrieve, search, searchAndRetrieveList, searchAndRetrieveList, setRequestingUid
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.DBObject
addDetail, addField, addField, addFieldError, addFoundKeys, addIfNeeded, addIndex, addKey, addOrUpdate, addSortKey, addTransition, addVirtualField, addVirtualField, addVirtualField, addVirtualField, average, basicAdd, cacheIsChangedComparison, checkAllReferredToBy, checkAllRefs, checkAllRefsPublic, checkDeleteDetailPerm, checkField, checkRef, checkRef, clear, clearDistinctFields, clearError, clearFieldsToRetrieve, clearSortKeys, containsWildCards, delete, deleteAll, deleteDetails, denotesRange, equals, forKey, formatDateTime, get, getAllAttributes, getAttribute, getAttributesIterator, getBooleanFieldValue, getCacheSize, getCacheStatsMap, getCacheUtil, getCheckZeroUpdate, getCustomWhereClause, getDataContext, getDataField, getDataTransferObject, getDBName, getDetails, getDistinctFieldCount, getDistinctFields, getField, getFieldBigDecimal, getFieldBoolean, getFieldByte, getFieldByteArray, getFieldData, getFieldDate, getFieldDecimalFormatted, getFieldDouble, getFieldErrorMessage, getFieldFloat, getFieldInt, getFieldLong, getFieldMetaData, getFieldShort, getFieldsToRetrieveCount, getFilterClass, getFoundCount, getFoundKeysArray, getIndexArray, getISOValuesDefault, getISOValuesDefault, getISOValuesDefault, getKey, getKeyFieldListIterator, getLength, getLengthInt, getLocalConnection, getLocale, getLogger, getLookupObject, getMax, getMax, getMaxRecords, getMyKeys, getMyUpdatesArray, getOffsetRecord, getPatternMatcher, getPrecision, getSerializedForm, getStringFilter, getThisDBbj, getThisDBObj, getValidValueDescrip, getValidValues, getValidValuesList, getValues, getValuesDefault, getValuesDefault, getValuesDefault, hasError, hasErrors, haveAllKeys, initialize, isCached, isChanged, isDistinct, isEmpty, isFieldDistinct, isFieldNull, isFieldsToRetrieve, isFieldToRetrieve, isMultiValued, isReadOnly, isSecret, isVirtual, loadFromConnection, logChange, max, min, newInstance, noNewLine, noQuotes, notifyListeners, populateDefaultValues, referredToBy, removeAttribute, removeFromCache, retrieveFromCache, saveBinaryField, search, set, setAttribute, setCacheSize, setCharset, setCheckZeroUpdate, setConnection, setConnection, setCustomWhereClause, setCustomWhereClause, setDataContext, setDataField, setDataTransferObject, setDefaultValue, setDescription, setField, setField, setField, setField, setField, setField, setField, setField, setField, setField, setFieldData, setFieldData, setFieldDistinct, setFieldsToRetrieve, setFilterClass, setFilterClass, setKeys, setLocale, setLookupField, setLookupObject, setMask, setMaxRecords, setMultiValued, setName, setOffsetRecord, setReadOnly, setSchema, setSecret, setSortKey, setStringFilter, setStringFiltersOnAll, setTargetDbSchema, setTargetTable, setupFields, sqlAggrFunction, sum, toDebugString, update, updateAll, updateAll, verify
 
Methods inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
addInParam, addOutParam, buildWhereClause, buildWhereClauseBuffer, checkZeroUpdate, constructNewMetaData, createAndExecuteSearch, createAndRunStoreProcedure, getConnectionPool, getCustomStringFieldValue, getDef, getDistinctFieldArrayList, getExecutor, getFieldsToRetrieveIterator, getJDBCMetaData, getJDBCUtil, getMappedDataContext, getMetaData, getQueryInterface, getSerialForm, loadFromConnection, makeLimitationStub, quoteIfNeeded, runStoredProcedure, runStoredProcedureAndRetrieveList, selectFieldString, setCaseSensitiveQuery, setDBConnectionPool, setDBName, setMappedDataContext, setOriginalDBName, setTargetStoreProcedure
 
Methods inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject
getGlobalMask, getStatus, isGlobalMasked, setFieldsWithDefaults, setGlobalMask, setStatus
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HistAuditSecuredDBObject

public HistAuditSecuredDBObject()
                         throws com.jcorporate.expresso.core.db.DBException
Construct an audit secured DBObject


HistAuditSecuredDBObject

public HistAuditSecuredDBObject(com.jcorporate.expresso.core.db.DBConnection theConnection)
                         throws com.jcorporate.expresso.core.db.DBException
Constructor

Method Detail

writeRecordToHistory

private void writeRecordToHistory()
                           throws com.jcorporate.expresso.core.db.DBException
Method to write an entry to the History table.


getHistoryTableClassName

public java.lang.String getHistoryTableClassName()
The assumption here is that the history table DBObject is called objectname + "History", such as "VendorHistory" for the DBObject "Vendor".


add

public void add()
         throws com.jcorporate.expresso.core.db.DBException
On the add method, always write an entry to the history table.

Specified by:
add in interface com.jcorporate.expresso.core.dataobjects.DataObject
Overrides:
add in class AuditedSecuredDBObject

update

public void update()
            throws com.jcorporate.expresso.core.db.DBException
On the update method, always write an entry to the history table.

Specified by:
update in interface com.jcorporate.expresso.core.dataobjects.DataObject
Overrides:
update in class AuditedSecuredDBObject