Successfully reported this slideshow.
Your SlideShare is downloading. ×

Oracle ADF Hands-on Lab Practices

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Author: Deepak Bhagat
Fusion Functional Consultant,
Solution Architect & ADF Corporate Trainer
Free Downloadable Course ma...
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices
i
ADF Essentials Training by Deepak Bhagat
T...
Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices
ii
ADF Essentials Training by Deepak Bhagat
...
Advertisement
Advertisement
Advertisement
Advertisement
Advertisement
Advertisement
Advertisement
Advertisement
Advertisement
Advertisement
Upcoming SlideShare
Oracle ADF Tutorial
Oracle ADF Tutorial
Loading in …3
×

Check these out next

1 of 465 Ad

Oracle ADF Hands-on Lab Practices

Download to read offline

Oracle ADF Tutorial- Hands-on Lab Practices. This document is part of Oracle Application Development Framework Training materials and technical resources, used in development, implementation and customization of Oracle Fusion cloud, SaaS and on-premise application. Prepared by Deepak Bhagat as part of Oracle ADF Corporate Training.

Oracle ADF Tutorial- Hands-on Lab Practices. This document is part of Oracle Application Development Framework Training materials and technical resources, used in development, implementation and customization of Oracle Fusion cloud, SaaS and on-premise application. Prepared by Deepak Bhagat as part of Oracle ADF Corporate Training.

Advertisement
Advertisement

More Related Content

Advertisement

