Advanced Techniques for Code Generation

2-12 Oracle® Fusion Middleware Knowledge Module Developer’s Guide for Oracle Data Integrator

2.9 Advanced Techniques for Code Generation

You can use conditional branching and advanced programming techniques to generate code. The code generation in Oracle Data Integrator is able to interpret any Java code enclosed between and tags. The following examples illustrate how you can use these advanced techniques. Using Java Variables and String Functions The following KM Code creates a string variable and uses it in a substitution method call : String myTableName; myTableName = ABCDEF; drop table =odiRef.getObjectNamemyTableName.toLowerCase Generates the following: drop table SCOTT.abcdef Using a KM Option to Generate Code Conditionally The following KM code generates code depending on the OPT001 option value. String myOptionValue=odiRef.getOptionOPT001; if myOption.equalsTRUE { out.print Option OPT001 is set to TRUE ; } else { The OPT001 option is not properly set Method Description Usable In getPop Returns information about the current interface. IKM, LKM, CKM, JKM getInfo Returns information about the source or target server. Any procedure or KM getSession Returns information about the current running session Any procedure or KM getOption Returns the value of a particular option Any procedure or KM getFlexFieldValue Returns information about a flex field value. Not that with the List methods, flex field values can be specified as part of the pattern parameter. Any procedure or KM getJrnInfo Returns information about the CDC framework JKM, LKM, IKM getTargetTable Returns information about the target table of an interface LKM, IKM, CKM getModel Returns information about the current model during a reverse-engineering process. RKM getPop Returns information about the current interface. LKM, IKM Introduction to the Substitution API 2-13 } If OPT001 is set to TRUE, then the following is generated: Option OPT001 is set to TRUE Otherwise the following is generated The OPT001 option is not set to TRUE 2-14 Oracle® Fusion Middleware Knowledge Module Developer’s Guide for Oracle Data Integrator 3 Reverse-Engineering Strategies 3-1 3 Reverse-Engineering Strategies This chapter explains the customized reverse-engineering process and the strategies used in the Reverse-engineering Knowledge Modules for retrieving advanced metadata. This chapter contains the following sections: ■ Section 3.1, Customized Reverse-Engineering Process