HomeOracle Page 2 - Adding Processes to HTML DB Applications
Creating Processes - Oracle
In this second part of a three-part series covering HTML DB applications, you will learn about processes. This article is excerpted from chapter 13 of the Oracle HTML DB Handbook, written by Lawrence Linnemeyer and Bradley Brown (McGraw-Hill, 2006; ISBN: 0072257687).
Processes, like almost anything else in HTML DB, are created with a wizard. The wizard for page-level processes is started either from the Add icon in one of the two Processes sections on the Page Definition page or through the Create link on the Developer’s Toolbar (selecting the Page Control on This Page option and then the Process option). In the first step of the Create Page Process Wizard, you must select from one of the eight different types of processes available (see Figure 13-1).
The wizard for application-level processes is started with the Create button from the Application Processes section of an application’s shared components. With application-level processes, you will not have to select a process type because the only type you are allowed to create as an application-level process is a PL/SQL type process. The eight different types of processes are
Figure 13-1. Process types in the Create Page Process Wizard
briefly described in the following table. The remaining steps in the process-creation wizard vary depending on the process type you select.
This is a generic PL/SQL anonymous block of code, which could be as complicated as you would like to make it or could simply call a program unit that is stored in the database (for instance, a general API that is always used for access to a particular table).
This process type is used to reset the pagination of a report back to the beginning of the result set. This way, the next time the report is displayed, the items displayed will be the first part of the result set.
The purpose of a page-level On Demand type process is to execute an application-level process that has been defined to have a processing point of On Demand. This way, a single process can be called from several different locations throughout the application. Use this process type if you have a generic process that must be executed at multiple locations in your application.
This process type is used to null out the values of existing session state items. It can be used to clear the cache for all workspace applications, for a selected workspace application, for the current session, for certain pages, or for particular items. This process type is also used to set the value of a user preference.
This process type is used for an automatic Data Manipulation Language (DML) process. The processes created by the wizards to do multirow or single-row form fetches, saves, updates, and deletes are of this type. Typically when you use this type of process, it will be created for you by a wizard.
This process type is used to implement a web service. When this process is run, it submits a request to the web service provider.
This process type is used with a master detail page. It is used to determine the next and previous master records and to display the master record positional count (for example, “3 of 4”).
Close Popup Window
This process type is used to close a pop-up window and refresh the calling window. This process type is new to version 2.0—so new that as of the time of publishing this book, Oracle had not been able to provide instructions on how it refreshes the calling page.
The path of the wizard will vary depending on the type of process you choose to create. A number of fields will be entered for most processes. In the Name field, you provide a descriptive name of the process to give other developers an idea of what the process does. The value you enter in the Sequence field is used to determine the order in which processes will be evaluated within the same process point. The Point field is used to specify a point in page rendering or page processing at which the process will be evaluated. Here are the possible points:
On New Instance – After Authentication
On Load – Before Header
On Load – After Header
On Load – Before Regions
On Load – After Regions
On Load – Before Footer
On Load – After Footer
On Submit – Before Computations and Validations
On Submit – After Computations and Validations
In almost all the paths through the Create Page Process Wizard, after you select the type of process you want to create, as shown earlier in Figure 13-1, you will be presented with the process’s Type field. The value of this field will be the type you selected. In most cases, you won’t want to change its value. However, when you select to create a PL/SQL type process, this field will default to the value “PL/SQL anonymous block.” You may wish to change the Type field to “PL/SQL DBMS JOB (runs anonymous block asynchronously).” This allows you to run the process in the background. This is ideal for long-running processes where the user does not need immediate feedback from the process.
The values entered into the Success Message field will be displayed if the process is evaluated successfully and the following page has the #SUCCESS_MESSAGE# substitution variable used in the page template. The value entered into the Failure Message field will be displayed if the process fails. You can make a process conditional by selecting a button for the When Button Pressed field and/or by selecting a condition type and specifying values for Expression 1 and Expression 2.