Oracle ADF Hands-on Lab Practices

  1. 1. Author: Deepak Bhagat Fusion Functional Consultant, Solution Architect & ADF Corporate Trainer Free Downloadable Course material: GDrive Link Deepak Bhagat’s Oracle ADF Blogs Develop Rich Web Applications with ADF 12c Essentials Hands-on Lab Practices
  2. 2. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices i ADF Essentials Training by Deepak Bhagat Table of Contents 1 Overview of Fusion Middleware and ADF ..............................................................1 1.1 System Requirements for ADF Training -* ......................................................2 1.2 Oracle Technology Resource Account Login -*................................................3 1.3 Downloading and Installing Oracle XE Database -* .........................................4 1.4 Downloading and Installing JDeveloper -*......................................................5 1.5 Unlocking HR Schema -*...............................................................................9 1.6 Entity Relation Diagram of HR System -*......................................................11 1.7 Working with JDev IDE Configuration Files -o ...............................................13 1.8 Java for Beginners -o ..................................................................................14 1.9 References -o.............................................................................................15 1.10 Grouping of Hands-on Lab Practices -* ........................................................16 1.11 Important Abbreviation and Information -* ..................................................17 1.12 Downloading Training Materials -*...............................................................18 1.13 Important to go through after the training -o ...............................................19 2 Understanding Development Tool: JDeveloper....................................................20 2.1 Creating a New Fusion Application and Project -* .........................................21 2.2 Creating a New Database Connection and Initialize the Project -*..................25 2.3 Adding ADF Business Components and ADF Faces -* ....................................27 2.4 Exploring JDeveloper and New Application -* ...............................................33 2.5 Exploring Windows of JDeveloper -* ............................................................34 2.6 Working with Windows -*............................................................................35 2.7 Taking Help using F1 key -* ........................................................................36 2.8 Refactoring JDeveloper Artifacts -* ..............................................................37 2.9 Setting IDE Preferences -* ..........................................................................39 2.10 Setting Package Levels -*............................................................................41 2.11 Lab Solution ...............................................................................................42 3 Modeling Database Schema...............................................................................43 3.1 Copying Application -o ................................................................................44
  3. 3. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices ii ADF Essentials Training by Deepak Bhagat 3.2 Exploring HR System ER Diagram -* ............................................................45 3.3 Examining Training Lab Application – Lab Solution 22 -*...............................46 3.4 Creating an Offline Database Diagram with Existing Schema Objects-o ..........47 3.5 Adding New Offline Database Schema Objects -o .........................................49 3.6 Generating the SQL Scripts -o......................................................................51 3.7 Running the SQL Scripts on Database -o ......................................................55 3.8 Invoking PLSQL -x ......................................................................................56 4 Building Business Services with Default Business Components .............................57 4.1 Creating another New Application and Projects -*.........................................58 4.2 Creating Default ADF Business Components -* .............................................59 4.3 Examining Generated ADF Business Components Artifacts -*.........................62 4.4 Testing the Business Service (using Oracle ADF Model Tester) -* ..................63 4.5 Lab Solution ...............................................................................................64 5 Persisting Data Using Entity Objects...................................................................65 5.1 Copying Application -o ................................................................................66 5.2 Creating Multiple Entity Objects at Once -*...................................................67 5.3 Creating an Association -*...........................................................................68 5.4 Examining Attribute Settings -* ...................................................................69 5.5 Creating Entity Object based on Database View -o........................................71 5.6 Synchronizing an Entity Object with Table Structure Changes -o....................74 5.7 Lab Solution ...............................................................................................75 5.8 Applying Property Set -d .............................................................................76 6 Querying Data Using View Objects.....................................................................77 6.1 Copying Application -o ................................................................................78 6.2 Creating Read-Only View Object based on SQL Query -*...............................79 6.3 Creating Updatable Join View Object -*........................................................82 6.4 Adding View Object to Existing Application Module -* ...................................85 6.5 Testing View Objects -* ..............................................................................86 6.6 Internationalizing through Resource Bundle -o..............................................89
  4. 4. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices iii ADF Essentials Training by Deepak Bhagat 6.7 Creating Read-Only View Object based on Static List -o ................................90 6.8 Creating Multiple Read-Only View Objects at Once -o....................................92 6.9 Creating View Link -o..................................................................................94 6.10 Adding Child VO to Master VO Through Link in Existing AM -o .......................95 6.11 Testing View Objects and Link -o.................................................................96 6.12 Lab Solution ...............................................................................................97 7 Exposing Business Service through Application Module........................................98 7.1 Copying Application -o ................................................................................99 7.2 Creating New Nested Application Module -o................................................100 7.3 Lab Solution .............................................................................................102 8 Declaratively Customizing Business Services .....................................................103 8.1 Copying Application -o ..............................................................................104 8.2 Customizing Entity Objects by Defining Control Hints -* ..............................105 8.3 Customizing View Object by Adding Transient Attribute -*...........................107 8.4 Defining List of Values and Accessors -*.....................................................109 8.5 Creating View Object with Parameterized Where Clause -*..........................113 8.6 Creating and Using Parameterized View Criteria -o......................................115 8.7 Creating Alternate Key Entity Constraints -o ...............................................119 8.8 Declaratively Populating Primary Key with a Database Sequence -o .............120 8.9 Lab Solution .............................................................................................121 8.10 References for Groovy -o ..........................................................................122 8.11 Defining Dependent List of Values (LOV) -x................................................123 8.12 View Criteria using Custom Operator -d......................................................124 9 Validating in Business Services.........................................................................125 9.1 Copying Application -o ..............................................................................126 9.2 Adding Declarative Validation: Range Validator -*.......................................127 9.3 Generating Java Files for Entity Objects -* .................................................129 9.4 Adding Method Validator -* .......................................................................131 9.5 Adding Declarative Validation: Unique Key Validator -o ...............................134
  5. 5. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices iv ADF Essentials Training by Deepak Bhagat 9.6 Lab Solution .............................................................................................137 9.7 Adding Domain Validator -x.......................................................................138 9.8 Demonstrate Various Types of Validations -d..............................................139 10 Introducing User Interface Technologies .......................................................140 10.1 Running, Exploring and Familiarizing Lab 20 Application -*..........................141 11 Getting Started with User Interface and UI Components ................................149 11.1 Creating New Application with only ViewController Project -* ......................150 11.2 Setting Up the UI Project for Internationalization -*....................................152 11.3 Setting Up the Skin Preference -* ..............................................................153 11.4 Lab Solution .............................................................................................154 11.5 ADF Faces Rich Client Components -d........................................................155 12 Planning Pages using Layout Components.....................................................156 12.1 Copying Application -o ..............................................................................157 12.2 Creating New JSF Page -* .........................................................................158 12.3 Adding Default Layout Components -* .......................................................159 12.4 Customizing Layout Components -* ...........................................................163 12.5 Lab Solution .............................................................................................165 13 Designing User Interfaces and Page Flows ....................................................166 13.1 Copying Application -o ..............................................................................167 13.2 Creating Bounded Task Flows and Add View Activities -* ............................168 13.3 Creating New Page Fragments -*...............................................................169 13.4 Adding Task Flow Call Activities -* .............................................................171 13.5 Adding Return Activities -* ........................................................................172 13.6 Using Bounded Task Flows as a Region on a page -*..................................173 13.7 Creating Bounded Task Flow without Fragments -o.....................................175 13.8 Converting Bounded Task Flows to Use Page Fragments -o.........................176 13.9 Using Unbounded Task Flow with View and Control Flow Activities -o ..........177 13.10 Extracting Part of Task Flow -o..................................................................179 13.11 Lab Solution .............................................................................................181
  6. 6. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices v ADF Essentials Training by Deepak Bhagat 13.12 Using URL View Activity -d ........................................................................182 14 Interactively Controlling with Navigation Components ....................................183 14.1 Copying Application -o ..............................................................................184 14.2 Adding Links and Buttons for Navigation -* ................................................185 14.3 Using Menu and Menu Items -*.................................................................191 14.4 Assigning Internationalization and Accessibility -o.......................................193 14.5 Using BreadCrumbs -o ..............................................................................195 14.6 Using Popup Dialog -o...............................................................................197 14.7 Defining Sequence of Steps (Train) and Use Wild Card Activity -o................199 14.8 Lab Solution .............................................................................................204 15 Ensuring Reusability in Web Applications.......................................................205 15.1 Copying Application -o ..............................................................................206 15.2 Creating and Using Reusable Component -* ...............................................207 15.3 Creating Page Templates -o ......................................................................212 15.4 Applying Template to Existing Page Fragments -o.......................................216 15.5 Creating a New Header Template -o ..........................................................218 15.6 Applying Template to Existing Page -o .......................................................221 15.7 Creating a New Page with Template -o ......................................................222 15.8 Adding Panel Springboard Component -o ...................................................224 15.9 Converting JSPX to Facelets -o ..................................................................226 15.10 Refactoring Page and Page Definition File -o ..............................................229 15.11 Lab Solution .............................................................................................231 15.12 Bind Custom Declarative Components to ADF -d.........................................232 16 Working with Parameters, Scopes and Partial Page Refresh (PSP)...................233 16.1 Copying BATLab_16-PSP from Solution -o ..................................................234 16.2 Implementing Set Action Listener, Scopes and Partial Page Refresh -o.........235 16.3 Setting Conditional Display -o....................................................................236 16.4 Defining Task Flow Parameters -o..............................................................238 16.5 Defining Regions Parameters -o.................................................................239
  7. 7. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices vi ADF Essentials Training by Deepak Bhagat 16.6 Using Refresh Property in PageDef -o ........................................................240 16.7 Lab Solution .............................................................................................241 17 Responding to Managed Beans, Events and Listeners.....................................242 17.1 Creating new Application BATLab_17 with ViewController Project -* ............243 17.2 Creating Managed Bean -* ........................................................................245 17.3 Creating Action Listener and Adding Method Binding -*...............................251 17.4 Creating Value Change Listener -*.............................................................252 17.5 Adding Phase Listener -o...........................................................................253 17.6 Adding Validator -o ...................................................................................255 17.7 Adding Converter -o..................................................................................256 17.8 Lab Solution .............................................................................................257 18 Binding Model Layer with Business Services and Databound View ...................258 18.1 Copying Application -o ..............................................................................259 18.2 Creating a Read Only ADF Tables with Row Selection -* .............................260 18.3 Customizing Data and UI Components -o ...................................................264 18.4 Creating a Detail Forms -o.........................................................................270 18.5 Making a Table Non-Selectable -o..............................................................272 18.6 Using setCurrentRowWithKey -o ................................................................274 18.7 Using setCurrentRowWithKeyValue -o ........................................................277 18.8 Creating a Graph Component -o ................................................................280 18.9 Creating a Read Only Tree -o ....................................................................283 18.10 Lab Solution .............................................................................................287 18.11 More ADF Data-bound Components -d .......................................................288 19 Querying Data with Search Components .......................................................289 19.1 Copying Application -o ..............................................................................290 19.2 Adding Query Search and Result -*............................................................291 19.3 Customizing Query Search and Result -o....................................................295 19.4 Adding Quick Search -o.............................................................................296 19.5 Lab Solution .............................................................................................299
  8. 8. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices vii ADF Essentials Training by Deepak Bhagat 20 Implementing Transactions ..........................................................................300 20.1 Copying Application -o ..............................................................................301 20.2 Implementing Create Operation -*.............................................................302 20.3 Implementing Delete Operation and Creating Helper Method -* ..................310 20.4 Implementing Update Operation -o............................................................313 20.5 Lab Solution .............................................................................................316 20.6 More ADF Transaction Management -d.......................................................317 21 Understanding Data Controls and Bindings ....................................................318 21.1 Examining the Page’s Data Bindings -*.......................................................319 22 Programmatically Customizing Business Services ...........................................321 22.1 Copying Application -* ..............................................................................322 22.2 Migrating Project to Another Application -*.................................................323 22.3 Prog Custz EO: Including Override Method -*.............................................325 22.4 Prog Custz EO: Overriding Method -*.........................................................327 22.5 Programmatically Assigning a Database Sequence -* ..................................329 22.6 Prog Custz AM: Adding and Exposing Service Methods -*............................330 22.7 Prog Custz VO: Default Parameterized Where Clause -* ..............................334 22.8 Prog Custz VO: Default Parameterized View Criteria -o................................335 22.9 Prog Custz VO: Dynamic Parameterized Where Clause -o............................336 22.10 Prog Custz VO: Dynamic Parameterized View Criteria -o..............................337 22.11 Prog Custz VO: Resetting -o ......................................................................338 22.12 Prog Custz VO: CRUD Operation: Creating -o .............................................339 22.13 Prog Custz VO: CRUD Operation: Reading and findByPrimaryKey -o.............340 22.14 Prog Custz VO: CRUD Operation: Deleting and findByKey -o........................341 22.15 Testing Exposed Service Methods using ADF Model Tester -o ......................342 22.16 Creating and Running Test Clients -o .........................................................343 22.17 Calling Service Method from MVC Layer -o .................................................345 22.18 Lab Solution .............................................................................................348 23 Deploying ADF Applications ..........................................................................349
  9. 9. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices viii ADF Essentials Training by Deepak Bhagat 23.1 Copying Application -o ..............................................................................350 23.2 Creating a Business Service Deployment Profile -*......................................351 23.3 Creating a Web Module Deployment Profile -*............................................353 23.4 Creating an Application Deployment Profile -* ............................................355 23.5 Starting Integrated Weblogic Server -* ......................................................358 23.6 Deploying the Application from JDeveloper -*.............................................359 23.7 Running the Application -* ........................................................................360 23.8 Undeploying the Application -* ..................................................................361 23.9 Lab Solution .............................................................................................364 24 Securing ADF Applications ............................................................................365 24.1 Copying Application -o ..............................................................................366 24.2 Configuring the Application to use ADF Security -o......................................367 24.3 Defining Users in the Identity Store -o .......................................................369 24.4 Defining Application Roles -o .....................................................................370 24.5 Implementing Security on Task Flows and Pages -o....................................372 24.6 Testing Application Authentication and Authorization -o ..............................374 24.7 Lab Solution .............................................................................................375 24.8 ADF Basic Authentication -d ......................................................................376 25 Debugging and Troubleshooting ADF Applications..........................................377 25.1 Copying Solution -*...................................................................................378 25.2 Discovering Application Problems -*...........................................................379 25.3 Setting Breakpoints in the Debugger -*......................................................380 25.4 Running Application Module in Debug Mode -* ...........................................383 26 Best Practices ..............................................................................................390 27 Miscellaneous Topics....................................................................................391 27.1 Real-time End-to-end ADF Application -d....................................................392 28 Advance Topics............................................................................................393 28.1 UI and Page Flow Design ..........................................................................394 28.2 List of Existing Features ............................................................................395
  10. 10. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices ix ADF Essentials Training by Deepak Bhagat 28.3 Adding Custom View Criteria .....................................................................396 28.4 Traversing, Creating and Deleting Master-Detail .........................................397 28.5 Creating an Application Module Base Class .................................................398 28.6 Programmatically Calling EL, Scopes and Conditional Display.......................399 28.7 Adding Router Activity...............................................................................400 28.8 Programmatically Handling Confirm Dialog .................................................401 28.9 Programmatically Invoking Popup..............................................................402 28.10 Programmatically Closing Popup ................................................................403 28.11 Rendering Dynamic Region........................................................................404 28.12 Adding Context Menu................................................................................405 28.13 Creating Data Control Method from Backing Bean.......................................406 28.14 Contextual Events.....................................................................................407 28.15 Publishing Contextual Event ......................................................................408 28.16 Subscribing and Handling Contextual Event to Region.................................409 28.17 Subscribing and Handling Contextual Event to Page....................................410 28.18 Programmatically Adding Partial Page Refresh ............................................411 28.19 Programmatically Handling UI Create Transaction.......................................412 28.20 Programmatically Handling UI Delete Transaction.......................................413 28.21 Lab Solution .............................................................................................414 28.22 Advance ADF Extended Examples -x ..........................................................415 28.23 Entity-Level Triggers -d.............................................................................416 29 Integrating ADF with Web Service ...............................................................417 29.1 Creating REST Web Service with ADF Business Service ...............................418 29.2 Creating SOAP Web Service with ADF Business Service ...............................422 29.3 Consuming REST Web Service (ADF) .........................................................425 29.4 Consuming REST Web Service (Generic) ....................................................427 29.5 Consuming SOAP Web Service...................................................................429 29.6 Advance ADF Extended Examples -x ..........................................................431 29.7 More Examples on ADF Integration with Web Services -d............................432
  11. 11. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices x ADF Essentials Training by Deepak Bhagat 30 Integrating ADF with Enterprise Java Bean (EJB).........................................433 30.1 Consuming EJB Data Control .....................................................................434 30.2 Advance ADF Extended Example -x............................................................435 30.3 More Examples on Consuming EJB Data Control -d .....................................436 31 Integrating ADF with Service Orientated Architecture (SOA).........................437 31.1 Integrating SOA........................................................................................438 31.2 Advance ADF Extended Example -x............................................................440 31.3 More Examples on Integrating Oracle SOA with ADF -d...............................441 32 Integrating ADF with Mobile Application Framework (MAF)...........................442 32.1 Mobile Application Framework (MAF) .........................................................443 32.2 Advance ADF Extended Example -x............................................................453 32.3 More Examples on Integrating Oracle MAF with ADF -d...............................454 Free Downloadable Course material: GDrive Link Deepak Bhagat’s Oracle ADF Blogs: www.cloudadfdeepakb.blogspot.com
  12. 12. Develop Rich Web Application with ADF 12c Essentials – Hands-on Lab Practices 1/465 ADF Essentials Training by Deepak Bhagat 1 Overview of Fusion Middleware and ADF For detail information refer handout “…BATHandoutsBATDocs- PreTrainingMaterialBAT ADF Hands-on Lab Setup Guide.pdf”. Download all Oracle ADF training documents and lab solutions, from shared folders on Google GDrive shared by the trainer. Unzip all lab solutions. These training materials consist of study guides, hands-on lab practices, reference guides, bookmarks, downloaded materials, extended samples, demos, books, tutorials, etc. This Hands-on Lab Practices is a beta version.
  13. 13. 2/454 ADF Essentials Training by Deepak Bhagat 1.1 System Requirements for ADF Training -* 1) Personal laptop with admin access (Logged in user must be an Admin) 2) Software versions and requirements on your personal laptop, for ADF Training: Requirements Recommended Minimum Value RAM 4 GB of RAM (Preferably 8 GB). (I use 16 GB). Display 1024 X 768 resolution or more. Prefer extra extended large monitor, to attend lecture and lab simultaneously. Hard Drive Space 10+ GB OS MS Windows 8+, Linux Java JDK 1.7 Update 15+ Oracle XE Database 11.2.0.2.0 ADF, JDeveloper and Fusion Middleware (12c) 12.2.1.0.0 (not latest) (Do NOT use 12.2.1.1.0 or later) Oracle Technology Resource Account https://www.oracle.com/technical-resources -> View Accounts -> Oracle Account -> Sign-In
  14. 14. 3/454 ADF Essentials Training by Deepak Bhagat 1.2 Oracle Technology Resource Account Login -* Login to your Oracle Resource account. Create one if necessary. The URL is https://www.oracle.com/technical-resources -> View Accounts -> Oracle Account -> Sign-In.
  15. 15. 4/454 ADF Essentials Training by Deepak Bhagat 1.3 Downloading and Installing Oracle XE Database -* 1) Link to download latest Oracle XE 11gR2 database: a) https://download.oracle.com/otn/nt/oracle11g/xe/OracleXE112_Win64.zip or b) https://www.oracle.com/database/technologies/xe-prior-releases.html or c) copy an executable file from someone who has already downloaded. 2) Links for installing Oracle XE Database: http://docs.oracle.com/cd/E17781_01/install.112/e18803/toc.htm#XEINW123 While Installing Oracle DB it will ask for system (SYS or SYSTEM) password. So, enter a password and save it for later use. Example sysadmin (used for this lab). 3) Links for starting Oracle XE Database: http://docs.oracle.com/cd/E17781_01/install.112/e18803/toc.htm#XEINW133
  16. 16. 5/454 ADF Essentials Training by Deepak Bhagat 1.4 Downloading and Installing JDeveloper -* 1) Link to download JDeveloper 12.2.1.0.0: https://www.oracle.com/tools/downloads/jdev-v12210-downloads.html. 2) Links for installing JDeveloper: https://docs.oracle.com/middleware/1221/jdev/install/GUID-311BD061-083E-403A-8FE7- 4D78EEAFCB45.htm#OJDIG114 3) Unzip jdev_suite_122100_win64-2.zip. 4) Right-click on jdev_suite_122100_win64.exe file and select Run as Administrator. Click Yes. Oracle JDeveloper Studio Installation wizard appears. 5) On the Welcome page of the wizard, click Next. 6) On the Auto Updates page of the wizard, ensure Skip Auto Updates is selected and click Next. 7) On the Installation Location page of the wizard, in the Oracle Home field, change the path to C:OracleMiddleware122100. 8) Click Next. Click Next. 9) On the Installation Summary page of the wizard, click Install. 10) On the Installation Progress page of the wizard, after installation is completed, click Next. 11) On the Installation Complete page of the wizard, a) select Customize Settings and Then Start JDeveloper. b) Click Finish. Note: Do NOT miss this Important Step. See image below.
  17. 17. 6/454 ADF Essentials Training by Deepak Bhagat 12) Oracle JDeveloper Studio Settings wizard appears. a) In the Default User Directory field, enter D:<<User>>.jdeveloper. b) In the JDeveloper Work Directory field, enter D:<<User>>BATJDev122100. Click OK. 13) Links for starting JDeveloper: https://docs.oracle.com/middleware/1221/jdev/install/GUID-533986A2-EF19-44B3- B2BA-7090DB6F8891.htm#OJDIG129 14) After installing the JDeveloper run the Weblogic Server by clicking Run > Start Server Instance (as shown in below image) and giving the password as weblogic1 (as shown in below image) and test whether it is running successful or not. D:Deepak-PC.jdeveloper D:Deepak-PCBATJDev122100
  18. 18. 7/454 ADF Essentials Training by Deepak Bhagat 15) To start JDeveloper, click on the Start menu > Oracle > Oracle JDeveloper Studio, or double-click on the desktop shortcut .
  19. 19. 8/454 ADF Essentials Training by Deepak Bhagat
  20. 20. 9/454 ADF Essentials Training by Deepak Bhagat 1.5 Unlocking HR Schema -* 1) After Installing Oracle XE, you can access ‘system’ schema but not ‘hr’ schema. ‘hr’ schema comes along with Oracle XE database, but locked. To unlock ‘hr’ schema from database to grant permission to the users to utilize this schema, follow below steps. a) Click Start > expand Oracle Database 11g Express Edition > select Run SQL Command Line. Run SQL Command Line editor opens. b) In the editor, enter connect; command c) Enter the user name and password for the ‘system’ Enter user-name: system (case insensitive) Enter password: sysadmin (case sensitive) d) Enter the following command to unlock the ‘hr’ Schema SQL> ALTER USER HR IDENTIFIED by hr ACCOUNT UNLOCK; e) Exit from the editor by giving command “exit” or by closing directly. f) Now login with ‘hr’ user and password User Name: hr (case insensitive) Password: hr (case sensitive) g) Now you can use all tables specified in tutorial. h) Unlocking the HR Schema OR 2) Alternatively, you can also unlock ‘hr’ Schema from JDeveloper as follows a) Once you are connected as system, expand the tree in the connection panel as Connections->SYSTEM->Other Users b) Right-click on HR to access the Edit User dialog.
  21. 21. 10/454 ADF Essentials Training by Deepak Bhagat c) Within the dialog, simply uncheck the box entitled Account is Locked and click Apply. d) After completing this process, you should now have a fully functional Oracle XE database with the example HR schema unlocked.
  22. 22. 11/454 ADF Essentials Training by Deepak Bhagat 1.6 Entity Relation Diagram of HR System -*
  23. 23. 12/454 ADF Essentials Training by Deepak Bhagat
  24. 24. 13/454 ADF Essentials Training by Deepak Bhagat 1.7 Working with JDev IDE Configuration Files -o 1) The locations from where you can start JDeveloper apart from the shortcuts are: a) MW_HOMEjdeveloperjdeveloper.exe b) MW_HOMEjdeveloperjdevbinjdevw.exe c) MW_HOMEjdeveloperjdevbinjdev.exe The first two options have the same purpose. The last option will open along with a console for diagnostic purposes. Example of MW_HOME is C:OracleMiddleware122100. 2) An alternate way for this is to set the JDEV_USER_DIR environment variable that points to the user's current working directory. JDEV_USER_HOME and JDEV_USER_DIR are the variables that are listed in the MW_HOMEjdeveloperjdevbinjdev.boot file. JDeveloper will look up these variables on startup to set the user's directory. For example: set JDEV_USER_HOME=C:Users<<User>>AppDataRoamingJDeveloper set JDEV_USER_DIR=D:<<User>>BATJDev122100mywork 3) Location of IDE configuration files: a) MW_HOMEjdeveloperidebinide.conf b) MW_HOMEjdeveloperjdevbinjdev.conf 4) Location of IDE boot files: a) MW_HOMEjdeveloperidebinide.boot b) MW_HOMEjdeveloperjdevbinjdev.boot
  25. 25. 14/454 ADF Essentials Training by Deepak Bhagat 1.8 Java for Beginners -o Following links are limited Java necessary for ADF. Those moving to ADF from non-Java background may find these sufficient to learn Java. 1) http://www.javatpoint.com/simple-program-of-java 2) http://www.javatpoint.com/variable-datatype 3) http://www.javatpoint.com/operators-in-java 4) http://www.javatpoint.com/object-and-class-in-java 5) http://www.javatpoint.com/constructor 6) http://www.javatpoint.com/static-keyword-in-java 7) http://www.javatpoint.com/this-keyword 8) http://www.javatpoint.com/interface-in-java 9) http://www.javatpoint.com/access-modifiers 10) http://www.javatpoint.com/package
  26. 26. 15/454 ADF Essentials Training by Deepak Bhagat 1.9 References -o 1) JDeveloper and ADF Release 12.2.1.0.0: https://www.oracle.com/tools/downloads/jdev-v12210-downloads.html 2) JDeveloper and ADF Latest Release, Technical Resources & Learn more: https://www.oracle.com/application-development/technologies/jdeveloper.html 3) ADF Homepage: https://www.oracle.com/database/technologies/developer-tools/adf/ 4) Step by Step Building Simple Demo Application with ADF: a) http://docs.oracle.com/cd/E53569_01/tutorials/tut_rich_app/tut_rich_app.html b) http://docs.oracle.com/cd/E53569_01/tutorials/tut_rich_app_alta/tut_rich_app_alta_ 1.html 5) ADF Faces Rich Component Demos: https://docs.oracle.com/middleware/1221/adf/develop-faces/GUID-EE22FD96-2723-4F07- 95A9-04931E42C365.htm 6) ADF Code Corner: https://www.oracle.com/application-development/technologies/adf/codecorner.html 7) ADF Forums: https://community.oracle.com/community/java/java_development_tools/application_devel opment_in_java/jdeveloper_and_adf
  27. 27. 16/454 ADF Essentials Training by Deepak Bhagat 1.10 Grouping of Hands-on Lab Practices -* 1) There is no Lab 01, Lab 10 and Lab 21. 2) Lab 02, Lab 16, Lab 17 and Lab 25 are independent Lab practices and are not dependent on any other Lab. 3) Lab 02, Lab 04, Lab 11, Lab 16, Lab 17, Lab 25 are new starter Labs. 4) Lab 04 continues to Lab 09 and has practices on ADF BC. Later Lab 09 merges with Lab 22 into one Application. 5) Lab 11 continues to Lab 24 (excluding Lab 16, Lab 17). Later Lab 15 adds Lab 09 as ADF Model Library. 6) Lab 20, Lab 24 and Lab 28 are full applications like real-time project. 7) To get a feel of lab objectives and practices, run Lab 20 or Lab 22.
  28. 28. 17/454 ADF Essentials Training by Deepak Bhagat 1.11 Important Abbreviation and Information -* Some of the abbreviations used in this documents are: 1) BAT stands for Bhagat’s (or Bright Wave’s) ADF Training. 2) Lxx where xx is a numeric value. L stands for Lab or Lesson. L04 means Lab04 or Lesson04. 3) -* are Hands-on Labs you must practice. 4) -o are optional example(s), as Advance ADF topics for self-paced Hands-on practice. 5) -x are extended example(s), as Advance ADF topics for self-paced Hands-on practice, provided separately under folder …BATHandoutsBATXtEg-Proprietary. These examples may also be found in my blog at https://cloudadfdeepakb.blogspot.com. 6) -d is downloaded examples from web, as Advance ADF topics for self-paced hands-on practice, provided separately under folder …BATHandoutsOADFXtEg-Downloaded. Important Information: 1) The labs marked with –o, -x and –d are extended example(s), as Advance ADF topics for optional self-paced Hands-on practice. 2) Some images may have the word AAT instead of BAT and aat instead of bat. Please read/replace them as BAT and bat respectively. 3) Steps provided for Hands-on Labs are beta version and not fully verified yet. All errors and omissions are regretted. 4) Kindly contribute with corrections to the Hands-on Lab Practices, to help the ADF community, as all Oracle ADF documents written by us, are free with no copyright. To participate send an email to adftraining.b@gmail.com. 5) Do share freely with larger ADF communities.
  29. 29. 18/454 ADF Essentials Training by Deepak Bhagat 1.12 Downloading Training Materials -* Download all Oracle ADF training documents and lab solutions (prepared by Deepak Bhagat), from shared folders on Google GDrive. Unzip all lab solutions. These training materials consist of study guides, hands-on lab practices, reference guides, bookmarks, downloaded materials, extended samples, demos, etc. Hands-on Lab Practices is a beta version. You may also find some Advance ADF topic examples in Deepak Bhagat’s blog at https://cloudadfdeepakb.blogspot.com.
  30. 30. 19/454 ADF Essentials Training by Deepak Bhagat 1.13 Important to go through after the training -o Codes, Scripts and Configurations: 1) ...BATHandoutsBATLabs-SrcCodesscrjdev.conf 2) ...BATHandoutsBATLabs-SrcCodesL28-SrcCodes-AdvanceADFvc-utilBATADFUtil.java 3) ...BATHandoutsBATLabs-SrcCodesL17-SrcCodes-Bean_Event_Listener 4) ...BATHandoutsBATLabs-SrcCodesL21-SrcCodes-Binding*.java 5) ...BATHandoutsBATXtEg-ProprietaryL28-BATXtEg-AdvanceADFBATVCContextualEventEg 6) ...BATHandoutsBATXtEg-ProprietaryL28-BATXtEg-AdvanceADFBATVCDynamicRegionEg 7) ...BATHandoutsBATXtEg-ProprietaryL28-BATXtEg-AdvanceADFBATVCProgHandleSimplePopupEg 8) ...BATHandoutsBATXtEg-ProprietaryL28-BATXtEg-AdvanceADFBATVCProgHandlePopupWithRegionEg 9) ...BATHandoutsBATXtEg-ProprietaryL29-BATXtEg-Integrating-WebService1Create_REST-WebService-withADFBS Documents: 10) ...BATHandoutsBATDocs-PreTrainingMaterialPrint- BAT ADF Handy Reference.pdf 11) ...BATHandoutsBATDocs-TrainingMaterialBAT ADF Study Guide - student.pdf 12) ...BATHandoutsBATDocs-TrainingReferenceBAT ADF Assorted Notes.pdf 13) ...BATHandoutsBATDocs-TrainingReferenceL08-BAT Introduction to Groovy.pdf 14) ...BATHandoutsBATDocs-TrainingReferenceOracle ADF Bookmarks 2016.html 15) ...BATHandoutsBATDocs-TrainingReferenceOracle ADF Feeds Firefox 2015.opml 16) ...BATHandoutsOADFDocs-DownloadedL26-ADFDocs-BestPractices 17) ...BATHandoutsOADFDocs-DownloadedL27-ADFDocs-MiscellaneousADF Programmer Cheat Sheet.pdf 18) ...BATHandoutsOADFDocs-DownloadedL35-ADFDocs-Books 19) ...BATHandoutsOADFDocs-DownloadedL35-ADFDocs-Tutorials Concepts: 20) Geometry Management 21) Scopes 22) Lifecycle and validation 23) Contextual event 24) Create or Expose as REST Web Service or as REST API
  31. 31. 20/454 ADF Essentials Training by Deepak Bhagat 2 Understanding Development Tool: JDeveloper In this lab for this lesson, start JDeveloper, set preferences for the IDE, and create a JDeveloper application, project and database connection.
  32. 32. 21/454 ADF Essentials Training by Deepak Bhagat 2.1 Creating a New Fusion Application and Project -* Start JDeveloper, create a new ADF Fusion Web Application named BATLab_02 with custom settings and database connection. Also explore data control, overview page and generated files. 1) Start JDeveloper using the default role. a) Double-click the desktop shortcut to start JDeveloper. b) In the Select Role dialog box, select the Role as Studio Developer (All Features). Click OK. c) Optionally, if system prompts the Confirm Import Preferences dialog box, click No. d) JDeveloper starts by displaying the Tip of the Day. Optionally, if you want, deselect the Show tips at startup check box. Click Close. e) Explore and then optionally close the Start page by clicking the X at the right of its tab. (The X is not visible until you position the cursor over the tab.) 2) Create a new ADF Fusion Web Application named BATLab_02 in the bat.lab.hrsystem package. Do not use an application template. Create the initial projects named HRService in the bat.lab.hrsystem.service package and HRViewController in the bat.lab.hrsystem.ui package. a) Click the File menu > New > select Application. Or In the Applications window, click the New Application link. New Gallery wizard appears.
  33. 33. 22/454 ADF Essentials Training by Deepak Bhagat b) Expand the General (in the Categories list) > Applications > select ADF Fusion Web Application (in the Items list). Click OK. Create ADF Fusion Web Application wizard appears. c) On the Application Name page of the wizard, i) In the Application Name field, enter BATLab_02. ii) In the Application Package Prefix field, enter bat.lab.hrsystem. iii) Click Next. d) On the Project 1 Name page of the wizard, Page BAT BAT bat BAT BAT
  34. 34. 23/454 ADF Essentials Training by Deepak Bhagat i) In the Project Name field, enter HRService. ii) Click Next. e) On the Project 1 Java Settings page of the wizard, i) In the Default Package field, enter bat.lab.hrsystem.service. ii) Click Next. f) On the Project 2 Name page of the wizard, i) In the Project Name field, enter HRViewController. ii) Click Next. g) On the Project 2 Java Settings page of the wizard, i) In the Default Package field, enter bat.lab.hrsystem.ui. ii) Click Next. h) Click Finish. 3) Notice that the Applications window displays your application and projects. BAT BAT BAT BAT BAT BAT BAT BAT BAT BAT BAT bat. bat
  35. 35. 24/454 ADF Essentials Training by Deepak Bhagat 4) Explore all the default generated files. 5) Explore the empty Data Controls window (within Applications window). 6) Explore the BATLab_02 Overview. (Notice that the BATLab_02 Overview page is open in the editor. This page enables you to see all the aspects of your application at a glance, to obtain related help and to create new objects. You can spend some time exploring this overview objects if you want to, but it is not used in this lab.) BAT BAT
  36. 36. 25/454 ADF Essentials Training by Deepak Bhagat 2.2 Creating a New Database Connection and Initialize the Project -* Create a new database connection and initialize the project. 1) Create a new database connection. a) Expand the Application Resources window. Right-click the Connections > New Connection > select Database. Create Database Connection wizard appears. b) Supply the following information. Connection Name Hrconn Connection Type Oracle (JDBC) Username hr (or if you are using a shared database, follow instructions given by your instructor.) Password hr (case sensitive) Save Password Select the check box (if not checked/selected) BAT
  37. 37. 26/454 ADF Essentials Training by Deepak Bhagat c) In Oracle (JDBC) Settings section, leave the Driver field as thin, Host Name field as localhost, JDBC Port field as 1521, SID field as XE respectively. d) Click Test Connection. The status box should display the word Success!. e) Click OK. Click Save All .
  38. 38. 27/454 ADF Essentials Training by Deepak Bhagat 2.3 Adding ADF Business Components and ADF Faces -* Create new default business components such as entity objects, view objects and application module. Also create a JSF page. 1) Create new default business components. a) Right-click the HRService > New > select Business Components from Tables. Initialize Business Components Project wizard appears. b) Ensure the Connection is hrconn (if the database connection is already created or else click icon and follow the 2.2 above to create a new database connection). Click OK. Create Business Components from Tables wizard appears. c) On the Entity Objects page of the wizard, Page bat
  39. 39. 28/454 ADF Essentials Training by Deepak Bhagat i) In the Package field, enter bat.lab.hrsystem.service.eo (note eo). ii) Click the Query button to see the available tables. iii) From the Available pane, select DEPARTMENTS and EMPLOYEES, click to shuttle to the Selected pane. iv) In the Selected pane, select the DEPARTMENTS, in the Entity Name field, change to DepartmentEO (remove s). v) Similarly, select the EMPLOYEES, in the Entity Name field, change to EmployeeEO (remove s). vi) Click Next. d) On the Entity-based View Objects page of the wizard, i) In the Package field, enter bat.lab.hrsystem.service.vo (note vo). ii) From the Available pane, select DepartmentEO and EmployeeEO, click to shuttle to Selected pane. iii) In the Selected pane, select the DepartmentEOView, in the Object Name field, change to DepartmentVO (remove View and replace E to V). iv) Similarly, select the EmployeeEOView, in the Object Name field, change to EmployeeVO (remove View and replace E to V). v) Click Next. Page Pane Pane bat
  40. 40. 29/454 ADF Essentials Training by Deepak Bhagat e) On the Query-based View Objects page of the wizard, i) In the Package field, enter bat.lab.hrsystem.service.vvo (note vvo replacing vo). ii) Click the Query button. iii) From the Available pane, select the JOBS, click to shuttle to the Selected pane. iv) In the Selected pane, select the JOBS, in the View Name field, change to JobsVVO (note sVVO). v) Click Next. f) On the Application Module page of the wizard, i) Ensure that the Add to Application Module check box is checked. ii) In the Package field, enter bat.lab.hrsystem.service.am (note am). iii) In the Name field, change to HRSystemAM. iv) Click Next. Page Page bat bat
  41. 41. 30/454 ADF Essentials Training by Deepak Bhagat g) On the Diagram page of the wizard, i) Check the Add to Business Components Diagram check box to create business components diagram. (Leave Package as it is. We will refactor later). ii) Click Next. iii) Click Finish. Click Save All . 2) Explore the files generated and diagrams. Ensure following details: Type of Object Package Objects Based on Entity Object bat.lab.hrsystem.service.eo DepartmentEO, EmployeeEO DEPARTMENTS, EMPLOYEES tables Updatable VO bat.lab.hrsystem.service.vo DepartmentVO, EmployeeVO DepartmentEO, EmployeeEO Query-based VO bat.lab.hrsystem.service.vvo JobsVVO JOBS table Application Module bat.lab.hrsystem.service.am HRSystemAM Page bat bat
  42. 42. 31/454 ADF Essentials Training by Deepak Bhagat 3) Test the default business components by running the application module. a) Right-click the (application module) HRSystemAM (in the bat.lab.hrsystem.service.am package) > select Run. Oracle ADF Model Tester wizard appears. b) Explore the view object instances in it. 2) Create a new JSF page named HRSystemIndex and run the page. BAT bat bat bat bat bat bat
  43. 43. 32/454 ADF Essentials Training by Deepak Bhagat a) Right-click the HRViewController > New > select Page. Create JSF Page wizard appears. b) In the File Name field, enter HRSystemIndex. Keep remaining as defaults. c) Click OK. d) Explore the newly created page HRSystemIndex.jsf. e) Right-click the HRSystemIndex.jsf > select Run. System opens the HRSystemIndex page in web browser. Explore the URL and title. BAT BAT bat bat bat bat bat bat
  44. 44. 33/454 ADF Essentials Training by Deepak Bhagat 2.4 Exploring JDeveloper and New Application -* Examine, explore, understand and familiarize with all generated artifacts. 1) Expand the HRService > Application Sources > bat.lab.hrsystem. 2) Double-click the HRService.jpx file (database connectivity) and explore it. Observe Connection details. 3) Expand the Data Controls window and explore newly displayed artifacts i.e., HRSystemAMDataControl and components under it. 4) Expand the bat.lab.hrsystem.service.am and double-click the Business Components Diagram.adfbc_diagram. 5) Explore all generated artifacts. 6) Expand the Application Resources window > Connections, explore HR System schema, tables, sequence, properties, etc. bat
  45. 45. 34/454 ADF Essentials Training by Deepak Bhagat 2.5 Exploring Windows of JDeveloper -* Examine, explore, understand and familiarize with various windows of the JDeveloper. 1) Explore various windows of JDeveloper such as Applications, Data Controls, Databases, Structure, Editors (code and visual), Log and Debugger, Components, Resources (IDE and Application), Properties, etc. and other Windows. BATLab_02
  46. 46. 35/454 ADF Essentials Training by Deepak Bhagat 2.6 Working with Windows -* Play around with windows and familiarize. 1) Right-click the window title, to work with following window options: Close / Open Maximize / Restore Float / Dock Split / Unsplit Resize Reposition 2) All JDev Menus and menu items like File, Edit, View, Application, Refactor, Search, etc. BAT
  47. 47. 36/454 ADF Essentials Training by Deepak Bhagat 2.7 Taking Help using F1 key -* Familiarize with JDeveloper Help. 1) Select or place the cursor on the object or context of which you need help. 2) Press F1 key for help. Help window appears, which contains the detailed information regarding the selected object or context.
  48. 48. 37/454 ADF Essentials Training by Deepak Bhagat 2.8 Refactoring JDeveloper Artifacts -* Refactor artifacts by renaming view object and moving diagram to appropriate package. 1) Rename (JobsVVO to JobVVO) and move diagram (from bat.lab.hrsystem.service.am to bat.lab.hrsystem.service.diagram). a) Right-click the JobsVVO > Refactor > select Rename. Rename wizard appears. b) In the Rename To field, change to JobVVO (remove s). Click OK. Notice the name JobsVVO changed to JobVVO. c) Expand the bat.lab.hrsystem.service.am, select Business Components Diagram.adfbc_diagram. d) Click the Refactor menu > select Move. bat
  49. 49. 38/454 ADF Essentials Training by Deepak Bhagat Move Files window appears. e) Select the service folder, create a new folder diagram by clicking icon and select it. f) Click the Select button. Diagram moves from package bat.lab.hrsystem.service.am to bat.lab.hrsystem.service.diagram 2) Save All. BAT BAT BAT BAT bat
  50. 50. 39/454 ADF Essentials Training by Deepak Bhagat 2.9 Setting IDE Preferences -* Configure JDeveloper preferences for Object Naming and Packages. 1) Set global naming preferences and packaging preferences for following ADF BC objects: entity object, domain, association, view object, view link and application module. a) Click the Tools menu > select Preferences. Preferences wizard appears. b) Expand the ADF Business Components > select Object Naming. c) In the Suffix column, enter values as follows: d) At the left pane, select Packages and enter Packages values as follows
  51. 51. 40/454 ADF Essentials Training by Deepak Bhagat e) Click OK. Save All. 2) Click the Tools menu > select Switch Roles, to switch default role to start JDeveloper, if needed.
  52. 52. 41/454 ADF Essentials Training by Deepak Bhagat 2.10 Setting Package Levels -* Set the project package and web content levels to reduce number of levels. 1) Click the Applications Window Options as shown below. 2) Change the both Package Level and Web Content Level to 5. 3) Save All. BAT bat bat bat bat bat bat
  53. 53. 42/454 ADF Essentials Training by Deepak Bhagat 2.11 Lab Solution Lab solutions can be found under …BATHandoutsBATLabs-SolutionsBATLab_02.
  54. 54. 43/454 ADF Essentials Training by Deepak Bhagat 3 Modeling Database Schema In this lab, you use the diagram modeler/editor to create a visual representation of the database schema. You also create a new database component (a table) and create the DDL (Data Definition Language) scripts to add the table to the schema.
  55. 55. 44/454 ADF Essentials Training by Deepak Bhagat 3.1 Copying Application -o Make a copy of application BATLab_02 and rename it to BATLab_03. 1) In the File Explorer, open location …mywork. 2) Copy and paste the application BATLab_02 in the same location. 3) Rename the newly copied application from BATLab_02-Copy to BATLab_03. 4) Switch to JDeveloper. 5) Click the File menu > select Open. 6) Select the …myworkBATLab_03BATLab_02.jws from your local system. Click Open. 7) Click the Application menu > select Rename. Rename wizard appears. 8) In the File Name field, change to BATLab_03.jws. Click Save. 9) Click the Build menu > select Clean All and Refresh Application. Click Yes. BAT BAT BAT BAT
  56. 56. 45/454 ADF Essentials Training by Deepak Bhagat 3.2 Exploring HR System ER Diagram -* Examine, explore, understand and familiarize with HR System ER diagram.
  57. 57. 46/454 ADF Essentials Training by Deepak Bhagat 3.3 Examining Training Lab Application – Lab Solution 22 -* Open …BATHandoutsBATLabs-SolutionsBATLab_22 lab solution. Run and explore the application. <<to be done together at end>>
  58. 58. 47/454 ADF Essentials Training by Deepak Bhagat 3.4 Creating an Offline Database Diagram with Existing Schema Objects-o Create a new offline database diagram (BAT_DB) with existing schema objects. 1) Expand the Application Resources window > Connections > Database > hrconn and explore. 2) Right-click the HRService > New > select From Gallery. New Gallery wizard appears. 3) Expand the General > Diagrams > select Database Diagram at right-side. Click OK. Create Database Diagram wizard appears. 4) In the Name field, enter BATSchema 5) In the Package field, enter bat.lab.hrsystem.service.db (note db). 6) Click OK. 7) BATSchema.db_diagram opens in the editor. Save All. bat BAT
  59. 59. 48/454 ADF Essentials Training by Deepak Bhagat 8) Expand the Application Resources window > Connections > Database > hrconn > Tables. 9) Drag the DEPARTMENTS and EMPLOYEES tables to the diagram modeler/editor. Specify Location dialog box appears. 10) Select the Offline Database, in Offline Database field enter BAT_DB. 11) Click OK. Save All. BAT BAT BAT
  60. 60. 49/454 ADF Essentials Training by Deepak Bhagat 3.5 Adding New Offline Database Schema Objects -o Add new database schema object (GENDERS) to the newly created offline database (BAT_DB). 1) From the Components window (ensure Database page is selected), drag Table component to the BATSchema.db_diagram editor. Specify Location wizard appears. 2) In the Offline Database list, select BAT_DB (If it is already not selected). Click OK. 3) In the diagram editor, change table name from TABLE1 to GENDERS. 4) Resize the table. 5) Double-click the GENDERS table diagram to invoke Edit Table page. a) Click the Columns page (left side). Page BAT BAT BAT
  61. 61. 50/454 ADF Essentials Training by Deepak Bhagat b) Click the icon (right end) to add a new column GENDER_ID. i) In the Name column, enter GENDER_ID, ii) In the Data Type column, change to Number, iii) In the Size column, enter 4, iv) In the Not NULL column, check the check box, to make it mandatory, v) In the PK column, click inside column, to make it a primary key, vi) Save All. OR vii) Click the Constraints page. Click icon and select New Primary Key Constraint. From Available Columns, select GENDER_ID and shuttle it to Selected Columns. c) Similarly add another column GENDER_NAME with default values. i) In the Name column, enter GENDER_NAME. 6) Save All.
  62. 62. 51/454 ADF Essentials Training by Deepak Bhagat 3.6 Generating the SQL Scripts -o Create and run scripts to create GENDER table in the Database and to insert data in it. 1) To generate DDL script, a) In the Projects window, expand Offline Database Sources > BAT_DB > HR. b) Right-click the GENDERS table > Generate To > select SQL Script. Generate SQL from Database Objects wizard appears. BAT BAT BAT BAT
  63. 63. 52/454 ADF Essentials Training by Deepak Bhagat c) On the SQL Script page of the wizard, in the File Name field change to …databaseBAT_DBcreateTableGender.sql. Click Next. Click Next. Click Next. Click Next. Click Finish. It creates createTableGender.sql file and opens in the editor 2) Double-click the Employees table. a) Click the Columns page. b) Select the last column (i.e. DEPARTMENT_ID), click icon to add a new column. It inserts new column. c) In the Name column, change from COLUMN1 to GENDER_ID, d) In the Data Type column, change to Number, e) In the Size column, change to 4. Save All. 3) Go back to BATSchema.db_digram (if it is closed, expand the Recent Files window and double-click the diagram). 4) In the Components window, drag Foreign Key from GENDER_ID of GENDERS table to GENDER_ID of EMPLOYEES table. Click OK. Save All. BAT BAT
  64. 64. 53/454 ADF Essentials Training by Deepak Bhagat 5) To generate DDL script, a) Expand the Offline Database Sources > BAT_DB > HR. b) Right-click the EMPLOYEES table > Generate To > select SQL Script. Generate SQL from Database Objects wizard appears. c) In the File Name field, change to …databaseBAT_DBalterTableEmp.sql. Click Next. Click Next. Click Next. d) On the Specify Operation page of the wizard, i) In the Operation option, select Alter radio button. ii) Check the With replace if necessary checkbox. iii) In the Target option, select Database Connection. iv) Ensure the Connection is hrconn (BATLab_03). v) Click Next. Click Finish. BAT BAT BAT
  65. 65. 54/454 ADF Essentials Training by Deepak Bhagat 6) Expand the Offline Database Sources. 7) Right-click the BAT_DB > New > select From Gallery. New Gallery wizard, appears. a) Expand the Database Tier > select Database Files > SQL File. Click OK. Create SQL File wizard appears. b) In the File Name field, enter populateTableGender.sql. c) In the Directory field, change path to …HRServicedatabaseBAT_DB. d) Click OK. populateTableGender.sql opens in the editor. 8) Insert following content in populateTableGender.sql editor. INSERT INTO GENDERS (gender_id, gender_name) VALUES (1, 'MALE'); INSERT INTO GENDERS (gender_id, gender_name) VALUES (2, 'FEMALE'); 9) Save All. BAT BAT BAT BAT
  66. 66. 55/454 ADF Essentials Training by Deepak Bhagat 3.7 Running the SQL Scripts on Database -o Run the all three scripts to create GENDER table and to insert data in the table. 1) Run the scripts in following order: createTableGender.sql, alterTableEmp.sql and populateTableGender.sql. a) Expand the Offline Database Sources > BAT_DB > HR. b) Double-click the createTableGender.sql to open it in the editor. c) Right-click in the editor, select Run Script. It creates new table GENDERS in database. 2) Similarly, Run Script on alterTableEmp.sql and populateTableGender.sql. 3) To verify, check the database that the GENDERS table is created and it has data.
  67. 67. 56/454 ADF Essentials Training by Deepak Bhagat 3.8 Invoking PLSQL -x This is part of advance ADF topic and a copy of this extended example (named BATPLSQLIntgEg) may be found under …BATHandoutsBATXtEg-ProprietaryL03- BATXtEg-Database. For hands-on practice, please refer to Deepak Bhagat’s Blog at https://cloudadfdeepakb.blogspot.com or download from above location. It’s a lab sample on invoking PLSQL.
  68. 68. 57/454 ADF Essentials Training by Deepak Bhagat 4 Building Business Services with Default Business Components In this lab, you create a business model by using the wizards that are built into JDeveloper. You see how to build a default model without any coding. In subsequent lessons and practices, you learn to build and customize components to meet your specific application requirements.
  69. 69. 58/454 ADF Essentials Training by Deepak Bhagat 4.1 Creating another New Application and Projects -* Create an application BATLab_04 with default projects, with default packages and settings. 1) Create an application named BATLab_04 with package bat (as explained in Lab 2.1) and with default projects, packages and settings. a) Click the File menu > New > select Application. New Gallery wizard appears. b) Expand the General > Applications > select ADF Fusion Web Application. c) Click OK. Create ADF Fusion Web Application wizard appears. d) On the Application Name page of the wizard, i) In the Application Name field, enter BATLab_04. ii) In the Application Package Prefix field, enter bat. iii) Click Finish. (or Click Next > Next > Next > Next > Next > Finish). 2) The application gets created with default projects Model and ViewController and with default packages bat.model and bat.view respectively. 3) Optionally one may delete ViewController project. BAT BAT BAT BAT bat
  70. 70. 59/454 ADF Essentials Training by Deepak Bhagat 4.2 Creating Default ADF Business Components -* Create default business components; Entity Objects, View Objects and Application Module. 1) Create Business Components by using Create Business Components from Tables with following details Type of Object Package Objects Based on Entity Object bat.model.eo DepartmentsEO, EmployeesEO DEPARTMENTS, EMPLOYEES tables Updatable VO bat.model.vo DepartmentsVO, EmployeesVO DepartmentsEO, EmployeesEO Query-based VO bat.model.vo JobsVO JOBS tables Application Module bat.model.am AppModuleAM a) Right-click the Model project > New > select Create Business Components from Tables. Initialize Business Components Project wizard appears. b) Click the icon, next to the Connection. Create Database Connection wizard appears.
  71. 71. 60/454 ADF Essentials Training by Deepak Bhagat c) Supply the following information: Connection Name Hrconn Connection Type Oracle (JDBC) Username hr (or if you are using a shared database, follow the instructions given by your instructor.) Password hr (case sensitive) Save Password Select check box d) Click the Test Connection. The status box displays the word Success! Click OK. e) Click OK. Create Business Components from Tables wizard appears. f) To create default business components, follow below steps, as explained in step 2.1.9. BAT
  72. 72. 61/454 ADF Essentials Training by Deepak Bhagat i) Click the Query button. From Available pane, select DEPARTMENTS and EMPLOYEES and shuttle them to Selected pane. Click Next. ii) On the Entity-based View Objects page of the wizard. From Available pane, shuttle DepartmentsEO and EmployeesEO to Selected pane. Click Next. iii) On the Query-based View Objects page of the wizard. Click Query button. From Available pane, select JOBS and shuttle them to Selected pane. Click Next. iv) Ensure the Add to Application Module checkbox is checked. v) Click Next. vi) Click Finish. g) Save All. Page bat
  73. 73. 62/454 ADF Essentials Training by Deepak Bhagat 4.3 Examining Generated ADF Business Components Artifacts -* Examine, explore, understand and familiarize with all generated artifacts. BAT bat bat bat bat bat bat
  74. 74. 63/454 ADF Essentials Training by Deepak Bhagat 4.4 Testing the Business Service (using Oracle ADF Model Tester) -* Test the business services which are created in earlier sections by using Oracle ADF Model Tester. 1) Run and test application module (AppModuleAM), using Oracle ADF Model Tester. a) Right-click the (application module) AppModuleAM, select Run. Oracle ADF Model Tester wizard appears. 2) Double-click the various object instances on the left side panel and test. a) For example, double-click the EmpDeptFkVL1 and Jobs and observe the details on right side panel. b) Navigate through records by clicking right-arrow and left arrow .
  75. 75. 64/454 ADF Essentials Training by Deepak Bhagat 4.5 Lab Solution Lab solutions can be found under …BATHandoutsBATLabs-SolutionsBATLab_04
  76. 76. 65/454 ADF Essentials Training by Deepak Bhagat 5 Persisting Data Using Entity Objects In this lab, you create entity objects for tables that the application will update and also create associations.
  77. 77. 66/454 ADF Essentials Training by Deepak Bhagat 5.1 Copying Application -o Make a copy of application BATLab_04 and rename it to BATLab_05. Follow the steps, as explained in Lab 3.1. 1) In the File Explorer, open location …mywork. 2) Copy and paste the application BATLab_04 in the same location. 3) Rename the newly copied application from BATLab_04-Copy to BATLab_05. 4) Switch to JDeveloper. 5) Click the File menu > select Open. 6) Select …myworkBATLab_05BATLab_04.jws from your local system. Click Open. 7) Click the Application menu > select Rename. Rename wizard appears. 8) In the File Name field, change to BATLab_05.jws. Click Save. 9) Click the Build menu > select Clean All and Refresh Application. Click Yes. 10) Open the Model.jpx file in the editor. 11) If the Connection is selected None, then select Online Database.
  78. 78. 67/454 ADF Essentials Training by Deepak Bhagat 5.2 Creating Multiple Entity Objects at Once -* Create following multiple entity objects at once by using Create Business Components from Tables. DB Tables Entity Objects (EO) COUNTRIES CountriesEO REGIONS RegionsEO JOB_HISTORY JobHistoryEO 1) Right-click the bat.model.eo package > New > select Business Components from Tables. Create Business Components from Tables wizard appears. 2) Click the Query button. 3) From the Available (left) pane, select COUNTRIES, REGIONS and JOB_HISTORY and shuttle them to Selected (right) pane. 4) Click Finish. bat
  79. 79. 68/454 ADF Essentials Training by Deepak Bhagat 5.3 Creating an Association -* (dependent on 5.3) Manually create an association JobHistDeptAS between two entity objects DepartmentsEO and JobHistoryEO. 1) Right-click the bat.model.as > New > select Association. Create Association wizard appears. 2) On the Name page of the wizard, in the Name field enter JobHistDeptAS. Click Next. 3) On the Entity Objects page of the wizard, a) From the Select Source Attribute pane, expand DepartmentsEO > select DepartmentId and from Select Destination Attribute pane, expand JobHistoryEO > select DepartmentId. b) Click the Add button. 4) Click Next. Click Next. Click Next. Click Finish. Save All. bat bat bat
  80. 80. 69/454 ADF Essentials Training by Deepak Bhagat 5.4 Examining Attribute Settings -* Examine, explore, understand and familiarize with all settings of an Attribute. 1) Property Set: Select a named property set to apply to this attribute. A property set is a version of an existing domain that is XML-only (no Java) and does not enforce a data type. 2) Effective Date: Specify effective date properties for the attribute. These options are available only if the attribute type is Date. 3) Start Date: Select to indicate that this attribute is the start attribute of an effective dated entity object. 4) End Date: Select to indicate that this attribute is the end attribute of an effective dated entity object. 5) Sequence Flag: Select to indicate that this attribute stores a flag indicating the most recent change in the sequence for an effective dated entity object. 6) Sequence: Select to indicate that this attribute stores a sequence of changes for an effective dated entity object. 7) Updatable: You can enable the attribute to Always or Never be updatable or enable it to be updated only before the entity is first posted (While New).
  81. 81. 70/454 ADF Essentials Training by Deepak Bhagat 8) Queryable: Specify that this attribute can occur in the WHERE clause of a view object (selected by default except for LOBs). 9) Precision Rule: Specifies that a validator is applied by the framework at runtime to enforce the maximum precision and scale of the data type. If selected, the validation is performed by the entity. If not selected, the validation is not performed by the entity and may result in invalid precision/scale errors from the database when the transaction is committed. 10) Refresh on Insert/ Update: Specify whether to retrieve the value from the database after an insert or update. 11) Change Indicator: Select this option if the column is a change indicator, such as a timestamp, to be used to indicate that a row has been changed by another transaction. (If no columns are specified as change indicators, ADF BC does a column-by-column comparison.) 12) Effective Date: The attribute is either the start or end date of a date range for which the entity row is effective (used for a point of time snapshot to answer such questions as what an employee’s salary was on January 30, 2004.) 13) History Column: Select to use this column to log changes to the database. You can log changes only if you have implemented Java Authentication and Authorization Service (JAAS) authentication, the selected attribute is persistent, you have not selected Primary Key, Mandatory, or Discriminator, and the attribute is Char, Character, String, Date, Timestamp, or Number. After you have selected History Column, you can select the history column type (created on or modified on for a Date or Timestamp attribute, created by or modified by for a Char, Character, or Stringattribute, or version number for a Number attribute). 14) Generate Unique Constraint: Select to generate a UNIQUE constraint for this attribute. It is often useful to define an attribute so that its values must be unique. For example, you might want to enforce that every customer has a unique email address. 15) Sequence Name: Enter the name of the database sequence. The sequence name shown on the Sequence tab is applicable only at design time when you use the Create Database Tables feature. The sequence indicated here will be created along with the table on which the entity object is based. This field is not available for all attribute types. 16) Start At: Enter an integer value you want the sequence to start at, the default value is 1. This field is not available for all attribute types.
  82. 82. 71/454 ADF Essentials Training by Deepak Bhagat 5.5 Creating Entity Object based on Database View -o Create Entity Object EmpDetailsViewEO in bat.model.eo package, based on Database View (EMP_DETAILS_VIEW). 1) In the Applications window, right-click the Model project (or bat.model.eo package) > New > select Entity Object. Create Entity Object wizard appears. 2) On the Name page of the wizard, in the Name field, enter EmpDetailsViewEO and click Browse (next to the Schema Object). Select Schema Object wizard appears. a) Check the Object Type as Views and uncheck Tables. b) Click the Query button. c) From the Available Objects select EMP_DETAILS_VIEW. Click OK. bat
  83. 83. 72/454 ADF Essentials Training by Deepak Bhagat 3) Click Next. 4) On the Attributes page of the wizard, select last two columns (CounrtyName and RegionName). Click Remove. Click Next. (Removing is important for lab 5.4). 5) On the Attribute Settings page of the wizard, select EmployeeId and check Primay Key check box to make it as Primary Key. Click Next. Click Next. Click Next. Click Finish. (See lab 5.6 for details on each properties of the Attribute). bat
  84. 84. 73/454 ADF Essentials Training by Deepak Bhagat
  85. 85. 74/454 ADF Essentials Training by Deepak Bhagat 5.6 Synchronizing an Entity Object with Table Structure Changes -o (dependent on 5.5) Synchronize EmpDetailsViewEO entity object’s missing columns with database or structure changes in table. 1) Double-click the EmpDetailsViewEO to open in the editor. 2) Click the Attributes page. Verify that CounrtyName and RegionName attributes are missing. 3) Right-click the EmpDetailsViewEO > select Synchronize with Database. Synchronize with Database wizard appears. 4) Select statements with COUNTRY_NAME and REGION_NAME. Click Synchronize button. Click OK. Click OK. Save All. 5) Verify the CounrtyName and RegionName attributes are now present in the EmpDetailsViewEO.
  86. 86. 75/454 ADF Essentials Training by Deepak Bhagat 5.7 Lab Solution Lab solutions can be found under …BATHandoutsBATLabs-SolutionsBATLab_05
  87. 87. 76/454 ADF Essentials Training by Deepak Bhagat 5.8 Applying Property Set -d This Property Set topic is part of the Advance ADF exte