Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.9.1)

E67681-01


oracle.jbo.server
Class ProgrammaticEntityImpl

java.lang.Object
  extended by oracle.jbo.server.RowImpl
      extended by oracle.jbo.server.EntityImpl
          extended by oracle.jbo.server.ProgrammaticEntityImpl

All Implemented Interfaces:
java.util.EventListener, AttributeList, DomainOwnerInterface, ExtDomainOwnerInterface, JIReservedVarNames, ExprScriptSupplier, ExprValueSupplier, ExprValueTypeSupplier, ExprWrappable, JboReservedVarNames, Row, RowExprScriptSupplier, ExprScriptRunner, Entity, TransactionListener, TransactionPostListener, ValidationListener, ValidationManager, VariableManagerOwnerBase, XMLInterface

public class ProgrammaticEntityImpl
extends EntityImpl

Nested Class Summary
static class ProgrammaticEntityImpl.CommitActionType
           

 

Field Summary

 

Fields inherited from class oracle.jbo.server.EntityImpl
CURRENT_VERSION, DML_DELETE, DML_INSERT, DML_UPDATE, MAXATTRCONST, mOrigData, ORACLE_ROWID_COLUMN, ORIGINAL_VERSION, PROPERTY_FORCE_BATCH_ON_CHILDREN, PROPERTY_LOOKUP_ACCESSOR, PROPERTY_LOOKUP_ATTR_NAME, PROPERTY_LOOKUP_DISPATTR, PROPERTY_LOOKUP_TYPE, PROPERTY_MULTIPLE_VERSION_NUMBER_UPDATE, SYS_EFFDT_ROW_SPLIT, TRANS_ORIGINAL_VERSION, XML_CI_CHANGED, XML_PK_CHANGED, XML_PK_CHANGED_YES

 

Fields inherited from class oracle.jbo.server.RowImpl
PROPERTY_SERVICE_RESOURCE_CONTAINER_PATH

 

Fields inherited from interface oracle.jbo.server.Entity
STATUS_DEAD, STATUS_DELETED, STATUS_MODIFIED, STATUS_UNMODIFIED

 

Fields inherited from interface oracle.jbo.Row
EFFDT_ADJUST_EFFECTIVE_END_DATE_MODE, EFFDT_ADJUST_EFFECTIVE_START_DATE_MODE, EFFDT_DELETE_FUTURE_CHANGE_MODE, EFFDT_DELETE_MODE, EFFDT_DELETE_NEXT_CHANGE_MODE, EFFDT_DELETE_THIS_CHANGE_MODE, EFFDT_DELETE_ZAP_MODE, EFFDT_EXPERT_MODE, EFFDT_NONE_MODE, EFFDT_UPDATE_CHANGE_INSERT_MODE, EFFDT_UPDATE_CORRECTION, EFFDT_UPDATE_INSERT_MODE, EFFDT_UPDATE_MODE, EFFDT_UPDATE_NEW_EARLIEST_CHANGE_MODE, EFFDT_UPDATE_OVERRIDE_MODE, REFRESH_CONTAINEES, REFRESH_FORGET_NEW_ROWS, REFRESH_REMOVE_NEW_ROWS, REFRESH_UNDO_CHANGES, REFRESH_WITH_DB_FORGET_CHANGES, REFRESH_WITH_DB_ONLY_IF_UNCHANGED, STATUS_INITIALIZED, STATUS_NEW

 

Fields inherited from interface oracle.jbo.XMLInterface
XML_IGNORE_DEPTH_COUNT, XML_OPT_ALL_ROWS, XML_OPT_ASSOC_CONSISTENT, XML_OPT_CHANGES_ONLY, XML_OPT_LIMIT_RANGE, XML_PASSIVATION_USE

 

