Professional Documents
Culture Documents
Eadstart Racle Esigner: User Guide
Eadstart Racle Esigner: User Guide
User Guide
Version 6.5.3.0
November, 2002
Headstart Oracle Designer 6.5, User Guide
November, 2002
The information contained in this document is subject to change without notice. If you find
any problems in the documentation please report them to us in writing. Oracle Corporation
does not warrant that this documentation is error free.
This document is provided “as is” and Oracle Corporation shall have no liability in
connection with or arising out of the use of this document.
ORACLE8i, Oracle Designer, Oracle Repository, Oracle Forms, Oracle Reports, Oracle Form
Generator, PL/SQL, Oracle Report Generator, and Oracle Applications are trademarks of
Oracle Corporation. Custom Development Method is a Service Mark of Oracle Corporation.
All other product or company names are used for identification purposes only, and may be
trademarks of their respective owners.
CHAPTER 17 Troubleshooting...........................................................................................................17-1
Troubleshooting Approach............................................................................................17-2
Common Problems ........................................................................................................17-3
ORA-04062 .......................................................................................................................... 17-3
ORA-06508 .......................................................................................................................... 17-3
FRM-40735 .......................................................................................................................... 17-4
FRM-41085 .......................................................................................................................... 17-4
Problem Assessment......................................................................................................17-5
Checking Application Logic................................................................................................. 17-5
Headstart Runtime Initializations ......................................................................................... 17-5
Generating without Headstart ............................................................................................... 17-5
Debug Template and Object Library ............................................................................ 17-6
Menu Attachment ......................................................................................................... 17-6
Checking Headstart Customizations ..................................................................................... 17-7
Debug Monitor ..............................................................................................................17-8
Using the Debug Monitor ..................................................................................................... 17-8
Standard Debug Messages .................................................................................................... 17-8
Adding Debug Messages ...................................................................................................... 17-9
Forms Debugger ..........................................................................................................17-10
1 Introduction
Headstart Oracle Designer is a powerful productivity suite for Oracle Designer based on the
best practices of Oracle Consulting worldwide.
The Headstart Template Package is based on the best practices of Oracle Consulting
and allows you to achieve 100% generation of applications which fully comply with
the standards and guidelines established in CDM, Oracle’s Custom Development
Method.
• Headstart Utilities A set of utilities, classified into quality checks and productivity
boosters, that use the Oracle Designer API to increase the quality and speed of
application development using Oracle Designer.
The Headstart Utilities assume that your application is generated with the Headstart
Template Package. This means that several utilities create objects specifically for use
with the Headstart Template Package.
This user guide does not attempt to replace the Oracle Designer online help and training.
However, Headstart uses and leverages Oracle Designer, so it is very important that you have
a basic understanding of Designer’s functionality to be able to understand and appreciate
what Headstart has to offer.
One of the best sources of information about how to use Oracle Designer is the CDM
Standards and Guidelines library.
The Custom Development Method (CDM) Standards and Guidelines Library support the
development, implementation and maintenance of high quality software using the Oracle
development tools. CDM is available to customers under the name CDM Advantage.
This library consists of 4 volumes which focus on the development of systems using Oracle
Designer:
These volumes provide standards and guidelines for using the Oracle Designer tool set.
Headstart Oracle Designer 6.5 - User Guide Headstart Template Package Components 2 - 1
Templates, Libraries and Preferences for Developer Generation
The following forms and library forms are supplied to generate Forms 6i applications:
• qmstpl65.fmb: Template to use for generating normal data entry and data retrieval
forms
• qmslvt65.fmb: Template for LOV forms
• qmsolb65.olb: Object Library to use when generating any form
• qmsevh65.pll: Event Handler Library, functions as a bridge library between form,
block and item level triggers and the core Headstart Library.
• qmslib65.pll: Core Headstart Library, containing all UI related features.
• qmsolm65.fmb: Object Library Maintenance Form.
• qmsmnt65.mmb: Menu template
2 - 2 Headstart Template Package Components Headstart Oracle Designer 6.5 - User Guide
Headstart Required Application Forms
Headstart Required Application Forms are forms that are required to run your application
generated with Headstart. The need for most of these forms comes from the Headstart menu
template, which contains a number of menu options that call required application forms.
A special form is the Headstart debug monitor form qms0002f. This form is not required to
run your application, but can be started in a separate runform session to view debug messages
raised by a Headstart-generated application. Refer to the chapter on Troubleshooting for more
information.
Except for the debug monitor form all required application forms are 100% generated with
the Headstart templates. The repository module definitions can be found in the QMS503
application system, which can be restored from the qms503.dmp dump file, located in the
\dmp directory under the Headstart-root directory.
The required application forms are set up for use in multiple applications. If you generate
multiple applications with the Headstart templates, you can use the same set of required
application forms to serve all your Headstart-generated applications (provided that they are
deployed in the same runtime environment).
Detailed information on each required application form can be found in the context-sensitive
online help file, available in both HTML format and MSHELP format. This help file,
qmshelp.htm/hlp is located in the \doc directory under the Headstart root-directory. Note that
the online help files are 100% generated as well. The .hlp file was generated using the
Designer MS Help Generator and the .htm version was generated using the Headstart Utility
‘HTML Online Help Generator’.
Headstart Oracle Designer 6.5 - User Guide Headstart Template Package Components 2 - 3
Headstart Foundation Application
The Headstart Foundation Application is intended for application administrators, it contains
forms to maintain the Headstart database tables that should be deployed together with your
own application tables.
The Headstart Foundation Application is 100% generated with the Headstart templates. The
repository module definitions can be found in the QMS503 application system, which can be
restored from the qms503.dmp dump file, located in the \dmp directory under the Headstart-
root directory.
Detailed information on each foundation application form can be found in the context-
sensitive online help file, available in both HTML format and MSHELP format. This help
file, qfdhelp.htm/hlp is located in the \doc directory under the Headstart root-directory. Note
that the online help files are 100% generated as well. The .hlp file was generated using the
Designer MS Help Generator and the .htm version was generated using the Headstart Utility
‘HTML Online Help Generator’.
2 - 4 Headstart Template Package Components Headstart Oracle Designer 6.5 - User Guide
Headstart Interface Layer
The Headstart Interface Layer (HIL) is a set of database packages that act as an Application
Programming Interface (API) between the PL/SQL libraries that are part the Headstart
Template Package, and some of the Headstart database tables.
By accessing these data sources through the Headstart Interface Layer, we have created data
independence for the Template Package. If you want to change the underlying table structure,
you do not need to change the Headstart libraries, you only need to replace the QMS calls in
the HIL_PROFILE or HIL_MESSAGE packages.
Headstart Oracle Designer 6.5 - User Guide Headstart Template Package Components 2 - 5
Headstart Demo Application
Headstart supplies a demo application, HSD65, which is 100% generated and demonstrates
many of the powerful features of the Headstart Template Package.
All of the features presented in this user guide are demonstrated in the demo application.
You can examine both the definitions in the Designer repository and the generated modules.
The Headstart Demo Application contains comprehensive online help. You can access the
online help context-sensitive while running the demo application. The online help file was
generated using the Headstart Utility ‘HTML Online Help Generator’.
2 - 6 Headstart Template Package Components Headstart Oracle Designer 6.5 - User Guide
CHAPTER
3 Headstart Utilities
Components
The implementation of the standards and guidelines presented in the CDM Standards and
Guidelines library leads to two challenges.
The Headstart Oracle Designer Utilities provide a set of tools to support the implementation
of the CDM Standards and Guidelines by addressing the above challenges. There are two
type of utilities.
Apart from these two components, the Headstart Utilities have two more components to help
you run and manage the utilities:
Productivity Boosters
These utilities perform inserts, updates and deletes in the Oracle Designer repository that
otherwise should have been carried out manually. In most cases, the elements created by
these utilities are actually maintained by the utility. By running the utility again, obsolete
elements will be deleted and existing elements will be updated according to changes that may
have taken place which influence the element definitions.
Quality Checks
These utilities check the Oracle Designer element definitions against the CDM Standards and
Guidelines. The results can be viewed in an HTML browser. User preferences specify
whether to show summary and/or detailed information.
By using the Quality Checks a large number of CDM Standards can be checked with very
little effort.
All utilities, the Productivity Boosters as well as the Quality Checks, are run from a single
user interface; the Run Utility Form. Log in as a Utilities User.
Administration Application
The administration of Utilities Users and the grouping of Utilities in the Run Utility Form can
be maintained by using the Administration Application. Log in as the Headstart Utilities
owner.
This chapter describes how to give your Development Team access to the Headstart Utilities
and to Headstart generated applications. It is assumed that at least the Thin Client installation
is already run for each user (see the [HSD65_HOME]\doc\install.htm for details).
Headstart Oracle Designer 6.5 - User Guide Development Team Access to Headstart 4 - 1
Headstart Utilities
To grant users access to the Headstart Utilities, you use the Utilities Administration
Application.
The Headstart Utilities come with two User Groups pre-defined, ‘All Productivity Boosters’
and ‘No Productivity Boosters’. If you like, you can define one or more custom User Groups
which contain only a subset of the productivity boosters.
When you grant a user access to the Headstart Utilities, you must assign that user to a User
Group. By defining custom User Groups, you can limit access to the Productivity Boosters.
Everyone always has access to the Quality Checks.
1. Choose the menu option Administration => User Groups and Productivity Boosters
2. On a blank record, enter the new User Group name.
3. In the Productivity Boosters field, open the List of Values. Select one or more
Productivity Boosters from the List of Values and press OK. (This List of Values
allows you to select multiple rows at once.)
4. Save.
Note that in order to add a Productivity Booster to a User Group, this Productivity Booster
must already be installed. If you want to create a new Productivity Booster and add it to a
User Group, you should read the information in the chapter ‘Customizing the Headstart
Utilities’.
In order to be a Headstart Utilities user, a user must first be defined as an Oracle Designer
user and a Headstart Template Package user (see previous Section).
4 - 2 Development Team Access to Headstart Headstart Oracle Designer 6.5 - User Guide
• Username - the user’s Oracle Username
• Group - select a User Group from the List of Values
• Name - the user’s name
• For a description of the other fields on this screen, see the User Preferences
Section of the chapter ‘Running the Headstart Utilities’.
3. Save.
4. Press [Reconcile user] to grant the correct privileges to the current user, or
[Reconcile all] to do the same for all recorded Utilities users.
Headstart Oracle Designer 6.5 - User Guide Development Team Access to Headstart 4 - 3
Headstart generated applications
To be able to use Headstart generated applications (like the Demo Application, or your own
generated application), each Oracle user account you use to access such an application must
have access to the Headstart database objects and a copy of procedure qms_exec_sql.
The script will grant access to the Headstart Database Objects, and it will also create private
synonyms for them in the schema of the specified user.
Attention: It is assumed here that you will have shared deployment of the
Headstart Database Objects, at least in the Development Environment. If you
decide to create a self-contained application (for more information about this
choice see the Section ‘Database Schema Organization’ in chapter ‘Test and
Production Environment’), you will have to create the Headstart Database
Objects in the application schema and use Alter Schema Set Current Schema, as
described in chapter ‘Test and Production Environment’. In that case you don’t
need to run GRT_SYN.SQL for every end user.
4 - 4 Development Team Access to Headstart Headstart Oracle Designer 6.5 - User Guide
CHAPTER
This chapter explains how to run the Headstart Oracle Designer Utilities using the supplied
Run Utility Form.
Headstart Oracle Designer 6.5 - User Guide Running the Headstart Utilities 5 - 1
Important Terms
Context Workarea
When you start the Run Utility Form you will have to specify the workarea you want to work
in. To be able to use the Productivity Boosters in a specific workarea you must be granted
Select, Update, Insert and Delete access rights to both the workarea and the application
system/folder by their respective owners. For using the Quality Checks, Select access is
sufficient.
The workarea you work in is referred to as the Context Workarea. It is visible in the window
title and at the bottom of the Run Utility Form.
Context Container
You can specify that container in the upper right hand corner of the Utility Parameter
window. It is the item with the prompt ‘Create new objects in’. The list of values contains all
folders/application systems of the workarea that you have Insert privileges for. If you leave it
at the default value <default>, the utility will create any new objects in the same container as
the object it is based on.
For example, the utility ‘Create CAPI Definition’ can be executed for multiple tables from
different containers in one run. For each of these tables, it will create the CAPI in the same
5 - 2 Running the Headstart Utilities Headstart Oracle Designer 6.5 - User Guide
container as the table the CAPI belongs to. This way the utility can create new primary
elements in multiple containers in the same run.
If you leave it at the default value <whole workarea>, the parameter LOV’s will not be
restricted and show all objects in the context workarea, regardless the owning application
system or folder.
Application Code
Many CDM Standards use the so-called Application code in naming conventions. Standard
OMS-42113 for example states that primary key constraints must be named using the
convention
<application_code>_<table/view_alias>_PK
The Headstart Oracle Designer Utilities assume that this standard has been followed, and
derive the Application Code from the Application System name. To clarify this derivation
some examples are given below.
Headstart Oracle Designer 6.5 - User Guide Running the Headstart Utilities 5 - 3
Run Utility Form
The Run Utility Form itself consists of two components.
• The Navigator where you can select a productivity booster or a quality check
• A Parameter window that brings up the parameters that you can fill in for the specific
utility that you have selected in the Navigator.
Navigator
The navigator gives you all the functionality that you normally find in a navigator. You can
expand, expand all, collapse, collapse all, refresh the entries and search forward or backward.
Expand All , expands the current node and the nodes below it.
5 - 4 Running the Headstart Utilities Headstart Oracle Designer 6.5 - User Guide
Collapse All, collapses the current node and the nodes below it.
Refresh, Refreshes the nodes for instance after installing a new utility.
Parameter Window
If you have selected a utility, the parameter window will automatically pop up and show you
the parameters for the selected utility. Parameters with light yellow background are
mandatory.
Most of the parameters you have to enter with the help of a list of values (LOV) . The list
of values can have two forms: multi select or single select. In the multi select LOV you can
select multiple objects (for instance tables) by using <Ctrl> click and/or <Shift> click. The
parameter item will display <multiple selection> if you have selected more than one element.
Parameters that don’t have a List of Values, have a button which pops up a multi-line text
editor. This is useful for entering long texts.
You can run the utility by clicking the green light button. The question mark button
gives you online help for the selected utility. The button lets you view the QA
run results. The run results are automatically shown in the browser so you normally will not
use this. The lets you view the log results. You also have the possibility to view the log
results after you have run a productivity booster, which means that you normally will not use
this button either.
After you have run a quality check the browser will be opened automatically (if the
preference is checked) and the output is shown in HTML format. Depending on your user
preferences you can get different forms of output. For more information see the Section on
user preferences.
If you have run a productivity booster you will get the following window.
We advise you to look at the logging first before you save your data to the repository. If you
are not satisfied you can press the undo button and the changes are not saved.
Headstart Oracle Designer 6.5 - User Guide Running the Headstart Utilities 5 - 5
Sometimes a utility completes with errors. This can be an error found by the utility itself, or a
violation of the Oracle Designer API (in which you will see an error code). For example if
you want to create a view and give an alias that already exists in the repository the utility will
report an error. The logging gives the error and you should change the alias and run the
utility again.
5 - 6 Running the Headstart Utilities Headstart Oracle Designer 6.5 - User Guide
User Preferences
The run utility form gives you a number of user preferences to steer the output and logging.
You can edit the user preferences from the Edit-menu.
QA Details Creation
The output of the QA-checks consists of four parts:
• Summary
• by element
• by standard
• CDM Standards (static)
• Element types, with a numeric overview of the violations for each element type
• Timing Statistics of the QA-check that you performed
• Violated standards, with a list of all standards that are violated. You can click on the
number of violations to start the ‘by standard’ part
• Elements with violations, with a list of all elements that are violated. You can click on
the number of violations to start the ‘by element’ part.
Headstart Oracle Designer 6.5 - User Guide Running the Headstart Utilities 5 - 7
The ‘by element’ part orders the violations per element. This is especially useful for
Developers that want to fix the violated errors for the element that falls under their
responsibility.
The ‘by standards’ part orders the violations per standards. This is especially useful for QA-
persons that want to get a feeling of which standards are violated in a project. It consists of
the following items:
• Violated standards, gives the standard and the elements that violated this standard
• Checked standards, all standards that have been checked
• Standards that are not checked (Comply to is set to No).
• Standards which have to be checked manually
The CDM Standards are a list of all standards with their rationale, examples, annotation etc.
These files are not included in Headstart Oracle Designer but are included in the Standards
and Guidelines Library of CDM Advantage.
If you are not interested in one of more of these parts you can regulate this with the following
user preferences.
By Standard
If you check this check box the ‘by standard’ part will be created.
By Element
If you check this check box the ‘by element’ part will be created.
QA Run Results
Delete Data
The output of the utilities is written to the database so you can make your own report to show
the output. Checking this checkbox leads to the situation that starting a QA check will delete
the data of the previous run. If you do not need that save the results to the database because
the output says it all check this check box.
5 - 8 Running the Headstart Utilities Headstart Oracle Designer 6.5 - User Guide
Suggestion: If you did not check this check box, you can delete the old QA
Run data later using the Utilities Administration Application (menu:
Administration => Cleanup old data).
Logging
Delete Data
The logging of the utilities is written to the database so you can make your own report to
show the logging. Checking this checkbox leads to the situation that starting a utility will
delete the logging of the previous run. If you do not need to save the results to the database
because the logging says it all, check this check box.
Suggestion: If you did not check this check box, you can delete the old
Logging data later using the Utilities Administration Application (menu:
Administration => Cleanup old data).
Before running a utility, you could check out all objects that you think the utility will need,
but it can be hard to guess which objects you need. There is an easier way: let the utility
check out the objects just before it changes them.
Headstart Oracle Designer 6.5 - User Guide Running the Headstart Utilities 5 - 9
Primary Objects
Each utility determines the primary objects it should modify and whether or not it has access
to those objects based on the setting of the user preferences ‘checked out by…’ and ‘…and
also checked in objects’.
If the utility determines that it should process an object but does not have access, then the
utility will err out. The log messages will list the first object that could not be accessed and
why.
Check In
It remains your own responsibility to check folders, application systems and other objects
back in, if needed.
5 - 10 Running the Headstart Utilities Headstart Oracle Designer 6.5 - User Guide
CHAPTER
This chapter explains how to use the Headstart Oracle Foundation Application.
The Foundation Application allows users to interactively maintain two important features of
the Headstart Template Package.
Headstart Oracle Designer 6.5 - User Guide Running the Headstart Foundation Application 6 - 1
Messages
Headstart provides a multi-lingual message dictionary for recording message text used in
your application.
When a message is raised on the client, the message code is passed to a procedure which
retrieves the correct message text from the dictionary taking the end user’s language
preference into consideration.
If the message is used for a constraint violation, the constraint name should be recorded. If
an error is raised on the server, the constraint name is passed to the client. Since no message
code is known at this point, the constraint name is passed to the procedure which retrieves the
message text.
Headstart provides a utility to automatically generate messages for primary key, unique key
and foreign key constraints. For other messages, you must manually record the message
using this form.
6 - 2 Running the Headstart Foundation Application Headstart Oracle Designer 6.5 - User Guide
Module and Parameters
Headstart provides a single dynamic launch form for all reports. This means you do not have
to create individual parameter forms for every report.
In Designer, you will define your report and its required user parameters.
You will then run a Headstart Utility to automatically populate the report parameter tables
with this information.
You can then use this form to add the Standard Report Parameters (Destination Type,
Destination Format, Orientation, etc.), and to record details about the user parameters.
Headstart Oracle Designer 6.5 - User Guide Running the Headstart Foundation Application 6 - 3
In the Default Value and Description, you can use SYSTEM and GLOBAL variables,
SYSDATE and USER, in addition to literal values.
The validation where clause is used to validate the input parameter against data stored
in a table. It is recorded as a where clause using the following standard format:
For example:
• list of values
You can also define a list of values query for parameter values that can be selected
from data stored in a table.
6 - 4 Running the Headstart Foundation Application Headstart Oracle Designer 6.5 - User Guide
The DESCRIPTION is displayed to the user on the report launch form and the
VALUE is hidden. The VALUE is what is actually passed to the report.
You can define the display width of the VALUE and DESCRIPTION fields as well
as the LOV as a whole. If you only want the DESCRIPTION field to be visible in the
LOV, set the VALUE field width to 0.
Multi-Select LOV
For the multi-select LOV, you define a query just as you did for the Native Forms
LOV above. Use the ‘Multi Select LOV’ checkbox to indicate that you want a multi-
select LOV.
Multi-select LOVs will be shown using the Shuttle Control Object Selector form,
qms0014f.
If you have a multi-select LOV, you can enter a list of values in the Default Value
and Default Description properties for the parameter as well. Separate the items in
the list using a comma.
If you choose multi-select, the LOV, VALUE and DESCRIPTION widths are
ignored.
LOV Form
To use an LOV form for a report parameter, you must first create the LOV form in
Designer. Follow the instructions in the Designer online help for creating an LOV
form.
Headstart Oracle Designer 6.5 - User Guide Running the Headstart Foundation Application 6 - 5
In the LOV Query field, instead of defining a query, use html-like tags to define the
name of the LOV form.
<FORM>hsd0024f</FORM>
When the user selects a record using the LOV form, the VALUE is filled in.
Unfortunately, the LOV form created by Designer does not contain a mechanism to
also return the DESCRIPTION to the calling form. Therefore, you must also define a
query that will fetch the DESCRIPTION to display to the user. The query must use
the following format.
<SELECT>
select <character value>
from <table_name(s)>
where <column_name> = :<parameter_name>
( and …)
</SELECT_DESC>
This query must return exactly one record. The <character value> may be a single
column or a concatenated list of columns. If it contains numeric data, it must be
converted to a character string using the to_char function.
If you choose an LOV Form, the LOV, VALUE and DESCRIPTION widths, as well
as the Multi Select LOV property, are ignored.
6 - 6 Running the Headstart Foundation Application Headstart Oracle Designer 6.5 - User Guide
Standard Report Parameters
This form allows you to define Standard Report parameters for use with your generated
reports. Headstart supplies default definitions with validation and appropriate lists of values
for all system parameters.
You can customize which parameters are displayed to users in the Report Options window of
the report launch form, and you can customize the default values for any standard parameter.
Headstart Oracle Designer 6.5 - User Guide Running the Headstart Foundation Application 6 - 7
(blank page)
6 - 8 Running the Headstart Foundation Application Headstart Oracle Designer 6.5 - User Guide
PART II ROADMAP TO
APPLICATION
DEVELOPMENT
(blank page)
CHAPTER
7 Headstart Application
Development Approach
The three-layer model introduced by the Gartner Group provides a framework for
modularizing an application system into the following three basic components:
Headstart Oracle Designer 6.5 - User Guide Headstart Application Development Approach 7 - 1
Benefits of Three Layer Approach
More Adaptable To Change
Applications can be made more adaptable to changes in business requirements and
technology. For example, an application that clearly separates presentation logic from
business logic would be easier to convert from windows mode to a web-interface than one
that mixes these two layers.
More Manageable
Individual components organized into well-defined layers can be managed more easily than
an application based on a monolithic architecture. Upgrades can be staged on a layer-by-
layer basis, while system monitors can be more effective at discovering and analyzing
performance problems of individual modules.
Improved Reusability
Modularity, well-defined interfaces between software and the centralization of application
logic are all prerequisites for reuse.
More Robust
Distributing the workload has the additional benefit of eliminating single points of failure.
Data Independence
Theoretically, the business logic and presentation tiers can be built independently of the data
source, allowing different databases to be used without modification.
7 - 2 Headstart Application Development Approach Headstart Oracle Designer 6.5 - User Guide
Logical versus Physical Partitioning
The distinction between logical and physical partitioning is very important.
Logical Partitioning
• design of the software components is based on a clear specification of each tier
• software interfaces are defined between the tiers
• more than one logically defined tier may be implemented on the same physical tier
(either hardware or software)
• prerequisite for physical partitioning
Physical Partitioning
• the three tiers are both logically and physically separated
• presentation is relegated to the browser
• business logic to one or more application servers
• data management to one or more database servers
• middleware handles the interactions between tiers
• different, non-integrated development toolsets may be used in each tier
• The Oracle Server has evolved over the years into a platform for internet computing
with very strong capabilities for hosting business logic, written in either PL/SQL or
Java. In other words, the Oracle Server has become both a Database Server and an
Application Server.
• Many business rules are implemented with data-driven logic. The tight binding of
data and business logic justifies a close physical coupling to cut down on network
traffic.
• Security and performance concerns cut across all tiers. Network performance, in
particular, may suffer from over-partitioning and an increase in middleware overhead.
• Physical partitioning adds cost and complexity to routine management tasks such as
security administration and software distribution.
• A close link between data structure and presentation is sometimes required to guide
users through informational data access (data mining, ad hoc query, etc.).
• Non-integrated approaches will often have multiple languages in each tier; for
example, a screen-building tool, graphical report writer, and 3GL for complex logic at
the workstation, a production report writer, 3GL, and scripting language for batch
processing on the application server, and a stored procedure language in the database.
Not only do multiple languages increase complexity, maintenance costs, and learning
curves, they also reduce the opportunities for reuse, since application logic cannot be
shared or re-partitioned, without re-coding or wrappering.
Headstart Oracle Designer 6.5 - User Guide Headstart Application Development Approach 7 - 3
• Complex, interactive transactions require an affinity between the business logic and
presentation layers. The presentation layer must adapt to underlying business rules to
give the user navigational flexibility and control over transaction boundaries.
7 - 4 Headstart Application Development Approach Headstart Oracle Designer 6.5 - User Guide
Headstart Application Development Approach
The application development process using Oracle Designer and Headstart Oracle Designer
can best be described as a matrix. It consists of 3 logical layers: the Data Layer, the Business
Logic Layer, and the Presentation Layer. For each of these layers, activities are performed
during the Analysis Phase and the Design and Implementation Phase.
Transformation
Generation
HTML
The remainder of this user guide is organized around this development approach matrix.
The following chapter presents a brief roadmap for each of the phases of the development
process. For each phase, the activities for the Data Layer, Business Logic Layer and
Presentation Layer are outlined. These roadmaps show when to use Headstart in your
development process.
Then each of the three Layers is presented in its own Part. There, you will find detailed
information on how to use the various Headstart features.
Headstart Oracle Designer 6.5 - User Guide Headstart Application Development Approach 7 - 5
(blank page)
7 - 6 Headstart Application Development Approach Headstart Oracle Designer 6.5 - User Guide
CHAPTER
8 Development Process
Roadmaps by Phase
This chapter presents a brief roadmap for each of the phases of the development process. For
each phase, the activities for the Data Layer, Business Logic Layer and Presentation Layer
are outlined.
Transformation
Generation
HTML
Headstart Oracle Designer 6.5 - User Guide Development Process Roadmaps by Phase 8 - 1
Analysis Phase Roadmap
The tasks listed in this roadmap are described in detail in the CDM Standards and Guidelines
Library, Volume 1: Requirements Modeling using Oracle Designer.
The four types of modeling described below are usually done in parallel and each feeds off of
information gathered in the others. Although the steps are presented here as sequential, it is
very likely that you will iterate around some of these steps, refining the details at every pass
of the iteration.
Tasks
1. Identify Primary Processes
2. Define Business Units
3. Develop Process Flow Diagrams for Primary Processes
4. Identify Events to which each Business Area Responds
5. Identify and Document Business Processes Associated with each Event
6. Develop Business Process Flow Diagrams
8 - 2 Development Process Roadmaps by Phase Headstart Oracle Designer 6.5 - User Guide
Data Layer - Entity Relationship Modeling
Tasks
1. Define Entities and their Relationships
2. Define Attributes
Tasks
1. Create events for entities
2. Record your business rules using the Business Rule Function object
Headstart Oracle Designer 6.5 - User Guide Development Process Roadmaps by Phase 8 - 3
Cleanup Unused Events for Entities
Tasks
1. Define Function Hierarchy (screens, reports, etc.)
8 - 4 Development Process Roadmaps by Phase Headstart Oracle Designer 6.5 - User Guide
Design and Implementation Phase Roadmap
The tasks listed in this roadmap are described in detail in the CDM Standards and Guidelines
Library, Volume 2: Designer and Generation of Multi Tier Web Applications.
Although the steps are presented here as sequential, it is very likely that you will iterate
around some of these steps, refining the details at every pass of the iteration.
Before you start your design you need to make important architectural decisions. Making or
changing these decisions later on will probably cost you a lot of rework
Tasks
1. Identify Necessary Tools
2. Define Batch Scheduling Mechanism
3. Define Debugging and Tracing Facilities
Headstart provides a debugging and tracing environment.
4. Decide on Business Logic Layer Structure
CDM RuleFrame supports an independent business logic layer.
5. Create or Buy Template Package
Headstart provides a sophisticated template package, which can easily be customized
and extended to meet application specific needs
6. Define Help System
Headstart HTML Online Help Generator provides a utility that generates context
sensitive on-line help in HTML files. This utility uses the help text recorded against the
various design objects in Oracle Designer.
7. Define Messaging System
Headstart offers a messaging component with help on messages, displaying cause and
action to be taken.
Headstart Oracle Designer 6.5 - User Guide Development Process Roadmaps by Phase 8 - 5
8. Multi-lingual Requirements
Headstart provides multi-lingual support for the messaging component.
9. Prepare to Address Performance Issues
Data Layer
8 - 6 Development Process Roadmaps by Phase Headstart Oracle Designer 6.5 - User Guide
5. Define Tablespaces
Headstart Productivity Booster: Assign objects to tablespace
6. Define Storage Definitions
7. Define Rollback Segments
3. Design and Code Other Business Logic Layer Components (Custom Services)
2. Generate the DDL for the TAPI, CAPI, VAPI and other Business Logic Layer
Components
Headstart Oracle Designer 6.5 - User Guide Development Process Roadmaps by Phase 8 - 7
Presentation Layer
8 - 8 Development Process Roadmaps by Phase Headstart Oracle Designer 6.5 - User Guide
Menu Structure and Security (MD.060)
1. Create Menu Structure
2. Enforce Function Access Rules
Headstart Productivity Booster: Create role module access based on bus. Unit function
access
Headstart Oracle Designer 6.5 - User Guide Development Process Roadmaps by Phase 8 - 9
(blank page)
8 - 10 Development Process Roadmaps by Phase Headstart Oracle Designer 6.5 - User Guide
PART III DATA LAYER
(blank page)
CHAPTER
This chapter describes the support that Headstart offers for the tasks involved in defining the
Data Layer.
For more detailed information on these tasks, refer to the CDM Standards and Guidelines
Library.
Headstart Oracle Designer 6.5 - User Guide Implementing the Data Layer 9 - 1
Data Layer Roadmap
This Part summarizes the activities that need to be performed for the Data Layer.
Analysis Phase
Tasks
1. Define Entities and their Relationships
2. Define Attributes
9 - 2 Implementing the Data Layer Headstart Oracle Designer 6.5 - User Guide
2. Assign System Privileges to Roles
3. Assign Object Privileges to Roles
Headstart Productivity Booster: Create role obj. privs based on module access and data
usages
Attention: When you generate the Table Definitions using Designer’s Server
Generator, make sure that you don’t include the Allowable Value Constraints
(check constraints named AVCON_…), by unchecking the checkbox ‘Generate
Valid Value Constraints’ in the Options of the Generate Server Model
Definitions (see figure below).
Headstart Oracle Designer 6.5 - User Guide Implementing the Data Layer 9 - 3
9 - 4 Implementing the Data Layer Headstart Oracle Designer 6.5 - User Guide
Implementing the Data Layer
The following utilities are provided by Headstart Oracle Designer to assist in creating the
Data Layer.
The utility will create a sequence for every column with the given name, and assign the
sequence to the corresponding column.
Depending on the value of the parameter Set to server defined? the column will also be set to
be server defined.
If you enter the Database and User parameters, the utility will also create a sequence
implementation for the sequence.
You can generate a Table API which (among other things) assigns a value to the primary key
column when inserting a record.
The parameter "primary keys only" is used to limit the utility so it only creates sequences for
primary key columns. If you set this value to No, you can use this utility to create sequences
for other columns as well.
In Volume 2 of the CDM Standards and Guidelines Library, two methods of data auditing are
discussed: last change columns (which are shown in the About This Record form of the
Headstart Template Package) and journaling.
Headstart Oracle Designer 6.5 - User Guide Implementing the Data Layer 9 - 5
You may choose whether these columns should be server derived (in the TAPI), or client
derived (in the Form).
In order for these columns to be displayed in the About This Record form, the columns must
be included as non-displayed items in any module component based on the associated table.
If you have already created modules before running this utility, you can specify that you want
to add these columns to existing module components as needed.
You can specify the tables you want to journal by adding the following tags in the notes of
the table definition.
<JN>Journal</JN> or
When you choose the tag <JN>Journal</JN> the resulting journal table will contain the same
columns as the underlying table and the addition columns JN_USER, JN_DATE_TIME and
JN_OPERATION
When you choose the tag <JN>Journal Old New</JN> the resulting table will contain two
copies of each column in the underlying table; one for the old value and one for the new
value.
It is also possible to specify which columns you want to journal. You can do this by adding
the tag <JN>Journal</JN> in the notes of the column. If you do not specify any tag it is
assumed that you want journaling for all columns.
The ‘Maintain journal tables’ utility will create and maintain journal tables based on these
journaling tags. The utility uses the naming convention <table name>_JN when a journal
table is created or when the existence of a journal table is checked.
See the Business Logic Layer Part for information on the ‘Maintain Journaling Business
Rules’ utility.
9 - 6 Implementing the Data Layer Headstart Oracle Designer 6.5 - User Guide
All attributes are also re-sequenced with the given increment.
If spacing must be optimized, the rest of the columns are ordered as follows:
Define Views
All properties of the table columns will be copied to the view columns, except the property
Denormalization Via Foreign Key, which can only get a value if a suitable foreign key is
created for the new view.
The utility will create the join conditions (i.e. where validation condition) based on the
foreign key constraints between the base and lookup tables. This where validation condition
can be extended by using the Repository Object Navigator.
A primary key constraint and/or unique key constraints will be created for the view, if the
base table has a primary key and/or unique keys. You can also add foreign keys to the view
based on the foreign keys of the base and look-up tables.
It is also possible to add an Instead Of trigger to the view, which redirects DML on the view
to the TAPI DML procedures of the base table. This makes the view into a Business VAPI
for CDM RuleFrame. The default values of the last three parameters reflect the appropriate
choices for Business VAPIs. For more information on CDM RuleFrame and Business
VAPIs, see the Business Logic Layer Part.
Be sure you defined aliases for all used tables. Otherwise it is possible that the utility will fail
because of non-unique foreign key names.
Headstart Oracle Designer 6.5 - User Guide Implementing the Data Layer 9 - 7
Data Security
Headstart provides two utilities to assist in building a Role based security scheme.
Create role obj. privs based on module access and data usages
This utility creates role object privileges based on the module component table usages of the
modules to which the role has access. The utility will label the created object privileges. If
an object privilege created by the utility is no longer applicable the object privilege will be
deleted. If however the object privilege was manually created or the label is modified it will
not be deleted. In these cases a message will be included in the log messages.
If an index already exists for a given foreign key constraint, the name of the index is
corrected if it does not meet the CDM naming conventions, and the columns in the index are
updated to match those of the foreign key.
If an index exists which does not reference a foreign key constraint, but which has the correct
columns, the reference is created.
If you do not want the utility to create an index for a given foreign key, specify 'NO FK
INDEX' in the Notes of that foreign key.
If an index is identical to another index, the utility is unable to determine which index to
delete. Therefore, neither index is deleted. Instead, a warning is given in the log messages
and you will have to delete one of the indexes yourself.
Indexes which reference no columns are also deleted. If the index of a foreign key is deleted,
the following text is added to the Notes of this foreign key: 'NO FK INDEX, Index of this
foreign key is deleted by Headstart Utility Delete Redundant Indexes because other index
exists which started with the same columns.'
9 - 8 Implementing the Data Layer Headstart Oracle Designer 6.5 - User Guide
Assign objects to tablespace
This utility assigns objects to tablespaces. You must choose a database, a tablespace, a user
and tables. The utility will create table implementations for every combination of the
database, users and tables you have chosen. With parameters you can choose which objects
of the chosen tables you want to assign to the tablespace. Indexes, primary and unique keys
are assigned to a tablespace through User Object Index Storages. These will be created and
the tablespace will be assigned to it.
The following Headstart Quality checks are available for the Data Layer.
Elements
• Domains
• Entities
• Table Definitions
• View Definitions
• Sequences
• Oracle Databases
• Non-Oracle Databases
Deliverables
• DB.010 - Logical Database Design
• DB.020 - Index Design
• DB.030 - Database Object Authorization Scheme
• DB.040 - Physical Database Design
• DB.050 - Product Database DDL
• RD.040 - Initial Business Data Model
• RD.041 - High Level Business Data Model
• RD.060 - Business Data Model
• RD.080 - System Data Model
Headstart Oracle Designer 6.5 - User Guide Implementing the Data Layer 9 - 9
PART IV BUSINESS LOGIC
LAYER
(blank page)
CHAPTER
10 CDM RuleFrame
This Part provides information on the use of the CDM RuleFrame, the Business Logic Layer
component of Headstart Oracle Designer.
The Business Rule Roadmap in this chapter presents an overview of the tasks involved in
implementing a business logic layer. If you want to get full understanding of the CDM
RuleFrame concepts we recommend that you read the following documents:
• CDM Standards and Guidelines Library, volume 1, chapter: Business Rule Modeling
• CDM Standards and Guidelines Library, volume 2, chapter: CDM RuleFrame
• CDM Standards and Guidelines Library, volume 2, chapter: Implementing the Rule
Layer
• Oracle Designer online help concerning the Table API (TAPI)
• Business Rule Roadmap A roadmap that gives you a step by step explanation on how
to analyze, design and generate business rules. You can use this roadmap as a cheat
sheet.
• Implementing the Rule Layer Explains every step mentioned in the business rule
roadmap in detail. This chapter will help you to implement business rules fast and
easy.
• Accessing the Rule Layer This chapter discusses the Headstart support for the creation
of a common access layer, the View API. It also discusses Headstart support for
several front ends (Forms, PL/SQL, WebDB, WebServer Generator, Java) for opening
and closing transactions and error handling .
You only do step 1 and 5 once. Step 2, 3 and 4 you do for all business rules.
1. Create process events using the utility Maintain Default Events for Entities
This Headstart utility creates all possible process events for all entities in your application.
Running this utility makes it easy to associate your business rules with events.
Attention: Before you run this utility there have to be entities, relationships and
attributes. If you add or remove some later you can run the utility again.
2. Record your business rules using the Business Rule Function object
Record your business rules using the Business Rule Function object in Oracle Designer as
described in the CDM Standards and Guidelines Library. Apply the naming convention as
described in standard OMS-60005, otherwise the Business Rule Design Transformer won’t
recognize them.
Suggestion: Attribute and Tuple rules do not need events, because later on the
Business Rule Design Transformer derives these from the business rules data
usage. This is also valid for Entity and Inter Entity rules where the usage and
the triggering event is the same. By the same we mean that a retrieve usage of
an attribute is translated to a create entity event and an update attribute event.
You only do step 1 and 2 once, step 4, 5 and 6 for all business rules and step 3 only for
business rules that cannot be supported on analysis level.
Attention: Run the Database Design Transformer before you run the Business
Rule Design Transformer. The Business Rule Design Transformer does not
create rules that relate to entities that have not yet been mapped to tables. It also
skips events and usages for attributes/relationships that do not have a
corresponding column or foreign key.
These utilities either prepare the enforcement of certain rule patterns in CDM RuleFrame, or
they create business rule design definitions that also include the code for the specified rule
patterns (so you don’t have to write any validation code yourself for these patterns).
If you did not specify your rules at analysis level you can use this utility to create the business
rule design definitions.
If operations on multiple rows can lead to the same violation of a business rule, you want to
make sure that the business rule is only validated once, and only one error message is shown
to the user. You can do this by using a special procedure (not_on_stack_yet) in the When
Condition.
• Insert, Update and Delete service of the Table API. Always use these services if you
want to code a DML Statement.
• Exists Row, determines the existence of a given row in a given table, using a
structured set of query conditions.
• Aggregate Value, gets COUNT, SUM, MIN, MAX or AVG of a column in a table
using a structured set of query conditions.
• Get Char, Date, Number Value, gets the value of any column in any row of the table.
• Display Label, displays descriptor columns for the indicated row, which can be used
for end user messages.
• You can also add your own custom services to the Custom API.
Suggestion: The CAPI utility uses the descriptor columns of the table to
determine the display label of a row. Before running this utility, check that your
descriptor columns are defined correctly. You can also use the utility ‘Set
unique key constraint components as descriptor columns’.
This chapter explains the necessary steps to use CDM RuleFrame in your application. It
consists of the following Sections (corresponding to the Roadmap in the previous chapter):
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 1
Business Rule Analysis
The CDM RuleFrame utilities include a Business Rule Design Transformer. This utility takes
Business Rule Functions, and transforms them into Business Rule Design Definitions.
The Business Rule Design Transformer assumes that the Business Rules have been recorded
in Oracle Designer according to the CDM Standards and Guidelines version 6 (CDM
Advantage 2.0). See the CDM Standards and Guidelines Library, Volume 1: Requirements
Analysis, Chapter ‘Business Rule Modeling’ for more information on how to model business
rules. See the Headstart Demo Application for examples of how to record Business Rule
analysis information.
To get the most out of the Business Rule Design Transformer, the Business Rule Functions
should be recorded as follows:
Run the Headstart Utility ‘Maintain default events for entities’ that creates all possible
process events for all entities, attributes and relationships. You can run it once for all entities.
If you add or remove entities, attributes or relationships you can run the utility again. The
utility will create process events with the following property values:
11 - 2 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
• If the event is triggered by a change in a relationship, then the relationship name and
other end entity is given in the description using the following convention:
<RL>[relationship name]->[other end entity name]</RL>
Attention: The same process event cannot trigger both a change in a and a
change in an attribute, they each need a separate event.
2. Record your business rules using the Business Rule Function object
Record your business rules in Oracle Designer as described in the CDM Standards and
Guidelines Library. Use native properties for structured recording wherever possible, and use
the Business Function object for the others. Apply the naming convention as described in
standard OMS-60005, otherwise the Business Rule Design Transformer will not recognize
the rule.
CDM recommends that, if no structured element exists for recording a business rule, you
should record the business rule using the Business Function object. This means that the
Oracle Designer repository will now contain two kinds of business functions:
• presentation/batch functions
• business rule functions
Create a separate hierarchy for each of these two types of function. Organize the business
rule function hierarchy per entity. Use common functions to record Inter-Entity rules under
both entities. Place Change Event rules under the entity that triggers the rule, not the entity
that is insert, updated or deleted.
What to Record
The following items discuss properties of the Function definition that you should use when
recording business rule functions.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 3
• Label - In order for the Business Rule Transformer to work correctly, business rule
functions must be named according to the following convention.
where…
11 - 4 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
• Short Definition - This will be used as the default error message text for this business
rule.
• Description - This property is optional and can be used to record thoughts about
implementation of this rule.
• constraint rules
• static
• dynamic
• change event rules
• with data manipulation
• without data manipulation
• authorization rules
Constraint rules define restrictions to the state of data (static) or the change of the data
(dynamic)
Change event rules define automatic actions to be taken after the state of the data has
changed. The automatic action can either be another change in data (insert, update, delete) or
an action outside the database such as sending an e-mail or printing a report.
Authorization rules define which business unit, person or group of people is able to perform
a function or manipulate (a set of) data.
Strangely enough, making the distinction between static constraints and change events is not
always straight forward. This is because some rules can be implemented as both static
constraints and change events. In other words, for the same rule, you can either display an
error when the data is invalid (static constraint) or you can automatically correct invalid data
(change event). You should always discuss with the users how they want such a rule
implemented.
• A dynamic constraint must be true at the moment of the data operation (insert, update,
delete), but does not have to be true later.
• Static constraints must always be true. You can check a static constraint when
creating or modify data, but you can also check it a week later and it must still be true.
Dynamic Rule Example: ‘If a project is complete, you may not create a new project
assignment.’ This only has to be true at the moment the insert is done on the project
assignment table. A week or a year later, the project assignment still exists, even though the
project may have long since completed.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 5
Static Rule Example: ‘A project assignment date range must fall within the project date
range.’ You also want to check this rule while inserting a new project assignment, but it must
still be true a week or a year later.
Generally, if you must use any of the following items in order to write your business rule, the
rule is Dynamic.
• format
• maximum length
• decimal places
• required
• uppercase
Examples
Department code must be numeric.
11 - 6 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Each employee must have a name.
Recording
Use the format, maximum length, decimal places, and optional? properties of the attribute.
Unfortunately, the database design transformer does not use the derivation field. This means
that after you have transformed the entities to tables, you must manually set the uppercase
indicator for each column that maps to an uppercase attribute.
Domain Rules
A domain rule defines attribute allowable values for an attribute. It either enumerates all
allowable values (enumerated domain), or restricts the allowable values by specifying ranges
of lowest and highest value allowed (range domain).
Examples
Employee job must be ‘CLERK’, ‘SALES REP’, or ‘MANAGER’. (enumerated)
Recording
Record these rules using the domain object in Oracle Designer. Associate the domain with
one or more attributes.
Other Attribute Rules (ATT)
These include all other allowable value rules for an attribute. In some cases the attribute
value depends on the value of a constant.
Examples
Employee salary must be multiple of 1000.
Recording
Use the Business Rule Function to record this rule.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 7
Tuple Rules (TPL)
Tuple rules define allowable values for attributes which depend on the value of other
attribute(s) within the same entity occurrence (tuple).
Examples
Employee exit date must be later than employee hire date.
Recording
Use the Business Rule Function object to record an entity rule.
Entity Rules
Entity rules define allowable values for attributes and combination of attributes which depend
on the values of attributes of other occurrences of the same entity.
Unique Identifier Rules
An entity unique identifier rule defines which (combination of) attribute(s) and relationship(s)
can be used to identify an occurrence of the entity.
Examples
Each employee is uniquely identified by an employee number.
Recording
The Oracle Designer repository provides a separate element for structured recording of
unique identifier entries. An entity can have multiple unique identifiers, each consisting of
one or more unique identifier entries: an attribute or relationship.
Other Entity Rules (ENT)
Other entity rules consist of all allowable value rules which you can define within an entity.
Examples
No more than 20 departments are allowed.
Recording
Use the Business Rule Function object to record an entity rule.
Attention: When using self referencing entities be aware that if you use
the relationship in your rule this will result in an inter entity rule not an
entity rule.
Inter-Entity Rules
Inter-entity rules define attribute allowable values which depend on the values of attributes in
one or more occurrences of another entity. They also define the relationships between
entities, and their conditions.
Relationship Rules
11 - 8 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
An entity relationship rule defines how an entity relates to another entity. Three main types of
relationships are recognized:
• one-to-one relationship (1:1, drawn as ------------)
• one-to-many relationship (1:m, drawn as ----------<)
• many-to-many relationship (m:n, drawn as >-----------<)
Each relationship end can be set to optional or mandatory.
Examples
Each employee can work for one and only one department. (optional)
Each employee must work for one and only one department. (mandatory)
Recording
The Oracle Designer repository provides the Entity Relationship Diagrammer with graphical
creation and representation of entity relationship rules. You can also use the Repository
Object Navigator (RON), to create a relationship between two entities.
Restricted Relationship Rules (RER)
A restricted relationship rule restricts the set of entity occurrences to which an entity
relationship can refer.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 9
Example
An employee can only be managed by an employee with job ‘MANAGER’.
Recording
Use the Business Rule Function to record this type of rule.
Other Inter-Entity Rules (IER)
Other inter-entity rules consist of all other static rules that exist between entities.
Examples
The project assignment dates (start and end date) of a project should lie between the project
dates (start and end date).
The project assignment dates (start and end date) of a project should lie between the project
dates (start and end date).
Recording
Use the Business Rule Function to record this type of rule.
Example
You may not create a project assignment for a project that is already finished (end date in the
past).
11 - 10 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Recording
Use the Business Rule Function to record this type of rule.
Update Rules
An update rule defines conditions for the update of an attribute, entity, or relationship.
Attribute Transition Rules (ATS)
Transition rules define attribute allowable values that depend only on the previous value of
the same attribute.
Example
Allowed transitions for civil state of employee
Recording
Use the Business Rule Function to record this type of rule.
Transferable Relationship Rule
For every relationship the transferability must be. In other words whether it is allowed to
transfer a child to another parent.
Example
You may not transfer on order item from one order to another.
Recording
Use the transferable property of a relationship to record the transferability rule.
Other Update Rules (UPD)
Other update rules consist of all other update rules that can exist.
Example
You may not update the standard rate of an employee if the exit date is in the past.
Recording
Use the Business Rule Function to record this type of rule.
Modify rules are a combination of a create, update or delete rule. This combination makes it
possible to specify one rule that is valid for creating, updating and or deleting.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 11
Example
You may not create or update a Project Assignment if the related Project is already finished
(end date in the past)
Recording
Use the Business Rule Function to record this type of rule.
Delete Rules
Example
Suppose you have a rule which states that an employee must be assigned to a department
(mandatory relationship rule). You have to decide what will happen to the employees if you
delete a department. Possible options are as follows:
In most cases you will use the restricted relationship delete rule because cascade is rather
rigorous. Nullifying is almost never used because it cannot be implemented for mandatory
relationships.
Recording
For the relationship delete rule the default is restricted and nothing needs to be recorded.
If a cascade delete is desired write the word CASCADE in the relationship notes to indicate
the cascade implementation of this rule. Unfortunately, the database design transformer does
not transform the CASCADE word in the notes. This means that you have to indicate this
yourself at design level.
Other Delete Rules (DEL)
Other delete rules consist of all other allowable delete rules.
Examples
You may not delete a file when the end date of that file is not in the past.
You may not delete customer when the related projects are not finished (end date in past). (in
addition to a cascade delete rule.
Recording
Use the Business Rule Function to record this type of rule.
11 - 12 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Change Event Rules with DML
Sub-class Rule Recording
A default rule defines the value of an attribute that will be automatically populated when an
occurrence of an entity is created and no value is given.
There is a distinction between a simple and complex default rule. A complex default rule
means that the default value for an attribute has to be derived from other data and/or has to be
derived through calculation.
Examples
When inserting a Customer the default value of the ‘total project limit’ should be set to
‘100000’. (simple)
When inserting a new Employee the default value for the department is the department of his
manager.(complex)
Recording
Record the simple default rule in the default property of the attribute. Record the complex
default rule as a function.
Change event rules can have different levels. At first you will look at real business events.
Later on at system requirements level you will look to more detail system events; for instance
default change event rules or a change event rule that implements a tuple rule.
Examples
When the exit date of an employee is set, create an occurrence in the entity work order (not
shown in the diagram) of the type ‘revoke computer access’, so the IS department will make
sure the employee has no access anymore to the company’s computer systems after the exit
date.
When the salary of an Employee is changed, create an occurrence in the Audit Employee
entity.
Recording
Use the Business Rule Function to record this type of rule.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 13
Change Event Rules without DML (CEW)
A change event rule without DML defines an automated action not involving data
manipulation, that takes place after a data state change. Examples of this type of rule are
sending an e-mail and printing a report.
Example
When the end date of a Project Assignment is changed, the manager of this employee should
be informed with an e-mail.
Recording
Use the Business Rule Function to record this type of rule.
These rules define all of the functions that are accessible for a business unit / agent.
Example
Only employees that are managers have access to the function ‘Change Salary’.
Recording
You can record business units in the Process Modeler or the Repository Object Navigator
(RON) of Oracle Designer. The relationship between the business unit and the functions it
performs can be recorded in the Matrix Diagrammer or the RON.
These rules define all the entities and attributes that are accessible for a business unit / agent.
11 - 14 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Example
Only the project manager has access to the entity ‘Project’.
Recording
Use the Matrix Diagrammer to populate the Business Unit Entity/ Attribute matrix. In
general, you only need to record this rule if the application is to be implemented in a
distributed environment, to get insight into the distribution requirements.
These rules define the conditions that an entity occurrence must meet in order to be accessible
for a business unit / agent.
Examples
A manager can only update the salary of his own employees.
A manager can only update project information of projects that fall under the department he
manages.
Recording
This type of authorization rule can only be implemented if the entity relationship model
allows you to describe the rule. In the last example above, you have to include a relationship
between the project and the department and need a username in the employee entity to be able
to match the current user with the username of the manager of that specific department.
Horizontal data access rules can be implemented as Dynamic Data Constraint rules, so use the
Business Rule Function to record this type of rule.
For all rules record the process events that trigger your business rule. Use the 'Triggered By'
association of the business rule and link it to the appropriate events created in step 1.
Suggestion: Attribute and Tuple rules do not need events because later on the
Business Rule Design Transformer can derive these from the business rules
data usage. This is also valid for those Entity and Inter Entity rules where the
usage and the triggering event is the same. By the same we mean that a retrieve
usage of an attribute is translated to a create entity event and an update attribute
event.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 15
4. Record Business Rule - Data Usage
Record the data usage of all rules. For validation rules this is always 'retrieve', only for
Change Event rules the usage can also be 'create', 'update' or 'delete'.
Suggestion: If the validation of the Business Rule requires the value of the same
Attributes and/or Relationships specified in the triggered by Events, then you can let
the Business Rule Design Transformer create the usages for you by setting the
parameter 'Create Attr/Relationship Usages' to Yes. This is often the situation for
Static Business Rules. In other words you can choose either not to record the events or
not to record the usages for static business rules.
• If the validation of the Business Rule requires the value of an Attribute as input
parameter, then this Attribute must be registered as a Usage for the Business Rule
Function. The Retrieve? property of this Usage must be set to Yes, both at Entity and
at Attribute level.
• If the validation of the Business Rule requires the value of a Relationship as input
parameter, then this Relationship must be registered by
• Including the ‘From’ Entity as usage for the Business Rule Function
• Setting the Retrieve? property of this Entity usage to Yes
• Entering the Relationship in the Comment property of the Entity usage. Use the
following convention:
<RL>[relationship name]->[other end entity name]</RL>
Don’t put any spaces in between the tags, except the spaces that are part of the
relationship name or entity name. It is possible to record multiple relationship
usages for one entity, just by repeating the tags.
11 - 16 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Example: To validate the business rule BR_PAS001_ENT, we need to know which
employee is assigned, and for which project the assignment is.
After you have specified all your business rules, clean up all redundant events by running the
'Cleanup unused events for entities' Headstart utility.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 17
Business Rule Design
During the business rule design you create Business Rule Design Definitions that form the
basis for the generation of the business rules. A business rule design definition consists of:
• a Table Trigger
• a PL/SQL Definition of type Trigger Logic
There are five utilities that can be used to create Business Rule Design Definitions:
All the above utilities will also create a message in the Headstart Message tables if the
Business Rule did not have a message yet.
You can modify a Business Rule Design Definition directly in Oracle Designer. See steps 4
and 5 in this chapter.
Attention: Note that if a Business Rule is triggered by events in more than one
table, you need one Business Rule Design Definition per triggering table. The
Business Rule Design Definitions are used as input for the utility Create CAPI
Definition.
Run the Headstart Utility 'Business Rule Design Transformer'. This utility creates Business
Rule Design Definitions. Remember that for each triggering entity a rule design definition is
made. That means that one rule can lead to more than one rule design definition. The
transformer links the PL/SQL Definition to the business rule function.
11 - 18 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Attention: Run the Database Design Transformer before you run the Business
Rule Design Transformer. The Business Rule Design Transformer does not
create rules that relate to entities that have not yet been mapped to tables. It also
skips events and usages for attributes/relationships that do not have a
corresponding column or foreign key.
These utilities either prepare the enforcement of certain rule patterns in CDM RuleFrame, or
they create business rule design definitions that also include the code for the specified rule
patterns (so you don’t have to write any validation code yourself for these patterns).
The Business Rule Design Transformer cannot handle rules that include self referencing
entities, because it is not allowed to record the usage of the same entity twice. You can use
the Headstart Utility 'Create Business Rule Design Definition' to add the rule design
definition that is missing.
If you did not specify your rules at analysis level you can use this utility to create the business
rule design definitions.
In this step you check if all triggering conditions are correct. An example of the Database
Trigger part of a Business Rule Design Transformer is shown below.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 19
Note that the Trigger When Condition refers to :new.job, which is not recommended unless
you repeat the condition in the validation code (see the Section Trigger When Condition for
details).
Complete?
The Complete? property is set to No, to ensure that the trigger will not be generated to the
database as a table trigger. It is not a real database trigger, but it is part of a Business Rule
Design Definition that must be included in the CAPI package.
Enabled?
Enabled? is set to Yes. Set it to No if you do not want to include the business rule in the
CAPI (because it is currently not valid).
11 - 20 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Trigger When Condition
Use the When condition to further detail the events that trigger the rule. The When condition
must be a boolean expression in which you can use the following constructs:
• :new.<column name> and :old.<column name> for any column in the table that the
Database Trigger belongs to
• inserting, updating and deleting (boolean values)
• user and sysdate
Attention: In this expression, you should not access any table data except by
the :new.[column name] or :old.[column name] construction, nor should any
procedures/functions be called that access table data.
Warning: If you use :new.[column name] in the When Condition, repeat the
condition in the Rule Validation code. You can only omit that if you are certain
that the new value can not change anymore in the same transaction. Otherwise
you might get an error message even though the Change Event corrected the
situation. It is safer to use just the :old.[column name] construction.
Attention: If you used the Business Rule Design Transformer for rules that are
triggered by a subtype entity, the corresponding Business Rule Design
Definition will have a when condition to check if the row is of the right
subtype. This assumes that the discriminator column is not updateable. If your
discriminator column is updateable (change of subtype is allowed), then you
will probably have to add the discriminator column as triggering column and
change the when condition at the design level.
Some business rules need to be performed only once, even though they were triggered by
more than one row. By calling the Not_On_Stack_Yet service from the Trigger When
Condition, you can make this happen.
Suppose that 5 new employees are added to the same department, during the same
transaction. This would mean that for each employee, the above business rule must be
validated. For this type of rule, however, it would have been sufficient to perform the rule
only once in this transaction.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 21
Performing the rule for each employee is not only bad for performance, but when violated, it
will also have the consequence that the message handler shows 5 messages at the end of the
transaction, all saying approximately the same thing!
The above problem only applies to certain types of business rules. Most of the time the
validation of such a rule includes an 'aggregate' or group function like count or sum (for
instance they use the CAPI Service called Aggregate_Value).
To avoid multiple checks where only one is needed, you must specify to CDM RuleFrame
that the 5 occurrences of the business rule are really the same, even though they were
triggered by different rows. You must specify which values should be part of the ‘unique key’
for the business rule.
You can do this in the When Condition of the Business Rule, by calling
qms_transaction_mgt.not_on_stack_yet. The signature of this function is:
function not_on_stack_yet
( p_br_name in varchar2
, p_uk_comp1 in varchar2 default null
, p_uk_comp2 in varchar2 default null
, p_uk_comp3 in varchar2 default null
, p_uk_comp4 in varchar2 default null
, p_uk_comp5 in varchar2 default null
)
return boolean;
This means that the Business Rule that has this When Condition, is only enforced (checked) if
the new salary is higher than the old and if there is not a rule with name ‘BR_DEP001_IER’
on the Transaction Management Stack yet, which has as its first UK component the same
Department Id. So, this rule is enforced only once, even if there were 5 rows triggering this
rule but all 5 had the same Department Id.
Note that the Department Id was used as a unique key component, but had to be converted to
character because the function parameters are of datatype varchar2.
Warning: You should not use the service Not_On_Stack_Yet if the validation
code of the business rule relies on old values of the triggering row, unless the
value is the same for all rows that have the same UK components. The reason is
that the rule could also be validated for another row that has the same UK
components, and it should then have the same result.
11 - 22 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Suggestion: If you have an Aggregate Rule that can be triggered from more than
one CAPI, you need more than one Business Rule Design Definition, each with
its own name. You can still ensure that they are treated as one ‘logical’ business
rule, by adding multiple calls to not_on_stack_yet in your when condition:
qms_transaction_mgt.not_on_stack_yet
( 'BR_DEP001A_IER'
, to_char(:new.dep_id)
)
and
qms_transaction_mgt.not_on_stack_yet
( 'BR_DEP001B_IER'
, to_char(:new.dep_id)
)
Notes
The Notes property contains the type of the business rule and the message code, both
enclosed between HTML-like tags <TY>…</TY> and <MG>…</MG>, respectively. If it is
a subtype, static domain or journaling business rule, it will also contain a tag further
identifying the kind of rule. Don’t remove these tags because that’s how the Headstart
Utilities recognize the Business Rules.
Rule Type Record the type of the business rule in the Notes between the tags <TY> and </TY>.
The allowable values for the rule type are (case insensitive):
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 23
• Static Data Constraint
• Dynamic Data Constraint
• Change Event with DML
• Change Event without DML
Reference: For explanation of these types, see the CDM Standards &
Guidelines Library, volume 1, chapter Business Rule Modeling.
Message Code Record the violation message code in the Notes between the tags <MG> and </MG>.
The message code must correspond to a message in the Headstart Message tables
(available through the Headstart Foundation Application). The message will be
raised when the Business Rule is violated.
Suggestion: Some business rules should only give a warning when they are
violated, instead of an error. If that is the case, you can go to the Headstart
Foundation Application and set the severity of the relevant message to
Warning. The default severity is Error.
Attention: The message text should contain at least one parameter <p1>, which
will be replaced with the display label of the row that violated the rule. If this is
omitted, it will be difficult to tell which row generated the error message when
all errors of the transaction are shown.
Attention: For Change Event business rules (both with DML and without
DML), the message code is never used because all errors are handled normally
either through the CAPI or as server side errors. However, the message code
must still exist in order for the utilities to work properly. For this purpose you
can use the ‘dummy’ message code ‘QMS-00151’.
PL/SQL Block
The PL/SQL Block contains a comment block with sections Purpose, Remarks and Revision
History. You can change the Purpose and the Remarks. You can also add new Revision
History Records (on top), in the same structure that was used by the utility. Don’t change the
heading or layout of the Revision History, and don’t change the end-of-comment marker
(*******/).
Enter code that sets l_rule_ok to false when the Business Rule is violated. New column
values of the triggering row can be referred to as p_[column name] (if specified in the
Arguments of the PL/SQL Definition). Old column values of the triggering row can be
referred to as p_old_[column name] (if specified in the Arguments of the PL/SQL
Definition).
In the PL/SQL Block program code you can use the Standard CAPI Services (see section
Using Standard CAPI Services below) and any Custom CAPI Services you defined.
11 - 24 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Attention: If you want to do DML within the code, don’t use direct insert,
update or delete statements but use the TAPI DML procedures (ins, upd, del)
instead. This way you don’t run the risk of bypassing the Business Rules that
apply.
Exists_Row
Use Exists_Row in the validation code of your business rules when violation of the rule
depends on the existence of a given row in a given table. You pass in the query criteria via
the named input parameters.
You can also check for a row in the same table, with a Primary Key different from the current
row.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 25
( p_not_id => p_id
, p_emp_id => p_emp_id
);
This service allows you to easily check if a row exists which meets the requested query
criteria. The service will have one named parameter for each column that…
• is in a Primary, Unique or Foreign Key
• is a discriminator column for subtypes
• has an enumerated domain.
Each time the CAPI utility is run, the columns that satisfy one of the above criteria will get
the tag <EXISTS_ROW> in their Notes.
The service will have one ‘not’ parameter for each column in the Primary Key.
You can add additional parameters by putting the literal text <EXISTS_ROW> in the Notes
property of the column.
Exists_Row - Dynamic
If you have a specific condition for the exists_row service, which can not be specified
through the provided parameters (not even by adding new column parameters), you can also
use the dynamic version of exists_row.
This overloaded function has a parameter called p_where which expects a free text where
clause, and one or more parameters p_not_[PK column name] to exclude a certain row.
You can specify anything you like in this where clause, if you adhere to the following rules:
11 - 26 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Example -- there must be no other row with a later end date
l_rule_ok := not hsd_ord_capi.exists_row
( p_where => 'end_date > to_date('''
|| to_char
( p_end_date
, 'DDMMYYYY'
)
|| ''' ,''DDMMYYYY'')'
, p_not_id => p_ord_id
);
Aggregate_Value
Use Aggregate_Value to get the COUNT, SUM, MIN, MAX or AVG (average) of a column
of a table.
Except for COUNT, the specified column must be a NUMBER column. If you use COUNT,
it will count the column you specify. So if you want to count the total number of records,
pass in a mandatory column. You pass in the query criteria via the named input parameters.
This service allows you to easily determine the count, sum etc. of all rows which meet the
query criteria. The service will have one named parameter for each column that…
• is in a Primary, Unique or Foreign Key
• is a discriminator column for subtypes
• has an enumerated domain.
Each time the CAPI utility is run, the columns that satisfy one of the above criteria will get
the tag <AGGREGATE_VALUE> in their Notes.
The service will have one ‘not’ parameter for each column in the Primary Key.
You can add additional parameters by putting the literal text <AGGREGATE_VALUE> in
the Notes property of the column.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 27
Get_Char_Value / Get_Num_Value / Get_Date_Value
These services can be used to get the most recent value of any column in any row of the table,
given the Primary Key value(s) of the desired row. It will use cached rows of the CAPI as
much as possible.
Use get_char_value to get the value of a character column, get_num_value for number
columns and get_date_value for date columns.
Display_Label
Use Display_Label when you want to give a message to the end user and want to refer to a
certain row of the table.
Example qms$errors.show_message
( p_mesg => 'HSD-00328'
, p_param0 => hsd_emp_capi.display_label(p_id => l_emp_id)
, p_rftf => false
);
Attention: Note that p_rftf (raise form trigger failure) is false. If the message
is an Error, and the call to show_message was made during an open transaction,
the message will be postponed until the transaction is closed and will be shown
with all the other errors and warnings of the transaction.
If you want to see the message immediately, set p_rftf to true.
The Display_Label service will use the descriptor columns of the table to create a meaningful
display label to identify a row to the end user. This service is always used for parameter <p1>
of the Business Rule violation messages.
You can include columns by giving a value to the Descriptor Sequence property. If no
descriptor columns are found, it uses the Primary Key and Unique Key columns.
Trace
Use Trace for debug messages, which you can view through the Headstart Debug Monitor.
Trace is identical to qms$errors.show_debug_info, except that it prefixes your message with
the schema name and the CAPI package name.
11 - 28 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Reference: For more information about activating the debug mode and using
the Headstart Debug Monitor, see chapter ‘Troubleshooting’ in Part V
‘Presentation Layer’.
• reuse of code, you may want to create a custom service that is used by more than one
business rule or even used by the front end.
• encapsulation, rather than adding code in component A that retrieves information of
another component B you want to add that code as a service in component B and
request that service from component A. This makes your code more resilient to
change.
• information hiding, hides the complexity of a component by communicating through
services on a need to know bases.
The Headstart Utility 'Create Custom CAPI Service Definition' allows you to create a design-
level definition of a Custom CAPI Service in Oracle Designer. This is used as input for the
utility Create CAPI Definition.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 29
You can modify the Custom CAPI Service Definition directly in Oracle Designer. How to do
this is described in this section. The Custom Service is stored in a PL/SQL Function or
Procedure Definition.
Type
Set the Type property to either Procedure or Function.
Return Type
If it is a Function, also specify the Return Type property.
Scope
If the Custom Service must also be available for Business Rules of other tables, set the Scope
property to Public. If the Scope is Private, it will only be available inside its own CAPI
package.
Suggestion: If your Custom Service has only the WNDS restriction, you can
still use the standard exception handler with qms$errors.unhandled_exception,
because that procedure also has the WNDS restriction.
PL/SQL Block
The PL/SQL Block contains a comment block with sections Purpose, Remarks and Revision
History. You can change the Purpose and the Remarks. You can also add new Revision
History Records (on top), in the same structure that was used by the utility. Don’t change the
heading or layout of the Revision History, and don’t change the end-of-comment marker
(*******/).
Arguments
Add or modify the Arguments of the PL/SQL Definition and use them in your program code
of the CAPI Custom Service. The arguments can have any name and can be defined through
either a Datatype, a Domain, a Column, or a Table. When it is defined through a Datatype,
you can add a Default Value. Use the Input Output property to specify whether it’s an input
parameter, an output parameter, or both.
11 - 30 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Program Data
The link to the table in whose CAPI the custom service will be included, is registered through
a dummy Program Datum called ‘CAPI Custom Service’. Note that these Program Data can
only be modified in the Repository Object
Navigator (RON).
Another example shows how a Custom Service can be used for information hiding and reuse
of code.
In this case you can create a Custom Service called CS_ORD_IS_PROBLEM, that receives
as input an order id and returns true if that order is a ‘problem order’. This service can then be
used both by the form, to color the order red, and by the business rule validation code, to
determine if a customer can place a new order. They don’t need to know when an order is
defined as a ‘problem order’, and when the definition of problem order changes, you only
need to modify the custom service.
For Inter-Entity Rules, it is sometimes best to put the actual validation code in a different
CAPI than the one where the business rule is added. In these cases you can use a Custom
CAPI Service.
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 31
Example The sum of the salaries in each department may not exceed 1
million.
This rule is about departments, so according to the principle of encapsulation, the logical
place to put the validation code is in the Departments CAPI. But, there is no triggering event
that applies to Departments, only triggers for Employees!
This can be solved by creating a Custom Service in the Departments CAPI, that takes the
department id as input and raises an error message (showing the Department display_label) if
needed.
The program code of this example Custom Service (let’s call it CS_DEP_CHK_TOT_SAL)
would be:
begin
-- if the total salary of this department
-- is larger than 1 million
if hsd_emp_capi.aggregate_value
( p_aggregate_function => 'SUM'
, p_aggregate_column => 'SALARY'
, p_dep_id => p_id
) > 1000000
then
-- give the appropriate error message
qms$errors.show_message
( p_mesg => 'HSD-99999'
, p_param0 => display_label(p_id => p_id)
, p_rftf => false
);
end if;
end;
The HSD-99999 message is for example: ‘The sum of the salaries in department <p1> has
exceeded the limit of 1 million.’ Note that CS_DEP_CHK_TOT_SAL is part of the
Departments CAPI, therefore the call to display_label is to the one in the Departments CAPI.
In the Employees CAPI, the validation code of the business rule always returns true and just
calls the Custom Service in the Department CAPI:
Only in this way can the error message include the Department display label, while it was
triggered from the Employees CAPI. If the error message was raised by the Employees CAPI,
<p1> would always become the Employee display label.
11 - 32 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
6. Check arguments of PL/SQL Definition
If you did not record your rule data usage correctly you will notice that you cannot compile
the Custom API. Always check the arguments for completeness, this can save you a lot of
time further on.
Arguments
You can modify the Arguments of the PL/SQL Definitions and use them in your program
code, as long as the argument names are either p_<column name> or p_old_<column name>.
‘<column_name>’ must be a column in the table to which the business rule belongs, and the
Argument definition must reference that particular column in the Column property.
Warning: Don’t use p_old_ arguments for Static Business Rules. Static rules are
included in Validate_All_Static_BR and during execution of
Validate_All_Static_BR, old column values are not available. If you need an old
value, your rule is Dynamic (or a Change Event).
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 33
Business Rule Generation
You can create (or re-create) the Custom API (CAPI) package definition in Oracle Designer
by running the Headstart utility 'Create CAPI Definition' for one or more tables.
The CAPI works together with the Table API (TAPI) from Oracle Designer and the
Transaction Management package (included with Headstart) to provide complete Business
Rule enforcement on the Server. The name of the CAPI is [application code]_[table
alias]_CAPI.
The utility uses the following Designer data for each table:
• the Table Definition with its Columns, its Primary/Unique/Foreign Keys and its Entity
Usages
• the Business Rule Design Definitions
• the Custom Service Definitions
and uses them to create (or replace) a PL/SQL Definition containing the CAPI Package
Definition.
All business rules in the CAPI are enforced at the transaction level. A transaction must be
explicitly opened and closed (see chapter Accessing the Rule Layer). All DML following the
open transaction will cause rules to be added to the rule stack. No rules are actually checked
until the transaction is closed. When the transaction is closed, all rules are evaluated and if an
error occurs, the error message is written to a message stack. After all rules have been
evaluated, if any errors occurred, an application error is raised.
If you entered Yes for the parameter ‘Do you install TAPI Triggers?’, the utility will create
the code segments described in table 2-1. If you entered No, the utility will create the code
segments described in table 2-2. The Pre- and Post-<event> logic is included in the generated
Table API package. The Before- and After-<event> logic is included in the TAPI triggers.
11 - 34 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Event Code segment
CAPI Structure
The CAPI contains the following public program units:
Public procedures
• post_insert, post_update, post_delete (used by TAPI)
• enforce_rule (used by transaction management)
• enable_br, enable_all_br, disable_br, disable_all_br, validate_all_static_br (possibly
used by batch programs)
• optional: (public) Custom Services defined in Designer
Public functions
• One function for each business rule, returns boolean (possibly used by front end)
• display_label, exists_row, aggregate_value, get_char_value, get_num_value,
get_date_value (possibly used by other CAPIs)
• br_enabled, revision (possibly used by batch programs)
• optional: (public) Custom Services defined in Designer
Headstart Oracle Designer 6.5 - User Guide Implementing the Rule Layer 11 - 35
Reference: For more information on the Standard Services for Business Rules
see section Using Standard CAPI Services.
For more information on the Standard Services for Batch Programs see section
Error! Reference source not found..
Generate the CAPI for all tables using the Server Generator of Oracle Designer. You can
generate the CAPIs at the same time as you generate the other database objects, such as tables
and views.
Warning: If the Design Editor was open while the CAPI utility was running, the
PL/SQL text of the CAPI package will not show the current content. To fix this,
go to the menu item File => Change Application System and choose the same
Application as before.
Generate the TAPI package (and if you wish, also the TAPI triggers) for all tables using the
TAPI Generator utility of Oracle Designer.
Warning: If you generate the Table API from Oracle Designer and set the
Target for Generation to File, Designer includes a call to (re)create the
CG$ERRORS package. This call is included at the top of the shell .sql script,
and will look like this:
PROMPT Creating Table API Error Package CG$ERRORS
@ C:\ORANT\cgens72\sql\cdsaper.PKS
@ C:\ORANT\cgens72\sql\cdsaper.PKB
This code should not be performed, as Headstart uses its own version of
CG$ERRORS.
The easiest way to prevent this problem is copying the files cdsaper.pks and
cdsaper.pkb to a safe place, and replacing them at the original location with
files that only contain the following text:
prompt CG$ERRORS is not recreated.
Since the Table API calls the Custom API and vice versa you will always start out with
invalid packages. By using the recompile script (recompl.sql) of Headstart you can easily
recompile these packages. If you still have invalid packages (check with the invalid.sql script)
you have probably made an error in your business rules coding. Go back to step 5. Code your
rule in the related PL/SQL Definition in Business Rule Design.
11 - 36 Implementing the Rule Layer Headstart Oracle Designer 6.5 - User Guide
CHAPTER
One of the things you have to decide on, is how you access the Rule Layer. You have the
following options:
For more information on the concepts of an access layer and these options, see the CDM
Standards and Guidelines Library volume 2, chapter 6. In short you can say:
• For WebServer Generated applications, the only possibility is to access the Table API
directly; for other applications, it is usually easier to use either VAPIs or TAPI
Triggers.
• Compared to TAPI Triggers, using VAPIs has the advantage that the transaction is not
automatically aborted when a declarative constraint is violated.
• Using Business VAPIs has the advantage that you can achieve true data independence,
which hides the complexity of your data model from the front end (and the front end
developers).
• If you create your forms based on tables in Designer, but run them against VAPIs in
the deployment environment, the implementation is more complex. For more
information, see the section Using VAPIs in generated Forms, later in this chapter.
• If you use database replication, it might be preferable not to use triggers, because they
also fire during snapshot refreshments.
If you choose to use VAPIs, Headstart Utilities will help you create these views. This chapter
describes how you can use these utilities. It also discusses some things you need to be aware
of for every front end.
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 1
Using the VAPI
The View API or VAPI allows your applications to act like they are working on Tables, while
in fact they are working on Views with Instead Of triggers. Those triggers redirect the DML
on the View to the Table API and Custom API. Headstart offers ample support for the
creation of the View API. You can either create
At the end of this section you’ll find some additional information about using VAPIs in
generated Oracle Forms applications.
These views are called <application code>_V_<logical part of table name> and include the
following:
If you want to use Business View API’s that are able to do DML on more than one table, you
must manually adapt the Instead Of Trigger in Oracle Designer. After the open_transaction,
copy the code related to inserting/updating/deleting of the default 1:1 VAPI of both tables,
and then do the close_transaction. It might also be necessary to perform record locking in the
Instead-of trigger.
12 - 2 Access the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Note that the created Instead-Of trigger will only perform DML on the specified base table. If
you need it to do DML on multiple tables, you have to modify the Trigger PL/SQL Definition
in Designer.
Attention: If you create a view on a VAPI, and this view does not have any
instead-of triggers, you will be unable to do DML (insert/update/delete)
through this view (you will get an ORA-01732: data manipulation operation not
legal on this view).
To avoid this, use Business VAPIs as much as possible, they might eliminate
the need for views on top of the VAPIs. If you still need views on top of VAPIs
and you want to do DML on them, you will have to create instead-of triggers
for those views as well.
• If the column properties or constraints of the underlying tables change, you have to
apply the same changes to the VAPI definition manually (or create your own utility to
do that).
• If you base a Form Module on a Table but intend to have a VAPI of that name in the
runtime environment (so the form actually runs against a VAPI), run the utility ‘Adapt
form modules for VAPI use’ before generating the form. This makes sure that the
form does not expect a rowid where it cannot find it. If you choose this
implementation, you will also run into bug #1541443, Unable to set ‘DML Returning
Value’ property on generated block. The result is a runtime error on these forms. The
only solution is a POST GENERATION MODIFICATION to set the ‘DML Returning
Value’ property to No for each block based on a table but run on a view. For more
information on why you might want to choose this option in spite of these problems,
see the section ‘Accessing the Rule Layer’ in the CDM Standards and Guidelines
Library, volume 2, chapter ‘Implementing Business Rules’.
Attention: Make sure that you set the Validate In property of the foreign keys
to Both (or Client). If you don’t enforce the foreign keys in the form, and a
block based on a VAPI includes server derived items, you can get an ORA-
01403 (no data found) in the POST-INSERT trigger, when the form violates a
foreign key (see bug 1574906).
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 3
Runtime Environment
CDM RuleFrame needs to have several Headstart Database Objects installed. If you also use
the Headstart Template Package, this installation can best be done following by performing
the steps described in the chapter ‘Test and Production Environment’. If you don’t use the
Headstart Template Package (you don’t have a Forms front end), you should pick out the
following steps from the chapter ‘Test and Production Environment’:
• Perform the Headstart Deployment Installation (you only need the files that are
installed in [HSD65_HOME]\hst\scripts)
• Perform the Headstart Database Installation
• Check the installation using the list of Headstart Database Objects at the end of the
chapter ‘Test and Production Environment’.
12 - 4 Access the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Opening and Closing a Transaction
Apart from installing the right objects in the database (see previous section) and generating
the Table API and Custom API as explained above, CDM RuleFrame needs one final step to
enforce the Business Rules for all data. Each transaction needs to be opened and closed by
calling the QMS Transaction Management mechanism. This should be done by the front end
(e.g. Forms, Java, HTML, PL/SQL batch).
If the front end does not do so, there is a fallback mechanism within the following layers:
1. If you are using the View API access layer (see section Using the VAPI), the VAPI
will open and close the transaction.
This means that a transaction consists of only one VAPI row manipulation (insert,
update or delete). For Business View API’s, one view row manipulation can involve
multiple table row manipulations.
2. If you are not using the VAPI but are using TAPI triggers, they will open and close
the transaction (but remember to move the After-stmt code to the end of the trigger,
see step 3. Generate Table API using Table API Generator of Business Rule
Generation). This means that a transaction consists of only one table manipulation
(insert, update or delete statement).
3. If you are neither using the VAPI nor the TAPI triggers, but access the TAPI DML
procedures directly (for instance by using WebServer Generator or the MAPI), the
CAPI will open and close the transaction.
This means that a transaction consists of only one row manipulation (insert, update
or delete).
With all of the above mechanisms, the best you can achieve is statement level rule
enforcement. However one of the important advantages of CDM RuleFrame is transaction
level rule enforcement. Transaction level rule enforcement can only be achieved if the
front end itself opens and closes the transaction, enclosing a full transaction with possibly
multiple statements.
Performing a Rollback
If you want to perform a rollback during a CDM RuleFrame transaction, it is important that
the transaction is also rolled back (that is, the rule stack and message stack should be cleared,
and the CAPI caches should be reset). This can be achieved by calling
• qms_transaction_mgt.abort_transaction;
The CDM Standards & Guidelines recommend enforcing all business rules in the Database
instead of the Front End. Only when user feedback is very important you should also enforce
a rule in the front end.
For attribute and tuple rules, you should first try to enforce the rules using GUI items and
other item properties. If you must code the rule, you can choose between calling the CAPI
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 5
rule function (which implies a network round trip to the Database Server) or copying the rule
code in the application (which implies a network round trip to the Application Server). You
must balance the performance impact of the network round trips against the maintenance
effort of duplicate code.
For entity and inter-entity rules, where you have to make a network round trip to the
database anyway, call the public rule function from the CAPI (which has the same name as
the business rule). This avoids duplication of the code and eases maintenance of the rule.
12 - 6 Access the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Oracle Forms Applications
Forms generated with the Headstart Template Package will automatically open the transaction
in the Pre-Commit trigger. The Post-Forms-Commit trigger in the form will close the
transaction and, if necessary, open a window to display errors and/or warnings. So you do not
have to do anything extra, Headstart does it for you.
This window (‘Errors and Warnings in this Transaction’) is subclassed from the Headstart
object library in each generated form.
Figure 12-1 Oracle Form showing errors and warnings in the transaction
Warning: If a form directly calls a CAPI program unit (for example a public
CAPI Service or a Business Rule validation function), sometimes the wrong
procedure or function is executed or the Form crashes. This can happen if the
CAPI package specification has changed after the Form has been compiled.
Cause: The Form references the internal sequence number of the program unit
within the package, which now refers to a different program unit.
Solution: Recompile the Form (create a new .fmx file).
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 7
Business Rule Enforcement in the Form
Be aware that in this way, you can not include the When Condition of the rule (if there is
one), because you can not code an if-statement around the function call in the check
constraint.
The other thing you need to know, is that the only triggering events will be Insert and Update
of the columns that are passed as parameters to the function call. If the Business Rule has
other triggering events, you can not use a check constraint.
Example:
begin
qms_transaction_mgt.open_transaction
( p_trans_opened_by => '<program unit>');
qms_transaction_mgt.close_transaction
( p_trans_opened_by => '<program unit>');
:system.message_level := 5;
commit;
:system.message_level := 0;
exception
when form_trigger_failure
then raise;
when others
then
qms$errors.unhandled_exception('<program unit>');
go_block('QMS$TRANS_ERRORS');
qms_transaction_mgt.abort_transaction;
end;
12 - 8 Access the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Testing CDM RuleFrame in SQL*Plus
When you are developing business rules, it is often useful to do a quick test in SQL*Plus.
There are a few things you have to be aware of when doing that.
The important line is ORA-20998: Transaction Failed. When you see that, you know that the
real error messages are on the CDM RuleFrame error stack. You can make them visible by
calling the script messages.sql, which is located at <Headstart Home>\hst\scripts.
SQL> @messages.sql
Error HSD-00213: Employee TURNER; An employee with job SALESMAN must have a
value for Commission.
Error HSD-00213: Employee MARTIN; An employee with job SALESMAN must have a
value for Commission.
Error HSD-00213: Employee WARD; An employee with job SALESMAN must have a
value for Commission.
Error HSD-00213: Employee ALLEN; An employee with job SALESMAN must have a
value for Commission.
Note that because the exception was raised by a trigger that fired during the update statement,
the update statement did not succeed and its changes were rolled back. So, if you should
commit now, you don’t commit the update but the situation before the update.
SQL> commit;
Commit complete.
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 9
Then perform your DML statements (you won’t get any errors yet), and when you’re done,
close the transaction using the same description you used when opening it.
If instead of just ‘PL/SQL procedure completed successfully’, you see the ORA-20998:
Transaction Failed, your transaction has errors.
*
ERROR at line 1:
ORA-20998: Transaction Failed
ORA-06512: at "HST65.QMS$ERRORS", line 121
ORA-06512: at "HST65.QMS_TRANSACTION_MGT", line 806
ORA-06512: at line 1
Now, if you should commit even though there were errors, you get the following:
SQL> commit;
commit
*
ERROR at line 1:
ORA-02091: transaction rolled back
ORA-02290: check constraint (HST65.QMS_NEED_TO_CLOSE_TRANSACTION) violated
The close_transaction did not succeed, so the RuleFrame transaction is still open. To avoid
commits while a transaction is still open, a deferred check constraint
(QMS_NEED_TO_CLOSE_TRANSACTION) was created. It is now violated, and the violation of any
deferred constraint automatically causes the database to rollback. If you would not have tried
to commit, the changes would still be present in the database. You could have corrected the
errors and tried to close the transaction again.
12 - 10 Access the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Batch Processing with CDM RuleFrame
You can also use CDM RuleFrame in combination with PL/SQL Batch Programs. This
section explains how.
In a batch program, you must explicitly code the open and close transaction calls as follows:
Use a unique program name that is not used by any other sessions running in parallel. When
closing, use the same program name as when you opened the transaction, otherwise it won’t
be closed.
Closing a transaction neither commits or rolls back the transaction. If an error in a transaction
occurs, the transaction management package raises a generic exception
qms$errors.qms$exception, which causes an 'ORA-20998: Transaction Failed'. The batch
program must include an exception handler to trap for this exception.
If a transaction is closed successfully, the calling program must still commit the data. If a
transaction has errors, the calling program must rollback or correct the data and close the
transaction again.
A procedure cg$errors.get_error_messages has been provided to get the contents of the error
stack. For each error it includes the table name and the rowid of the row that caused the error,
so that the batch program can produce an exceptions report, or even correct the errors itself. If
you want a nice text for the error, you can call cg$errors.get_display_string (p_msg_code,
p_msg_text, p_msg_type(=severity)). If you want to abort the transaction, do so after
retrieving the messages.
Example declare
..
l_message_rectype_tbl hil_message.message_tabtype;
l_message_count number := 0;
l_raise_error boolean := false;
..
l_run_number number := <get unique number>;
begin
qms_transaction_mgt.open_transaction
( p_trans_opened_by => 'Batch ABC, Run '
||to_char(l_run_number)
);
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 11
..
.. (do the DML)
..
-- when closing, program name must be exactly the same
-- as when opening
qms_transaction_mgt.close_transaction
( p_trans_opened_by => 'Batch ABC, Run '
||to_char(l_run_number)
);
commit;
exception
when qms$errors.qms$exception
then
cg$errors.get_error_messages
( l_message_rectype_tbl
, l_message_count
, l_raise_error
);
if l_message_count > 0
then
for i in 1..l_message_count loop
-- now you have access to the error stack:
.. l_message_rectype_tbl(i).msg_code
.. l_message_rectype_tbl(i).msg_text
.. l_message_rectype_tbl(i).severity
.. l_message_rectype_tbl(i).table_name
.. l_message_rectype_tbl(i).table_rowid
..
end loop;
end if; -- l_message_count
-- either correct the changes & close again, or abort
qms_transaction_mgt.abort_transaction;
when others
then
..
end;
• Enable all rules (using procedure enable_all_br) and disable individual rules (using
procedure disable_br)
• Disable all rules (using procedure disable_all_br) and then enable individual rules
(using procedure enable_br)
The function br_enabled can be used to check if a business rule is enabled or disabled.
Attention: The enabling and disabling only applies to the current user session.
In a new session all business rules are again enabled by default.
12 - 12 Access the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Suggestion: If you need to disable all rules but you don’t have the opportunity
to call disable_all_br during the session (for example in a SQL*Loader
session), you can instead (temporarily) modify the package
qms_transaction_mgt for this schema: in procedure add_business_rule,
comment out the code for the Static and Dynamic constraints. You could leave
the code for the Change Events as is, or also comment that out (whatever you
wish).
Don’t forget to recreate the original version of qms_transaction_mgt
afterwards!
• when introducing a new business rule to a system that already includes data
• when the project phasing requires that data are already entered into the system before
all business rules have been implemented
• when accepting data from an outside source before it is entered into the system
• for performance reasons (see section Performance Issues)
The checking of the Static Constraints can be done using the CAPI procedure
Validate_All_Static_BR. This procedure loops through all rows of the table and validates all
static Business Rules. (It immediately calls the validation functions, and does not put the
rules on the Transaction Management stack). You can also supply the primary key values of
a specific row as parameters. In that case only the requested row is validated.
Validate_All_Static_BR places an error message on the message stack for each violation of a
rule by a certain row. You can check if there were rule violations and retrieve the messages
by performing the script <Headstart Home>\hst\scripts\messages.sql.
If you call the procedure from within a transaction (after a call to Open_Transaction has been
made), the errors that are put on the message stack will prevent a successful closing of the
transaction.
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 13
If you call the procedure outside of a transaction (at the beginning of a session or after a call
to Close_Transaction), the errors that are put on the message stack will have no influence on
DML operations. As soon as a new transaction is opened, the message stack is cleared.
Performance Issues
CDM RuleFrame is optimized for DML against individual rows, and for small transactions.
All rule checks are saved until the end of the transaction, and then each rule is checked once
for each row. During interactive processing (e.g. forms), this is appropriate. However,
during large batch transactions and during the validate all process, this is an inefficient way to
check business rules.
There are several ways to improve the performance (listed in order of preference).
The CAPI for Team Members will contain the following rule.
12 - 14 Access the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Event = Insert, Update (team_leader_ind)
Code = l_rule_ok := app_tmr_capi.aggregate_value
( 'COUNT'
, p_aggregate_column => 'ID'
, p_tem_id => p_tem_id
, p_team_leader_ind => 'Y'
) = 1;
When Condition = qms_transaction_mgt.not_on_stack_yet
( p_br_name => <Business Rule Name>
, p_uk_comp1 => to_char(:new.tem_id)
)
In CDM RuleFrame, the validation code will be performed for every team that is touched by
the batch program. If the batch program inserts or updates the team leader indicator of team
members of 100 different teams, this results in 100 dynamic SQL statements. Depending on
the total size of the tables, a more efficient way of checking this rule is possible. You really
only need two select statements to determine if this rule is violated by any rows in the table.
select tem_id
from teams
minus
select tem_id
from team_members
where team_leader_ind = 'Y'
;
select tem_id
from team_members
where team_leader_ind = 'Y'
group by tem_id
having count(*) > 1
;
In CDM RuleFrame, this rule will be performed for every row that is touched by the batch
program. If the batch program inserts or updates the start or end date of 1,000 rows, the
validation code is performed 1,000 times. This comparison between package variables does
not take long, but if you apply it to a lot of rows the cost adds up. Depending on the total size
of the table, it could be done more efficiently with a single SQL statement.
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 15
select id
from table
where start_date > nvl
( end_date
, start_date
);
You can make the set validations even more efficient by restricting the rows you check to
those touched by the batch program. For that, it is necessary that some identification of this
particular batch run is present in the rows. You could add an optional column
BATCH_RUN_ID to every table that is being processed in batch runs, and let the batch
program fill it with a unique run identification each time it performs an insert or update. In
that case you can extend the where clause with
If you decide to use these set validations for certain rules, you must disable those rules before
performing the DML, and call the set validations afterwards. Of course, if the SQL statements
return one or more rows, those are rows that violate the rule and they should be processed in
the same way you would process normal CDM RuleFrame rule violations.
If you want the rule violations to be added to the normal CDM RuleFrame error stack, you
can call
qms_transaction_mgt.process_rule_violation
Parameter Type Mode Default?
--------------- -------- ---- --------
P_BR_NAME VARCHAR2 IN Y
P_MSG_CODE VARCHAR2 IN Y
P_DISPLAY_LABEL VARCHAR2 IN Y
P_TABLE_NAME VARCHAR2 IN Y
P_TABLE_ROWID ROWID IN Y
If you use set validations, the structure of your batch program should be as follows.
1. Disable rules that cannot be violated or that are checked in another way.
2. Open the transaction.
3. Do your DML.
4. Close the transaction, handle the ‘Transaction Failed’ exception.
5. Call the set validations.
6. If there were no errors (ignore messages with severity = ‘W’, they are just
warnings), commit.
7. If there were errors, either correct the changes and repeat from step 4 onwards, or
report the errors and abort the transaction.
For large tables, performing Validate_All_Static_BR on the whole table can take a very long
time. It may be better to call the procedure for one row at a time (using the primary key
values as parameters), and then only for the rows that were touched during the batch program.
12 - 16 Access the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Violations are automatically reported on the CDM RuleFrame error stack. If you want to use
it to prevent faulty DML, call it after closing the transaction but before committing, and
commit only if there are no errors on the message stack.
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 17
WebDB Applications
This section assumes the use of WebDB version 2.2.
To make sure that transactions are opened and closed, and that errors are shown, you have to
replace a few package bodies of the WebDB owner.
First, you should provide the WebDB owner to the Headstart database objects. You can do
this by logging into SQL*Plus as the owner of the Headstart database objects and running the
script <Headstart Home>\hst\scripts\grt_obj.sql. When asked for the application owner
schema, supply the schema name of the WebDB owner.
To install the modified WebDB package bodies, log into SQL*Plus as the WebDB owner,
and run the following scripts from the <Headstart Home>\webdb folder:
The RFstderr.pkb script ensures that CDM RuleFrame errors are added to the WebDB error
stack, and displayed in the same way as WebDB errors.
The RFmdgen.pkb script only applies to WebDB master-detail forms. It ensures that DML
actions on the master and the detail table are handled as one transaction. This is important if
you have business rules that involve both tables. (For example: an Order must have at least
one Order Line). If you have existing Master-Detail forms, you should regenerate the
PL/SQL package of the form to ensure the changes are picked up.
The original WebDB package body sources are also included in this folder, in case you want
to revert the changes.
Attention: Warning messages are only displayed if the transaction fails due
to other error messages. If there are no error messages, and the transaction is
successful, the warning messages are not displayed.
Figure 12-2 WebDB Error Page with CDM RuleFrame Errors displayed.
12 - 18 Access the Rule Layer Headstart Oracle Designer 6.5 - User Guide
WebServer Generated Applications
For WebServer Generator you do not need to change anything because it will automatically
use the Headstart version of the cg$errors package to display all the errors of the transaction.
Attention: Warning messages are only displayed if the transaction fails due to
other error messages. If there are no error messages, and the transaction is
successful, the warning messages are not displayed.
Figure 12-3 WebServer Generated form showing errors and warnings in transaction
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 19
JDeveloper/BC4J Applications
The file <Headstart home>\java\rf_prj.zip contains a JDeveloper 3.1 project (called
CDMRuleFrame) which contains Java classes to use CDM RuleFrame with Business
Components for Java.
• Use the BC4J wizards as usual to create your BC4J objects (EO's, VO's, AM's) for the
Headstart demo tables.
• Import the CDMRuleFrame project into your JDeveloper workspace and compile it.
• Change the parent class of your Application Module Implementations:
By default, all Application Module classes extend
oracle.jbo.server.ApplicationModuleImpl. To use CDMRuleFrame, they should now
extend oracle.idevcoe.ruleframe.RuleFrameApplicationModuleImpl
• Create a Business Components JSP application (or Business Components Data Form)
as usual (using the wizards) to create the presentation layer on top of BC4J
That's all! The JSP or DAC Form application will automatically display the CDM RuleFrame
errors when you hit the commit button.
12 - 20 Access the Rule Layer Headstart Oracle Designer 6.5 - User Guide
Other Front Ends
Make sure that at the beginning of a transaction, the following command is performed:
• qms_transaction_mgt.open_transaction
( p_trans_opened_by => <program name, e.g. 'FRAMEWORK'>
);
Make sure that just before any commit statement, the following command is performed:
• qms_transaction_mgt.close_transaction
( p_trans_opened_by => <program name, e.g. 'FRAMEWORK'>
);
Use a unique program name that is not used by any other sessions running in parallel. When
closing, use the same program name as when you opened the transaction, otherwise it won’t
be closed.
Closing a transaction neither commits or rolls back the transaction. If an error in a transaction
occurs, the transaction management package raises a generic exception
qms$errors.qms$exception, which causes an 'ORA-20998: Transaction Failed'. The front end
must be able to handle this exception.
If a transaction is closed successfully, the calling program must still commit the data. If a
transaction has errors, the calling program must abort or correct the data and close the
transaction again.
• qms_transaction_mgt.abort_transaction;
After the transaction is closed, make sure that any errors and warnings raised by the
Transaction Management package are shown to the end user. Check the CDM RuleFrame
message stack (by calling cg$errors.getErrors). If there were messages on the CDM
RuleFrame stack, show them.
Example code:
• l_message := cg$errors.getErrors;
if l_message is not null
then
… show the errors …
end if;
Headstart Oracle Designer 6.5 - User Guide Access the Rule Layer 12 - 21
PART V PRESENTATION LAYER
(blank page)
CHAPTER
13 Getting Started
This chapter begins with a brief overview of the Headstart Template Package architecture.
Next, the steps are detailed which prepare your application for generation with the Headstart
Template Package.
Next, the chapter outlines a number of iterative development tasks you should perform before
generating your modules.
Finally, there is a brief discussion about using Module Libraries in your applications.
This chapter assumes you have already performed the following steps.
• The Object Library contains form level triggers which are subclassed into the template
form (qmstpl65.fmb) through three object groups:
• QMSSO$MODULE: contains form level triggers required in each and every form
• QMSSO$STND_MODULE: contains form level triggers required in normal data
entry forms
• QMSSO$LOV_MODULE: contains form level triggers required in LOV forms
• The trigger code for all of these form level triggers consists of one line of code: a call
to procedure QMS$EVENT_FORM which resides in the event handler library
(qmsevh65.pll). The name of the form level trigger is passed as a parameter to
QMS$EVENT_FORM.
OFG*65.PLL Libraries
Unfortunately, Oracle Designer 6i uses the exact same library names as were used by Oracle
Designer 2.x/6.0, but with significantly different code. This presents a problem for people
who want to deploy forms generated from Designer 2.x/6.0 and 6i in the same runtime
environment. Forms generated from Designer 2.x/6.0 cannot run with the ofg*.pll libraries
from Designer 6i, and vice versa.
At first glance, you might think you can just include both versions of the ofg*.pll libraries but
in different directories. However, this will not work. In the runtime environment, the
FORMS60_PATH variable determines where the forms runtime engine will search for
libraries. It will always use the first occurrence of a given library in the path. So, even if you
put both directories in the path, it will never get to the second directory.
The only solution is to rename one or the other set of libraries. Of course, when you rename
the libraries, you will have to re-generate the forms to get the new libraries attached. Since
Designer 6i is the newer release, it makes sense to rename the libraries provided with it before
you begin generating forms.
The renamed versions of these libraries are in the [HSD65_HOME]\hst\admin directory. You
can leave them there or move/copy them to the [ORACLE_HOME]\cgenf61\admin directory.
In order to instruct Oracle Designer to use the renamed versions of these libraries, you must
create new string values in the registry. The Headstart installation process creates the
following new items in the registry.
Under HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\CGENF61\OPTIONS
Advantages
• The event handler structure allows you to plug in new events, delete events, or replace
events with your own code very easily.
• As the various object types have their own event handler, overhead is minimized, and
you immediately have an overview of the triggers and actions associated with a certain
object type.
• Each event handler includes standard debug information that will be displayed in the
Headstart Debug Monitor. This allows you to quickly localize your problem.
Headstart supplies a number of preference sets and reusable module components you can
(and should) make use of when generating your applications. These objects are stored in a
Designer application system shipped with Headstart. You should have imported the
application .dmp file during the Headstart installation process.
Perform the following steps to make these objects available in your own application systems:
1. Create a workarea which contains (at least) the following application folders.
• QMS65
• HSD65
• your application folder(s)
2. Open the Design Editor, click on your Application System folder node, invoke the
Preferences window, select Form Generator in the product poplist, and reference the
named set QMS65_RECOMMENDED.
3. Change the Product poplist to Report Generator and reference named set
QMSREP65_RECOMMENDED
4. Change the Product poplist to Help Generator and reference named set
QMS65_HTML_HELP.
By default Oracle Designer determines the command line to use when calling forms and
reports from a menu by the Language specific settings in the System Folder. Designer also
provides a mechanism for overriding this default, the user preference MNUUCL, Use
Command Line from Module.
• First, it will look at the individual module. If the module has a command line, it will
be used whenever this module is called from a menu.
• If the module has no command line, the Forms Generator will look at the command
line for the appropriate language defined in the System Folder.
• Finally, if the language specific command line is null, the Forms Generator will look
at the application preferences MNUDFC and MNUDRC for forms and reports
respectively.
For Headstart, you must use the values defined in MNUDFC and MNUDRC in the
QMS65_RECOMMENDED preference set unless specifically instructed to use a module
specific command. Therefore, you must blank out the preferences set for the languages in the
System Folder.
The following lists are objects in the QMS65 application system which you will use
frequently in your applications. While not strictly necessary, you might find it useful to
create shortcuts in your application system folders to these objects. (A shortcut simply makes
the object a bit quicker to locate in the various dialog windows you will use.)
You create a shortcut in the RON. Simply drag and drop the desired object from the owning
container to the target container. Note that you must drop the object on the target Application
System folder node, not on the sub-node for the object type.
• Preference Sets:
QMS65_RECOMMENDED
QMS65_MULTI_RECORD_BLOCK
QMS65_NO_CLIENT_CONSTRAINTS
QMSREP65_RECOMMENDED
QMS65_WIZARD_BUTTONS
QMS65_DEBUG_MODULE
QMS65_HTML_HELP
• Reusable Module Components:
In the Design Editor, you can set generator options for all the generators. (Options menu ->
Generator Options).
You must instruct the Form Generator where to find the Headstart Template form.
If you have not already done so, you should also set up the other Forms, Reports and Library
generation options at this time.
Note that if you use Headstart to develop multiple applications, you might consider creating a
company-wide library, in addition to the application library. Refer to chapter on Template
Package Customizations for more information.
The simplest way to create an application library is to copy the application library from the
Headstart Demo Application, hsdapp65.pll.
You can make a copy on the file system and design capture the application library into your
application system, or copy the library within Designer from the QMS65 application system.
Once you have copied the demo application library, you will need to open and modify each of
these procedures to make the library specific to your application.
Attention: It is assumed here that you will have shared deployment of the
Headstart Database Objects, at least in the Development Environment. If you
decide to create a self-contained application (for more information see the section
‘Database Schema Organization’ in chapter ‘Test and Production Environment’),
you will have to make an extra change in your application library, as described in
chapter ‘Test and Production Environment’.
You should attach library qmsevh65 to the application library, which in turn will attach
library qmslib65 and a number of OFG libraries, as shown in the schematic representation in
the previous section. It is important to keep this sequence of library attachments for two
reasons:
• The application library should be sequenced before the Headstart libraries for
customized QMS program units to overrule the same program unit in a Headstart
library. See the chapter on Template Package Customization for more information.
• The Headstart library qmslib65 contains a modified version of procedure
CGHP$CALL_MS_HELP, an Oracle Form Generator procedure stored in OFG
library ofghpl65. The modified version is required to allow for invocation of HTML-
based help when running on the WEB. (HTML help can also be used when running
client/server on Windows). This implies that qmslib65 should always be sequenced
before ofghpl65.
• By defining the application library as a module of type ‘Library’ in the repository and
adding this module to the module network of each form module.
• By setting the MODLIB preference at application level to the name of your
application library.
It is clear that the second option is much less work, and therefore preferred.
The standard menu options and the Smartbar are included in the Headstart menu template.
You can add your application forms and reports to your menu using the module network in
the Design Editor.
You may choose to create a Navigator Tree for your application instead of a menu for
accessing your application forms and reports. However, even if you choose this option you
should still generate a menu so that you have the standard menu options and Smartbar.
1. Select the application level node and open the Preferences Navigator.
2. Set the FMNDMA preference to the name of the menu module. Enter the name in
lowercase letters and do not include the .mmx extension.
You need to create some sort of a launchpad for your application. This may be a simple Start
Form with a graphic, or it could be a navigator tree.
You can copy the start form from the Headstart Demo Application, hsd0000f.fmb. After you
have copied the form module to your application, you must edit the window title to be
appropriate for your application. You may also want to replace the image with your company
logo.
Once your have generated your start form, you can create an html launch document for
launching your application.
Headstart 6.5 is optimized for forms deployed in a web environment. As such, deploying
Headstart generated forms in a client/server environment is not recommended. (There are a
number of know issues with using Oracle Forms 6i in a client/server environment. Headstart
6.5 has not attempted to overcome these issues.)
For a sample and information on creating an html launch document, see the chapter Test and
Production Environment in the Part Deploying Your Applications.
You can record an error message against primary keys, unique keys, foreign keys and check
constraints. Use the Headstart Utility ‘Create default error messages for constraints’ before
generating your forms to set up these error messages using the Headstart message tables.
More information: Chapter User Assistance, section Message Handling; Online help
Headstart Utility ‘Create default error messages for constraints’.
If you want to record information about the user and date the record was created and last
updated, you should run the Headstart utility, ‘Create About This Record columns’, prior to
generating your database tables from Designer.
You should also include these change history columns as hidden columns in your base table
definitions in your modules.
To ensure your online help system will be fully context-sensitive, you should run the
Headstart Utility ‘HTML Online Help generator’, prior to generating your forms.
To be able to view module revision information at runtime, you should add a module
argument P_REVISION to each forms module.
Headstart supplies a generic report launch form (qms0012f) which can be used to launch all
reports. When you attach a report to a menu and generate the menu, the Form Generator will
automatically generate a call to the Headstart report launch form in the menu, rather than a
direct call to the report.
This launch form uses two tables to store information about reports and their associated
parameters. When you choose the report from the menu, the report launch form will open
and will attempt to query the requested report in the tables.
Headstart also supplies a Headstart Utility, Create Headstart Report and Report Parameter
Definitions, to automatically populate these two tables based on the report and parameter
information stored in the Designer repository.
Perform the following steps to create the report and report parameter definitions.
1. Run the utility Create Headstart Report and Report Parameter Definitions. You may
run this for one or more modules.
2. Open the Headstart Foundation Application and choose Parameters -> Module and
Parameters from the menu.
3. Query the report definition(s) that were created in step 1.
4. In the Parameter block, place your cursor on the first empty record (after the report
specific parameters). Press the ‘Add Standard Report Parameters’ button.
5. Select all parameters that you wish to have available to your users.
6. Press OK. The selected parameters will be added to the parameter list for this report.
7. Save your changes.
Refer to the online help of the Headstart Foundation application, qfdhelp.htm/hlp located in
the \doc directory for more detailed information.
• in module libraries, restricting the module application logic to single line calls to
program units in the module library
• all the logic in the module itself, without creating any module specific libraries.
• Maintenance and debugging will be easier, all custom code for a module is
centralized, and by viewing the content of a module library, one can quickly trace all
custom logic.
• Module libraries will encourage reuse. Code common to multiple forms modules can
be put into one library that is shared by multiple modules.
• Program units in a module library use dynamic loading. They are only read into
memory when they are needed, whereas the form itself is loaded entirely at forms
start-up. When all logic is stored in the module itself, the form might grow
considerably in size, which will slow down start-up time of the form.
• You can modify code in the library without having to regenerate or even recompile the
associated form(s) .
• It is quicker to build. For smaller program units with only a few lines of code it might
be perceived unnecessary overhead to create separate program units in a module
library.
• Direct references to forms objects can be made. In the module library, the Name_In
construct must be used to reference globals, forms parameters, blocks and items.
Direct references are checked at compile time, errors in object names within the
Name_In construct are only discovered at runtime.
• Logic stored in the module itself can call CG$ program units generated by the Form
Generator.
Note that the centralization of code can also be achieved in the form itself, by grouping
related program units in packages, and using event handlers within these packages.
A side effect of storing all application logic against the forms module definition itself, might
be a drop in performance of the Form Generator, as much more custom code must be loaded
before the generation process can start.
As with the application library, we have the choice of using the MODLIB preference or the
module network to attach module libraries to the form. For reasons of documentation and
impact analysis, we strongly recommend the following.
The following steps are required for attaching a module specific library to a form.
The library specified in the MODLIB preference is always attached before any libraries
recorded in the module network. Therefore, if you do not clear the MODLIB preference at
module level, it will inherit the application level setting, which is set to the name of the
application library. This would cause the application library, and attached Headstart libraries,
to be sequenced before your module library, causing the module specific customization to be
ignored at runtime.
Two situations can occur:
• You are about to generate a new application that will be deployed on a UNIX
application server and therefore must be case-sensitive.
• You have an existing Oracle Forms application which must be deployed on a UNIX
application server, but the application currently does not handle case-sensitive
filenames.
The next two subsections discuss each situation.
Generating a Case-Sensitive Application
If the first situation applies, most of the case-sensitivity is already taken care of by Headstart:
• Generated filenames will be in lowercase due to preference LWCFLN (Filenames in
lowercase, uppercase, or mixed case) which is set to LOWER in named set
QMS65_RECOMMENDED.
• The filenames of all Headstart libraries are in lowercase, and library attachments are
lowercase as well (although displayed as uppercase in Forms Designer).
• The filename of the 'subclass information' (qmsolb65) of the object groups in the
Headstart template form (qmstpl65) is in lowercase.
You should stick to the following rules to ensure your generated application is completely
case-sensitive, and ready to be deployed on a UNIX platform:
• If you change the MODLIB preference for a module, make sure the new library name
is in lowercase.
• Preference FMNDMA, which specifies the name of your menu file, should be in
lowercase.
• Assign a lowercase name to any additional forms and libraries you create manually.
• If you subclass objects from either the Headstart Object Library, or from your own
object library, make sure the filename of the subclass information is in lowercase.
• Any calls to other modules, coded in the module library, should be in lowercase.
• Calls to explicit LOV Forms are generated in uppercase by Form Generator. This
means that you will have to modify the KEY-LISTVAL trigger post-generation, and
convert the LOV filename to lowercase.
Making an Application Case-Sensitive
If you generated your application without paying attention to lowercase/uppercase filenames,
it is a difficult and time-consuming task to convert it into a case-sensitive application. Read
the previous section for an outline of the issues you need to be aware of.
Refer to the Elcheapo user guide (elcheapo.doc, located in \doc directory) for detailed
instructions on using the elcheapo script to migrate your application to a UNIX application
server.
Example: suppose you have a file named qmslib65.pll, but one of your libraries refers to it as
QMSLIB65.pll.
Go to the UNIX folder where you stored qmslib65.pll and perform the following command:
ln qmslib65.pll QMSLIB65.pll
This creates a 'synonym' QMSLIB65.pll which points to the real file qmslib65.pll, and the
reference from your other library will work.
This chapter provides you with detailed information on various aspects of user interface
generation using Oracle Designer and Headstart Oracle Designer.
File Menu
Save Saves any pending changes
Save and Proceed Saves any pending changes, and returns the form to a state where the
next transaction can be started
Log on as a Opens the logon screen
Different User
Print Prints the current screen in which the cursor is located
Close Form Closes current form
Close All Closes all open forms
Exit Closes all open forms and exits the application
Edit Menu
Undo Record Undoes all changes in the selected record
Cut Cuts current selection to the clipboard
Copy Copies current selection to the clipboard
Paste Pastes from the clipboard
New Record Creates a new record
Duplicate Field Above Copies the value from the preceding row
Duplicate Record Above Copies the preceding record to the current record.
Delete Record Deletes the current database record
Clear Field Clears the current field
Clear Record Clears the current record, and does not ask for
confirmation if pending changes might be lost.
Clear Block Clears all records in the current block
Clear Form Clears any pending changes in the current form.
Clears all child windows (even if they are not
coordinated) but does not close them.
Select All Selects all records (for blocks with multi-select functionality)
Deselect All Deselects all selected records, except for the current record (for blocks
with multi-select functionality)
List of Values Invokes the LOV Window
Edit Field Invokes the Editor. The Editor to be used can be specified by setting the
SYSTEM_EDITOR environment variable. By default the Oracle Forms
editor is invoked.
Preferences Change Invokes a window that allows the user to change
Password their Oracle password
Preferences Preferences Invokes window to set a number of end user options
to influence the look and feel of the application.
View Menu
Find Shows the Find Window, or Row-LOV to retrieve all records
Find All Retrieves all records
The default Smartbar included in the Headstart menu template contains buttons that replicate
the following common standard Forms functions:
Save Saves any pending changes
Save and Saves any pending changes, and returns the form to a state where the
Proceed next transaction can be started
Print Prints the current screen in which the cursor is located
Undo Undoes all changes to the currently selected record
New Record Creates a new record
Delete Record Deletes the current database record
Clear Record Clears the current record, and does not ask for confirmation if pending
changes might be lost.
Clear Form Clears any pending changes in the current form. Clears all child
windows (even if they are not coordinated) but does not close them.
List of Values Invokes the LOV Window
Edit Field Invokes the Editor. The Editor to be used can be specified by setting the
SYSTEM_EDITOR environment variable. By default the Oracle Forms
editor is invoked.
Find Invokes Row-LOV or Find Window on the current block
Enter Query Invokes Query-By-Example mode
Run Query Retrieves all records, or if in Query-By-example mode run the currently
entered query.
Cancel Query Exits Query-By-Example mode
Previous Moves the cursor to the previous record
Record
Next record Moves the cursor to the next record
What's This Displays context-sensitive reference help on the item that will be
clicked on after this menu option has been invoked.
As previous, doesn’t this now display context sensitive
The Smartbar buttons are enabled and disabled context-sensitive, controlled through an end
user preference. If a certain function replicated by a button toolbar is not available in the
current context, the button is disabled.
A number of preferences as well as the Language specific command lines must be set in order
for proper functioning of menus generated with the Headstart menu template. Note that the
preferences are already set in the named set QMS65_RECOMMENDED which should be
referenced at application level, and you should have blanked out the language specific
command lines in the Getting Started chapter.
If nevertheless your generated menu does not behave as expected, you should check whether
the following settings are correct.
In the System Folder, under the Languages node, the command line for both Oracle Forms
and Oracle Reports must be blank.
In your application folder, at the application level, the following preferences should be set.
• MNUUCL = Yes
• MNUDFC = qms$menu.call_form('<MODULE>');
• MNUDRC = qms$menu.set_current_action('LAUNCH_REPORT','<MODULE>');
execute_trigger('qms$menu_item');
• The menu item code to call a form is taken from the Command Line property of the
module. If the command line is blank, the menu item code is taken from the language
specific command line in the System Folder. Since we ensure that command line is
blank, the command line will be taken from the preference MNUDFC. We
recommend only using the Command Line property to pass module specific
parameters to the form. Refer to section Passing parameters to forms for more
information.
• Reports are assumed to be launched through the Headstart Report Launch Form.
Reports are not called directly from the menu. This is implemented using the
MNUDRC preference.
Form-Menu Attachment
When generating a form, the menu that will be associated with the form is determined by the
value of preference FMNDMA. Usually, you will create one application-wide menu, and set
preference FMNDMA at application level to the name of this menu.
However, in complex environments with multiple applications, you might have forms that are
used in multiple applications. This would force you to create application-specific copies of
these forms, only to attach the appropriate menu.
By calling this procedure in the PRE-FORM trigger, Headstart dynamically replaces the
design-time specified menu with the application menu through a call to the
REPLACE_MENU built in. As the REPLACE_MENU built-in cannot be used in conjunction
with the Forms Debugger, you must comment out this procedure call before running the form
in debug mode, or use the Headstart Debug Monitor instead.
The end user of a Headstart-generated application can control what happens when they
invoke a new form from the menu.
• Replace current form: The NEW_FORM built-in is used to call the form from the
menu.
• Stack forms, save all changes at once: The OPEN_FORM (NO_SESSION) command
is used.
As a result of this parameter setting, package variables that are assigned in one form keep
their value when another form is invoked that has the same library attached.
Oracle Designer has the concept of Argument Passed Values (APVs) and Named Passed
Values (NPVs) to pass data from one form to another. APVs and NPVs are defined against a
module network link. Unfortunately, they are only taken into account for a form-calling-form
network link which is implemented through an action item. For menu-calling-form network
links, the recorded APVs and NPVs are currently ignored (enhancement request 772098).
Headstart supplies functionality which allows you to pass up to five parameters to a form
called from the menu. To use this functionality you should invoke procedure
QMS$MENU_CALL_FORM from the Module Command Line property.
QMS$PROCEED_BLOCK Any block in the form When the user Presses the Save
and Proceed Button on the
Toolbar, changes are saved and
the cursor is placed in the first
navigable block of the form. By
specifying this parameter you can
explicitly set the block the cursor
should navigate to after saving
the changes.
In addition to these pre-defined parameters, you can specify your own parameters which you
define as Argument against the forms module in the repository. Assume you want to call the
employee form from the menu, and you want to restrict access to those employees that work
for the same department as the user (we assume the user’s department is stored in a global.).
To do so, perform the following steps:
It is a common requirement that the same form should be called multiple times from the
menu, with different parameter values. Ideally, the different parameter values should be
recorded against each module network link, but as explained in the previous version, this is
currently not supported by Oracle Form Generator.
You can achieve the requirement in a slightly different way, by creating a ‘secondary’ module
definition in the repository, which acts as a shell module to call the original form. The shell
module definition (no module components need to be defined) has the Command Line
property defined such that the original form (generated from the ‘primary’ module definition)
is called with a different set of parameters.
Assume you have module EMP that needs to be included twice in the menu: once as a module
to insert, query, update and delete employee information, once as a query only module.
Perform the following steps to achieve this:
• Create the ‘primary’ module with Short Name/Implementation Name EMP as normal,
including the EMP module component which allows for insert, update, delete and
query.
• Set the Short Title of EMP to something like ‘Maintain Employee Information’
• Create the ‘secondary’ module with Short Name EMP_QO, Implementation Name
EMP and the Command Line set to:
qms$menu_call_form('EMP', 'QUERY_MODE', 'QUERY_ONLY');
• Set the Short Title of EMP_QO to something like ‘Query Employee Information’
• Add both modules to the menu structure.
• Generate the menu and form EMP.
If you want to enable or disable a menu option that is associated with a standard form
function, you should use the following procedures:
In addition to the pulldown-menu, Headstart will generate an item popup menu. Clicking the
right mouse button on an item invokes this popup menu with the following item-specific
options:
• Cut
• Copy
• Paste
• Clear Field
• Field Above
• Order Ascending
• Order Descending
• List of Values…
• What's This? Help
The items in the popup menu are displayed and hidden context-sensitive, instead of enabled
and disabled. A popup menu is intended for quick access to item level functions, so it
therefore does not include a number of disabled functions which are not valid for the current
item. Exception to this behavior are the Cut, Copy and Paste options which are always
displayed for text items. The enabling and disabling of these options is handled automatically
because they are defined as magic menu items.
Like the items in the pulldown menu, you can enable, disable, and hide or display the items in
the popup menu, by calling one of the following procedures:
QMS$MENU.ENABLE_POPUP_ITEM('<item name>');
QMS$MENU.DISABLE_POPUP_ITEM('<item name>');
QMS$MENU.DISPLAY_POPUP_ITEM('<item name>');
QMS$MENU.HIDE_POPUP_ITEM('<item name>');
If you do not want the item popup menu to be available in your forms, you should clear the
Popup Menu property of CGSO$DEFAULT_ITEM in the Headstart object library. Refer to
the chapter on Template Package Customizations, section Customizing the Headstart Object
Library for more information.
If you want to enable or disable a popup menu option that is associated with a standard form
function, you should use the following procedures:
QMS$FORM_FUNCTION.ENABLE('<form function>');
QMS$FORM_FUNCTION.DISABLE('<form function>');
Each time you open a new menu which contains the Headstart Smartbar, the gif files of the
iconic buttons are reloaded from the application server. This can be prevented by creating a
jar file which contains these items, and set up the base HTML file to load this .jar file at
application start-up.
Headstart ships with the hst65.jar file, located in the <HSD_HOME>\java directory, a
preconfigured .jar file that includes all the gif files from the Headstart Smartbar as well as a
number of java class files.
• Place the Headstart Jar file hst65.jar in a directory which maps to a virtual directory
included in your java_CODEBASE.
• Include the name of the Headstart .jar file in the java_ARCHIVE entry in the base
HTML file.
• In the registry.dat file, located in <ora_home>\FORMS60\java\oracle\forms\registry,
the default.icons.iconpath entry should point to the virtual directory of the Headstart
.jar file, and the default.icons.iconextension should be set to ‘gif’.
Example:
Using the set_menu_item_property built-in to change the label and the visibility (hide /show)
of a menu item at runtime causes the whole menu to be reloaded.
By default, the calendar window is invoked with all dates being enabled. However, it is
possible to disable (ranges of) dates when invoking the calendar window to prevent the user
from picking an invalid date from the calendar.
You can customize the display of the calendar for a specific item, as is appropriate in the
context of the item. The specification of the procedure is as follows:
procedure show
( p_new_type varchar2 default null
, p_low_date date default null
, p_high_date date default null
, p_sql_string varchar2 default null
, p_first_date date default null
, p_title varchar2 default null
)
The usages of the parameters are:
Calendar Examples
Instead of using the sysdate pseudo column, you can also refer to a date item in the form. For
example:
qms$calendar.show( p_high_date => :EMP.HIREDATE + 1);
Instead of hardcoded low and high dates you can also disable dates which are stored in a
table, by using the p_sql_string parameter. Assume you have a table HOLIDAYS which
holds all the holidays. To invoke the calendar with only working days enabled, you set the
PL/SQL block property to:
qms$calendar.show
( p_new_type => 'WEEKEND'
, p_sql_string => ' select action_date LOW_DATE'
||', action_date HIGH_DATE'
||' from HOLIDAYS'
, p_title => 'Calendar - Working Days'
);
Note that the selected columns must be aliased to LOW_DATE and HIGH_DATE.
Assume you want to have a button in your form that invokes the calendar with the hire dates
of your employees marked. To do so, create a button action item in the module in the
repository and, using application logic, specify the WHEN-BUTTON-PRESSED as follows:
qms$calendar.show
( p_new_type => 'DISPLAY'
, p_sql_string => ' select hiredate LOW_DATE'
||', hiredate HIGH_DATE'
||' from EMP'
, p_title => 'Employee Hiring Dates'
);
The table below shows the various source objects in the Headstart object library and the
visual attributes they use.
The Form Generator generates block and item group titles as boilerplate text. Boilerplate text
cannot be based on a source object in the object library, therefore the visual attributes of these
titles are still determined through the Designer version 1.3.2 style of CG$ visual attributes.
This is the reason that CG$TITLE is included as a font, which inherits all its properties from
qms$item_font, except for the background color which is set to gray.
Ideally, the background color for titles should be set to ‘automatic’, but due to a forms bug,
this results in black text on a black background.
Ideally, the List of Values object, cgso$lov, should inherit from the qms$gui_item_font with
‘automatic’ as its Visual Attribute. However, due to a forms bug, this results in black text on
a black background. Therefore, this object is set to visual attribute
QMS$BLACK_ON_GREY.
By default, the Headstart Visual Attributes enforce Oracle look and feel. The font typeface
used is MS Sans Serif, 8-point, with a medium font weight. The foreground and background
colors are set to the value ‘automatic’ which is interpreted at runtime according to settings in
the base html file and the registry.dat file.
The subclassing mechanism in the object library makes it very easy to modify the supplied
object library to change the font typeface, size and weight.
For example, to generate your objects with Oracle Applications compliant fonts, you should
make the following modifications:
Refer to the chapter on Template Package Customization for general instructions on how to
modify the object library.
The Headstart Object Library contains a large number of pre-defined visual attributes you can
use to display an item with specific background and foreground colors.
To attach such a visual attribute to a specific item, you specify the name of the visual attribute
in the hint text of the item, enclosed between the HTML-like tags: <VA> and </VA>. For
example:
<VA>QMS$BLACK_ON_RED</VA>
Open the object library maintenance form, qmsolm65, for a complete list of all the predefined
visual attributes.
Blocks on Tabs
To generate blocks on tabs, you simply set the Placement property of the module component
to either ‘New Tab canvas page’ or ‘Same Tab canvas page’.
There are a number of issues and restrictions you should be aware of when generating blocks
on tab canvas pages. We strongly recommend you read the Designer online help topic
‘Generating blocks onto native Form Builder tab canvases’ which documents all of these
issues.
You can work around this restriction by ‘fooling’ the generator by creating an invisible
unbound item as the first item of the module component with the following properties:
Because the width of this item is set to 0, the layout does not change. When you click on the
tab, the OFG code navigates to this item, and because the display type is set to 'Current
Record', the generated WHEN-NEW-ITEM-INSTANCE trigger fires, which navigates to the
next item, which is the first visible item displayed on a tabbed item group page.
A wizard is a special form of user assistance that automates a task through a dialog with the
user. Wizards help the user accomplish tasks that can be complex and require experience.
Novice users often do not avail themselves of the full power of a product because they are
intimidated by its high-end functionality. They may be unsure of what actions to take or what
order in which to perform those actions, or they may be overwhelmed by the quantity of
options they are faced with.
Experienced users may be comfortable with the complexity but still find some repetitive
processes tedious, especially if they do not take a wide variety of paths through the process.
In these cases, a direct manipulation interface may make users feel they are constantly
reinventing the wheel.
A wizard can address these problems by doing some or all of the following:
The result for novices can be a comfortable starting place that helps them get results and feel
successful quickly – and experts can increase their efficiency by leaving some of the
repetitive details to the computer.
Building a Wizard
Building a wizard is not straightforward. Carefully design the wizard before you start
building your module definition. Issues to consider:
• Number of pages, which items should be placed where, and in which sequence. Note
that Headstart allows you to split items belonging to the same table over multiple
pages.
• Use of images to embellish the wizard.
• Page instructions, short and concise text description at the top of a page to explain the
goal and usage of a page.
• Wizard size and positioning of control buttons.
• Availability of control buttons.
Note that sometimes you might want to omit this graphic panel if you are running out of
space on a specific wizard page.
• The larger the width, the less space remains for any items.
• The height should fit within the height of the wizard window. If the height is too
small, the Generator might generate items below the image, which is uncommon in a
wizard style layout.
Within the Headstart demo application, the wizard image items have a width of 30 and a
height of 15, which is an appropriate setting for a wizard that is sized 6 inches x 4 inches.
Both options have pro’s and con’s, your choice will depend on the specific situation, as is
explained below.
Using the first option, you are not restricted in the length of the text. However, the first
option is only possible if the unbound item is part of a module component that has a base
table usage. Otherwise, the module will fail to generate as Designer validates the derivation
expression against the base table of the module component.
• set_item_property(‘<block.item>’,ENABLED,PROPERTY_TRUE);
Using this option, you are not restricted in the length of the text. However, you can only use
it if the unbound item is part of a module component that has a base table usage. Otherwise,
the module will fail to generate as Designer validates the derivation expression against the
base table of the module component.
You can force ‘carriage returns’ within the text by concatenating the CHR(10) ASCII-code.
Using this option, the length of your text is limited to the length of the Prompt property which
is 130 characters. You can of course work around this limitation by creating multiple
unbound items.
You can force ‘carriage returns’ within the text by including the symbol which is set as
‘Force Split Prompt Marker’ in preference ITMFPS. This preference is set to ‘#’ in
QMS50_RECOMMENDED.
Headstart provides support for this, by allowing you to define separate module components
for each content canvas that will behave as one ‘virtual block’ at runtime.
To do so, you specify separate module components for each wizard page, all of which are
based on the same table. The first of these module components (‘the primary module
component’) is the one that takes care of the DML, it includes displayed items that must be
displayed on the first wizard page, and it includes all other items (non-displayed!) which
are placed on subsequent wizard pages.
For the subsequent wizard pages, you define ‘secondary’ module components, which only
include the items that should be displayed on that specific page (content canvas). To make
the primary and secondary module components behave as one ‘virtual block’ at runtime, you
should do two things:
You must copy the RMC because you will need to customize the button definitions for each
page:
• Buttons that are not applicable for a certain page should be disabled. For example, the
Back button will be disabled on the first wizard page. To disable a button, you should
set the Template/Library Object of the button to QMSSO$DISABLED_BUTTON.
• The PL/SQL Block property of the Back and Next buttons should be modified to
navigate to the first block on the previous and next page.
Due to a limitation in the Design Editor, copying the RMC is not straightforward. Follow
these steps to include the RMC:
The control buttons should be disabled until they are available. Use application logic to
dynamically enable and disable the control buttons, dependent on the data entered by the user.
Most likely you will use the POST-TEXT-ITEM and WHEN-LIST-CHANGED events to
enable and disable the Next and Finish buttons. Note that you cannot use the WHEN-
VALIDATE-ITEM event, as this trigger does not fire when the user nullifies an item.
Normally, the control buttons is placed directly below the last item on the page. Since the
items on each page do not necessarily take the same amount of vertical space, this causes the
y-position of the control buttons to be different for each page.
Headstart has solved this by using a special source block in the object library,
QMSSO$WIZARD. This block contains an item called WIZARD_HEIGHT which has a
Height of 3.5 inches and a Width of 0. At runtime, the item is not visible because of the zero
width, however, because the Visible property of this item is set to ‘Yes’, the layout algorithm
of the Form Generator takes this item into account when computing the vertical space the
module component will need. Each module component that is placed on a new content
canvas (a new wizard page) should subclass from this source block QMSSO$WIZARD (or
QMSSO$WIZARD_SPLIT_BLOCK which also contains this item) to ensure that the same
amount of vertical space is consumed and the control buttons will be positioned consistently
at the bottom of each page.
The consequence of this technique is that you cannot place another module component
between the first module component of the page, and the control buttons module component,
as this would increase the page height. If you need to put items on a page that originate from
more than one module component, you must use a stacked canvas which you then display
beside the first module component.
However, you cannot use the <PP>AUTO_SHOW</PP> window title tag to display this
stacked canvas, as this would display the Stacked Canvas on top of every wizard page! Refer
to the section on generating side by side blocks for instructions on generating this within a
wizard style layout.
The height of 3.5 inch of the WIZARD_HEIGHT item, together with margins and the control
buttons module component, will lead to an overall height of the wizard of 4 inches. If you
The horizontal layout of the control buttons is based on a wizard width of 6 inches. If you
want to use a different width, you will have to change the block tabulation preference
BLKTAB, in preference set QMS_WIZARD_BUTTONS, to reposition the buttons based on
the new wizard width.
Below, a summary of steps is included to help you perform this challenging task:
• Create a module definition and set preference PAGMAR to 0 for the module.
• Decide on the wizard size. If you use a wizard width other then 6 inch, you must
modify preference BLKTAB in preference set QMS_WIZ_BUTTONS accordingly. If
you use a wizard height other then 4 inches, you must modify the height of item
WIZARD_HEIGHT in QMSSO$WIZARD accordingly.
• Set the Template/Library Object property of the window to
QMSSO$MODAL_DIALOG_WINDOW.
• For each wizard page, create a module component with the following characteristics:
• Template Library/Object is set to QMSSO$WIZARD or
QMSSO$WIZARD_SPLIT_BLOCK
• Placement property is set to ‘New Content Canvas’
• Rows displayed is 1
• Canvas Width is 60
• The first item is an unbound image item
• The second item is an unbound item to generate the page instructions
• Unbound and/or bound items you want to display on the page
• Non-displayed bound items if the module component is the ‘primary module
component’ of a virtual block split over multiple pages.
• For each wizard page, include a copy of reusable module component
QMS_WIZ_BUTTONS, set the Placement property to ‘Same Content Canvas’, and
change the PL/SQL block of the navigation buttons to ensure correct navigation
• If the wizard page should contain a multi-record block, and/or items from more than
one base table, create additional module components for these blocks with the
Placement property set to ‘New Stacked Canvas’. Set the size and the x, y coordinates
of these module components such that the block does not obscure the image, the page
instructions or any other items.
• Create application logic to:
The Headstart demo application contains two wizard modules, hsd0008f and hsd0020f.
Examining the module definitions and libraries of these two modules might be of great help
in understanding the complex process of building a wizard.
By default, the Form Generator only raises a popup page if you navigate to the block which is
placed on the popup page. You can drive Headstart to automatically display popup pages at
forms startup, by including the following string in the window title of the window containing
the popup page(s):
<PP>AUTO_SHOW</PP>
The window title itself should be enclosed between <WT> and </WT> tags, to ensure that at
runtime only this tagged window title is displayed, without the Popup Page tags.
Note that you cannot use this technique when generating wizard style layouts. In a wizard,
the popup pages should only be displayed when a specific content canvas is displayed. With
the PP window title tag, the popup pages are displayed all the time, regardless of the active
content canvas.
To get side-by-side blocks in a wizard layout, you will have to programmatically raise and
hide the popup pages when the user navigates through the wizard pages:
• Use the SHOW_VIEW and HIDE_VIEW built-ins to raise and hide the popup pages
when the user presses the Next and Back navigation buttons.
• Disable the canvas management code generated by Form Generator, by using the
following application logic as the first event segment in the form level WHEN-NEW-
BLOCK-INSTANCE trigger:
copy(get_item_property(name_in('system.cursor_item'),
item_canvas),'cg$ctrl.cg$last_canvas');
Refer to library hsd0008l in the Headstart demo application for an example.
Headstart allows you to implement resizable spread tables: if the user resizes the window
width, the width of the scrolling region is changed accordingly. To make your spread tables
resizable, you simply include the following statement in procedure
QMS$INIT_APPLICATION in your application library:
QMS$CONFIG.SET_SPREADTABLES_RESIZABLE('TRUE');
Restrictions
Note that if you want to use resizable spread tables, two restrictions apply:
The reason for these restrictions is that it is not possible to reposition the scrollbar at runtime,
nor is it possible to resize the block decoration. Therefore, the scrollbar and/or block
decoration would have been obscured by the scrolling region when the user increases the
default window width.
• Image Items
• Action Items
Image Path
By default, Forms will look for the image file in the working directory of the application
start-up icon, and in the directories as specified in the FORMS60_PATH.
To use this feature, you must define your image items in a special way.
Note that the HSD65_IMAGEFILE_PATH can only contain one directory. If you want to
store your images in multiple directories, you should include those directories in the
FORMS60_PATH.
Action Items
Generation of action items is standard Designer functionality. When using Headstart, there is
one rule you should stick to:
The Headstart template form uses a real-inch coordinate system, with both the character width
and height set to 0.1 inch. This means that if you set the height of an action item to 1, the
generated button will have a height of 0.1 inch, which looks very odd, and makes the button
label unreadable. If you leave the height of the action item blank, the button inherits the
height of it's source object (cgso$button) in the object library, which is set to 0.219 inch (the
same height as for text items with a Plain MS Sans Serif 8-point font).
You might set the height to 2 or higher, but that will cause the action items to have a different
height than unbound button items, as for unbound button items, Form Generator uses the font
(ITMBIF is set to Yes) to determine the height.
By default, Headstart sets the Mouse Navigate property of buttons to False. In most cases,
this is the desired setting. However, if you have a button in each record of a multi-record
block, the cursor will not navigate to the selected record when the user clicks on the button.
If the code attached to that button contains logic to read or update the selected record (which
it usually does), then the code will go wrong because it will be working against the wrong
record.
Generation of these LOV types is clearly documented in the Designer online help. In this
section we provide some additional information.
To generate a Row LOV, simply set preference ROWLOV to Yes for the module component
you want to have the Row LOV.
When this property is set to True, the List of Values window is displayed without any records
displayed. The user first has to enter a ‘filter value’ in the Find Item at the top of the window.
This feature is useful if you want to use built-in List of Values on large tables. You can set
this property for both the Row LOV and foreign key LOVs. To set this property, invoke the
property palette for the base table usage (in case of a Row LOV), or the lookup table usage
(in case of FK LOV). The property is included in the group with title ‘Lookup’.
The Filter Before Display property is one way to implement List of Values for large tables.
An alternative to this property is the generation of explicit LOV forms, as discussed in the
next section.
LOV Forms
To generate an explicit LOV form module, you should perform the following steps:
• Set Module Layout Format (only accessible through property sheet) to ‘Lov’
• Set the Template/Library Object property of the item that should invoke the LOV form
through the <List> function to ‘QMSSO$LOV_FORM_ITEM’.
• Set the Template/Library Object property of the module component which is based on
the LOV Table to 'QMSSO$LOV_BLOCK'. This ensures that double-clicking on a
row will select the row, and close the LOV window.
Refer to the section on Multi-Select Functionality in the chapter on Runtime Behaviors, for
instructions on generating Multi-Select LOV windows.
The search criteria are easily applied by creating application logic against the PRE-QUERY
trigger of the LOV table block. For example, assume a search block called FIND, with an
item called FIND, and an LOV block EMP with ENAME being the first item, then the PRE-
QUERY trigger code against EMP should be:
:EMP.ENAME := :FIND.FIND;
If a search block is not needed, you might want to query all records when the LOV form is
invoked. To do so, add a module argument by the name of CG$STARTUP_MODE and set
the Default Value of this argument to ‘AUTO QUERY’.
Window Styles
Find Window
A Find Window is a type of window that enables the user to locate one or more records
without having to invoke enter-query mode. All fields for which a user may want to enter
search-criteria should be placed in the Find Window so that the user does not need to use
Query By Example.
Both the Row LOV and the Find Window are invoked from the same 'Find' button in the
button toolbar.
The Headstart Utilities contain a very powerful utility ‘Create Find Window(s)’ which
creates the required window and module component definitions in the repository to generate
the Find Window. Refer to the online help of this utility for more information. You can also
create a Find Window manually, by performing the following steps:
• Create a Module Component (MCO) in a new window. Base this Find MCO on the
same table as the block that must be queried. Set Rows Displayed to 1. Add lookup
table usages if you want LOVs on items in the Find Window.
• Set Insert?, Select? and Update? flags of this MCO to TRUE. Make sure the MCO
Alias is set according to the following naming convention: 'QF_'<Result_Block>.
Example: QF_EMP.
• Add bound and unbound items as required for the Find Window. Create bound items
if the item in the Find Window should have the same display dimensions as a column
in the base table. Add unbound items if you need additional items in the Find Window
which have unique display dimensions, or have display dimensions that match with a
column of the target table that is already bound to another item in the Find Window.
(You cannot bind two items to the same base column, as the Form Generator will
generate the second item as a mirror item of the first item.) For example, if you want
the ability to do a range select on deptno, you need two items in the Find Window:
DEPTNO_FROM and DEPTNO_TO. You can bind item DEPTNO_FROM to
column DEPTNO, and must create DEPTNO_TO as an unbound item.
• Define all items in the Find Window as optional. Note that items that are part of
mandatory foreign key are always generated as required items by Form Generator.
Headstart fixes this by making the item optional again at runtime.
• For each item in the Find MCO, the target item in the result block must be defined.
By default, Headstart assumes the target item is the item with the same name as the
item in the find MCO. For example, the value of item ENAME in QF_EMP will be
applied to item ENAME when the query is executed. You can use the Hint Text
property of the item in the Find MCO to deviate from this default behavior. As the
hint text is used for other purposes as well, the query find driving information is
enclosed between HTML-like tags: <QF> and </QF>. The following syntax applies
for the Hint Text.
• <QF> COPY_TO: target fieldname </QF>
• <QF> RANGE_FROM: target fieldname </QF>
• <QF> RANGE_TO: target fieldname </QF>
Examples:
<QF> COPY_TO:ENAME </QF>
<QF> RANGE_FROM:HIREDATE </QF>
• Set the Template/Library Object of the Find MCO to 'QMSSO$FIND_BLOCK'. This
source object will ensure the block will behave as a Find Block, and will generate
three buttons: Clear, New and Find into the Find Window.
Known Restriction
The Module Component that must be queried through the Find Window must have the
Datasource Type set to either 'Table' or 'View'.
A (secondary) window frequently contains data that can only be understood in the context of
data presented in a master window. As the master window can be hidden by the current
window, or any other window, the necessary context information should be displayed in the
window title.
The Window Positioning feature offers developers the possibility to position a newly opened
window relative to the previous active window.
To implement window titling and positioning features, you must set preference NAVWND to
Yes (already set in QMS65_RECOMMENDED)
The window title in the repository is used to record information on the context information on
the window title, and to indicate the positioning style (see below).
To indicate which part of the repository window title is used to construct the dynamic
window title, and which part contains the window positioning information, you should use
the following HTML-like tags:
The <WT> and </WT> tags enclose the window title information
The <WP> and </WP> tags enclose the window positioning keyword
Window Titling
Define the context items of the master block in the Window Title property of the Window
holding the detail Module Component (e.g. Employees). You must enclose these master
block items between brackets. For example:
<WT>Employees in department [DEP.DEPTNO][DEP.DNAME]</WT>
Note that you can reference an unlimited number of master block items in the window title.
You can also reference forms parameters and globals. For example:
<WT>Employees in department [:PARAMETER.P_DEP_NAME]<WT>
Its is not possible to use concatenations or the Decode-function.
Window Positioning
Headstart implements the following window positioning algorithm:
• Window positioning is extracted from the repository window title (see below)
• If no window positioning information is included in the window title, the positioning
style is CASCADE if ‘Hide on Exit’ property is set to No (this usually indicates a
document window). If the ‘Hide on Exit’ property is set to Yes (this usually indicates
a modal dialog window), the positioning style is CENTER.
If you want to deviate from this standard positioning algorithm, you can explicitly set the
window positioning style for each window in the window title property of the Designer
repository.
• CASCADE: Child window overlaps the parent window, with an offset to the right and
down from the current position of the parent window.
• RIGHT: Child window opens to the right of the parent window without obscuring it.
• BELOW: Child window opens below the parent window without obscuring it.
• OVERLAP: Detail window overlaps the parent window, aligned with its left edge,
with offset down.
• CENTER: Windows open centered relative to MDI window (or monitor size when not
running on MS Windows platform).
• CENTER_DOCUMENT: Windows open centered relative to MDI window (or
monitor size when not running on MS Windows platform). This keyword must be
used when the window you want to center is a document window.
• CENTER_WITHIN_PARENT: Windows open centered relative to another window.
Note that both windows must have the same style, either document or dialog. If the
window styles differ, the positioning will be not correct.
• FIRST_WINDOW: Positions the window immediately below the toolbar. Usually
used for main entity windows.
For example:
<WT>Employees in department [DEP.DNAME]</WT>
<WP>RIGHT</WP>
15 Runtime Behaviors
• Runtime Initializations
• Inter-Form Navigation
• Multi-Select Functionality
• Date Handling
All initializations discussed below can be easily switched off at any point, by making a call to
the following procedure:
QMS$CONFIG.DISABLE_RUNTIME_INIT
Form Initializations
Date Format
Oracle Form Generator generates the following code in the PRE-FORM trigger to support
Year 2000 compliant code:
/* CGYR$SET_DATE_FORMAT */
BEGIN
set_application_property(DATE_FORMAT_COMPATIBILITY_MODE
, '5.0');
set_application_property(PLSQL_DATE_FORMAT
, 'YYYY/MM/DD HH24:MI:SS');
set_application_property(BUILTIN_DATE_FORMAT
, 'YYYY/MM/DD HH24:MI:SS');
forms_ddl('ALTER SESSION SET NLS_DATE_FORMAT =
''YYYY/MM/DD HH24:MI:SS''');
END;
Unfortunately, you cannot configure the date format that is used within these statements.
Headstart has added a form initialization, which re-executes the above statements with the
date format as set by the first date environment variable that is set:
• FORMS60_OUTPUT_DATE_FORMAT
• FORMS60_USER_DATE_FORMAT (first value used)
• NLS_DATE_FORMAT
Refer to the Oracle Developer documentation for more information on these environment
variables.
Apart from supporting a general desire to be able to change this date format, Headstart has to
change the date format to support the calendar window on character items. (Used in the report
launch form.)
Block Initializations
As part of the block initialization, all items within the block are also initialized.
Blocks in subsequent windows are only initialized when the user navigates to the window,
preventing unnecessary initialization overhead at forms start-up.
This section discusses the runtime block initialization settings performed by Headstart.
Note that if there are multiple blocks in the same window, the NAVWRP = Yes and
NAVBWN = Yes preference settings already ensure that navigation wraps round within the
window.
Item Initializations
This section discusses the runtime item initialization settings performed by Headstart.
Required Items
Headstart suggests that you use the following settings in the Registry.dat file to set the
background color of required items to a light yellow as recommended for the Oracle Look
and Feel (OLAF).
app.ui.requiredFieldVA=true
# The background color is specified as an RGB triple.
app.ui.requiredFieldVABGColor=255,242,203
However, users can also use the ‘Edit Preferences’ menu option to change the prompt of all
required items that are insertable to a user specified color.
If the user has chosen to set this option and if the block allows insert, the prompt of all
required items that are insertable is set to the required item color as set by the user.
• If you have used read-only items to create dynamic prompts, you don’t want these
items to have a gray background. Headstart provides a special object,
QMSSO$TEXT, in the object library which you can reference in the Template /
Library Object property of these items. QMSSO$TEXT uses a special java class to set
the background of these items to match the canvas color for the colorScheme
parameter specified in the Base HTML file. Unfortunately, the readOnlyBackground
parameter overrides all other settings including the java class in QMSSO$TEXT.
• This parameter automatically colors all poplists gray in order to contrast between
poplists and combo boxes.
Therefore, Headstart recommends that you do not use the parameter readOnlyBackground in
your Base HTML file.
Instead, Headstart provides an alternate mechanism which identifies all read-only items (that
don’t use QMSSO$TEXT) and sets the background color to the read-only color as specified
by the user through the ‘Edit Preferences’ menu option.
Headstart sets the background color of poplists to ‘white’ instead of using the automatic
setting. The Headstart mechanism described above takes care of graying out poplists that are
read-only.
Repositioning of Items
Headstart allows you to align an item with another ‘master’ item by repositioning the item at
runtime. To do so, you specify the name of the ‘master’ item in the hint text of the item that
must be aligned, enclosing the item name between <AI> and </AI> tags. For example:
<AI>ORL.AMOUNT</AI>
This is particularly useful to align summary items with the item that is summarized.
<VA>QMS$BOLD</VA>
Note that although this is a quick way to set a special visual attribute, you can achieve the
same result by creating a new source item object in the object library, and set the
template/Library Object property of this item in the repository to the name of the new source
item.
The Headstart block and item initialization routines contain hooks to allow you to easily plug
in your own runtime initializations. These hooks are provided through two procedures in
qmsevh65, QMS$INIT_BLOCK and QMS$INIT_ITEM, which are called twice for each
block and each item in the form:
• QMS$INIT_BLOCK is called both before and after the Headstart block initializations
as discussed before. In addition to the block name and ID, this procedure contains a
third parameter which indicates the call sequence: BEFORE or AFTER the Headstart
block initialization code
• QMS$INIT_ITEM is called both before and after the Headstart item initializations as
discussed before. In addition to the Item Name, Item ID and Item Type, this
procedure contains a fourth parameter which indicates the call sequence: BEFORE or
AFTER the Headstart item initialization code
To add your own initialization code, you simply drag and drop these procedures to your
application or module library, and add the required initialization code. You should make sure
your library is attached before qmsevh65 to ensure your modified version of these hook
procedures will be executed.
• When calling a form from another form it is possible to use either OPEN_FORM or
CALL_FORM as the call method.
• when using OPEN_FORM, either a new database session or the same database session
can be used.
• Increased performance as library data are shared between forms, when a call method
other then OPEN_FORM with new database session is used.
• ability to keep the same menu as the calling form, regardless of the call method
• ability to invoke the called form in query-only mode, regardless of the call method
• ability to specify the window position of the first window in the called form, relative
to the active window in the calling form.
Designer provides the ability to pass context information from one form to another by
defining Argument Passed Values (APVs) and Named Passed Values (NPVs). Refer to the
Designer online help for more information.
Headstart leverages the powerful concept of APVs and NPVs to implement the functionality
described above:
Headstart uses the SHARE_LIBRARY_DATA parameter when calling another form through
the QMS$AI_OPEN_FORM or QMS$AI_CALL_FORM built-in. By sharing library data,
performance is increased, as multiple forms share the same instance of a library.
As a result of using this parameter, package variables that are assigned in one form keep their
value when another form is invoked that has the same library attached.
Note that library data are never shared when a new database session is opened, which will
happen when you set Named Passed Value SESSION_MODE to SESSION.
You can apply the Headstart multi-select functionality to the standard form functions, Clear
Record and Delete Record.
The clear record and delete record functions will operate on the selected records.
If no record is selected, the current record is cleared/deleted, just like in a normal block
without multi-select functionality.
If multiple records are selected and the deletion of a given record fails due to referential
integrity constraints, that record will not be deleted and remains selected. The records which
do not fail will be deleted.
You can use the Headstart Multi-Select functionality for your own user-defined actions.
Perform the following steps:
Multi-Select LOV
This functionality is completely driven by repository definitions, you do not need any
PL/SQL logic in the repository or a module library to implement this functionality.
It is important to understand that the multi-select LOV window will be part of the same
module definition that contains the intersection table. The LOV window cannot be generated
as a separate LOV form!
• Create a module with a master and a detail module component in Designer with the
detail module component representing the intersection table.
• Set Template/Library Object property of the item that should invoke the LOV window
when KEY-LISTVAL is pressed, to 'QMSSO$MSEL_LOV_ITEM'.
• If the detail module component that is based on the intersection table includes a
lookup table usage on the multi-select LOV item, all lookup items (displayed and non-
displayed) should have the 'Display in LOV' property set to No.
• Add another Module Component to the module with the base table being the LOV
table and the columns you want to see in the LOV window. Name the LOV Module
Component as follows:
ML_<target block name>
For example, a multi-select LOV on block PEM, will have the LOV module
component named ML_PEM.
For example, item EMPNO in module component ML_PEM could have a hint
text like: MS>EMP_EMPNO</MS>
By default, a query will be executed automatically on the LOV table. If you want the user to
enter search criteria first (which you should add as the first module component in the LOV
window), you must set the following tag in the hint text of the item that has the LOV
attached:
<ML>FILTER_BEFORE_DISPLAY</ML>
The Headstart demo application contains a module, hsd00012f which implements the multi
select LOV functionality. This module definition may clarify the steps required.
This required application form allows you to create and manipulate a set of selected items.
You can use this as an alternative to the multi-select LOV or for any action you need to
perform on a user-defined set of records.
The Report Launch Form, qms0012f, uses this feature to implement multi-select report
parameters.
You can display and manipulate the shuttle control object selector form through the following
API.
<value column(s)>
• 1 character value
• can be multiple columns concatenated
• must be a UNIQUE identifier (e.g. Primary Key)
• this value will be hidden from the user
• must use the alias "VALUE"
<description column(s)>
• 1 character value
• can be multiple columns concatenated
• should be unique (e.g. Unique Key) so the user can
• always distinguish between values
• this value will be displayed to the user
• must use the alias "DESCRIPTION"
function qms$shuttle_ctrl.get_return
( p_shuttle_ctrl_name in varchar2
) return varchar2;
This function returns 'OK' if the user closed the shuttle control window by pressing the OK
button. It returns 'CANCEL' if the user pressed the Cancel button.
function qms$shuttle_ctrl.count_selected
( p_shuttle_ctrl_name in varchar2
) return number;
This function returns the number of rows selected by the user in the requested shuttle control.
function qms$shuttle_ctrl.get_value
( p_shuttle_ctrl_name in varchar2
, p_selected_record in number
) return varchar2;
This function returns the VALUE from the requested shuttle control and selected record.
function qms$shuttle_ctrl.get_description
( p_shuttle_ctrl_name in varchar2
, p_selected_record in number
) return varchar2;
This function returns the DESCRIPTION from the requested shuttle control and selected
record.
function qms$shuttle_ctrl.get_value_list
( p_shuttle_ctrl_name in varchar2
, p_delimiter in varchar2 default ','
) return varchar2;
This function returns a list of all selected VALUEs from the requested shuttle control. The list
is delimited by the requested delimiter which defaults to a comma.
function qms$shuttle_ctrl.get_description_list
( p_shuttle_ctrl_name in varchar2
, p_delimiter in varchar2 default ','
) return varchar2;
This function returns a list of all selected DESCRIPTIONs from the requested shuttle control.
The list is delimited by the requested delimiter which defaults to a comma.
procedure qms$shuttle_ctrl.reset
( p_shuttle_ctrl_name in varchar2
);
This procedure resets all items in the requested shuttle control to unselected. If the requested
shuttle control does not exist, an error is returned.
procedure qms$shuttle_ctrl.cleanup
( p_form_name in varchar2 default null
);
This procedure closes all shuttle controls that have been opened by the requested form. If no
form is given, the procedure closes shuttle controls for the current form.
procedure qms$shuttle_ctrl.default_selected
( p_shuttle_ctrl_name in varchar2
, p_shuttle_ctrl_title in varchar2
, p_shuttle_ctrl_query in varchar2
, p_datatype in varchar2
, p_default_value in varchar2
, p_default_description in varchar2
, p_delimiter in varchar2 default ','
);
This procedure defaults the requested shuttle control to the given value which may contain
one or more objects delimited by the requested delimiter.
To generate a form which uses multi-select functionality to transfer multiple details to another
master record, you must perform the following steps:
The Headstart demo application contains a form, hsd0008f, which implements the transfer of
multiple records to another master (on the second window). This module definition may
clarify the steps required.
Known Restrictions
If you transfer a record, transfer it back again, and re-transfer it (three moves in a row), you
will get error ‘QMS-00123: Cannot move record again, requery the record first’. This error is
raised to prevent the ‘Record Changed by another user’ error, which would have been
confusing to the user. The internal implementation of this functionality makes it impossible
to remove this limitation.
If you allow query on the master block, and/or the detail block, you should add application
logic to synchronize with the block that contains the records not linked to the current master
record:
• Dependent Items
• Conditionally Dependent Items
• Multiple Dependent Items
• Two Master Items and One Dependent Item
• Cascading Dependence
• Mutually Exclusive Items
• Mutually Inclusive Items
• Mutually Inclusive Items with Dependents
• Conditionally Mandatory Items
Dependent Items
To make a text item, check box or poplist that is enabled only when a master item is
populated, use the procedure qms$item_instance.set_dependent_field.
• The dependent item is either cleared or made invalid when the master item changes.
• If the master item is NULL or the condition is FALSE, the dependent item is disabled.
In this example, a block order has items item_type and item_name. Item_name is dependent
on item_type. Thus, item_name is enabled only when item_type is NOT NULL.
Step 1
In the ‘POST-TEXT-ITEM’ trigger for item_type, add the following code.
qms$item_instance.set_dependent_field
( 'INIT'
, 'order.item_type' -- master item
, 'order.item_name' -- dependent item
);
(See note 3 below)
Step 2
In the WHEN-CREATE-RECORD trigger for the order block, add the following code.
qms$item_instance.set_dependent_field
( 'INIT'
, 'ORDER.ITEM_TYPE' -- master item
, 'ORDER.ITEM_NAME' -- dependent item
);
Note 1
In a multi-record block, if the dependent item is the last item in the record, the cursor
navigates to the next record when tabbing from the master. To work around this behavior,
code a KEY-NEXT-ITEM trigger that does a VALIDATE(item_scope) and then a
NEXT_ITEM.
Note 2
If the dependent item is a required list or option group, set the ‘invalidate’ parameter in the
call to qms$item_instance.set_dependent_field to TRUE. When this flag is TRUE, the
dependent item is marked as invalid rather than cleared.
Note 3
If the master item is displayed as a poplist, radio button, or checkbox, you can use the
appropriate trigger ‘WHEN-LIST-CHANGED’, ‘WHEN-RADIO-CHANGED’, or ‘WHEN-
CHECKBOX-CHANGED’ instead of the ‘POST-TEXT-ITEM’ trigger in Step 1.
In this example, block order has items item_type and size. Size is only enabled when
item_type is ‘SHOES’.
Step 1
In the ‘POST-TEXT-ITEM’ trigger for item_type, add the following code.
qms$item_instance.set_dependent_field
( 'INIT'
, (:order.item_type = 'SHOES') -- condition
, 'order.size' -- dependent item
Step 2
In the WHEN-CREATE-RECORD trigger for the order block, add the following code.
qms$item_instance.set_dependent_field
( 'INIT'
, (:order.item_type = 'SHOES') -- condition
, 'ORDER.SIZE' -- dependent item
);
Step 3
In the POST-QUERY trigger for the order block, add the following code.
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, (:order.item_type = 'SHOES') -- condition
, 'ORDER.SIZE' -- dependent item
);
Step 4
Create a form level user-named trigger called ‘UNDO_DEPENDENT’ with the following
code.
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, (:order.item_type = 'SHOES') -- condition
, 'ORDER.SIZE' -- dependent item
);
There are cases where multiple items are dependent on a single master item. For example,
only certain item_types can specify a color and size. Therefore, the color and size fields are
dependent on the master field item_type, and there are enabled only when item_type is
RAINCOAT.
Step 1
In the ‘POST-TEXT-ITEM’ trigger for item_type, add the following code.
qms$item_instance.set_dependent_field
( 'INIT'
, (:order.item_type = 'RAINCOAT') -- condition
, 'ORDER.SIZE' -- dependent item
);
qms$item_instance.set_dependent_field
( 'INIT'
, (:order.item_type = 'RAINCOAT') -- condition
, 'ORDER.COLOR' -- dependent item
);
(See note 3 in Dependent Items)
There may also be cases where an item is dependent on two master items. Suppose that
difference sizes of sweaters come in different colors. You cannot fill in the color of the
sweater until you have filled in both item_type and size.
Step 1
In the ‘POST-TEXT-ITEM’ triggers for both item_type and size, add the following code.
qms$item_instance.set_dependent_field
( 'INIT'
, ((:order.item_type is not null) and
(:order.size is not null)) -- condition
Step 2
In the WHEN-CREATE-RECORD trigger for the order block, add the following code.
qms$item_instance.set_dependent_field
( 'INIT'
, ((:order.item_type is not null) and
(:order.size is not null)) -- condition
, 'ORDER.COLOR' -- dependent item
);
Step 3
In the POST-QUERY trigger for the order block, add the following code.
qms$item_instance.set_dependent_field
( 'INIT'
, ((:order.item_type is not null) and
(:order.size is not null)) -- condition
, 'ORDER.COLOR' -- dependent item
);
Step 4
Create a form level user-named trigger called ‘UNDO_DEPENDENT’ with the following
code.
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, ((:order.item_type is not null) and
(:order.size is not null)) -- condition
, 'ORDER.COLOR' -- dependent item
);
Cascading Dependence
With cascading dependence, item_3 depends on item_2, which in turn depends on item_1.
Usually all items are in the same block.
For example, the block order contains the items vendor, site, and contact. The list of valid
sites depends on the current vendor.
Step 1
In the ‘POST-TEXT-ITEM’ trigger for vendor, add the following code.
Step 2
In the ‘POST-TEXT-ITEM’ trigger for site, add the following code.
qms$item_instance.set_dependent_field
( 'INIT'
, 'ORDER.SITE' -- master item
, 'ORDER.CONTACT' -- dependent item
);
(See note 3 in Dependent Items)
Step 3
In the WHEN-CREATE-RECORD trigger for the order block, add the following code.
qms$item_instance.set_dependent_field
( 'INIT'
, 'ORDER.VENDOR' -- master item
, 'ORDER.SITE' -- dependent item
);
qms$item_instance.set_dependent_field
( 'INIT'
, 'ORDER.SITE' -- master item
, 'ORDER.CONTACT' -- dependent item
);
Step 4
In the POST-QUERY trigger for the order block, add the following code.
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, 'ORDER.VENDOR' -- master item
, 'ORDER.SITE' -- dependent item
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, 'ORDER.SITE' -- master item
, 'ORDER.CONTACT' -- dependent item
);
Step 5
Create a form level user-named trigger called ‘UNDO_DEPENDENT’ with the following
code.
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, 'ORDER.VENDOR' -- master item
, 'ORDER.SITE' -- dependent item
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
Use the procedure qms$item_instance.set_exclusive_field to code two items where only one
item is valid at a time.
If both mutually exclusive items are NULL, then both items are navigable. If one item is
populated, then the other item is unnavigable (you can still click there), and any value in that
item is cleared.
If one item must not be null, set the Required property of both items to True. If both items
may be null, set the Required property of both items to False.
Qms$item_instance.set_exclusive_field reads the initial Required property and dynamically
manages the Required properties of both items.
You can also use qms$item_instance.set_exclusive_field for a set of three mutually exclusive
items. For more than three items, you must write your own custom logic.
In this example, a block lines has mutually exclusive items credit and debit.
Step 1
In the ‘POST-TEXT-ITEM’ triggers for both credit and debit, add the following code.
qms$item_instance.set_exclusive_field
( 'INIT'
, 'LINES.CREDIT'
, 'LINES.DEBIT'
);
(See note 3 in Dependent Items)
Step 2
In the PRE-RECORD trigger for the line block, add the following code.
qms$item_instance.set_exclusive_field
( 'PRE-RECORD'
, 'LINES.CREDIT'
, 'LINES.DEBIT'
);
Step 3
In the POST-QUERY trigger for the line block, add the following code.
qms$item_instance.set_exclusive_field
( 'POST-QUERY'
, 'LINES.CREDIT'
, 'LINES.DEBIT'
);
The item values may be entered in any order. If all of the items are null, then the items are
optional.
In this example, a block payment_info has two mutually inclusive items payment_type and
amount.
Step 1
In the ‘POST-TEXT-ITEM’ triggers for both payment_type and amount, add the following
code.
qms$item_instance.set_inclusive_field
( 'INIT'
, 'PAYMENT_INFO.PAYMENT_TYPE'
, 'PAYMENT_INFO.AMOUNT'
);
(See note 3 in Dependent Items)
Step 2
In the PRE-RECORD trigger for the payment_info block, add the following code.
qms$item_instance.set_inclusive_field
Lets look at a more complex example combining dependent items and mutually inclusive
items.
This example shows a block payment_info with mutually inclusive items payment_type and
amount. (just as in the previous section)
The block also contains two regions, one for check information and one for credit card
information. Check information has a single item, check_number. Credit Card information
has three items: card_type, card_number, and expiration_date.
Step 1
In the ‘POST-TEXT-ITEM’ trigger for payment_type, add the following code.
qms$item_instance.set_inclusive_field
( 'INIT'
, 'PAYMENT_INFO.PAYMENT_TYPE'
, 'PAYMENT_INFO.AMOUNT'
);
qms$item_instance.set_dependent_field
( 'INIT'
, (:payment_info.payment_type = 'Check')
, 'PAYMENT_INFO.CHECK_NUMBER'
Step 2
In the ‘POST-TEXT-ITEM’ trigger for amount, add the following code.
qms$item_instance.set_inclusive_field
( 'INIT'
, 'PAYMENT_INFO.PAYMENT_TYPE'
, 'PAYMENT_INFO.AMOUNT'
);
(See note 3 in Dependent Items)
Step 3
In the PRE-RECORD trigger for the payment_info block, add the following code.
qms$item_instance.set_inclusive_field
( 'PRE-RECORD'
, 'PAYMENT_INFO.PAYMENT_TYPE'
, 'PAYMENT_INFO.AMOUNT'
);
Step 4
In the WHEN-CREATE-RECORD trigger for the payment_info block, add the following
code.
qms$item_instance.set_inclusive_field
( 'INIT'
, 'PAYMENT_INFO.PAYMENT_TYPE'
, 'PAYMENT_INFO.AMOUNT'
);
qms$item_instance.set_dependent_field
( 'INIT'
, (:payment_info.payment_type = 'Check')
, 'PAYMENT_INFO.CHECK_NUMBER'
);
qms$item_instance.set_dependent_field
( 'INIT'
, (:payment_info.payment_type = 'Credit')
, 'PAYMENT_INFO.CARD_TYPE'
);
In the example, the block purchase_order has items quantity, unit_price and vp_approval.
Vp_approval is required when total is more than $10,000. (total = quantity * unit_price)
Step 1
In the ‘POST-TEXT-ITEM’ triggers for quantity and unit_price, add the following code.
qms$item_instance.set_required_field
( 'INIT'
, (:purchase_order.quantity * :purchase_order.unit_price)
> 10000 -- condition
, 'purchase_order.vp_approval' -- dependent item
);
(See note 3 in Dependent Items)
Step 2
In the PRE-RECORD trigger for the order block, add the following code.
qms$item_instance.set_required_field
( 'PRE-RECORD'
, (:purchase_order.quantity * :purchase_order.unit_price)
> 10000 -- condition
, 'purchase_order.vp_approval' -- dependent item
);
Step 3
In the POST-QUERY trigger for the order block, add the following code.
qms$item_instance.set_required_field
( 'POST-QUERY'
, (:purchase_order.quantity * :purchase_order.unit_price)
> 10000 -- condition
, 'purchase_order.vp_approval' -- dependent item
);
In the Headstart Demo Application, the form Subtype Consistency, HSD0010F, is used to
maintain both customers and suppliers. The Type item identifies whether the current row is a
customer or supplier.
If the row is a Supplier, the following items are affected and should be displayed
accordingly.
If the row is a Customer, the following items are affected and should be displayed
accordingly.
-- dependent items
qms$item_instance.set_dependent_field
( 'INIT'
, :BUR.BUR_TYPE='S'
, 'BUR.CONTACT_PERSON'
);
qms$item_instance.set_dependent_field
( 'INIT'
, :BUR.BUR_TYPE='S'
, 'BUR.EMAIL_ADDRESS'
);
qms$item_instance.set_dependent_field
( 'INIT'
, :BUR.BUR_TYPE='C'
, 'BUR.CATEGORY'
);
qms$item_instance.set_dependent_field
( 'INIT'
, :BUR.BUR_TYPE='C'
, 'BUR.DISCOUNT'
);
qms$item_instance.set_dependent_field
( 'INIT'
, :BUR.BUR_TYPE='S'
, 'BUR.FAX_NUMBER'
);
qms$item_instance.set_dependent_field
( 'INIT'
, :BUR.BUR_TYPE='C'
, 'BUR.CREDIT_LIMIT'
);
-- dependent items
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='S'
, 'BUR.CONTACT_PERSON'
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='S'
, 'BUR.EMAIL_ADDRESS'
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='C'
, 'BUR.CATEGORY'
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='C'
, 'BUR.DISCOUNT'
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='S'
, 'BUR.FAX_NUMBER'
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='C'
, 'BUR.CREDIT_LIMIT'
);
-- dependent items
qms$item_instance.set_dependent_field
( 'INIT'
, :BUR.BUR_TYPE='S'
, 'BUR.CONTACT_PERSON'
);
qms$item_instance.set_dependent_field
( 'INIT'
, :BUR.BUR_TYPE='S'
, 'BUR.EMAIL_ADDRESS'
);
qms$item_instance.set_dependent_field
( 'INIT'
, :BUR.BUR_TYPE='C'
, 'BUR.CATEGORY'
-- dependent items
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='S'
, 'BUR.CONTACT_PERSON'
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='S'
, 'BUR.EMAIL_ADDRESS'
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='C'
, 'BUR.CATEGORY'
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='C'
, 'BUR.DISCOUNT'
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='S'
, 'BUR.FAX_NUMBER'
);
qms$item_instance.set_dependent_field
( 'POST-QUERY'
, :BUR.BUR_TYPE='C'
, 'BUR.CREDIT_LIMIT'
Refer to the Oracle Developer documentation for more information on these environment
variables.
Headstart evaluates the value of these environment variables to determine the date and
datetime format that is used to handle and display dates.
Note that dates entered into a CHAR item (for example, date parameters in the report launch
form!) must be entered in the format of FORMS60_OUTPUT_DATE_FORMAT. The
formats in FORMS60_USER_DATE_FORMAT are ignored for CHAR items.
In Oracle Forms, you can set the following properties using the
SET_APPLICATION_PROPERTY built-in.
• PLSQL_DATE_FORMAT
• BUILTIN_DATE_FORMAT
Oracle Form Generator generates the following code in the PRE-FORM trigger to set these
two properties (and NLS_DATE_FORMAT):
set_application_property(PLSQL_DATE_FORMAT, 'YYYY/MM/DD
HH24:MI:SS');
set_application_property(BUILTIN_DATE_FORMAT, 'YYYY/MM/DD
HH24:MI:SS');
forms_ddl('ALTER SESSION SET NLS_DATE_FORMAT =
''YYYY/MM/DD HH24:MI:SS''');
As you can see, the date formats are hardcoded into the generated forms. Headstart re-
executes the same statements after the generated code, but uses the datetime format from the
environment variables as described in the previous section, instead of a hardcoded format.
This ensures that the same date format mask is used in all date-related operations.
Recommended Approach
This chapter discusses the following topics related to end user assistance in your generated
application:
• Message Handling
• Online Help
• Item Hint and Tooltips
• About This Record
• About This Application
The remaining subsections discuss how to perform specific tasks related to message handling.
The Headstart message handling provides you with the following functionality:
• The messaging is multi-lingual. The end user can set their preferred language and will
receive all application messages in this language. (… provided of course that the
message translations have been added to the Headstart Message Dictionary.)
• You can use up to 10 substitution parameters while invoking the message procedure.
The substitution parameters can be used in the message text and/or in the help text.
• If you have recorded the cause and action of a message in the message table (help_text
column), the message alert box is shown with an extra 'Help' button which shows a
'Help on Message' form when pressed.
• Messages hardcoded by the Form Generator are captured and replaced with an error
message code which subsequently is used to get the corresponding message text from
the message table.
• Server-side application errors raised in Table API, database triggers, or stored
procedures and functions, are trapped and stripped to extract the message code that
must be used to fetch the message text from the message table.
• Declarative constraint violations in the Oracle database are trapped and replaced with
a user-friendly message.
• Unwanted FRM and ORA messages can be suppressed or rephrased.
• You can set the severity of a message:
Usage Conditions
Two general conditions must be met to be able to use the Headstart message handling system:
The CG$ERRORS package is used by the Designer Table API packages and triggers.
Headstart replaces this package with a Headstart specific version to ensure that messages
raised in the Table API, are handled in the same way as all other messages. The Headstart
version of this package replaces the hardcoded Table API errors, with a Headstart message
code which is used to access the Headstart message table.
Warning: Oracle Designer includes a call to (re)create the CG$ERRORS package when you
generate the Table API scripts from Designer. This call is included at the top of the shell .sql
script, and will look like this:
PROMPT Creating Table API Error Package CG$ERRORS
@ C:\ORANT\cgens70\sql\cdsaper.PKS
@ C:\ORANT\cgens70\sql\cdsaper.PKB
You must ensure that this version of the package is not loaded. The easiest way to ensure this
is to save the cdsaper.pks and .pkb scripts to another name and replace the contents in the
original scripts with a NULL statement. You have to repeat this step at each workstation
where Oracle Designer is installed.
If this script is inadvertently executed, the result depends on the user account you use to run
the script:
• If the user has a synonym pointing to the Headstart version of CG$ERRORS you will
get error ‘ORA-00955: name is already used by an existing object’ on the creation of
the package specification of CG$ERRORS, and the package body (without its
specification!) is created with numerous compilation errors. To correct this situation,
logon to SQL*Plus as the same user and execute the following command:
To correct this situation, run the following scripts connected as the owner of the
Headstart Template Package database objects:
• cg$err.pks
• cg$err.pkb
• recompl.sql (possibly repeated until all objects are valid again)
The scripts are located in <headstart_home>\hst\scripts directory. The last script,
recompl.sql, should also be run under all other user accounts that have synonyms
pointing to the CG$ERRORS package you just recreated.
Oracle Designer allows you to enter an ‘Error Message’ against the following constraint
objects:
When you record the actual message text in this property, this message text will be hardcoded
in the generated forms. We strongly recommend you not use these hardcoded messages,
because you will lose important functionality:
Instead, you should record a message code in the ‘Error Message’ property, and record this
message code and the constraint name in the message table, along with a message and help
text for each language you wish to support. There are several Headstart Utilities which add
messages to the message dictionary automatically. You can also use the Headstart
Foundation application Messages Form to add and edit messages manually.
Message Code
The message code used in the Headstart Message Dictionary must use the following format.
This format follows the precedent set in Forms messages (FRM-00001), Designer messages
(OFG-00001) and Server messages (ORA-00001).
Notice this format implies that you must follow the CDM Standard for naming applications
using 3-letter codes. For example, the Headstart Utility ‘Create Default Error Messages for
Constraints’ uses your application name to create error message codes. If you need to use a
longer name for your application, you can work around this restriction by also including a 3-
letter abbreviation in the application name as shown below.
MYAPP (MYA)
The utility will then use the value in parentheses as the application code in generated
messages.
• Only constraints defined on the base table usages of your module are trapped. If for
example, you have a module with a block based on table A and you have a database
trigger on this table which does an update of table B, the ON-ERROR trigger will not
be able to replace the general Oracle constraint violation message raised by a violation
of a constraint on table B.
• Each time you add a key or check constraint you will have to regenerate your form to
update the ON-ERROR trigger
Both limitations go away if you record the constraint name in the Headstart message tables.
When a server-side constraint violation takes place, Headstart traps the Oracle error, strips the
constraint name from the Oracle Error, uses this constraint name to look up the proper
message in the message table, and displays this message to the end user instead of the Oracle
error
Note that this implies that you cannot use substitution parameters in key constraint and check
constraint messages, as each constraint message must have its own unique constraint name.
The additional work of creating separate messages can be automated using a Headstart utility,
as the next section explains.
You can run this utility multiple times to insert messages for each language you need to
support.
Headstart allows you to show a user-friendly error message for when these rules are violated
in the server (they are checked by the Table API).
For each possible rule violation, you can use the Headstart Utility ‘Create default messages
for constraints’ to add an error message to the message table. A special naming convention
for the constraint name property in the message table will allow Headstart to look up the
appropriate message in case of such a rule violation.
Application messages are coded in the application by you, the developer. You should ensure
that you use a unique message code and record the message code and text correctly in the
message handling tables. This is done using the Headstart Foundation Application.
Example: Message QMS-12345 which does not have any substitution parameters, is
recorded as an informational message in the message tables, but should be displayed as an
error, and processing should stop. The following statement will accomplish this:
qms$errors.show_message
( p_mesg => 'QMS-12345'
, p_errtp => 'E'
, p_rftf => TRUE
);
Note that procedure qms$errors.show_message is available at both the client and the server.
This allows you to drag and drop program units from the client to the server, and vice versa,
without the need to rewrite the message handling calls.
Sometimes a program needs to ask a question to the user and act on the feedback provided.
This can be done by specifying a message of type ‘Q’ (question) . Such a message will be
displayed in an alert with three buttons: Yes, No and Help.
To do so, you must call the informational message in the normal way, using
qms$errors.show_message. Directly after the call to the server-side program unit which
raises the message, you must add the following statement:
qms$trans_errors.display_messages;
This procedure call will read the stack of messages, and display them to the user, and clear
the stack. If you forget to include this call, the message remains on the stack, and will be
displayed to the user when another (probably unrelated!) message is raised in the application.
For messages which are raised in the server as part of a standard DML action of Forms, the
call to qms$trans_errors.display_messages is not required. This procedure call is already
included in Headstart at the POST-INSERT and POST-FORMS-COMMIT events. This
means that informational messages raised (indirectly) in database triggers, or in the Table API
are automatically displayed to the user.
With Questions, the feedback from the user should determine further processing. You can
use function qms$forms_errors.get_dialogfeedback to evaluate the response of the user after
the call to qms$trans_errors.display_messages.
Example: We want to raise a question message ‘Are you sure you want to delete this
record?’ each time a user tries to delete a department from the DEPT table. We record this
message with severity ‘Question’ in the message tables, and call qms$errors.show_message
with the appropriate message code in the pre-delete database trigger on table DEPT. To show
this message to the user, and handle processing according to the user’s response, you should
include the following code in the POST-DELETE trigger in your form:
qms$trans_errors.display_messages;
if not qms$forms_errors.get_dialogfeedback
then
raise form_trigger_failure;
end if;
Note that the function qms$forms_errors.get_dialogfeedback will always return the feedback
of the last question. Therefore, you can only raise one question in the server during one
database transaction.
Important! In order for Headstart message handling to work properly, you must include this
exception handler in every program unit in your application, both client and server.
Unhandled errors are captured by the WHEN OTHERS exception. This will allow the
message handling system to capture all unhandled exceptions and provide the user with
detailed information on the error that occurred and the program unit that had the error.
To temporarily suppress a message, you must add it to the stack programmatically. To show
the message again, you must delete it from this stack.
To suppress a message:
qms$forms_errors.Add_Suppress_Message (<error code>);
To show the message again:
qms$forms_errors.Delete_Suppress_Message (<error code>);
You can also suppress or replace the text for ORA and FRM messages displayed in forms.
To replace the standard text for and ORA or FRM message, record it in the Headstart
Message dictionary with the desired text. To suppress the message permanently, check the
‘Suppress Always?’ checkbox.
The server side error handling of Headstart can also be used for batch programs. The
example below shows the framework of using Headstart for batch programs. All
messages/errors are placed in a PL/SQL table inside the cg$errors package. The “start”
program must read this table using cg$errors.pop (p_errorrec) to read the stack and place it in
a log file (using utl_file or dbms_output).
DECLARE
l_errorrecord hil_message.message_rectype;
BEGIN
my_batch_procedure;
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
cg$errors.pop(l_errorrecord);
WHILE v_errorrecord.msg_text IS NOT NULL
LOOP
dbms_output.put_line(l_errorrecord.msg_text);
cg$errors.pop(l_errorrecord);
END LOOP;
END;
A script to unload messages from the Headstart tables into a file is included. The script
(unld_msg.sql, located in hst\scripts directory) creates a SQL*Plus script that can be run on
another database schema, for example the test or production environment. You can adapt this
script to include a where clause if you want to unload all messages created or updated after a
certain date (creation_date or last_update_date column in both tables), or unload messages
with a specific prefix.
The Headstart Utility ‘HTML Online Help Generator’, creates an HTML help file, following
the same algorithm as applied by the MS Help Generator.
The HTML Online Help Generator adds a context help ID prefix/suffix to all modules,
module components and items, regardless of whether or not help text is recorded against the
element. It then generates a Help file in HTML format and uses the context help ID
prefixes/suffixes to construct bookmarks in the Help file. These bookmarks are prefixed with
‘BM’ since HTML bookmarks cannot start with a number.
Refer to the online help of the HTML Online Help Generator Utility for detailed information
on how the help file is structured and laid out.
This means that if you run the HTML Online Help Generator once before you start generating
your forms, you ensure that KEY-HELP triggers with unique context ID's will be generated
for ALL blocks and items in the form. You can record the actual help text later on, and re-
run this utility to add content to the generated help file. The bookmarks will stay the same.
Important note: If you run the MS Help Generator provided by Oracle Designer to
create an MS Help version of your help files, you should NOT save the changes in the
repository. This utility clears the context help ID suffixes for elements without help text.
You can re-run the HTML Online Help Generator to re-assign them, but the ID’s will be
different, forcing you to regenerate all your forms!
The WEB.SHOW_DOCUMENT built-in expects a URL as the parameter which specifies the
document to show. This URL should be set through the environment variable
HSD65_HELPFILE_WEB_PATH. This environment variable should include the server
name and the virtual directory that contains the help file. For example:
'nlt1460.nl.oracle.com/webforms/'
You should, of course, change the server name (nlt1460.nl.oracle.com) and virtual directory
path (/webforms/) according to your local set-up.
Note: this implementation relies on the library attachment sequence in the generated forms:
QMSLIB65 is attached before OFGHPL65, therefore the modified version of
CG$HP_CALL_MS_HELP is executed.
• The item hint text, displayed at the bottom of the screen in the status bar
• The item tooltip, displayed in a small balloon window, just below the item
The Oracle Designer repository only supports the item hint text, the item tooltip cannot be set
in the repository, and is not set in the generated form. The only way a tooltip can be set, is to
specify the tooltip against the source item in the object library. Generated items that will
subclass from this item, will inherit the tooltip as well. This feature is of little use, because
tooltips are by definition item specific, and source items in the object library are subclassed
by many items.
From a usability point of view, tooltips are preferred over item hint text. It is less user
friendly when the user has to look at the bottom of the screen, each time they want a hint on
the current item. Furthermore, they can only get the hint on the item the cursor is in. If they
want to get help on another item, they first have to navigate to the item. Tooltips are easier
and quicker to use, they appear with a short delay when the user moves the mouse to an item.
The user does not have to click on the item, and they show immediately below the item, not at
the bottom of the screen.
Headstart supports item tooltips by copying the item hint text to the tooltip property at
runtime.
The user can switch on and off the tooltips through the Show Item Hint menu option.
If you do not specify a hint text in the repository, Oracle Form Generator (OFG) creates a
default hint text of the form ‘Enter value for <prompt name>’. A tooltip with this text does
not make much sense, therefore Headstart does not copy this default, OFG generated, hint
text. For National Language Support, you can configure this default OFG hint text at
application start-up in procedure QMS$INIT_APPLICATION, by calling the following
Headstart built-in:
QMS$CONFIG.SET_DEFAULT_OFG_HINT_TEXT('<language specific
hint text>');
Headstart also uses the item hint text for extended ‘declarative generation’. Using special
HTML-like tags in the hint text, you can easily align items, assign special visual attributes,
etc. Headstart strips these special tags from the hint text before copying to the item tooltip, so
the user will not see them. Because of the tooltip support, and the use of these special
generation tags in the hint text, the ‘Display Hint Automatically’ property has been switched
off for all source items in the object library.
• Created By : specifies the Oracle username of the user who inserted the record into the
database
• Creation Date : specifies the date and time which the Created By user inserted the
record
• Updated By : specifies the Oracle username of the user who last updated the record in
the database.
• Last Updated : specifies the date and time which the Updated By user updated the
record
In addition the database table name in which the record is stored is displayed.
The audit columns can be created using a Headstart Utility. A full description of this can be
found in the chapter ‘Implementing the Data Layer’.
The display of the change history information relies on naming conventions of the change
history columns. If you deviate from the default column names as suggested by the Headstart
Utility, you should add a call to procedure QMS$CONFIG.SET_AUDIT_COLUMNS in
procedure QMS$INIT_APPLICATION in your application library.
For example:
qms$config.set_audit_columns
( 'USER_CREATED'
, 'DATE_CREATED'
, 'USER_LAST_UPDATED'
, 'DATE_LAST_UPDATED'
);
Note that you must include the change history columns as hidden columns in your base table
usages in your module definition. The Headstart Utility will add these column usages if
needed.
This menu option invokes a form that shows the following types of information:
The next subsections discuss the steps you should take to display the correct application,
module and system information. (The session information is derived at runtime!)
• application title
• application copyright line 1
• application copyright line 2
• application version information
• file name of the application logo image
• version of Headstart event handler library qmsevh65
• version of Oracle Form Generator
The Headstart demo application contains a library, hsdapp65, which contains an example of
the QMS$ABOUT_THIS_APPLICATION procedure which you can base your own version
on.
System Information
The system information of the About This Application form contains two types of versioning
information:
Module Information
The name of the module is derived from the system variable system.current_form. The
version number is derived from the initial value of Forms parameter P_REVISION. You
should define a module argument with this name for each forms module in the repository in
order to have version information displayed. If you do not define an argument
P_REVISION, the module version number will be displayed as ‘UNKNOWN’ in the About
This Application form.
The module version number should be specified in the Default Value property of the
P_REVISION argument.
17 Troubleshooting
This chapter discusses the following topics related to problems you might encounter when
building and running your application:
• Troubleshooting Approach
• Common Problems
• Problem Assessment
• Headstart Debug Monitor
• Forms Debugger
ORA-04062
When starting a Headstart-generated application, you might get the following error:
This error is caused because you installed the Headstart database objects under a new schema
owner. You will have to recompile all program units (Program -> Compile -> All) in the
following libraries:
• qmslib65
• qmsevh65
Note that there is a SQL*Plus script available, compile.sql located in \hst\admin directory,
that launches a .bat file to recompile these libraries in batch. You are prompted for the
username/password of the owner of the Headstart database objects.
ORA-06508
When starting a Headstart-generated application, you might get the following error:
QMS-00100: Unhandled Exception ORA-06508: PL/SQL: Could not find program unit being
called in PL/SQL Program Unit <program unit name>. Contact Helpdesk.
Possibility 1
The error text is quite misleading, you didn’t loose a program unit, you just need to
recompile all program units (Program -> Compile -> All) in the following libraries:
• qmslib65
• qmsevh65
Sometimes, you also need to recompile your application library, and your application
menu.
If the problem persists, it might be caused by invalid .plx files. The <hsd_home>\admin
directory contains renamed versions of all Form Generator libraries. Remove all .plx
files in this directory, and recompile all libraries starting with the OFG libraries, then
qmslib65, qmsevh65 and your application library.
Possibility 2
To be able to use Headstart generated applications, each Oracle user account you use to
access such an application must have access to the procedure qms_exec_sql.
FRM-40735
When starting a Headstart-generated application, you might get the following error:
• An attached library cannot be found. Check if all required libraries are located in
directories which are included in the FORMS60_PATH environment variable, or are
located in the working directory of your application start-up icon.
• The Headstart database packages have become invalid. This happens frequently when
you generate and execute TAPI scripts from Designer, and accidentally overwrite the
Headstart specific version of the CG$ERRORS package. (See chapter User
Assistance, section Message Handling, section Usage Conditions for more
information)
To correct this situation, run the following scripts, connected as the owner of the
Headstart Template Package database objects:
• cg$err.pks
• cg$err.pkb
• recompl.sql (possibly repeated until all objects are valid again)
The scripts are located in <headstart_home>\hst\scripts directory. The last script,
recompl.sql, should also be run under all other user accounts that have synonyms
pointing to the CG$ERRORS package you just recreated.
FRM-41085
When starting a Headstart-generated application, you might get the following error:
followed by
This error is raised if you try to run the application under an Oracle user who does not have
access to the Headstart database objects. Chapter 18 describes the necessary actions on how
to grant a user to headstart.
Check your application library for ‘suspect’ program units, and comment out any suspect
code.
Generate your module without any custom logic you have added that might be related to the
problem. Note that the custom logic you have added to a module can be easily excluded from
generation:
Headstart performs various runtime initializations at form, window, block and item level.
Unexpected behaviors might be caused by such a runtime initialization, or by application
logic interfering with these runtime initializations.
You can easily switched off these runtime initializations by temporarily adding a call to the
following procedure in QMS$INIT_APPLICATION:
QMS$CONFIG.DISABLE_RUNTIME_INIT
Refer to the chapter Runtime Behaviors, section Runtime Initializations for information on
the types of initialization you switch off with this statement.
By referencing this preference set at module level, the following preferences are set:
Note: Forms generated without Headstart in this manner will still use the renamed versions
of the OFG libraries. (See Chapter ‘Getting Started’, Section ‘OFG*65.PLL Libraries’ for
more information.)
If the problem does not occur anymore after generation with this debug preference set, it is
likely to be a Headstart or Headstart customization problem.
In both cases, we recommend you use the Headstart Debug Monitor and/or the Forms
Debugger to further localize the code segment that is causing the problem before asking
Oracle for further assistance.
The reason for supplying the debug template and object library is twofold:
• To prevent you from being forced to change the call method of the action items which
call other forms. The call method will usually be set to QMS$AI_OPEN_FORM or
QMS$AI_CALL_FORM. Both procedures are included in the template form, and
consist of a single statement, OPEN_FORM or CALL_FORM, to invoke the other
form.
• To ensure the generated layout is similar to the Headstart-generated form. To
accomplish this, a minimum set of source objects is included in the debug object
library to set the font for text items and GUI items. The source objects do not contain
any trigger logic or any other reference to Headstart functionality.
Neither the template form nor the object library contain any references to Headstart
functionality. Forms generated with the debug template can be run without any QMS library
attached! Whether or not the Headstart libraries will actually be attached to the generated
form, depends on the setting of the MODLIB preference, and the libraries that are attached
through the module network.
Menu Attachment
By applying the debug preference set, the form will be generated with the default Forms
menu attached (controlled through FMNDMA preference). If your problem is related to the
invocation of a form through the menu, you probably want to reset FMNDMA to the original
application menu. To be able to run your form in this case, you will have to generate your
application menu structure without Headstart. To do so, you should set the following
preferences at application level:
These preferences must be set at application level, because they are ignored when set at
module level (bug 777036). Instead of using OPEN_FORM, you are free to use
NEW_FORM or CALL_FORM as the call method in MNUDFC.
Do not forget to re-inherit these preferences from QMS65_RECOMMENDED after you have
finished debugging!!
If the problem does not occur anymore when generated with the debug template, the problem
might be caused by a Headstart customization, or caused by the core Headstart code.
To check this, you should remove any modified QMS program unit from your application or
company libraries, and generate the form with the standard shipped Headstart template and
object library.
• You can view debug messages raised in the Forms client, as well as in the database.
• You can view debug messages raised in an application running on the WEB.
• Some errors or unexpected behaviors do not reproduce when using the Forms
Debugger. The Headstart debugger does not interfere with normal processing
whatsoever, therefore Headstart debug messages are 100% reliable.
• Headstart has included a number of pre-defined standard debug messages, that can
point you in the right direction when tracking down a particular problem.
To be able to view the debug messages in the debug monitor, the user of the runform session
you want to debug must have switched on the Headstart debug mode. You can enable the
Headstart debug mode in two ways:
You should run the Headstart Debug monitor (form qms0002f, located in the
<headstart_home\hst\admin directory) in a separate runform session. In the debug monitor
form, there is a poplist to choose the user you want to debug.
The Debug Monitor uses a DBMS Pipe to send and retrieve the debug messages. The debug
messages are refreshed every 5 seconds.
In order to run the debug monitor you need to have execute privilege on the hil_message
package (to read the pipe) and SELECT privilege on data dictionary view
SYS.V_$DB_PIPES (to select the pipename).
All event handling procedures in qmsevh65 already contain a debug message which displays
the name of the procedure and the name of the event, together with the name of the current
form, the trigger block and the trigger item.
Various runtime initialization actions also log debug messages, describing the runtime setting
performed.
To include debug message in your application, you can use the following procedure call, in
both the forms client and the server:
QMS$ERRORS.SHOW_DEBUG_INFO(‘<debug message>’);
There is an important restriction you should be aware of when using the Forms Debugger in
conjunction with Headstart. If a Headstart-generated form contains a call to
qms$form.keep_start_menu in the PRE-FORM trigger, and you try to run the form in debug
mode, the debugger runs into an infinite loop. This is caused by the REPLACE_MENU
command in procedure qms$form.keep_start_menu in qmslib65.pll which sets the application
menu as specified in QMS$INIT_APPLICATION.SET_START_MENU. Work around is to
remove the call to QMS$FORM.KEEP_START_MENU temporarily.
Note that all required application forms include a call to qms$form.keep_start_menu in the
PRE-FORM trigger.
This release of Headstart must be deployed with Oracle9ias Forms and Reports Services. The
Oracle9ias Forms and Reports Services deployment architecture and configuration steps
deviates significantly from the previous deployment method using a cgi and a windows forms
server. It is therefore highly recommended to consult the following documentation for a
detailed description of Oracle9ias Forms and Reports Services architecture and involved
middle-tier configuration files:
• Oracle9iAS Forms Services Deployment Guide Release 9.0.2 January 2002 Part No.
A92175-01
• Oracle9iAS Reports Services Publishing Reports to the Web Release 9.0 Part No.
A92102-01 February 2002
• How to Execute Reports Services from 9iDS An Oracle9i Reports Technical Note
May 2002
In addition to above documentation look-out for the following white paper regarding
Forms/Reports deployment: “… usage of RUN_REPORT_OBJECT with Oracle9iAS
Reports Services …” available at OTN in the December 2002 timeframe.
Note that you should only use the Oracle9ias Forms and Reports Services in a
Development, Test and Production environment. You should only use the 9ids r2
deployment method for demonstration purposes.
From here – after a applying the middle- tier configuration steps, restart of your 9ias
application server and the database installation - you should be able to run the Headstart
demo – see also <HSD_HOME>\doc\install_for_9i.htm guide - and/or other Headstart
applications. To facilitate your deployment, Headstart provides shortcuts with url examples
that can be adapted to your deployment environment. They are available in
<HSD_HOME>\Environment_Setup\Shortcuts.
You will have to choose in which schema(s) the Headstart Database Objects will be installed.
If this is the case, you will have to decide whether all applications share the same set of
Headstart database objects (this option is called Shared Deployment), or each application will
have its own set (this option is called Self-Contained Deployment).
The Oracle Server allows you to give the following SQL command:
ALTER SESSION SET CURRENT_SCHEMA = <SCHEMA NAME>
What this statement does is simple but very powerful. When encountering references to
database objects (tables, views, packages, etc.) it resolves these references by prefixing the
name of the object with the schema owner as set above. By default, database object
references are resolved by prefixing the object name with the Oracle username that connected
to the application, which is the reason that public or private synonyms are required.
Note that the schema name set through this command is only used to resolve the reference to
the object. It does not affect your security system in any way. You still have to grant access
on the various Headstart and Application database objects to the individual Oracle usernames.
In other words, by using this feature there is no longer a need to create synonyms for each
and every database object that is directly referenced from a Forms application. This allows
you to use the same Oracle username to connect to different Headstart generated applications
which have their own set of Headstart database objects (in other words, which are self-
contained)!
Headstart will issue the Alter Session command for you when you include a call to
qms$application.set_app_schema(<p_app_owner>) to the qms$init_application procedure in
your application library. Note that you should only do this for self-contained applications!
If the application will also contain Reports, each report will need a Pre-Report trigger which
contains a call to srw.do_sql(‘alter session set current_schema = <p_app_owner>’). If you
generate your reports from Designer, you can include this trigger in your Report Template
(note that Headstart does not supply any Report Templates, you can customize one of the
standard Designer templates). In order to store the application owner schema name only once,
you could create a hidden standard report parameter p_app_owner (in the Foundation
Application) that has the schema name as a Default Value. Remember to log into the
Foundation Application with the username/password of the application owner.
Depending on the choices you make, you have to run several scripts to install and grant the
Headstart Database Objects.
Whichever path you have chosen, you will need to grant the following privileges to the owner
of the Headstart objects.
• select on dba_role_privs
• select on dba_tab_privs
• select on dba_synonyms
• select on sys.v_$version
• select on sys.v_$db_pipes
• select on sys.v_$session
• execute on sys.dbms_pipe
• create any synonym
• create role
• drop any synonym
On the ‘Set Installation Options’ screen, install the Template Package and optionally, the
Demo Application (for testing purposes). Do not install the Utilities in your deployment
environment.
The actions you need to perform depend on how you choose to handle synonyms. You can
choose from one of the following three options.
3. Private Synonyms
Options 1 and 2 are attractive because in that case you can give an end user access just by
granting a role which contains all necessary privileges.
If you have chosen Shared Deployment, you need to create grants and synonyms for your
application owner, and grants for the end users.
Public synonyms
You need to create the public synonyms only once.
For the application owner and for every end user of your application, you have to create
grants.
Private synonyms
For the application owner and for every end user of your application, you have to create both
grants and synonyms.
• Logon to SQL*Plus as your application schema owner and run the script
[HSD65_HOME]\hst\scripts\exec_sql to create the procedure.
• Grant execute on qms_exec_sql to the owner of the Headstart Database Objects.
Note: This procedure is automatically created for the Headstart Demo Application owner.
• unld_msg.sql
• unld_rpts.sql
This Headstart release for 9i can only be deployed with Oracle9ias Forms and Reports
Services. It contains the following custom Oracle9ias Forms and Reports Services
configuration files:
• HSD65FORMSWEB.CFG
• HSD65DEFAULT.ENV
• HSD65BASEJINI.HTM
• HSD65REG.DAT
• QMSRF65W.RES
• HST65.JAR
HSD65FORMSWEB.CFG
The hsd65formsweb.cfg file is the Forms90 Servlet configuration file – based on the default
formsweb.cfg - and defines for example:
• Named configurations
Within the Oracle9ias release 2 OC4J environment you can use a custom formsweb.cfg
through a change of this file reference in the
<9ias r2 home>\j2ee\properties\oc4j_bi_forms.properties file.
System and user parameters are defined in hsd65formsweb.cfg. The following parameters
require special attention:
Parameter Description
ORACLE_HOME Your 9ias r2 Oracle home directory
baseHTML Reference to the standard or custom basejini.htm
baseHTMLjinitiator Reference to the standard or custom basejini.htm
envFile Reference to the environment file – here hs65default.env
Term Reference to a custom terminal file
CODE_BASE Should contain a virtual directory that is mapped to the
<ORA_HOME>\Forms90\Java directory.
Archive The name(s) of the jar files needed to run the application,
separated by commas. These will in general be f90all.jar
and hst65.jar. They should either be present in the
CODEBASE location explained above, or be prefixed
with a virtual path.
ServerArgs This string will be passed to the Forms Runtime process
similar to the way you would have launched the form in
Client/Server mode. If you want all keyboard mappings to
work correctly, this parameter should include a section
like: “term=<full_physical_path>/qmsrf65w.res”.
Please note the hardcoded physical path (the
FORMS90_PATH is not used). Also note that you may
use Unix-style slashes even on NT, but not the other way
around.
ServerApp If this parameter is set to anything but “default”, Forms
Server will use the value of this item, suffixed with “.dat”,
as the custom registry file (also see the section
“Registry.dat File” below).
RegistryPath The virtual directory where Forms Server will look for the
custom registry file specified in the above parameter.
When left blank, Forms Server will look for it in the
default location
<ORA_HOME>\forms90\java\oracle\forms\registry
jinit_download_page Your users will need to have JInitiator installed on their
computer to be able to run webforms in their browser. If
they do not have it, and are using Netscape, they will be
automatically redirected to the URL you enter here.
The version of Jinitiator depends on the patches that you
applied to the Oracle Forms installation.
JInitiator 1.3.1.9 is shipped with Headstart as it is certified
against 9.0.2.0.1 of iDS 9i.
LookAndFeel You can set this to ‘generic’ if you want a Windows-style
GUI, or to ‘oracle’ to use the Oracle Look And Feel
(OLAF).
DarkLook If you use lookAndFeel=oracle without darkLook=true,
some prompts will be black while others will be white.
Named Configurations
The hsd65formsweb.cfg already contains sections for all Headstart Applications like the
Headstart demo, server_side install, etc. For example:
[hsd65_demo]
form=hsd0000f.fmx
userid=hdemo65/hdemo65
Most likely you only need to add your configuration sections for your custom configurations
to the hsd65formsweb.cfg file for example:
[my_app]
form=myapp0000f.fmx
Note that you do not need to evaluate all other parameters in the hsd65formsweb.cfg for your
specific custom applications.
HSD65DEFAULT.ENV
The hsd65default.env file – based on default.env - is the form90 environment file where you
can setup your environment variables:
• ORACLE_HOME
• NLS_LANG
• FORMS90_MAPPING
• FORMS90_OUTPUT
• FORMS90_REPFORMAT
• HSD65_CDM_MAPPING
• REPORTS_PATH= Lists all directories that include reports and report libraries used
by your application
• TNS_ADMIN
Typically you should evaluate the following variables to setup your custom application:
• FORMS90_PATH
• REPORTS_PATH
Note that the hsd65default.env file is referred once in the generic part of hsd65formsweb.cfg.
You are able to refer different environment files – along with other parameters - in the
configuration part of hsd65formsweb.cfg, see also section “Multiple Environments” below.
Consider an evaluation of the hsd65default.env file when you planning to install new 9ias r2
software since hsd65default.env is based on a copy of the standard default.env from around
September 2002.
HSD65BASEJINI.HTM
The hsd65basejini file – based on basejini file default.env - is the default base html file for
running a form on the web using Jinitiator-style tags.
This specific hsd65basejini.htm file is called through the baseHTML and baseHTMLjinitiator
parameters in the generic part of hsd65formsweb.cfg. Normally you do not need to make any
changes to this file for your custom application.
When making changes, please note that many settings occur in two places. That is because
the browsers that support JInitiator (Netscape and Internet Explorer) use different ways to
launch the Forms applet. The document is constructed so that each browser ‘sees’ it’s own
native code. The <PARAM> tags are used by Internet Explorer, the <EMBED> statement by
Netscape
Consider an evaluation of the hsd65basejini.htm file when you planning to install new 9ias r2
software since hsd65basejini.htm is based on a copy of the standard basejini.htm from around
September 2002.
This specific hsd65reg.dat file is called through the RegistryPath and serverApp parameters
in the generic part of hsd65formsweb.cfg. Normally you do not need to make any changes to
this file for your custom application.
You may consider an evaluation of the hsd65reg.dat file when you planning to install new
9ias r2 software since hsd65reg.dat is based on a copy of the standard registry,dat from
around September 2002.
QMSRF65W.RES
Headstart supplies this terminal resource file for running Headstart applications on the web.
This resource file has the key mappings identical to running a Forms application client/server
on MS Windows. For example, F7 is set to Enter-Query and F8 is set to Run Query.
This specific qmsrf65w.res file is called through the term parameter in the generic part of
hsd65formsweb.cfg. You most likely do not need to make any changes to this file for your
custom application.
HST65.JAR
Headstart supplies a hst65.jar file that contains custom icon files – referred for example in the
iconic tool bar.
This specific hst65.jar is called through the archive_jini parameter in the generic part of
hsd65formsweb.cfg. You most likely do not need to make any changes to this file for your
custom application.
Virtual Directories
The following virtual directories are used by the Headstart Oracle9ias OC4J runtime
environment – you can lookup the forms90.conf file (see
<HSD_HOME>\Environments_setup\9iasr2conf directory) for the correct syntax file:
Virtual Directory Description
/hsd65html/ This directory stores the Headstart HTML files, and
the custom version of the Registry.dat file.
/hsd65java/ Contains the Headstart Java archive, hst65.jar. Is
referred to in the default value for the Archive
parameter.
/hsd65icons/ Contains the GIF files Headstart uses for the
toolbar icons.
/hsd65-help/ Contains the html help files and associated .gifs for
your applications. Is referred to by the environment
variable HSD65_HELPFILE_WEB_PATH.
/hsd65-cdm/ Necessary if you want to run the Headstart Utilities
on this server. Referred to by environment variable
Multiple environments
Different stages can be identified in an application lifecycle. These stages are generally
implemented in separate environments e.g. development, test, production.
Each of the environments has its own set of database objects (tables, packages, etc.) and file
system objects (forms, libraries, etc.). The set of database objects that are used in an
application is defined by the account that is used to connect to the database. The set of file
system objects is defined by environment variables such as Forms90_path, etc.
Environment variables are defined in a so-called .env file like hsd65default.env that is
supplied with Headstart.
If you choose the latter method it is highly recommended to consult the documentation as
mentioned at the beginning of this chapter.
Note that depending on your middle-tier environment setup you could use multiple
“default.env” files to define each environment and refer to these different files in the
hsd65formsweb.cfg:
..
..
[hsd_dev]
form=hsd0000f.fmx
envFile=[DEV_HOME]\html\hsd_dev.env
[hsd_test]
form=hsd0000f.fmx
envFile=[TEST_HOME]\html\hsd_test.env
..
..
In the example above, two configurations are defined, each using their own environment file.
• http://<hsd65-server>:<port>/forms90/f90servlet?config=hsd_dev
• http://<hsd65-server>:<port>/forms90/f90servlet?config=hsd_test
Note: the environment files are in a different directory and have different names. The latter is
to stress that the files are different.
If you have a lowercase file name on UNIX, but a form or library expects it to be (partly) in
uppercase, you can make a so-called link.
Example: suppose you have a file named qmslib65.pll, but one of your libraries refers to it as
QMSLIB65.pll.
Go to the UNIX folder where you stored qmslib65.pll and perform the following command:
ln qmslib65.pll QMSLIB65.pll
This creates a 'synonym' QMSLIB65.pll which points to the real file qmslib65.pll, and the
reference from your other library will work.
For a more detailed discussion on case sensitivity issues, see chapter “Getting Started”.
This section will list the objects that are used by Headstart in your deployment environment.
Files
Required Application Forms
• qms0002f: Debug Monitor form
• qms0004f: Change Password form
• qms0006f User Preferences form
• qms0008f: About this Application form
• qms0010f: About this Record form
• qms0012f: Report Launch Form
• qms0014f: Shuttle Control Object Selector
• qms0020f: Help on Message form
Headstart Libraries
• qmsevh65: event handler library
• qmslib65: core Headstart library
• qms0004l: module specific library for form qms0004f
• qms0006l: module specific library for form qms0006f
• qms0012l: module specific library for form qms0012f
• qms0014l: module specific library for form qms0014f
Environment Variables
• FORMS90_PATH
• HSD65_HOME
• HSD65_HELPFILE_WEB_PATH
• HSD65_IMAGEFILE_PATH
Unix Links
If the deployment server is a Unix server, the installer will create the following links to
overcome the problem of case sensitive file names.
• OFGBSL65.pll
• OFGCALL65.pll
• OFGHPL65.pll
• OFGMES65.pll
• OFGMNL65.pll
• OFGNAVL65.pll
• OFGTAB65.pll
• OFGTEL65.pll
• OFGTREEN65.pll
• QMSEVH65.pll
• QMSLIB65.pll
Database Objects
Tables and Table API’s
• QMS_USER_OPTIONS
• QMS_MODULES
• QMS_MDE_PARAMS
• QMS_STND_REP_PARAMS
• QMS_MESSAGE_PROPERTIES
• QMS_MESSAGE_TEXT
• QMS_REF_CODES (no Table API)
• QMS_TRANSACTIONS (no Table API)
Oracle Sequences
• QMS_MDE_SEQ1 (populates QMS_MODULES.ID)
• QMS_MPM_SEQ1 (populates QMS_MDE_PARAMS.ID)
• QMS_SRP_SEQ1 (populates QMS_STND_REP_PARAMS.ID)
• QMS_TRANS_SEQ (populates QMS_TRANSACTIONS.ID)
This chapter discusses customization of the Headstart Template Package. The following
topics are covered:
• Impact of customizations
• Customization of Headstart PL/SQL Libraries
• Customization of Headstart Object Library
• Customization of Headstart Menu and Smartbar
• Customization of Required Application forms
• Changing End User language
• Using Your Own Message Dictionary
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Template Package 19 - 1
Impact of Customizations
Most likely, at least one of the following situations is applicable to your organization:
Without a structured approach to the customization of Headstart, you are likely to encounter
one of the following problems:
• Two applications are using different versions of the same library form. This implies
you cannot install them in the same runtime environment!
• Two applications are using different versions of the same template and/or referenced
form. This implies you cannot maintain these applications in the same maintenance
environment.
• Configuration management becomes very (too) complex, with multiple versions of the
same source co-existing within one application as well as across multiple application
systems.
• When receiving a new version of Headstart, you risk losing customizations made to
the previous version of the Headstart code.
Part of the potential problems will be prevented by Oracle because of the naming conventions
Headstart applies. All Headstart template forms, referenced forms and library forms hold the
release number in the name (qmstpl65.fmb, qmslvt65.fmb, qmslib65.pll, etc.).
Follow the customization instructions in the next section to minimize the risk of running into
one or more of the aforementioned problems.
19 - 2 Customizing the Headstart Template Package Headstart Oracle Designer 6.5 - User Guide
Customizing Headstart PL/SQL Libraries
This section discusses the general approach to take when you want to make customizations to
the Headstart Libraries.
Never modify code directly in the two shipped libraries qmslib65.pll and qmsevh65.pll:
Instead, you should copy the event handling program unit in qmsevh65.pll you want to
change to your application library and make the desired modifications in this library. Do not
forget to update the change history record! As the MODLIB preference is set to your
application library (or a module specific library that has the application library attached), this
library will always be attached first in the sequence of attached libraries, overruling the same
procedure in qmsevh65.
• If several applications are installed in the same runtime environment, they can all
share the same QMS library.
• By opening the application library you immediately have an overview of the modified
QMS program units. This is very convenient for debugging purposes as well as
upgrading to a new Headstart version.
• You easily apply patches to the QMS libraries by simply copying them over the old
files.
Note: Try to avoid the drag and drop of packages from QMSLIB65 into your application
library. Instead, trap the procedures that call this package in qmsevh65.pll, and drag and drop
this procedure to your application library, and replace the call to the QMS package, with a
call to your own package. (You might cut and paste code out of the original QMS package,
as long as you give the package a different name.)
If for some reason, you do have a need to drag and drop a QMS package into your application
library, you should stick to the following rules:
If you do not apply these rules, your application probably will raise runtime errors varying
from program errors and value errors to General Protection Faults! This is caused by the
PL/SQL engine in Forms which references packaged program units and variables based on
sequence numbers within the package, not on names.
If you want to make customizations to QMS program units that should apply to all your
applications, you should consider introducing a company library (organization-wide library)
in addition to the application library. This company library holds the modified QMS program
units (and additional custom made program units) that should be used by all applications.
This company library should be attached before the QMS library, but after the application
library to allow for application specific deviations from the company 'standard':
Module Library -> Application Library -> Company Library -> qmsevh65 -> qmslib65
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Template Package 19 - 3
Name Resolution in Module Specific Libraries
When making module specific customizations to the Headstart PL/SQL libraries, there is an
issue you need to be aware of.
Since version 5.0, Forms only performs name resolution once per session for performance
reasons. This means that if you have a procedure of the same name in two different libraries,
Forms will always use the first version of the procedure called during that session. The
problem this causes is best understood through an example.
• Suppose library qmsevh65 contains a procedure ‘abc’ which displays the message ‘abc
in qmsevh65’. The first line in procedure qms$event_form in qmsevh65 calls
procedure abc.
• Thus, on startup any Headstart form will display the message ‘abc in qmsevh65’.
• Module test1 has a module specific library, test1.pll, which contains its own version of
procedure ‘abc’ which displays the message ‘abc in test1.pll’. The module specific
library is the first attached library, the application library, qmsevh65 and qmslib65 are
attached to the module library.
• When you run module test1 directly, the message ‘abc in test1.pll’ is correctly
displayed.
• However, when you first start another Headstart form, Forms performs the name
resolution to the qmsevh65 version of procedure ‘abc’. That form will display the
message ‘abc in qmsevh65’ as it should. But, when you then call module test1, the
name resolution is not performed again, so test1 also displays ‘abc in qmsevh65’
instead of ‘abc in test1.pll’ !!
You will not encounter this problem with application-wide customizations which are stored in
the application library. The application library is attached to all forms, so there is no problem
in that the name resolution of the first form is re-used over and over again.
You also will not encounter this problem when the program unit is called directly from the
form. The name resolution is performed once for each calling entity. Since the calling entity
is now the form and not qms$event_form in qmsevh65.pll, the naming resolution is
performed again. This means that you can safely customize any event handler in qmsevh65,
since they are all called directly from the form.
You will only encounter this bug when you use a module specific library to customize a
Headstart program unit which is not called directly by the form, but rather by another
Headstart program unit. (This includes almost all program units in qmslib65.)
• Copy the chain of calling program unit(s) to the module specific library, even if you
do not want to customize these program units. In the above example, this would mean
you must also copy qms$event_form to the module specific library. At runtime, the
instance of qms$event_form in the module library will be called, causing Forms to do
a new name resolution since the calling entity is different. This is the preferred
workaround, but not always feasible if the program unit being customized is called
from various places.
19 - 4 Customizing the Headstart Template Package Headstart Oracle Designer 6.5 - User Guide
• Only copy the calling program unit to the module specific library and replace the call
to the program unit you want to customize with a call to a renamed version of this
program unit. In this example, this would mean that only qms$event_form is copied
to the module specific library, and the call to ‘abc’ is changed to call a new module
specific procedure ‘abc_custom’.
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Template Package 19 - 5
Customizing the Headstart Object Library
This section discusses how to customize the Headstart Object Library.
Oracle Designer 6i allows you to specify multiple object libraries when generating your
forms. Use the STOOLB preference to define a list of one or more object libraries. If you
have multiple object libraries, use semi-colons to separate object library names.
Form Generator searches through object libraries for a particular object in the order in which
you specify the object libraries. Note also that Form Generator attempts to use the first object
it locates with the correct name (regardless of the object's type).
The FM2LIB61 utility, shipped with Oracle Designer 6i, plays a key role in the approach you
should follow. The FM2LIB61 utility allows you to work around a major limitation of object
libraries in general, which will be discussed in the first two sections. This utility also allows
you to preserve as much as possible your customizations made to the Headstart Object
Library when a new version of Headstart is released, which will be discussed in the last
section.
You cannot create and maintain objects in the object library itself. You need to create an
object in a normal forms module, and drag and drop it into the object library. If you
subsequently want to modify the object definition, you will have to drag and drop it back into
a normal form, edit it, and drag and drop it back into the object library, replacing the old
object definition.
When an object is dragged to the Object Library, a Copy operation always ensues (note that
you don't get the option to "Copy" or "Subclass"). As part of the Copy operation, all
subclassing relationships are "flattened", in other words, the subclassing relationship is lost
and property values are a snapshot. The big problem here is that you also lose subclassing
links to objects that reside in the same object library.
We will illustrate the impact of this limitation with two objects in the Headstart object library:
CGSO$BLOCK and CGSO$BLOCK_MR. It makes sense to subclass CGSO$BLOCK_MR
from CGSO$BLOCK as there are many properties and triggers that will apply to all blocks,
regardless of the block being multi-record or not. You can do this in three steps:
Now, you start generating your forms. All your single-record blocks subclass from
CGSO$BLOCK, all your multi-record blocks subclass from CGSO$BLOCK_MR.
Then, you decide to add a trigger, say KEY-DELREC, to all your blocks. You add the trigger
to CGSO$BLOCK in the maintenance form qmsolm65.fmb that mirrors the object library,
and drag and drop the new CGSO$BLOCK definition into the object library (qmsolb5.olb),
replacing the old definition. You would expect all blocks in the forms to automatically
inherit the new KEY-DELREC trigger, but this does not happen! Only the single-record
19 - 6 Customizing the Headstart Template Package Headstart Oracle Designer 6.5 - User Guide
blocks will inherit the trigger, the multi-record blocks will not. This is caused by the fact that
the subclassing link from CGSO$BLOCK_MR to CGSO$BLOCK is lost upon dragging the
block into the object library!
Fortunately, Designer is shipped with a very useful utility, FM2LIB61, that enables a very
workable work around to this problem.
Basically, the FM2LIB61 utility takes all objects in a normal forms module, and copies them
into an object library. Using this utility, you would implement the example above a little
differently:
Now, if you want to add the KEY-DELREC trigger to all already generated forms, you
simply perform the following steps:
Because the subclassing link is kept within the maintenance form, block
CGSO$BLOCK_MR inherits the KEY-DELREC trigger as well. The FM2LIB61 utility
subsequently refreshes all object definitions in the object library, adding the KEY-DELREC
trigger to both CGSO$BLOCK and CGSO$BLOCK_MR.
Headstart supplies form QMSOLM65.FMB as the object library maintenance (OLM) form.
This form mirrors the content of the Headstart Object Library.
To create the object library from this maintenance form using the FM2LIB61 utility, you
should set up the FM2LIB61 registry key as follows:
TAB 1: ID1 = 'QMSSO$', NAME = 'QMS OBJECTS'
TAB 2: ID1 = 'CGSO$' , NAME = 'CGSO OBJECTS'
A registry file, qmsolb65.reg, is supplied in the hst\admin directory to automatically create
these two entries. The registry entries are added by double-clicking on this registry file. Note
that you should not run the fm2lib61.reg file shipped with Oracle Designer, as this will create
additional TAB entries which are not required. If you already ran the fm2lib65.reg file, you
should remove the tab keys TAB 3 to TAB 8.
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Template Package 19 - 7
To recreate the Headstart Object Library, the FM2LIB61 utility can be run using the
following command line:
fm2lib61.exe -i qmsolm65.fmb -o qmsolb65.olb
The next steps depend on the type of customization you want to make:
• Create the new object in your OLM form, prefix the name with your application
shortname, concatenated with ‘SO$’ (SO stands for source object). For example, an
application to Locate Unknown Travelers will have a prefix of ‘LUTSO$’.
• Add an entry to the FM2LIB61 registry to register your application prefix, and to
create a separate tab in the object library with your application specific objects. In the
above example, you would add the following new key:
TAB 3: ID1 = 'LUTSO$', NAME = 'LUT OBJECTS'
• Run the FM2LIB61 utility to create your custom object library. If you named your
OLM form lutolm10, the command to do so would be:
• Source objects that can be subclassed directly by generated objects. These objects are
prefixed with CGSO$ or QMSSO$.
• Standard objects that need to be present in generated forms, but are not ‘subclassable’
by other objects. These objects are prefixed with QMS$, and are grouped into object
groups. These object groups are prefixed with QMSSO$ and are subclassed into the
template forms.
• Subclass the object from qmsolm65 into your own OLM form
19 - 8 Customizing the Headstart Template Package Headstart Oracle Designer 6.5 - User Guide
• Modify the object as required
• Save your object library maintenance form
• Run the FM2LIB61 utility to create your custom object library
Note that if you apply this approach, you cannot delete a trigger that belongs to the object. If
you try to delete a trigger from a block or item that you subclassed into your object library
maintenance form, the following error will be raised:
FRM-15103: Can’t delete <trigger name> because its parent
is subclassed.
You have two options to work around this limitation:
• Copy instead of subclass the object into your OLM form. This has the disadvantage,
that when a new version of Headstart is released, you do not automatically inherit the
Headstart changes. You will have to manually resolve the differences between the
new version of the object as shipped with Headstart, and the old version of the object
modified by you.
• Change the trigger text to Null.
• Subclass the object group that contains the object you want to change into your own
OLM form. As you will see, all objects within the object group are subclassed into
your OLM form as well.
• Modify the object as required
• Save your object library maintenance form
• Run the FM2LIB61 utility to create your custom object library
This approach works fine, as long as your customization does not involve the deletion of a
‘child-object’ that belongs to an object within the object group. For example, it is not
possible to delete an item of a standard block, nor a trigger of an item. If you try to delete
such a child object, the following error will be raised:
FRM-15103: Can’t delete <object name> because its parent
is subclassed.
To work around this limitation, you will have to do the following:
• Before subclassing the object group as a whole into your OLM form, you copy the
object you want to modify into your OLM form.
• Now subclass the object group into your OLM form. All objects in the object group
will be subclassed into your OLM form, except for the object you already copied into
your OLM form.
• You are now able to delete any child object of the copied object.
• Save the OLM form and run the FM2LIB61 utility to create your custom object library
Because you first copied the object you want to customize, the object group changes its
reference from the original object in qmsolm65, to the copied object in your own OLM form.
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Template Package 19 - 9
However, be aware of the following: when you copy an object that is subclassed from
another object, this subclassing link is lost during the copy operation. After the copy
operation you will have to re-establish those links.
19 - 10 Customizing the Headstart Template Package Headstart Oracle Designer 6.5 - User Guide
Customizing the Menu and Smartbar
To customize the menu or Smartbar, perform the following steps.
Depending on the changes you make, you will probably also need to customize the Headstart
core library, qmslib65.pll. This library contains the code which controls the context sensitive
enabling and disabling of menu options. Specifically, you must determine if your changes
affect the following packages.
• QMS$CONTEXT
• QMS$MENU
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Template Package 19 - 11
Customizing Required Application Forms
Headstart Required Application Forms are forms that are required to run your application
generated with Headstart. The need for most of these forms comes from the Headstart menu
template, which contains a number of menu options that call the following required
application forms:
The last required application form is qms0020f ‘Help on Message’ which is called by the
Headstart Message Handling system, when the user presses the Help button on the message
alert box.
All required application forms are 100% generated with the Headstart templates. The
repository module definitions can be found in the QMS65 application system folder.
Basically, you can simply change the module definitions in the Designer repository according
to your requirements, and generate the forms again. Do not make the changes in the QMS
application system. Copy the modules to your own application system first.
The required application forms are set up for use in multiple applications. If you generate
multiple applications with the Headstart templates, you can use the same set of required
application forms to serve all your Headstart-generated applications (provided that they are
deployed in the same runtime environment).
Because the forms can be shared across applications they only need to be renamed if you
customize the forms.
Headstart uses a package procedure which contains variables which hold the names of the
required application forms. To change the initialization of these variables, you need to
change the form name in the following procedure calls in procedure
QMS$INIT_APPLICATION in your application library:
qms$config.set_change_password_form ('qms0004f');
qms$config.set_user_prefs_form ('qms0006f');
qms$config.set_about_application_form ('qms0008f');
qms$config.set_about_record_form ('qms0010f');
qms$config.set_report_launch_form ('qms0012f');
qms$config.set_message_help_form ('qms0020f');
19 - 12 Customizing the Headstart Template Package Headstart Oracle Designer 6.5 - User Guide
Changing End User Language
If you want to change the language presented to the end user, you must make the following
modifications in the Headstart template package:
You should copy and rename the template form before making the modifications discussed
below. Refer to the previous section for the steps to perform to carry through these name
changes.
To translate the menu template, you must change three properties of all menu items:
• Label. (Do not forget to check for the uniqueness of the mnemonic access key of the
menu label. This key is ALT+<Letter> combination with the letter being the letter in
the label that is prefixed with &-sign.)
• Hint (text)
• Help (text)
Suggestion: The FILE, EDIT and HELP menu item labels are
largely based on MS Excel and MS Word. You can take the menu
item labels used when running MS Excel or MS Word in your native
language as a starting point.
Note that you cannot change the name of the items appearing in the WINDOW submenu.
These items are created automatically by Oracle Forms if you define the WINDOW submenu
as a ‘Magic Item’ of type ‘Window’.
One menu label is set dynamically depending on the mode the form is in. This label is set to
'Enter Query' (if form is in normal mode) or 'Show Last Criteria' (if form is in query mode).
To translate these dynamic labels, you must change the following procedure calls in
QMS$INIT_APPLICATION in your application library:
qms$config.set_entqry_label ('Enter');
qms$config.set_lstqry_label ('Show Last Criteria');
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Template Package 19 - 13
To translate the object library, you must make the following modifications in your object
library maintenance form.:
Translating Messages
You can use the Message form in the Headstart Foundation Application to add languages for
a message.
To have the messages displayed runtime in the correct language, the end user must invoke the
‘Preferences’ form under the Edit-menu and set the language as desired.
To translate the required application forms, you must change the domain allowable values
and the prompts, item group labels, and user help text of the corresponding module
definitions in Oracle Designer. The module definitions of the required application forms are
stored in the QMS65 application system folder.
• QMS_WIZ_BUTTONS
• QMS_LOV_BUTTONS
• QMS_MSEL_LOV_BUTTONS
• QMS_DIALOG_BUTTONS
Each reusable module component contains a number of unbound button items. For each
button, you should translate the Prompt, the Hint and the User Help text.
Make a copy of each reusable module component and modify the copy instead of the original
in the QMS65 application system.
19 - 14 Customizing the Headstart Template Package Headstart Oracle Designer 6.5 - User Guide
Using your own Message Tables
You might want to use your own database tables to store the message information. Changing
Headstart to use you own database tables is easy through the Headstart Interface Layer (HIL)
packages.
All read access in the Headstart Template Package to the message database tables is routed
through the package HIL_MESSAGE. Each procedure/function in this package calls a
procedure/function in the package QMS_MESSAGE. You’ll have to write your own package
(OWN_MESSAGE) and change the calls in HIL_MESSAGE to your package. Read the
package specification of HIL_MESSAGE to identify what each procedure/function must do.
Note that the HIL packages are read-only, they are intended to make the template Package
independent from the message data structure.
The form shipped with the Headstart Foundation Application to maintain the message tables,
directly operates on these tables, and does not use the HIL packages. This means that you
will have to create a new form to maintain the messages, that operates on your own message
tables.
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Template Package 19 - 15
(blank page)
19 - 16 Customizing the Headstart Template Package Headstart Oracle Designer 6.5 - User Guide
CHAPTER
This chapter gives you guidelines for customizing the Headstart Utilities. It includes the
following topics:
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Utilities 20-1
Exclude CDM Quality Checks
The Headstart Utilities Quality Checks are based on the standards as recorded in Oracle’s
Custom Development Method. Since you may have different standards or want to deviate
from the CDM ones, a Quality Check can be excluded. The Headstart Utility Administrator
can do this in the Administration Application by simply setting the ‘Comply to’ pop-list to
‘No’ . Standards with ‘Comply to’ = ‘No’ will not be checked anymore by the Headstart QA-
checks. They will be reported however in the QA-check results if you set the user preference
‘QA Details Creation - Non Complied Standards’.
20 - 2 Customizing the Headstart Utilities Headstart Oracle Designer 6.5 - User Guide
Creating your own QA-set
The Headstart Utilities contain the possibility to group standards of different elements
together in a QA-set. You can also leave standards out because you do not want to check
them yet. This is especially useful if you only want to check certain aspects of the elements
(e.g. only standards that apply to the ‘Logical Database Design (DB.010) and element Tables
and not aspects of the physical table implementation which are checked in DB.040 Physical
Database Design).
The standard Headstart Utility installation comes with a number of QA-sets that are directly
related with the CDM Deliverables. The Headstart Utility Administrator can create new QA-
Sets in the Utilities Administration Application.
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Utilities 20-3
Adding your own Quality Checks to existing utilities
If you want to create your own quality checks (for element types that are already checked by
the Utilities) take the following steps (each step is illustrated by a running example of adding
a check on the length of a column name):
Example: You want to add a check for the element type Column.
2. Determine the parent element type of this element type. Currently you are limited to
the primary element types for which utilities already exist (Application Systems,
Domains, Entities, Events, Functions, Tables, Views, Sequences, Modules, Reusable
Module Components, PL/SQL Definitions, Oracle Databases, Non-Oracle
Databases).
Example: The element type Column belongs to parent element types Table and
View.
3. Determine which property of the element type you want to check. If you can not
pinpoint one property, the check is for the element type in general.
20 - 4 Customizing the Headstart Utilities Headstart Oracle Designer 6.5 - User Guide
5. Determine the short name of the element type (for instance from the LOV on
Element Type in the Standards form).
9. Save the SQL script and run it under the Utilities owner.
Example: Save the changed qa_col.pkb, log into SQL*Plus as HSU65 and run the
script.
10. Start the Run Utility form and run the Quality Checks for the parent element type.
Example: Run the Quality Checks for Tables. It will apply the check for PRJ-00001
to all columns of the selected tables.
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Utilities 20-5
Before creating your own utilities
Before you create your own Utility (Quality Check or Productivity Booster) you should check
if the right base layer packages are available.
• Investigate which Designer element types you will use in your utility.
• Determine the short names of those element types. You can find the correct element
type short name in file [Oracle Home]\CDOC72\model\el_defs\outer_frame_de.htm
• Look in the folder [Headstart Home]\hsu\scripts\bl for scripts named bl<element type
short name>.pks or .pkb. They contain the source code of the Base Layer package for
that particular element type. For a description of the Base Layer see file [Headstart
Home]\doc\bldoc.htm.
If one of the associated Base Layer packages does not exist, create it first.
• Check if the database initialization parameter utl_file_dir is set. The package scripts
will be generated into one of the directories specified by this parameter. If you set
utl_file_dir = * in the init.ora (or equivalent) file, you can generate the scripts to any
directory on the database server.
• Log into SQL*Plus as the Headstart Utilities owner, and run [Headstart
Home]\hsu\scripts\bl\gen_bl.sql. You will be prompted for the element type short
name and the database server directory to which the scripts must be generated.
• Still logged in as the Headstart Utilities owner, execute the bl<short name>.pks and
bl<short name>.pkb scripts to create the new base layer package.
20 - 6 Customizing the Headstart Utilities Headstart Oracle Designer 6.5 - User Guide
Creating your own Productivity Boosters
If you want to create your own Productivity Boosters take the following steps (the hsu_ex.pks
and hsu_ex.pkb scripts can be used as an example).
1. Give your utility creation scripts the file names <package name>.pks and <package
name>.pkb.
Example: Write files prj_utl1.pks and prj_utl2.pkb, which create the specification
and body of package prj_utl1.
Suggestion: First look for an existing utility that loops over roughly the same
objects as your planned utility, copy the scripts of that package and modify
them.
Example: Add the new utility to the user group ‘All Productivity Boosters’.
4. Possibly add the utility to a suitable parent node.
Headstart Oracle Designer 6.5 - User Guide Customizing the Headstart Utilities 20-7