You are on page 1of 12

Exercises for Lesson 5:

Business Rules
Overview

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 1 of 12 Rev 1
Practices for Lesson 5

Distribution
Job Title*

Ownership
The Job Title [list@YourCompany.com?Subject=Exercises for Lesson 5: Business Rules:
344617784.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 (i.e., you learned how to define the
elements in a BO schema). In this section, you'll learn how to set up business rules for your
business objects.

Lesson Objectives
By the end of this chapter, you will be able to:
Understand the core plug-in spots that can be used to set up business rules for a
business object
Create validation rules for a business object
Write simple validation rules using a high-level scripting language
Debug business rules written using the scripting language
Understand the performance implications of using scripting versus Java for business
object rules

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 2 of 12 Rev 1
Practice 5-2: Examine a Validation Plug-In

Overview
During this exercise, you will use the following:
Admin Business Object (Algorithms)
Admin Script (Steps)
The tips on Admin Script

Tasks
Please break up into teams, and then look at the D1-ManualMeterInstallEvent business
object's validation plug-in.
Prepare a presentation describing what this plug-in does. At a minimum, please describe your
opinion about the usage of:
The use of system variables (e.g., BLANK or $BLANK)
The segregation of the logic into the various steps (remember, this script could have
just contained a single step with all the logic)
The use of for and if statements to iterate through the BO status options list. It uses the
goto to break the loop.
The top 5 cool things you learned about edit data syntax that were not covered in this
section's slides

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 3 of 12 Rev 1
Practice 5-2: Add A Service Point Type And Examine The Log

Overview
Your instructor will show you how to add a new service point type using Admin Service Point
Type +. In this walk through you'll do the same thing, and then look at the server log to see what
happened on the server when you did this.

Tasks
1. Start The System In Debug Mode
If you haven't done so already, suffix ?debug=true to the URL used to start the system, for
example:
http://sf-ugbu-05:8100/spl/cis.jsp?debug=true
2. Navigate To The Service Point Type Page
Use the menu (Admin Service Point Type) to open the service point type page.

3. Initiate The Add Process


Click the Add link in the Service Point Type List zone header to start the process that adds
a new service point type.
Choose the business object for Service Point Type.

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 4 of 12 Rev 1
4. Turn On Logging
Before you add the new service point type, turn on the server log. To do this:
Turn on Global debug:

When you turn this switch on, the logging options pop-up appears:

Please turn off Trace All and all other options except for Trace Output (in other words, the
only option that should be turned on is Trace Output).

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 5 of 12 Rev 1
5. Add The Service Point Type
Return to the add service point type dialog and enter the following information:
Service Point Type: enter a code in the format XXX_SPTYPE where XXX are your
initials
Note: use a team member's initials for the service point type code to avoid
duplicates between teams.
Description: enter a description with your name and service point type
Service Type: select Electric from the available services
Parent Service Point: leave this field blank
Service Point Business Object: select Service Point
Valid Device Types: add one or more valid device types for this service point,
including E-SMART as one of your choices

Click Save to add the new service point type.

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 6 of 12 Rev 1
6. Examine The Server Log
After the new service point type is added, click the Show User Log button to see what
happened on the server:

After you click the Show User Log button, a pop-up will appear that shows what happened
on the server to add the new service point type:

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 7 of 12 Rev 1
This log is quite lengthy as it shows every step of every script that was executed during the
add process (and the subsequent redisplay of the portal). Browse through this list to
familiarize yourself with its contents. Pay special attention to the fact that the log contains a
snapshot of how the XML documents look after each modification so you can debug your
scripts.

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 8 of 12 Rev 1
7. Turn Logging Off
When you're finished, make sure to toggle the Global debug switch to the off state as the
log can slow down your system due to the vast amount of information that is saved.

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 9 of 12 Rev 1
Practice 5-2: Examine the Parameters of Plug-Ins

Overview
During the exercise we'd like you to use the following:
Admin Business Object (Main and Data Area)
The View Plug-in Script Data Area hyperlink

Tasks
Break up into teams and compare the parameters between the Information, Validation, and
Audit plug-in spots. Prepare a brief summary of the similarities and the differences.

Instructors Notes
Notice how the Information system event has a usage=output on the parm/hard/info element.
This means that this type of plug-in is intended to populate this element (all of the other
elements have usage=input which means that the framework will never use the values
populated in these elements).
Notice how the Validation plug-in has no usage=output elements. This means that validation
plug-ins can't update the BO by populating hard parms (rather, they'd have to perform BO
updates using Invoke BO steps). Also notice what the framework passes into this type of plug-
in:
<action use="input"/> This will have a value of add, update or delete.
<businessObject type="group" use="input"> This node contains the name of the BO.
<businessObjectKey type="group" use="input"> This node contains the BO's prime key.
<entityId type="group" use="input"> This node contains the MO's PK constituents. This is
sometimes needed when you have to add an entry to a log (they don't know about this yet) and
you need the MO's PK as log's are physical things.
<maintenanceObject type="group" use="input"> This node contains the name of the MO.
<newBusinessObject type="group" use="input"> This node contains how the BO's elements will
look if the update is successful.
<originalBusinessObject type="group" use="input"> This node contains how the BO's element
looked prior to the start of the logical transaction.
Notice how similar the Audit plug-in is to the Validation plug-in. The main difference is the
<changedValues type="group" use="input">, this contains the changes that were made to the
BO during the update.

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 10 of 12 Rev 1
Review Questions
1. No BO oriented plug-ins will be executed if the BO's MO is missing a Determine BO plug-in.
True/False
False. This is a trick question Preprocessing plug-ins will be performed.
2. A BO's validation plug-ins can override validation rules defined in the MO's core validation
logic (written in Java). True/False
False.
3. Developers can use their discretion when deciding which language to use to write a plug-in
program. True/False
False. The plug-in's language will be defined in the internal design.
4. There are 9 different types of steps. True/False
False
5. Scripting can be used to develop the logic for all plug-in spots defined on a BO. True/False
False. You can also use Java to write the logic; it's really a technical design decision as to which
language is used.
6. You must involve a Java programmer to write a plug-in. True/False
False. Not if you develop the plug-in's logic using scripts as all functions are available on the
admin menu.
7. If your plug-in script executes a Terminate step, all previously performed updates will be
rolled back. True/False
Trick question - Terminates will sometimes do rollbacks and sometimes won't. See question 8
for the details.
8. You don't have to set up an error category / message number on a Terminate step.
True/False
True You can configure a Terminate step to stop what the script is doing without logging an
error, but if you want the script to roll back, you must supply a message category and number.
All errors in the system must have a corresponding message category and number (i.e., literal
error messages are not allowed).
9. If you develop a new plug-in script, you must apply a "patch" before it is available for use.
True/False
False. Once the plug-in script exists and is referenced on an algorithm type (and the algorithm
type has an algorithm), it's executable; there is no patching.
10. Many algorithms can be configured to invoke the same plug-in script. True/False
True. Because the script is defined on the algorithm type and an algorithm type can have many
algorithms.
11. A plug-in script can invoke business services, business objects and service scripts.
True/False
True. These are the means of retrieving and updating the database.

Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 11 of 12 Rev 1
12. Plug-in scripts can contain inline SQL. True/False
False. You don't know about business services yet, but you must invoke a business service or
business object to execute SQL.
13. Most scripts contain a single edit data step. True/False
False. Most scripts are structured to have subsets of logic defined in individual steps.
14. Consider two plug-ins that handle the same logic - the 1st is written in Java and the 2nd is
written using the scripting language. At run time, the Java version will always be much
faster than the scripting version. True/False
False. It all depends on the logic in the plug-in. Update-intensive plug-ins should probably be
written in Java if they are invoked by heavy-duty background processes. Other types of plug-ins
are harder to classify (you'll have to do performance tests to know for sure).
15. A plug-in script is probably easier to maintain than a java plug-in. True/False
True. We believe that the fact that the scripting language is very high-level language results in
far easier maintenance.
16. You must install additional software to develop a plug-in script. True/False
False. You just need the product installed, as all functions are available from the Admin menu.
In other words, no compilers or application workbenches are needed.
17. The "tips" available on the Script page are a good source of frequently used edit data
techniques. True/False
True.
18. For BO-oriented plug-ins, the framework passes in the BO in its entirety in the algorithm's
parameters. This means that the script's steps can immediately implement their logic
without needing to retrieve the BO. True/False
True.
19. Because the BO-Validation plug-in spot receives the entire BO as a parameter, this means
that validation plug-ins can update elements on the BO by populating the algorithm's
parameters. True/False
False. If you check out the script data area when the plug-in spots is BO-Validation, you'll see
that originalBusinessObject and the newBusinessObject group nodes are marked as
usage=input. This is your clue to know that the script can't update the elements. The
framework does not allow validation plug-ins to update the BO being validated.
20. Consider two business objects, one is a service point type, the other is a service point. If
you were to look at the validation plug-ins for each BO, you'd see both have group nodes of
originalBusinessObject and newBusinessObject. True/False
True. And the contents of these group nodes is dynamic based on the BO being validated.
21. At run time, for Validation scripts, you can count on the contents of the
originalBusinessObject and the newBusinessObject group nodes to have the elements in
the BO specified on the script's main page. True/False
False. This is tricky. The BO elements that the framework passes in to a Validation plug-in will
be those associated with the BO returned from the Determine BO plug-in. This might be
different than the BO on the Script - Main page. This is very intentional as we want
implementations to use validation scripts on their BO's that was originally developed for base-
package BO's.
Copyright 2017, Oracle and/or its affiliates. All rights reserved.

Exercises for Lesson 5: Business Rules 344617784.doc


Effective mm/dd/yy Page 12 of 12 Rev 1

You might also like