Fields inherited from interface oracle.jbo.JboReservedVarNames
RESERVED_VAR_AGG_AVG, RESERVED_VAR_AGG_COUNT, RESERVED_VAR_AGG_MAX, RESERVED_VAR_AGG_MIN, RESERVED_VAR_AGG_SUM, RESERVED_VAR_AGGVAL_PREFIX, RESERVED_VAR_STRUCTURE_DEF

 

Fields inherited from interface oracle.jbo.expr.JIReservedVarNames
RESERVED_VAR_VALUE

 

Constructor Summary
ProgrammaticEntityImpl()
           

 

Method Summary
 void afterRollback(TransactionEvent e)
          Internal: Applications should not call this method.
 void beforeCommit(TransactionEvent e)
          Polls transaction listeners before a commit operation.
protected  void commitDataProvider(ProgrammaticEntityImpl.CommitActionType commitActionType)
          Override this method to perform commit on custom datasource, if the custom Datasource is supporting both postChange / commit separately
protected  ViewObjectImpl createAssociationAccessorVO(AssociationDefImpl assocDef, java.lang.String voName, EntityAssociation eoAssoc)
           
protected  void doDML(int operation, TransactionEvent e)
          Performs INSERT/UPDATE/DELETE processing for the row.
protected  void doSelect(boolean lock)
          Advanced: Most applications should not use this method.
protected  java.util.HashMap<java.lang.String,java.lang.Object> getChangedAttributeMap()
           
protected  java.util.HashMap<java.lang.String,java.lang.Object> getPrimaryKeyMap(boolean orig)
           
protected  java.util.List<SparseArray> getRowFromDataSource(java.util.HashMap<java.lang.String,java.lang.Object> origPrimaryKeyMap)
          User should override this method and return a List of rows from Datasource which matches this Entity's primary key.
protected  void lockDataProvider(boolean lock)
          Override this API to lock the underneath dataprovider.
protected  java.util.HashMap<java.lang.String,java.lang.Object> postDataProvider(int operationType, java.util.ArrayList retAttrNames)
          Override this method to insert/delete/update a Row into custom datasource
protected  void rollbackDataProvider()
          Override this method to perform rollback on custom datasource, if the custom Datasource is supporting both postChange / commit separately
protected  void setLocked(boolean lockedState)
          Sets the locked state.

 

