Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers 10g (10.1.3.1.0) Part Number B25947-01 |
|
|
View PDF |
All of the interfaces described in this section are designed for use by client-layer code and are part of the oracle.jbo.*
package.
Note: The corresponding implementation classes for theseoracle.jbo.* interfaces are consciously designed to not be directly accessed by client code. As you'll see in the Section D.2, "Most Commonly Used Methods In the Business Service Tier" section below, the implementation classes live in the oracle.jbo.server.* package and generally have the suffix Impl in their name to help remind you not to using them in your client-layer code. |
The ApplicationModule is a business service component that acts as a transactional container for other ADF components and coordinates with them to implement a number of J2EE design patterns important to business application developers. These design pattern implementations enable your client code to work easily with updatable collections of value objects, based on fast-lane reader SQL queries that retrieve only the data needed by the client, in the way the client wants to view it. Changes made to these value objects are automatically coordinated with your persistent business domain objects in the business service tier to enforce business rules consistently and save changes back to the database.
Table D-1 ApplicationModule Interface
If you want to... | Call this ApplicationModule interface method... |
---|---|
Access an existing view object instance by name |
|
Creating a new view object instance from an existing definition |
|
Creating a new view object instance from a SQL Statement |
Note: This incurs runtime overhead to describe the "shape" of the dynamic query's |
Access a nested application module instance by name |
|
Create a new nested application module instance from an existing definition |
|
Find a view object instance in a nested application module |
Note: To find an instance of a view object belonging to a nested application module you use a dot notation |
Accessing the current transaction object |
|
In addition to generic ApplicationModule
access, Oracle JDeveloper 10g can generate you a custom YourApplicationModuleName
interface containing service-level custom methods that you've chosen to expose to the client. You do this by visiting the Client Interface tab of the Application Module editor, and shuttling the methods you'd like to appear in your client interface into the Selected list. JDeveloper will also generate an appropriate YourApplicationModuleName
Client
client proxy implementation class that is used automatically by your remote client in the case that you deploy your application module as an EJB Session Bean or whenever you use your application module in Batch Mode.
The Transaction interface exposes methods allowing the client to manage pending changes in the current transaction.
Table D-2 Transaction Interface
If you want to... | Call this Transaction interface method... |
---|---|
Commit pending changes |
|
Rollback pending changes |
|
Execute a one-time database command or block of PL/SQL |
Note: Commands that require retrieving |
Validate all pending invalid changes in the transaction |
|
Change the default locking mode |
Note: You can set the locking mode in your configuration by setting the property |
Decide whether to use bundled exception reporting mode or not. |
Note: ADF controller layer support sets this parameter to |
Decide whether entity caches will be cleared upon a successful commit of the transaction. |
Note: Default is |
Decide whether entity caches will be cleared upon a rollback of the transaction. |
Note: Default is |
Clear the entity cache for a specific entity object. |
|
A ViewObject encapsulates a database query and simplifies working with the RowSet
of results it produces. You use view objects to project, filter, join, or sort business data using SQL from one or more tables into exactly the format that the user should see it on the page or panel. You can create "master/detail" hierarchies of any level of depth or complexity by connecting view objects together using view links. View objects can produce read-only query results, or by associating them with one ore more entity objects at design time, can be fully updatable. Updatable view objects can support insertion, modification, and deletion of rows in the result collection, with automatic delegation to the correct business domain objects.
Every ViewObject
aggregates a "default rowset" for simplifying the 90% of use cases where you work with a single RowSet
of results for the ViewObject
's query. A ViewObject
implements all the methods on the RowSet
interface by delegating them to this default RowSet
. That means you can invoke any RowSet
methods on any ViewObject
as well.
Every ViewObject
implements the StructureDef
interface to provide information about the number and types of attributes in a row of its row sets. So you can call StructureDef
methods right on any view object.
Table D-3 ViewObject Interface
If you want to... | Call this ViewObject interface method... |
---|---|
Set an additional runtime WHERE clause on the rowset |
Note: This |
Set a dynamic ORDER BY clause |
|
Create a Query-by-Example criteria collection |
Note: You then create one or more |
Apply a Query-by-Example criteria collection |
|
Set a query optimizer hint |
|
Access the attribute definitions for the key attributes in the view object |
|
Add a dynamic attribute to rows in this view object's row sets |
|
Clear all row sets produced by a view object |
|
Remove view object instance an its resources |
|
Set an upper limit on the number of rows that the view object will attempt to fetch from the database. |
Note: Default is -1 which means to impose no limit on how many rows would be retrieved from the database if you iterate through them all. By default they are fetched lazily as you iterate through them. |
In addition to generic ViewObject
access, JDeveloper 10g can generate you a custom YourViewObjectName
interface containing view-object level custom methods that you've chosen to expose to the client. You do this by visiting the Client Interface tab of the View Object editor, and shuttling the methods you'd like to appear in your client interface into the Selected list. JDeveloper will also generate an appropriate YourViewObjectName
Client
client proxy implementation class that is used automatically by your remote client in the case that you deploy your application module as an EJB Session Bean or whenever you use your application module in Batch Mode.
A RowSet is a set of rows, typically produced by executing a ViewObject
's query.
Every RowSet
aggregates a "default rowset iterator" for simplifying the 90% of use cases where you only need a single iterator over the rowset. A RowSet
implements all the methods on the RowSetIterator
interface by delegating them to this default RowSetIterator
. This means you can invoke any RowSetIterator
method on any RowSet
(or ViewObject
, since it implements RowSet as well for its default RowSet).
Table D-4 RowSet Interface
If you want to... | Call this RowSet interface method... |
---|---|
Set a where clause bind variable value |
Note: Bind variable ordinal positions are zero-based |
Avoid view object row caching if data is being read only once |
|
Force a row set's query to be (re)executed |
|
Estimate the number of rows in a view object's query result |
|
Produce XML document for rows in View Object rowset |
|
Process all rows from an incoming XML document |
|
Set whether rowset will automatically see new rows based on the same entity object created through other rowsets |
|
Create secondary iterator to use for programmatic iteration |
Note: If you plan to find and use the secondary iterator by name later, then pass in a string name as the argument, otherwise pass |
A RowSetIterator is an iterator over the rows in a RowSet
. By default it allows you to iterate both forward and backward through the rows.
Table D-5 RowSetIterator Interface
If you want to... | Call this RowSetIterator interface method... |
---|---|
Get the first row of the iterator's rowset |
|
Test whether there are more rows to iterate |
|
Get the next row of iterator's rowset |
|
Find row in this iterator's rowset with a given Key value |
Note: It's important that the |
Create a new row to populate for insertion |
Note: The new row will already have default values set for attributes which either have a static default value supplied at the entity object or view object level, or if the values have been populated in an overridden |
Create a view row with an initial set of foreign key and/or discriminator attribute values |
Note: You use this method when working with view objects that can return one of a "family" of entity object subtypes. By passing in the correct discriminator attribute value in the call to create the row, the framework can create you the correct matching entity object subtype underneath. |
Insert a new row into the iterator's rowset |
Note: It's a good habit to always immediately insert a newly created row into the rowset. That way you will avoid a common gotcha of creating the row but forgetting to insert it into the rowset. |
Get the last row of the iterator's rowset |
|
Get the previous row of the iterator's rowset |
|
Reset the current row pointer to the slot before the first row |
|
Close an iterator when done iterating |
|
Set a given row to be the current row |
|
Remove the current row |
|
Remove the current row to later insert it at a different location in the same iterator. |
|
Remove the current row from the current collection but do not remove it from the transaction. |
|
Set/change the number of rows in the range (a "page" of rows the user can see) |
|
Scroll to view the Nth page of rows (1-based) |
|
Scroll to view the range of rows starting with row number N |
|
Set row number N in the range to be the current row |
|
Get all rows in the range as a Row array |
|
A Row is generic value object. It contains attributes appropriate in name and Java type for the ViewObject
that it's related to.
Table D-6 Row Interface
If you want to... | Call this Row interface method... |
---|---|
Get the value of an attribute by name |
|
Set the value of an attribute by name |
|
Produce an XML document for a single row |
|
Eagerly validate a row |
|
Read row attribute values from XML |
|
Remove the row |
|
Flag a newly created row as temporary (until updated again) |
|
Retrieve the attribute structure definition information for a row |
|
Get the Key object for a row |
|
In addition to generic Row
access, JDeveloper 10g can generate you a custom YourViewObjectName
Row
interface containing your type-safe attribute getter and setter methods, as well as any desired row-level custom methods that you've chosen to expose to the client. You do this by visiting the Client Row Interface tab of the View Object editor, and shuttling the methods you'd like to appear in your client interface into the Selected list. JDeveloper will also generate an appropriate YourViewObjectName
RowClient
client proxy implementation class that is used automatically by your remote client in the case that you deploy your application module as an EJB Session Bean or whenever you use your application module in Batch Mode.
A StructureDef is an interface that provides access to runtime metadata about the structure of a Row
.
In addition, for convenience every ViewObject
implements the StructureDef
interface as well, providing access to metadata about the attributes in the resulting view rows that its query will produce.
Table D-7 StructureDef Interface
If you want to... | Call this StructureDef interface method... |
---|---|
Access attribute definitions for all attributes in the view object row |
|
Find an attribute definition by name |
|
Get attribute definition by index |
|
Get number of attributes in a row |
|
An AttributeDef provides attribute definition information for any attribute of a View Object row or Entity Object instance like attribute name, Java type, and SQL type. It also provides access to custom attribute-specific metadata properties that can be inspected by generic code you write, as well as UI hints that can assist in rendering an appropriate user interface display for the attribute and its value.
Table D-8 AttributeDef Interface
If you want to... | Call this AttributeDef interface method... |
---|---|
Get the Java type of the attribute |
|
Get the SQL type of the attribute |
Note: The |
Determine the kind of attribute |
Note: If it's a simple attribute, it returns one of the constants |
Get the Java type of elements contained in an |
|
Get the SQL type of elements contained in an |
|
Get the name of the attribute |
|
Get the index position of the attribute |
|
Get the precision of a numeric attribute or the maximum length of a String attribute |
|
Get the scale of a numeric attribute |
|
Get the underlying column name corresponding to the attribute |
|
Get attribute-specific custom property values |
|
Get the UI |
|
Test whether the attribute is mandatory |
|
Test whether the attribute is queriable |
|
Test whether the attribute is part of the primary key for the row |
|
The AttributeHints interface related to an attribute exposes UI hint information that attribute that you can use to render an appropriate user interface display for the attribute and its value.
Table D-9 AttributeHints Interface
If you want to... | Call this AttributeHints interface method... |
---|---|
Get the UI label for the attribute |
|
Get the tool tip for the attribute |
|
Get the formatted value of the attribute, using any format mask supplied |
|
Get the display hint for the attribute |
Note: Will have a String value of either |
Get the preferred control type for the attribute |
|
Parse a formatted string value using any format mask supplied for the attribute |
|