Vous êtes sur la page 1sur 8

C

BUSINESS OBJECT
INHERITANCE

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.

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.

2016 Oracle Proprietary and Confidential

Business Object Inheritance

Chapter 6

Objectives

10-Oct-16

Oracle Configuration Tools Training Workbook

Walk Thru - Add Simple Validation To A New Child BO


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.

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-ugbu07.us.oracle.com:7700/spl/cis.jsp?debug=true.

Note. You'll learn more about debug mode later in this class.

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

6 - 2 Business Object Inheritance

2016 Oracle Proprietary and Confidential

Oracle Configuration Tools Training Workbook

10-Oct-16

Navigate To The Business Object Page


Open the Business Object page (it's on the Admin menu) and display the
CI_ConservationProgram business object:

Business Object - Main

Chapter 6

2016 Oracle Proprietary and Confidential

Business Object Inheritance

10-Oct-16

Oracle Configuration Tools Training Workbook

Duplicate The Business Object


Press the duplicate button (or Alt-D). When the duplicate window opens, enter a
Business Object name of XXX_ConservationProgram where XXX are your initials and
then click OK.
After the business object page appears, make the following updates:
Add your initials to the Description (so that you can distinguish yours in
dropdowns)

Change the Parent Business Object to CI_ConservationProgram

Navigate to the Schema tab and include CI_ConservationProgram's schema


rather than C1-ConservationProgram
Save your work.

Your New Business Object - Main

Your New Business Object - Schema

6 - 4 Business Object Inheritance

2016 Oracle Proprietary and Confidential

Oracle Configuration Tools Training Workbook

10-Oct-16

Create A New Validation Algorithm


Click the Create Algorithm button in the dashboard zone:

Dashboard Wizard Zone To Create A New Plug-In Algorithm

When prompted, indicate you want to create a BO Algorithm (rather than a BO Status
Algorithm). You will then be asked to enter basic information about your new algorithm.
Please supply the following information:

Name: XXX_CP_VAL1 (where XXX are your initials)

Description: XXX Conservation Program Supplemental Validation

System Event: Validation

Sequence: 10

Chapter 6

Add A BO Algorithm Information

2016 Oracle Proprietary and Confidential

Business Object Inheritance

10-Oct-16

Oracle Configuration Tools Training Workbook

When you click Save, the system will add a plug-in script, an algorithm type, an
algorithm, and plug the new algorithm in on the BO in the specified System Event. It will
then transfer you to the new plug-in script's Steps tab where you should create the
following edit data step:

Script - Edit Data

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;

6 - 6 Business Object Inheritance

2016 Oracle Proprietary and Confidential

Oracle Configuration Tools Training Workbook

10-Oct-16

Chapter 6

2016 Oracle Proprietary and Confidential

Business Object Inheritance

10-Oct-16

Oracle Configuration Tools Training Workbook

Review Questions
1. A stand-alone data area can be included in an unlimited number of BO schemas.
True/False
2. If you add, change or remove an element from a stand-alone data area, you must
display and save all BO's that include it. True/False
When you save a stand-alone data area, the framework dynamically changes all
business objects that include it; no "recompilation" is necessary.
3. You can use the Schema tab on the Data Area maintenance page to see all of the
business objects that include the data area. True/False
4. If a BO includes a parent BO's schema, and the parent BO's schema includes a
stand-alone data area; you can easily see all elements in the child BO by clicking the
View Schema hyperlink on the BO - Main page. True/False
5. A BO's parent BO must be part of the same MO. True/False
6. A parent BO's schema is automatically included in all of its children. True/False
7. It's a good practice to include a parent BO's schema in a child BO. True/False
This way, if the parent changes, the children (and grandchildren, and great
grandchildren, etc.) change automatically.
8. If you add or remove a Validation plug-in from a parent business object, you must
"recompile" all child BO's for the change to take effect. True/False
When you add or remove a plug-in from a parent BO, the framework affects the
change immediately; no "recompilation" is necessary.
9. A plug-in that's been developed for one child BO can be used by any number of
other BO's. True/False
But, if you've developed a BO hierarchy, it's probably a better idea to plug the
algorithm in on the parent BO rather than on each individual child BO.
10. A BO that's owned by the base-package cannot be changed by an implementation
team. True/False
While the implementation team cannot change the schemas of base-package owned
BO's, they can add additional plug-ins and disable base-package plug-ins (and a few
other things) without having to create a child BO.
11. A BO that's owned by the base-package cannot be used as a parent BO by an
implementation team. True/False
Allowing implementations to add elements to our BO's is a big part of our value as
we develop fully functioning, robust BO's that can then be easily extended by our
customers without having to perform database changes, Java builds, etc.
12. If you plan to create a BO hierarchy that's more than 3 levels deep, it's probably wise
to get a second opinion. True/False
BO hierarchies are as tempting as class hierarchies and can be equally misused
and, ironically, result in a maintenance nightmare as it becomes difficult to find where
logic is executing.

6 - 8 Business Object Inheritance

2016 Oracle Proprietary and Confidential

Vous aimerez peut-être aussi