Methods inherited from class oracle.jbo.server.EntityImpl
addToTransactionManager, addToValidationListeners, addTransactionPostListener, addTransactionPostListenerNoCheck, afterCommit, afterRemove, appendXMLElementNodes, appendXMLElementNodesForAttrs, beforeRollback, bindDMLStatement, bindWhereClause, buildDMLStatement, buildRefreshSQL, buildWhereClause, checkConsistency, clearAttributeException, compare, copyChangedNonKeyAttributes, copyEffDtEntity, create, createArray, createAssociationAccessorRS, createBlob, createClob, createEntityAttrHints, createEntityViewLinkAccessorRS, createEntityViewLinkAccessorVO, createNClob, createRef, createStruct, createUnqualifiedRowSet, createViewAccessorRS, createViewAccessorRS, doAllowsOperation, doDMLForCascadeUpdate, doDMLWithLOBs, doEffectiveDateRangeOperation, domainToBeModified, donePostingAll, doRefreshSQL, doSelectForAltKey, eventsDebugOnly, fetchExprValueSupplierOverrideRow, findAssociationAccessorVO, findEntityViewLinkAccessorVO, findOrCreateAssociationAccessorRS, findOrCreateLocalViewObject, findOrCreateViewAccessorRS, findOrCreateViewAccessorRS, findViewAccessorDef, findViewAccessorVO, getAltKey, getAttribute, getAttribute, getAttribute, getAttributeChangedCount, getAttributeCount, getAttributeHints, getAttributeHints, getAttributeIndexOf, getAttributeInternal, getAttributeNames, getAttributeValue, getAttributeValues, getAttrInvokeAccessor, getBaseAttributeCount, getChangeIndicator, getComparator, getContainerEntity, getDBTransaction, getDynamicAttributeCount, getDynamicAttributeValue, getEffDtInitEndDateValue, getEffectiveDate, getEntityCache, getEntityCacheInternal, getEntityDef, getEntityState, getExprVarVal, getHistoryContextForAttribute, getKey, getListBindingRSI, getListBindings, getLookupDescription, getOrigData, getParentVariableManager, getPKBasedRef, getPostedAttribute, getPostState, getPrimaryKey, getRefreshSQLKeyAttrs, getRowOperationsScript, getSQLBuilder, getStateAsString, getStructureDef, getTransactionListeners, getTransactionListenersList, getTransPostHandle, getValidationListeners, getValidationListenersList, handleActivatedRowNotFound, handleEffectiveDateOperations, handleEffectiveDateRowCreate, handleEffectiveDateRowDelete, handleEffectiveDateRowUpdate, handleListBindingMismatch, handlePostChangesError, hasAttributeException, hasListBindings, hasUpdatePrivilege, initBusLogicGroupDefaults, initBusLogicGroupDfltExprAttrs, initData, initDefaultExpressionAttributes, initDefaults, initialize, isAttributeChanged, isAttributeChanged, isAttributeChangedInTransaction, isAttributePopulated, isAttributePopulated, isAttributeUpdateable, isDead, isInCache, isInvalid, isLocked, isLookupIdValid, isOrigDataEmpty, isOrigDataPopulated, isPostedToDB, isSkipDML, isTransientTransactionListener, isTransientTransactionPostListener, isValid, isViewAccessorAttribute, lock, lockTopLevelEntity, markViewAccessorsDirty, notifyAttributesAndBlgChanged, notifyAttributesChanged, notifyAttributesChanged, notifyEntityActivated, notifyEventRaised, outputEventString, populateAttribute, populateAttribute, populateAttribute, populateAttributeAsChanged, postChanges, prepareForBatchDML, prepareForDML, prepareVOToFetchNextEffDtRows, prepareVOToFetchNextEffDtRows, prepareVOToFetchNextEffDtSeqRows, prepareVOToFetchNextEffDtSeqRows, prepareVOToFetchPrevEffDtRows, prepareVOToFetchPrevEffDtRows, prepareVOToFetchPrevEffDtSeqRows, prepareVOToFetchPrevEffDtSeqRows, readAttrsFromXML, readXML, refresh, refreshFKInNewContainees, registerAttributeException, remove, removeAndRetain, removedByAnotherTrans, removeFromCollection, removeTransactionPostListener, resetPKBasedRef, revert, revertChangesToEffDtEntity, setAttribute, setAttribute, setAttributeChanged, setAttributeInternal, setAttributeValues, setAttrInvokeAccessor, setDynamicAttributeValue, setEffectiveDateMode, setEntityDef, setInvalid, setNewRowState, setPostedToDB, setTransPostHandle, toString, validate, validateDateEffectivity, validateEntity, variablesAdded, vetoRemoveWithDetails

 

Methods inherited from class oracle.jbo.server.RowImpl
addListBindingsForAttribute, clearAllExceptions, clearAttributeException, clearRowExceptions, createXMLDefinition, doAutoClearAttribute, ensureVariableManager, findAttrAndGetIndex, findListBindingName, forceFilterListExecute, getAllExceptions, getAttributeInternal, getAttributeSecurityHints, getAttributeSecurityHints, getCombinedAttrNames, getEffectiveDateMode, getExprMethodVal, getExprVarValType, getGlobalScript, getHints, getMessageBundleClass, getMethodKind, getResourceBundleDef, getRowExceptions, getSecurityHints, getVariableManager, getViewAccessorResultIndex, hasAttributeException, hasDeferredExceptions, hasVariables, invokeMethod, isRefreshRequired, isRefreshRequired, isRefreshRequired, lookupListBinding, printXMLDefinition, readXML, refreshViewAccessor, refreshViewAccessor, refreshViewAccessor, registerRowException, setAttributeInternal, setExprVarVal, setInMultiSetter, skipFilterListOnKeyAttributes, writeXML, writeXML, writeXML, writeXML

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Methods inherited from interface oracle.jbo.Row
getAttributeSecurityHints, getAttributeSecurityHints, getEffectiveDateMode, getSecurityHints

 

