Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3) B16005-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.jbo
Interface Row

All Superinterfaces:
  AttributeList, XMLInterface

All Known Subinterfaces:
  Entity

All Known Implementing Classes:
  EntityImpl, RowImpl, RowImpl, TransPostEntityRow, ViewCriteriaRow, ViewRowImpl

public interface Row
extends AttributeList, XMLInterface

This interface provides access to rows. This interface is implemented by View rows and Entity rows. Custom application logic can use this interface to access database table rows independently of the implementation of the underlying row. For example, assume that a custom application is written to perform batch style inserts into a database table. Such an application can reference the `Row` interface for row access instead of accessing instances of `EntityImpl` or `ViewRowImpl` directly. This design would allow changes in a row's implementation (Entity row or View row) without necessitating changes in the application logic.

In addition to providing a base type for View row and Entity row access, this interface provides tier-independent access to rows. Consequently, custom application logic can reference the interface on both the client and middle tiers of a three-tier application.

Note in an application running in the three-tier configuration, Entity rows are not marshalled to the client tier. The client tier has access only to View rows and not Entity rows. Of course, in the middle tier, the business logic has full access to both View rows and Entity rows. This interface should not be implemented by a custom application.

Since:
  JDeveloper 3.0
See Also:
  `RowImpl`, `EntityImpl`, `ViewRowImpl`

