Inheritance
Overview
Distribution
Job Title*
Ownership
The Job Title [list@YourCompany.com?Subject=Exercises for Lesson 6: BO Inheritance:
344617794.doc] is responsible for ensuring this document is necessary, reflects actual practice,
and supports corporate policy.
Lesson Overview
Up to now, you've learned to define a BO's data structure and basic business rules. In this
section, you'll learn techniques to avoid redundant logic.
Note. Additional reuse techniques will be unveiled in later chapters.
Lesson Objectives
By the end of this chapter, you will be able to:
Understand how you can create a hierarchy of business objects so you can
encapsulate business rules on "super class" BO's rather than repeat common rules
that are shared by many business objects.
Understand how implementation teams can extend the base package business rules
by creating a BO hierarchy (where the base-package BO is at the top of the hierarchy).
Create common data structures that can be reused amongst business objects.
Overview
In this walk thru, you'll create a new child BO and add validation to it. Note, in real life, you
wouldn't have to put the validation on a new child BO, rather, you'd put it on the base-package
BO, but doing it this way allows us to avoid concurrency issues with multiple team updating the
same BO.
Tasks
1. Enter The System In Debug Mode
Later in this exercise, you will use a function that requires "debug mode" to be enabled.
To enable this mode, suffix ?debug=true to the URL used to enter the system and then
redisplay the script you just created . For example, if you entered the system with the
URL of http://sf-ugbu-07.us.oracle.com:7700/spl/cis.jsp, you'd enter http://sf-ugbu-
07.us.oracle.com:7700/spl/cis.jsp?debug=true.
Note. You'll learn more about debug mode later in this class.
2. Add A New Error Message
Navigate to the Admin - Message page and add a new message by pressing the +
button in the grid and entering the following information:
Message Number: 15xx (where XX is your team's number, for example, if you're in
team one, you'd enter a message number of 1501)
Message Text: Start date cannot be in the future
New Message
The framework is not able to validate information within double quotes (i.e., the Xpath),
therefore take care with what you enter. If you have entered invalid Xpath, you'll see a
"nasty" error at execution time.
Navigate to the Main tab and set the Script Engine Version to 2.0 as you are using Xpath
2 in your script. If you don't do this, you can't use the date casting function (xs:date).
Script - Main
When you save the script, you're ready to test your work. To do this, choose Admin -
Conservation Program + and see if your validation works as desired. Note, you should
see the description of your BO in the dropdown that appears when initiate the addition of
a new conservation program.
Instructors Notes
The xpath to check if startDate is before the current date (note $CURRENT-DATE is a global
and they can read about more globals in the script tips):
if ("xs:date(parm/hard/newBusinessObject/generalInfo/startDate) > xs:date($CURRENT-DATE)
")
terminate with error (90000, xxxxx element='generalInfo/startDate');
end-if;