Académique Documents
Professionnel Documents
Culture Documents
ORACLE Technical
Training
560 – ORACLE V2 for
Developers
Version 1.0
Agenda
1. Introduction to ORACLE Framework
2. ORACLE Services
3. Business Entities
4. Artifact Generator
5. Introduction to Eclipse
6. Change Handlers Part I – Validation Rules
7. Unit Testing
8. Change Handlers Part II – Conditional Validation
9. Messages
2
Agenda
10. Change Handlers Part III – Conditions
11. Change Handlers Part IV – Custom Validation Rule
12. Change Handlers Part V – Cascading Changes
13. Algorithms Part I – Validation
14. Algorithms Part II – Validation & Formatting
15. ORACLE Batch Part I – Simple Batch
16. ORACLE Batch Part II – ToDo Creation
17. Custom User Interface (UI)
3
Utilities Practice @ HCL
Algorithms
Part I
ORACLE Technical
Training
Algorithms - Overview
Where system requires customization, ORACLE provides for
customizable algorithms (a.k.a plug-ins)
Base algorithms exist, but can be cloned and modified
Like “user exits”, but …
Unlike Change Handlers, more related to business functions
and events
Also, unlike Change Handlers, use configurable (“soft”)
parameters
For example …
In CC&B world, if CSR requests customers recommended
deposit amount, system calls “deposit recommendation
algorithm” to calculate amount
If base version of algorithm not appropriate, new algorithm can
be coded to replace base on
At upgrades, custom algorithms will not be overwritten
5
Algorithms - Overview
Some more examples where algorithms are used
Validating the format of a phone number entered by a user
Validating the format of a latitude/longitude geographic code
entered by a user.
Calculating late payment charges in ORACLE CC&B
Calculating the recommended deposit amount in ORACLE
CC&B
Constructing your GL account during the interface of financial
transactions to your GL in ORACLE CC&B
And many other functions...
Let’s take a look at how algorithms work internally …
6
Algorithms - Overview
Algorithms are defined in 2 places
1. Database tables
2. ORACLE Framework (Java classes / COBOL programs)
Online Admin menu used to define database components
1. Algorithm Types
2. Algorithms
3. Event / activity to which algorithm applies (e.g. FT freeze,
phone number validation, etc.)
ORACLE Framework requires “implementation” class and various
generated artifacts
Let’s take a look at the online definitions first …
7
Algorithm Database Model
1 CI_ALG_TYPE CI_ALG Customized Entity
PK ALG_TYPE_CD PK ALG_CD
CI_ALG_PARM
CI_ALG_TYPE_PRM PK,FK2 ALG_CD
PK,FK1 ALG_TYPE_CD PK EFFDT
PK SEQNO PK,FK1 SEQNO
PARM_REQ_SW ALG_PARM_VAL
FK1 ALG_TYPE_CD
Algorithm database tables
1. Algorithm Type defines …
Entity – e.g. Char Type – Adhoc Value Validation, SA
Type – SA Creation, etc.
Program name
Program type – JAVA or COBOL
8
Algorithm Database Model
1 CI_ALG_TYPE CI_ALG Customized Entity
PK ALG_TYPE_CD PK ALG_CD
CI_ALG_PARM
2 CI_ALG_TYPE_PRM PK,FK2 ALG_CD
PK,FK1 ALG_TYPE_CD PK EFFDT
PK SEQNO PK,FK1 SEQNO
PARM_REQ_SW ALG_PARM_VAL
FK1 ALG_TYPE_CD
4 CI_ALG_PARM
2 CI_ALG_TYPE_PRM PK,FK2 ALG_CD
PK,FK1 ALG_TYPE_CD PK EFFDT
PK SEQNO PK,FK1 SEQNO
PARM_REQ_SW ALG_PARM_VAL
FK1 ALG_TYPE_CD
10
Algorithm Database Model
1 CI_ALG_TYPE 3 CI_ALG 5 Customized Entity
PK ALG_TYPE_CD PK ALG_CD
4 CI_ALG_PARM
2 CI_ALG_TYPE_PRM PK,FK2 ALG_CD Examples
PK,FK1 ALG_TYPE_CD PK EFFDT
PK SEQNO PK,FK1 SEQNO Characteristic Type
PARM_REQ_SW ALG_PARM_VAL SA Type
FK1 ALG_TYPE_CD
Etc.
Algorithm database tables
5. Algorithm code is specified on customized entity’s
configuration table – algorithm will be invoked based on this
specification
Let’s look at an example …
11
Algorithm Phone Format
Example
Phone format - algorithm definition diagram
Algorithm Type:PHN-FMT Algorithm:PHN-FMT-US Phone Type: BUSN
Format 1 – required (999) 999-9999
Format 2 – optional
Format 3 – optional Algorithm:PHN-FMT-UK Phone Type: BUSN_UK
Format 4 thru 9 – optional 999 9999-9999
99999 999999
9999 999-9999
CI_ALG_PARM
CI_ALG_TYPE_PRM PK,FK2 ALG_CD
PK,FK1 ALG_TYPE_CD PK EFFDT
PK SEQNO PK,FK1 SEQNO
PARM_REQ_SW ALG_PARM_VAL
FK1 ALG_TYPE_CD
12
Algorithm Phone Format
Example
Admin -> Algorithm Type – Phone format
1
2
3
4
2
3
4
4
1. Algorithm name – 1st “instance” of algorithm type
2. Algorithm type parent definition
3. Effective dated – can create multiple sequences, each with
different effective date
4. Phone format for this instance – U.S. has only one phone 15
format
Algorithm Phone Format
Example
Admin -> Algorithm – Phone format UK
1
1
2
17
Algorithm Phone Format
Example
Main -> Person – Algorithm activation
1
18
Algorithm Spots
“Call out” places in system (e.g. from Person to validate phone
number) are known as algorithm spots
Each algorithm spot has interface class
Communication with algorithm takes place through interface
Interface provides abstraction between base and customization
Business Algorithm
Algorithm Spot
Component Interface Component
PhoneTypeFormat
PhoneTypeFormat
Person Phone ValidationAlgorithmSpot
ValidationAlgComp
19
Algorithm Spots
Attributes of an algorithm spot interface class
Internal to framework – only created by Product Development
20
Algorithm Spots
These classes form part of base code
Invoked from base at appropriate times (events)
Methods on interface related to algorithm type – e.g.
setPhoneValue() only relevant to
PhoneTypeFormatValidationAlgorithmSpot
«interface»
AdhocCharacteristicValueValidationAlgorithmSpot
+setFormatOnly() : void
+setCharacteristicType() : void
+setAdhocValue() : void
+getReformattedValue() : String
«interface»
+isValidAdhoc() : Boolean
AlgoritmSpot
+invoke()
«interface»
PhoneTypeFormatValidationAlgorithmSpot
+setPhoneValue() : void
+setPhoneType() : void
+isValidPhoneValue() : Boolean
+getPreferredFormatString() : String 21
+getReformattedPhoneValue() : String
Algorithm Components
Algorithm requires programmatic implementation
Algorithm Type specifies program name – e.g.
com.ORACLEwg.base.domain.common.phoneType.
PhoneTypeFormatValidationAlgComp
This name in fact specifies another interface – generated from
implementation class
Implementation class has name = interface name + “Impl” – e.g.
com.ORACLEwg.base.domain.common.phoneType.
PhoneTypeFormatValidationAlgComp_Impl
Following diagram describes full Phone Type Validation algorithm
component …
22
Algorithm Components – Phone
Type Validation
Remember …
Interface is “empty” – requires implementation to perform
appropriate tasks
Implementation for algorithm spot is Algorithm Component –
i.e. Business Component «interface»
AlgoritmSpot
+invoke()
«interface»
PhoneTypeFormatValidationAlgorithmSpot
+setPhoneValue() : void V2.0.10 +
+setPhoneType() : void
+isValidPhoneValue() : Boolean
+getPreferredFormatString() : String
+getReformattedPhoneValue() : String
V2.0.6
PhoneTypeFormatValidationAlgComp_Gen
PhoneTypeFormatValidationAlgComp_Impl
«interface»
+getPhoneFormat1() : String
PhoneTypeFormatValidationAlgComp
+getPhoneFormat2() : String
+setPhoneValue() : void +invoke() : void
+getPhoneFormat3() : String
+setPhoneType() : void +setPhoneValue() : void
+getPhoneFormat4() : String
+isValidPhoneValue() : Boolean +setPhoneType() : void
+getPhoneFormat5() : String
+getPreferredFormatString() : String +isValidPhoneValue() : Boolean
+getPhoneFormat6() : String
+getReformattedPhoneValue() : String +getPreferredFormatString() : String
+getPhoneFormat7() : String
+getPhoneFormat8() : String
+getReformattedPhoneValue() : String 23
+getPhoneFormat9() : String
Algorithm Components – Phone
Type Validation
1. Implementation class (…_Impl) is hand coded – can be customized
2. Component interfaces generated by artifact generator – customized
versions will be generated for custom “impl” class
3. Algorithm invoked via component interface
«interface»
AlgoritmSpot
+invoke()
«interface»
PhoneTypeFormatValidationAlgorithmSpot
+setPhoneValue() : void V2.0.10 +
+setPhoneType() : void
+isValidPhoneValue() : Boolean
+getPreferredFormatString() : String
+getReformattedPhoneValue() : String
2 V2.0.6
PhoneTypeFormatValidationAlgComp_Gen 1
3
PhoneTypeFormatValidationAlgComp_Impl
«interface»
+getPhoneFormat1() : String
PhoneTypeFormatValidationAlgComp
+getPhoneFormat2() : String
+setPhoneValue() : void +invoke() : void
+getPhoneFormat3() : String
+setPhoneType() : void +setPhoneValue() : void
+getPhoneFormat4() : String
+isValidPhoneValue() : Boolean +setPhoneType() : void
+getPhoneFormat5() : String
+getPreferredFormatString() : String +isValidPhoneValue() : Boolean
+getPhoneFormat6() : String
+getReformattedPhoneValue() : String +getPreferredFormatString() : String
+getPhoneFormat7() : String
+getReformattedPhoneValue() : String
+getPhoneFormat8() : String
+getPhoneFormat9() : String 24
Algorithm Components –
Phone Type Validation
1. Implementation class contains hand coded logic
2. _Gen class has methods for “soft” parameters (as specified on
Algorithm Type definition)
Note: Generated from annotations in “_Impl” class
«interface»
AlgoritmSpot
+invoke()
«interface»
PhoneTypeFormatValidationAlgorithmSpot
+setPhoneValue() : void V2.0.10 +
+setPhoneType() : void
+isValidPhoneValue() : Boolean
+getPreferredFormatString() : String
+getReformattedPhoneValue() : String
2 V2.0.6
PhoneTypeFormatValidationAlgComp_Gen 1
PhoneTypeFormatValidationAlgComp_Impl
«interface»
+getPhoneFormat1() : String
PhoneTypeFormatValidationAlgComp
+getPhoneFormat2() : String
+setPhoneValue() : void +invoke() : void
+getPhoneFormat3() : String
+setPhoneType() : void +setPhoneValue() : void
+getPhoneFormat4() : String
+isValidPhoneValue() : Boolean +setPhoneType() : void
+getPhoneFormat5() : String
+getPreferredFormatString() : String +isValidPhoneValue() : Boolean
+getPhoneFormat6() : String
+getReformattedPhoneValue() : String +getPreferredFormatString() : String
+getPhoneFormat7() : String
+getReformattedPhoneValue() : String
+getPhoneFormat8() : String
+getPhoneFormat9() : String 25
Algorithm Components –
Phone Type Validation
3. Generated component interface class also contains “factory”
class to create instance of algorithm component – we’ll see
example shortly
«interface»
AlgoritmSpot
+invoke()
«interface»
PhoneTypeFormatValidationAlgorithmSpot
+setPhoneValue() : void V2.0.10 +
+setPhoneType() : void
+isValidPhoneValue() : Boolean
+getPreferredFormatString() : String
+getReformattedPhoneValue() : String
V2.0.6
PhoneTypeFormatValidationAlgComp_Gen
PhoneTypeFormatValidationAlgComp_Impl
«interface»
+getPhoneFormat1() : String
3
PhoneTypeFormatValidationAlgComp
+getPhoneFormat2() : String
+invoke() : void
+setPhoneValue() : void +getPhoneFormat3() : String
+setPhoneType() : void +setPhoneValue() : void
+getPhoneFormat4() : String
+isValidPhoneValue() : Boolean +setPhoneType() : void
+getPhoneFormat5() : String
+getPreferredFormatString() : String +isValidPhoneValue() : Boolean
+getPhoneFormat6() : String
+getReformattedPhoneValue() : String +getPreferredFormatString() : String
+getPhoneFormat7() : String
+getReformattedPhoneValue() : String
+getPhoneFormat8() : String
+getPhoneFormat9() : String
26
Algorithm Implementation Class
Base versions of all algorithms provided by ORACLE
To create new one, easiest to duplicate appropriate base one if
exists and modify
Basic Java elements of new algorithm …
“_Impl” class – implementation class that contains logic
27
Algorithm Phone Format
Example
1
3
4
Annotation specifies …
1. Algorithm entity – i.e. where in system used – corresponds with
entity defined on Algorithm Type (we will see shortly how to
determine this name)
2. Soft parameters expected – correspond with Algorithm Type
28
parameter definitions
Algorithm Phone Format
Example 1
3
4
Class name …
3. Has Algorithm Component name (as specified on Algorithm
Type) + “_Impl”
4. Extends “_Gen” class – generated by Artifact Generator
29
Algorithm Phone Format
Example
Algorithm Spot interface methods that are implemented in _Impl class
35
Algorithm Phone Format
Example
Generated artifacts based on _Impl class annotation
1
2
37
Algorithm Entity Query
1 2
39
Algorithm Implementation
Class Review
Steps to create new class
7. Create Algorithm Type definition – Java class name will now
be in Program Name drop-down list
8. Create Algorithm definition
9. Attach algorithm to business component
10. Test
40
Exercise 8 – Geographic
Type Algorithm
In this exercise you will create a Geographic Type algorithm to
validate geographic type “REGION” on Premise
Scenario
1. Premises may be in North America or Europe
2. Within North America, country may be U.S.A. or Canada
3. Within Europe, country may be United Kingdom or France
4. Geographic type of “region” must be created to allow for region
code to be specified on premise
41
Exercise 8 – Geographic Type
Algorithm
Scenario
5. Format of region code is W-CC …
W = World Region – “N” (North America); “E” (Europe)
CC = Country Code – “US” (USA); “CN” (Canada); “UK”
(UK); “FR” (France)
Algorithm must validate country code for region – e.g.
E-FR is valid; E-US is invalid
6. Valid region code values must be specified as soft parameters
– i.e. no hardcoding of values in Java
Following are exercise notes to help guide …
42
Exercise 8 – Geographic Type
Algorithm
Java
Algorithm Entity is “Geographic Type – Value Format Rule”
(determine Java annotation name from this)
Name your class XXGeoTypeRegionAlgComp_Impl
Create 2 parameters
1. worldRegion, string, required
43
Exercise 8 – Geographic
Type Algorithm
Online Configuration
Create Algorithm Type XXGEOREGION with necessary
parameter definitions
Create 2 Algorithm definitions
1. XXGEOREG-E
44
Exercise 8 – Geographic
Type Algorithm
Online Configuration
Create 2 new Geographic Types
1. XXREG-E
45
Utilities Practice @ HCL
Algorithms
Part Il
ORACLE Technical
Training
Exercise 9 – Adhoc Char
Value Algorithm
Last exercise could not reformat region code – Geographic Type
algorithm does not provide for that
In this exercise you will create an Adhoc Characteristic Value
validation algorithm to validate and format a new Premise
Characteristic Type of “REGION”
Scenario – same as before except …
Characteristic Type of “region” must be created
Country code may be entered without world region code
Algorithm will format region code into W-CC format
Will display custom error message for invalid region code
47
Exercise 9 – Adhoc Char
Value Algorithm
Java
Create new message constant and method for runtime
message (not declarative)
Message text should be
XX Country code %1 not valid for region %2
(Note: should contain your initials)
Use message number > 10000
Add CustomMessages constant for your message
Add method for message to MessageRepository class in
characteristicType package
Message takes 2 parameters – world region code and
country code – method must substitute them in message
text
48
Exercise 9 – Adhoc Char
Value Algorithm
Java
Algorithm Entity is “Char Type - Adhoc Value Validation”
(determine Java annotation name from this)
Name your class XXAdhocRegionValidationAlg_Impl
Create same 2 parameters as before
invoke() method must …
1. Format region code – for example …
49
Exercise 9 – Adhoc Char
Value Algorithm
Online Configuration
Create Algorithm Type XX-AV-REGION with necessary
parameter definitions
Create 2 Algorithm definitions
1. XX-AV-REG-E - specifies Europe and valid countries
50
Exercise 9 – Adhoc Char
Value Algorithm
Online Configuration
Use Admin menu to create new message in category 90000
“XX Country code %1 not valid for region %2”
(place your initials in the message)
Test
When adding/changing Premise Characteristic of “region”,
algorithm should format region code, validate and
diORACLEay custom message if invalid
51