Field Summary
`static int` | `REFRESH_CONTAINEES` `REFRESH_...` constants are used as refresh mode flags to be passed into ``refresh(int)``.
`static int` | `REFRESH_FORGET_NEW_ROWS`
`static int` | `REFRESH_REMOVE_NEW_ROWS` `REFRESH_...` constants are used as refresh mode flags to be passed into ``refresh(int)``.
`static int` | `REFRESH_UNDO_CHANGES` `REFRESH_...` constants are used as refresh mode flags to be passed into ``refresh(int)``.
`static int` | `REFRESH_WITH_DB_FORGET_CHANGES` `REFRESH_...` constants are used as refresh mode flags to be passed into ``refresh(int)``.
`static int` | `REFRESH_WITH_DB_ONLY_IF_UNCHANGED` `REFRESH_...` constants are used as refresh mode flags to be passed into ``refresh(int)``.
`static byte` | `STATUS_INITIALIZED` Indicates that the row is newly created and no setAttribute has been called on it yet.
`static byte` | `STATUS_NEW` Indicates that the Row is newly created and this Row's consistuent entities have been added to the transaction.

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`

Method Summary
`Key` | `getKey()` Returns the row's key.
`StructureDef` | `getStructureDef()` Returns the structure of the row.
`boolean` | `isAttributeUpdateable(int index)` Tests if an attribute is updateable.
`boolean` | `isDead()` An attempt to access a dead view row will lead to a DeadViewRowAccessException.
`void` | `lock()` Locks the row(s) in the database table.
`void` | `refresh(int refreshMode)` Refreshes the row's attributes with values from database.
`void` | `remove()` Removes the row from the database table.
`void` | `removeAndRetain()` Removes the row from the collection and then retain it for insertion into another location.
`void` | `removeFromCollection()` Removes the row from the collection.
`void` | `setNewRowState(byte state)` Sets a new unposted row, created in this transaction, to either STATUS_NEW or STATUS_INITIALIZED mode.
`void` | `validate()` Validates the row.

Methods inherited from interface oracle.jbo.AttributeList
`getAttribute, getAttribute, getAttributeCount, getAttributeIndexOf, getAttributeNames, getAttributeValues, setAttribute, setAttribute`

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

Field Detail

### STATUS_INITIALIZED

    public static final byte STATUS_INITIALIZED

  Indicates that the row is newly created and no setAttribute has been called on it yet. Entities that comprise this row have not been added to the ValidationManager's or TransactionManager's lists. Rows in this state are primarily used as scratch-pad/temporary rows and can be placed back into the appropriate lists and made a postable row again by changing the row state to STATUS_NEW using setNewRowState method.
  See Also:
    Constant Field Values

### STATUS_NEW

    public static final byte STATUS_NEW

  Indicates that the Row is newly created and this Row's consistuent entities have been added to the transaction.
  See Also:
    Constant Field Values

### REFRESH_WITH_DB_FORGET_CHANGES

    public static final int REFRESH_WITH_DB_FORGET_CHANGES

  `REFRESH_...` constants are used as refresh mode flags to be passed into ``refresh(int)``.

  `REFRESH_WITH_DB_FORGET_CHANGES` forgets edits that the current user made to the row. The row data is refreshed from database. The latest data from database replaces data in the row regardless of whether the row was modified or not.

  If the current user had called ``Transaction.postChanges()`` `REFRESH_WITH_DB_FORGET_CHANGES` will pick up the data that he himself wrote through his call to `postChanges()`.

  If `REFRESH_REMOVE_NEW_ROWS` is not specified, `REFRESH_WITH_DB_FORGET_CHANGES` puts a new row back to blank. If `REFRESH_REMOVE_NEW_ROWS` is specified, the new row is removed.

  See Also:
    Constant Field Values

### REFRESH_WITH_DB_ONLY_IF_UNCHANGED

    public static final int REFRESH_WITH_DB_ONLY_IF_UNCHANGED

  `REFRESH_...` constants are used as refresh mode flags to be passed into ``refresh(int)``.

  `REFRESH_WITH_DB_ONLY_IF_UNCHANGED` works just like `REFRESH_WITH_DB_FORGET_CHANGES` for unmodified rows, i.e., the row is refreshed with attribute values from the database. If a row was already modified by this transaction, the row is not refreshed.

  If locking mode is pessimistic, the fact that you (this user) were able to change the data means that you were able to lock the row and that you got the latest data.

  When using this refresh mode, if the locking mode is optimistic, the framework could bring the latest data for unmodified attributes and merge them into the row, while retaining changed attributes as is. However, this could lead to data integrity problems. Thus, for consistency sake and data integrity, we leave the row alone if it was modified even for optimistic locking mode.

  If `REFRESH_REMOVE_NEW_ROWS` is not specified, calling refresh with this mode will be a no-op (treated just like a modified row). If `REFRESH_REMOVE_NEW_ROWS` is specified, the new row is removed.

  See Also:
    Constant Field Values

### REFRESH_UNDO_CHANGES

    public static final int REFRESH_UNDO_CHANGES

  `REFRESH_...` constants are used as refresh mode flags to be passed into ``refresh(int)``.

  `REFRESH_UNDO_CHANGES` works just like `REFRESH_WITH_DB_FORGET_CHANGES` for unmodified rows, i.e., the row is refreshed with attribute values from the database.

  For a modified row, this mode refreshes the row with attribute values at the beginning of this transaction. This mode will back out changes that have been posted to database through `postChanges()`, but not yet committed. Suppose a row's attribute value was modified from 'A' to 'B' and 'B' is posted. Suppose further the user changes 'B' to 'C' (after the post). Calling `refresh(int)` with this mode will restore the attribute value to 'A'.

  Out on database, the attribute value is still 'B'. However, the row is marked as modified, so that when the changes are posted later 'A' will replace 'B' out on database.

  If `REFRESH_REMOVE_NEW_ROWS` is not specified, `REFRESH_UNDO_CHANGES` puts a new row back to blank. If `REFRESH_REMOVE_NEW_ROWS` is specified, the new is removed.

  See Also:
    Constant Field Values

### REFRESH_REMOVE_NEW_ROWS

    public static final int REFRESH_REMOVE_NEW_ROWS

  `REFRESH_...` constants are used as refresh mode flags to be passed into ``refresh(int)``.

  `REFRESH_REMOVE_NEW_ROWS` is a bit-wise flag that can be OR'ed with other `REFRESH_...` constants.

  If `REFRESH_REMOVE_NEW_ROWS` is specified, `refresh(int)` will remove new rows.

  See Also:
    Constant Field Values

### REFRESH_FORGET_NEW_ROWS

    public static final int REFRESH_FORGET_NEW_ROWS

  See Also:
    Constant Field Values

### REFRESH_CONTAINEES

    public static final int REFRESH_CONTAINEES

  `REFRESH_...` constants are used as refresh mode flags to be passed into ``refresh(int)``.

  `REFRESH_CONTAINEES` is a bit-wise flag that can be OR'ed with other `REFRESH_...` constants.

  `REFRESH_CONTAINEES` causes an Entity row to call `refresh(int)` on its containees (children) with the same refresh mode (if this Entity row is a master is composition association).

  See Also:
    Constant Field Values

Method Detail

### getKey

    public Key getKey()

  Returns the row's key.
  Returns:
    the row's Key.

### validate

    public void validate()

  Validates the row. The default implementation of this method on a View row calls `validate()` for each Entity row that makes up the View row.
  Throws:
    `ValidationException` - if a validation error is detected.
  See Also:
    `EntityImpl.validate()`, `ViewRowImpl.validate()`

### lock

    public void lock()

  Locks the row(s) in the database table.

  For a View row, this method calls `lock()` on each Entity row that makes up the View row.

  Throws:
    `RowNotFoundException` - if the row to be locked no longer exists in the database table. The row was probably deleted by another transaction (and transaction committed).
    `DeadEntityAccessException` - if the row to locked is one that has already been deleted.
    `TooManyObjectsException` - to service the lock request, a SELECT statement is issued against the database table using this row's primary key value. Normally, only one row with matching primary key should be found in the database. If more than one row with the given PK is found, this represents a data inconsistency problem in the table. In that case, this exception is thrown.
    `RowInconsistentException` - after the row is locked in the database table, BC4J retrieves the latest data values from the table. A check is made to see if the row had been changed by another transaction (and committed). If so, this exception is thrown.
    `AlreadyLockedException` - if the row is already locked by another transaction.
    `DMLException` - if the SELECT statement to lock the row is not accepted by the DBMS. Make sure that the statement generated for the Entity Object is correct.

### remove

    public void remove()

  Removes the row from the database table.

  If this method is invoked on a View row or an Entity row, and if the current concurrency control mode is ``Transaction.LOCK_PESSIMISTIC``, this method first locks the Entity row(s), and then removes the Entity row(s). Thus, this method may throw the same exceptions as ``lock()`` method.

  Throws:
    `ReadOnlyViewObjectException` - the View Object to which this row belongs is marked as read-only. You cannot remove the row.

### removeFromCollection

    public void removeFromCollection()

  Removes the row from the collection.

  This method differs from ``remove()`` in that it just removes the row from the collection. It does not remove the underlying Entity row(s) or database row(s). However, once the row is removed, it cannot be used any more. If you want to remove the row from the collection and insert it elsewhere, call ``removeAndRetain()``.

### removeAndRetain

    public void removeAndRetain()

  Removes the row from the collection and then retain it for insertion into another location.

  This method differs from ``remove()`` in that it just removes the row from the collection. It does not remove the underlying Entity row(s) or database row(s).

  This method also differs from ``removeFromCollection()`` in that after the row is removed from the collection, it can be inserted back into the collection at another location.

### refresh

    public void refresh(int refreshMode)

  Refreshes the row's attributes with values from database. `refreshMode` should be a combination of `REFRESH_...`. See `REFRESH_...` constants for further information.
  Parameters:
    `refreshMode` - the refresh mode.

### setNewRowState

    public void setNewRowState(byte state)

  Sets a new unposted row, created in this transaction, to either STATUS_NEW or STATUS_INITIALIZED mode. Calling this method on a row in any other state will be a no-op.

  This method should be used to create a row and then to mark it temporary (STATUS_INITIALIZED) so that an app can use the created Row to fill UIs like Table UIs with valid default values for rows. Then when the Row values are updated, UIs should once again call this method to turn the Row into new (STATUS_NEW) state before any setAttribute calls on the Row, so that the changes are validated and posted.

  When a created row is in STATUS_NEW (by default) state and this method is called to turn the row in to STATUS_INITIALIZED, all updateable entities that this row comprises of, de=registers themselves from their respective transaction and validation managers. Assocation and ViewLink finders will not find/include these rows. Only the collection into which this row was inserted into will contain a reference to this row and when that collection is re-executed this row cannot be reached via the framework. To include this row again an app should call this method again with STATUS_NEW as the method-argument

  When this row is in STATUS_INITIALIZED state and this method is called with STATUS_NEW state then, this new row is added back into it's relevant transaction and validation manager and will then participate in validation, transaction cycles.

  Note that incase of composition if a master/detail hierarchy is being created with the intention of making them temporary (STATUS_INITIALIZED) then the logic should be: Create Master row, insert Master row into a collection, create Detail row insert detail row into a relevant collection, make detail row initialized, create/insert/change-to-initialized more detail rows and at the end set the master row as initialized.

  Parameters:
    `state` - This could be STATUS_NEW or STATUS_INITIALIZED.
  Since:
    9.0.3.1

### isAttributeUpdateable

    public boolean isAttributeUpdateable(int index)

  Tests if an attribute is updateable. Returns `false` if the attribute is read-only and `true` if it is updateable.

  The following logic is used for determining if the attribute is updateable. If this attribute for a View row and is one which is mapped to an Entity Attribute, and if the Entity base is marked as read-only in the View Object, the attribute is read-only.

  If the Entity base is marked updateable, a check is made to see if the the current user has updateable privilege on the underlying Entity row. If not, the attribute is read-only.

  After this, we check the View Object's Attribute Definition. If the Attribute Definition indicates that it is `READONLY`, this method returns `false` (read-only). If the Attribute Definition says `UPDATEABLE`, it drops to the Entity level to determine if the Entity level Attribute Definition says it is updateable. If the attribute is `UPDATEABLE_WHILE_NEW` We check to see if the 'row' is new or not. (If this attribute comes from an Entity Row, the 'row' is the Entity Row. Otherwise, the 'row' is the View Row.) If the row is new, the attribute is updateable.

  Parameters:
    `index` - the index of the attribute.
  Returns:
    `true` if the attribute is updateable in this row. `false` if not.

### isDead

    public boolean isDead()

  An attempt to access a dead view row will lead to a DeadViewRowAccessException. Using this API method, client code can test the row state.
  Returns:
    `true` if the row is dead.

### getStructureDef

    public StructureDef getStructureDef()

  Returns the structure of the row.
  Returns:
    `StructureDef` that describes the structure of the row.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3) B16005-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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