14.01.2013 Views

Oracle JHeadstart Developer's Guide - Downloads - Oracle

Oracle JHeadstart Developer's Guide - Downloads - Oracle

Oracle JHeadstart Developer's Guide - Downloads - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

13.5. Handling Forms PL/SQL Logic<br />

13.5.1. Moving PL/SQL Logic to the Database<br />

The <strong>JHeadstart</strong> Forms2ADF Generator allows you to “copy” the PL/SQL logic used in<br />

the form to the <strong>JHeadstart</strong> Application Definition, so you can easily see the logic in the<br />

editor, and determine what to do with it. Below we have listed common types of<br />

PL/SQL logic, with some suggestions on how you might handle it. Note that this is a<br />

high-level overview, not a detailed cookbook on how to handle each piece of PL/SQL<br />

logic. Always make sure you fully understand the PL/SQL logic before you take a final<br />

decision on how to re-implement it in the ADF/<strong>JHeadstart</strong> stack.<br />

• Canvas and window management logic: this kind of logic can typically be<br />

ignored, as it is specific to how <strong>Oracle</strong> Forms works.<br />

• Navigation logic: logic to navigate to detail windows within the same form can<br />

typically be ignored, since <strong>JHeadstart</strong> will generate buttons to navigate between<br />

parent and detail groups. Navigation logic to call other forms, passing along<br />

context parameter(s) used to query information in the called form can be<br />

implemented using the <strong>JHeadstart</strong> Deep Linking functionality. See chapter 6<br />

“Generating User Interface Widgets” section 6.14 “Hyperlink to Navigate<br />

Context-Sensitive to Another Page (Deep Linking)” for more information.<br />

• Logic to implement conditionally dependent items: with this we mean PL/SQL<br />

logic that changes the user interface properties like required, enabled, or visible<br />

for one or more “dependent” items based on the value(s) of one or more<br />

“depends on” items. In other words, this kind of logic creates dynamic user<br />

interfaces that change based on the values you enter. <strong>JHeadstart</strong> offers extensive<br />

declarative support for conditionally dependent items. See chapter 6<br />

“Generating User Interface Widgets”, section 6.12 “Conditionally Dependent<br />

Items” for more information.<br />

• Business rule logic: logic that causes error or messages or dialogs to be displayed<br />

when the user enters invalid data, or logic that automatically updates other<br />

values either directly in the form or by executing SQL DML statements (change<br />

event rules). This kind of logic can be implemented in ADF Business<br />

Components, as described in the Business Rules White Paper, or can be moved to<br />

the database (in case it is not yet implemented there).<br />

Reference: For information about enforcing business logic within the ADF BC<br />

Business Service, see the whitepaper Business Rules in ADF BC:<br />

otn.oracle.com/products/jdev/collateral/papers/10131/businessrulesinadfbc<br />

technicalwp.pdf<br />

When analyzing the PL/SQL logic in older forms, you might encounter a lot of PL/SQL<br />

logic to implement business rules or computations that might well be executed inside the<br />

<strong>Oracle</strong> Database. Using the “Move to database” icon in the <strong>JHeadstart</strong> Application<br />

Definition Editor, which is enabled when you select a PL/SQL program unit or trigger in<br />

the navigator tree, you can easily move such logic to the database.<br />

If you want to call out to PL/SQL procedures or functions that you moved to the<br />

database from a button in your ADF web page, you need to do the following:<br />

13 - 18 Forms2ADF Generator <strong>JHeadstart</strong> Developer’s <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!