Methods inherited from interface oracle.jbo.XMLInterface
readXML, writeXML, writeXML, writeXML, writeXML

 

Constructor Detail

ProgrammaticEntityImpl

public ProgrammaticEntityImpl()

Method Detail

postDataProvider

protected java.util.HashMap<java.lang.String,java.lang.Object> postDataProvider(int operationType,
                                                                                java.util.ArrayList retAttrNames)
Override this method to insert/delete/update a Row into custom datasource
Parameters:
operationType - - possible values for this flag are EntityImpl.DML_INSERT , EntityImpl.DML_UPDATE and EntityImpl.DML_DELETE. Based on the opeartion type, we should update the datasource with latest values.
retAttrNames - - List of attribute names, whose values need to be returned once insert/update been performed.
Returns:
- Map of attributeName and corresponding values.

rollbackDataProvider

protected void rollbackDataProvider()
Override this method to perform rollback on custom datasource, if the custom Datasource is supporting both postChange / commit separately

commitDataProvider

protected void commitDataProvider(ProgrammaticEntityImpl.CommitActionType commitActionType)
Override this method to perform commit on custom datasource, if the custom Datasource is supporting both postChange / commit separately
Parameters:
commitActionType - - possible values for this flag are:- CommitActionType.DELETE - Delete the row from cache and original custom DS CommitActionType.MERGE - Merge the row from cache to original custom DS CommitActionType.IGNORE - Ignore this cached row and perform No action for Original row

getRowFromDataSource

protected java.util.List<SparseArray> getRowFromDataSource(java.util.HashMap<java.lang.String,java.lang.Object> origPrimaryKeyMap)
User should override this method and return a List of rows from Datasource which matches this Entity's primary key. Default implementation will return the caller's entity current row state.
Parameters:
origPrimaryKeyMap - - Attribute Name-Value Map of original key values. It may possible that user modify the PK attribute
Returns:
- List of rows from Datasource which matches this Entity's primary key.

lockDataProvider

protected void lockDataProvider(boolean lock)
Override this API to lock the underneath dataprovider. If the dataprovider is already locked and lock is TRUE, in that case throw oracle.jbo.AlreadyLockedException
Parameters:
lock - - If true, lock the underneath data provider

doDML

protected void doDML(int operation,
                     TransactionEvent e)
Description copied from class: EntityImpl
Performs INSERT/UPDATE/DELETE processing for the row. Override this method to provide custom logic for processing inserts, updates, and deletes. Note, do not set any of this Entity's attributes in this method if this entity needs to work alike in both batch and non-batchmode cases. Perform all setAttributes that needs to done in postChanges() phase in prepareForDML().

This method calls buildDMLStatement() to build the DML string based on the DML operation to be performed. For insert and update, the DML statement will only set the values that have been modified/changed. Other attributes do not participate in the DML.

Next, bindDMLStatement() is called to bind the DML statement with values to be updated and any other where-clause and returning parameters. After this, it executes the jdbc-statement or adds the current DML as a batch operation into a batched jdbc-statement, to be executed in Transaction.postChanges().

Here is sample code for overriding the doDML() method of any Entity Object's EntityImpl class to invoke a stored procedure, and pass arguments. For example, given a PL/SQL stored procedure like:

 PROCEDURE updateDepartment( p_Deptno NUMBER,
                             p_Dname  VARCHAR2,
                             p_Loc    VARCHAR2 )
 

The code to call it when an Entity is updated would look like this: Note: The following code assumes only updates are possible, disallowing inserts and deletes by ignoring them in the doDML() method.

    public void doDML(int operation, TransactionEvent e) {
       // Don't call the superclass. This procedure handles only updates
       //super.doDML(operation, e);
       CallableStatement stmt = null;
       // ONLY Perform updates, this Entity won't allow inserts/deletes.
       if (operation == DML_UPDATE)
       {
         // Prepare JDBC CallableStatement with the Stored Procedure Call
         String updateStr = "{call updateDepartment(?,?,?)}";
         stmt = getDBTransaction().createCallableStatement(updateStr, 1);
         try
         {
            // Bind the Statement Parameters and Execute this Statement
            stmt.setString(1, getDeptno().toString());
            stmt.setString(2, getDname().toString());
            stmt.setString(3, getLoc().toString());
            stmt.execute();
          }
          catch (Exception ex)
          {
            throw new oracle.jbo.JboException(ex);
          }
          finally
          {
             try
             {
                stmt.close();
             }
             catch (Exception nex)
             {
          }
        }
      }
    }
 
Overrides:
doDML in class EntityImpl
Parameters:
operation - the integer representation of DML_INSERT, DML_UPDATE, or DML_DELETE.
e - this Entity Object's transaction event.

getChangedAttributeMap

protected java.util.HashMap<java.lang.String,java.lang.Object> getChangedAttributeMap()
Returns:
- It returns the HashMap of all those attribute whose value has been changed.

doSelect

protected void doSelect(boolean lock)
Description copied from class: EntityImpl
Advanced: Most applications should not use this method.

Performs SELECT/SELECT FOR UPDATE processing for the row. This method faults-in all column-values from the database object for this Entity Object.

This method can be overridden, for example, if you want to fill in the Entity Object values yourself.

Overrides:
doSelect in class EntityImpl
Parameters:
lock - true generates a "SELECT for UPDATE"

setLocked

protected final void setLocked(boolean lockedState)
Description copied from class: EntityImpl
Sets the locked state.

This method is protected since users should call lock to place the row into the correct locked state.

Overrides:
setLocked in class EntityImpl
Parameters:
lockedState - set to true to lock the row.

createAssociationAccessorVO

protected ViewObjectImpl createAssociationAccessorVO(AssociationDefImpl assocDef,
                                                     java.lang.String voName,
                                                     EntityAssociation eoAssoc)
Overrides:
createAssociationAccessorVO in class EntityImpl

afterRollback

public final void afterRollback(TransactionEvent e)
Description copied from class: EntityImpl
Internal: Applications should not call this method.

Initiates a state change and polls listeners following a rollback operation.

Resets the EntityState to STATUS_DEAD or STATUS_UNMODIFIED for new or updated/removed rows respectively. Sets other status flags for this Entity Object so that it behaves just like it was fetched for the first time from the database.

This method should not be overridden.

Specified by:
afterRollback in interface TransactionListener
Overrides:
afterRollback in class EntityImpl
Parameters:
e - this Entity Object's transaction event.
See Also:
TransactionListener

beforeCommit

public final void beforeCommit(TransactionEvent e)
Description copied from class: EntityImpl
Polls transaction listeners before a commit operation.
Specified by:
beforeCommit in interface TransactionListener
Overrides:
beforeCommit in class EntityImpl
Parameters:
e - this Entity Object's transaction event.
See Also:
TransactionListener

getPrimaryKeyMap

protected final java.util.HashMap<java.lang.String,java.lang.Object> getPrimaryKeyMap(boolean orig)
Parameters:
orig - - If passed as true, this API return the original PK value map else the current PK values map
Returns:
- Based on the orig flag, this API returns the PK value. User can modify the PK attribute.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.9.1)

E67681-01


Copyright © 1997, 2016, Oracle. All rights reserved.