OIG 11G R2 Training Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 1 | Page OIG 11G R2 Field Enablement Training Lab 12 - Advanced UI Customization Disclaimer: The Virtual Machine Image and other software are provided for use only during the workshop. Please note that you are responsible for deleting them from your computers before you leave. If you would like to try out any of the Oracle products, you may download them from the Oracle Technology Net- work (http://www.oracle.com/technology/index.html ) or the Oracle E-Delivery WebSite(http://edelivery.oracle.com )
32
Embed
OIG 11G R2 Field Enablement Training - Oracle · 62. Right-click CommonUI project. 63. Click on Deploy and select available deployment profile. 64. Click Finish. All your custom task
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 1 | P a g e
OIG 11G R2 Field Enablement Training Lab 12 - Advanced UI Customization
Disclaimer: The Virtual Machine Image and other software are provided for use
only during the workshop. Please note that you are responsible for deleting
them from your computers before you leave. If you would like to try out any of
the Oracle products, you may download them from the Oracle Technology Net-
work (http://www.oracle.com/technology/index.html) or the Oracle E-Delivery
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 2 | P a g e
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 3 | P a g e
Table of Contents
OIG 11G R2 Field Enablement Training ..................................................................................................................................................................................... 1
1.3 Use Case .......................................................................................................................................................................................................... 4
2. Add user-defined fields (UDF) to User ........................................................................................................................................................................ 6
3. Preparing your JDeveloper environment .................................................................................................................................................................... 8
3.1 Setup the ADF shared libraries ....................................................................................................................................................................... 8
3.2 Setup the JDeveloper Workspace ................................................................................................................................................................... 8
4. Develop the code for LOVs ........................................................................................................................................................................................ 16
5. Develop the Managed Bean ...................................................................................................................................................................................... 18
5.1 Develop the Managed Bean.......................................................................................................................................................................... 18
5.3 Set default values for form fields .................................................................................................................................................................. 19
5.3 Implement field validation ............................................................................................................................................................................ 20
6. Compile the code and generate the WAR file ........................................................................................................................................................... 21
6.1 Setup the project dependencies and deployment profile ............................................................................................................................ 21
6.2 Define the Managed Bean ............................................................................................................................................................................ 23
6.3 Compile the project ...................................................................................................................................................................................... 24
6.4 Deploy the project ........................................................................................................................................................................................ 24
7. Add the UDFs ............................................................................................................................................................................................................ 26
7.1 Add the UDFs to the Create User Page ......................................................................................................................................................... 26
7.2 Export the sandbox as a backup ................................................................................................................................................................... 31
7.3 Import the sandbox ...................................................................................................................................................................................... 31
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 4 | P a g e
1. Introduction
Oracle Identity Manager 11g R2 introduces a self-service UI, based on the Application
Development Framework (ADF) and a UI customization framework
based on middleware technologies including Composer, Metadata Services (MDS) and ADF
Business Components (ADF BC). Unlike prior versions of OIM 11g,
the UI is completely customizable (barring a handful exceptions) and configurable. Where it is
not possible to customize the UI, OIM 11g R2 offers the ability to replace the OOB UI with your
own UI without breaking the OOB UI and without requiring rework when a patch is applied.
This lab is an advanced UI customization lab that focuses on common UI customization use cases
that have been asked by over five R2 deployments. The goal of this lab is not to cover all
scenarios, but to show you what is possible, how to do it and where you can go to learn more so
that you can implement your own use cases.
1.1 Pre-requisites
Familiarity with Java
Familiarity with JDeveloper (Note: Eclipse supports ADF via Oracle Enterprise Pack for
Eclipse but that is out of scope for this lab)
Familiarity with JSF
1.2 Supporting collateral
This lab is accompanied with a folder (/app/dummydata/Lab 12/assets) that contains …
Libraries required for developing Task Flows and Managed Beans
Java source files for the managed bean
Sandboxes containing the initial and the final UI
Helper Projects to help you implement common ADF use cases
The WAR file to be used to deploy the customizations
1.3 Use Case
There are two scenarios you will implement in this lab.
Customizing the Create User Form
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 5 | P a g e
o In this scenario, the requirements are as follows
o Offer a guided user creation flow. This means that Minimum data entry must be
required upon initial page load.
o The administrator must select a user type. If the user type is Contractor or
Employee, the administrator must select a job code.
o After selecting the job code, the administrator must pick a responsibility. The
responsibilities shown must be filtered based on the selected job code
o If the user type is a contractor
o The account must have a validity of 180 days
o The user login must start with contr_
o The email address must end with @acme.com
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 6 | P a g e
2. Add user-defined fields (UDF) to User
Follow the steps below to add UDFs to the User entity.
1. Login to the Sysadmin console as ADMIN.
2. Click on Sandboxes at the top.
3. Click on Create Sandbox.
4. Name it as AdvancedUICustLab12_1.
5. Click Save and Close.
6. Click OK.
7. Click on Form Designer under Configuration.
8. From the Type drop-down, select User.
9. Click Search.
10. Select User form from the search results and click Open.
11. Click on the create icon under Custom section.
12. Add the following UDFs.
Display Label Name Data Type Display Width API Name
Job Code Display Name JobCodeDisplayName Text 50
Job Code ID JobCodeID Text 50
Responsibility ID ResponsibilityID Text 50
Responsibility Name ResponsibilityName Text 100
Contractor ID ContractorID Text 50
Contract Expires On ContractExpiresOn Date
Contract Number ContractNumber Text 50
13. After you add a UDF, note down the API Name. This is the string that you will use in the
managed beans to manipulate properties, set data etc. For example, for Job Code
Display Name, the API Name is JobCodeDisplayName__c (two underscores).
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 7 | P a g e
14. The API names for the UDFs are given below as a reference. You must check and use the
names from your OIM environment.
Display Label API Name
Job Code Display Name JobCodeDisplayName__c
Job Code ID JobCodeID__c
Responsibility ID ResponsibilityID__c
Responsibility Name .ResponsibilityName__c
Contractor ID ContractorID__C
Contract Expires On ContractExpiresOn__c
Contract Number ContractNumber__c
15. Close all the tabs.
16. Click on the Sandboxes link at the top.
17. Select the AdvancedUICustLab12_1 by clicking on that row. Do not open it.
18. Click on Publish Sandbox from the menu above.
19. Click Yes.
20. Logout and close the browser.
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 8 | P a g e
3. Preparing your JDeveloper environment
3.1 Setup the ADF shared libraries
Follow the steps below to setup the shared libraries required to develop the customizations
1. Create a directory, OIMLibraries on your VM desktop.
2. Create two directories, client and ext under it.
3. Copy the jdev.lib folder from
/app/Middleware/Oracle_IDM1/server to the OIMLibraries folder.
4. Copy the file /app/Middleware/Oracle_IDM1/server/client/oimclient.jar to the client
folder in the OIMLibraries folder.
5. Copy the /app/Middleware/Oracle_IDM1/server/ext/internal/orai8n-adf.jar to the
ext/internal folder in the OIMLibraries folder.
6. Copy the /app/Middleware/Oracle_IDM1/server/modules folder to the OIMLibraries
folder.
7. Verify that your OIMLibraries structure looks as shown below.
3.2 Setup the JDeveloper Workspace
Follow the steps below to setup the JDeveloper workspace
1. Launch JDeveloper in the VM.
2. Click File New.
3. Select Generic Application.
4. Click OK.
5. Provide application name as R2Workshop.
6. Copy the directory structure.
This has already been done for you. Do this only if you want to know how to package OIM
Libraries from scratch.
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 9 | P a g e
7. Click Finish. Application will be created including one sample project.
8. Right-click on the project and select Delete to delete the project. Remember the location
of the R2Workshop directory.
9. Choose the first option, Remove Project from Application and click on Yes.
10. Copy the CommonModel and CommonUI folders that have been provided to the
R2Workshop directory. The two folders contain two JDeveloper projects that contain
helper classes.
a. /app/dummydata/Lab 12/assets
11. Click File Open and open R2Workshop/CommonModel/CommonModel.jpr.
12. Click File Open and open R2Workshop/CommonUI/CommonUI.jpr.
13. Right-click the CommonModel project and select Project Properties.
14. Select Libraries and Classpath. Scroll down till you see the libraries highlighted in red;
these are the libraries that the system couldn’t find.
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 10 | P a g e
15. Select and Remove them.
16. Now add the new libraries.
17. Click Add Library.
18. Click Load Dir.
19. Navigate to the /app/dummydata/Lab 12/assets/OIMLibraries/OIMLibraries/jdev.lib
folder.
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 11 | P a g e
20. Confirm selection by clicking on Select.
21. Click OK.
22. Click Add Library.
23. Select OIM Client Library.
24. Confirm selection by clicking on Select.
25. Click OK.
26. Click Add Library.
27. Click Load Dir.
28. Select OIM Model Shared Library.
29. Confirm selection by clicking on Select.
30. Click OK.
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 12 | P a g e
31. Click Add Library.
32. Click Load Dir.
33. Select the OIM View Shared Library.
34. Confirm selection by clicking on Select.
35. Click OK.
36. Click OK.
37. Right-click the CommonUI project and select Project Properties.
38. Select Libraries and Classpath. Scroll down till you see the libraries highlighted in red;
these are the libraries that the system couldn’t find.
39. Select and Remove them. Now add the new libraries.
40. Click Add Library.
41. Select OIM Client Library.
42. Confirm selection by clicking on Select.
43. Click OK.
44. Click Add Library.
45. Click Load Dir.
46. Select OIM Model Shared Library.
47. Confirm selection by clicking on Select.
48. Click OK.
49. Click Add Library.
50. Click Load Dir.
51. Select the OIM View Shared Library.
52. Confirm selection by clicking on Select.
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 13 | P a g e
53. Click OK.
54. Click OK.
55. Right-click CommonModel project.
56. Choose Make ….
57. Right-click CommonUI project.
58. Choose Make ….
59. Right-click CommonModel project.
60. Click on Deploy and select available deployment profile.
61. Click Finish.
62. Right-click CommonUI project.
63. Click on Deploy and select available deployment profile.
64. Click Finish.
All your custom task flows, pages and managed beans should be present in a project configured
for ADF UI. This is called the View Controller project. To set up the View Controller project,
follow these instructions:
1. Launch the JDeveloper in the VM.
2. Click File New.
3. Find and select ADF ViewController Project.
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 14 | P a g e
4. Click OK.
5. Provide Project Name as UICustomizations.
6. Click Next.
7. Provide the Default Package name as oracle.iam.ui.custom.
8. Click Finish.
9. Right-click the Project and click Project Properties.
10. Click Dependencies.
11. Click the pencil icon and expand the CommonModel and CommonUI.
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 15 | P a g e
12. Select Build Output of each project.
13. Click OK.
14. Click OK.
All your custom EOs/VOs and classes interacting directly with OIM APIs should be present
in an ADF Model project. To set up the Model project follow these instructions.
1. In the JDeveloper, click File New.
2. Find and select ADF Model Project and click OK.
3. Provide the Project Name, CustomModel and click Next.
4. Provide the default package name oracle.iam.ui.custom.
5. Click Finish.
6. Setup the dependencies with the CommonModel and CommonUI as did previously.
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 16 | P a g e
4. Develop the code for LOVs
There are two types of Lists of Values that are used in Oracle Identity Manager.
Lists of Values; that are generated when an entity attribute or a Process Form attribute
is associated with a Lookup Definition. These LOVs cannot be customized.
Custom Lists of Values where the customer needs more control over the values are
displayed and how many columns are displayed.
In this lab, we will not focus on the LOVs generated and used by OIM. Instead, we will focus on
learning how to develop a LOV component and make the selected value of one LOV drive the
values in another LOV.
We need to develop the code for two LOVs:
Job Code
Responsibility.
Values in the Responsibility LOV are driven by the selected value from the Job code LOV. Follow
the steps given below to develop the LOV
1. Launch the JDeveloper in the VM.
2. Open the CustomModel project if not already open.
3. Add a Java class by going to File New Java Java Class.
4. Provide JobCode as the class name and oracle.iam.ui.sample.userform.model as the
package name. This class represents the JobCode object. We will next create a class that
will provide a list of JobCode objects.
5. Click OK.
6. Add a Java class by going to File New Java Java Class.
7. Provide JobCodeDataProvider as the class name and
oracle.iam.ui.sample.userform.model as the package name.
8. Click OK.
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 17 | P a g e
9. To save time, the source for these classes has been provided in the
3. You might notice compilation errors for the UserFormRequestBean class at this moment, it's
due to missing dependency on CustomModel project, don't worry about it right now, this
dependency is configured later in this lab
4. Make sure that values of JOB_CODE_NAME_ATTRIBUTE, JOB_CODE_ID_ATTRIBUTE,
RESPONSIBILITY_NAME_ATTRIBUTE, RESPONSIBILITY_ID_ATTRIBUTE constants match the
API names of the UDFs created earlier in this lab.
The following sections discuss some of the key methods of the UserFormRequestBean class; you
don't have to copy the code again. The code snippets are mentioned just for reference.
5.2 ValueChangeListener
In order to provide an interactive UI experience, two things need to happen.
When a user interacts with the UI, the UI framework must be made aware of the action
The UI framework must execute some logic and repaint the UI
In order to perform these actions, valueChangeListener needs to be implemented. This method
intercepts user actions (changes of values of certain fields) and makes a determination of what has
to be done.
Key Methods
OIG 11G R2 Training
Oracle Proprietary - Restricted to Personal Use in an Oracle partner training class 19 | P a g e
The following method checks if Contractor has been selected as the User Type, certain regions of the
page are displayed conditionally based on the return value of this method
FaceUtils.getListBindingValue is a method in the FaceUtils helper class that gets the selected value
from a LOV Component
The following method checks if Job Code has been selected, Responsibility LOV field is only displayed
if a value of Job Code has been selected
FacesUtils.getAttributeBindingValue is a method in the FacesUtils helper class that gets the value of
the Job Code attribute.
5.3 Set default values for form fields
The following method sets default values for User Login and Email, it's being invoked from
valueChangeListener method mentioned above.
FaceUtils.setAttributeBindingValue is used to set the value for a form field.
public boolean isContractorUserTypeSelected() { // return true if value of "usr_emp_type__c" binding attribute equals to "Contractor" // "usr_emp_type__c" binding attribute is used to display value of User Type in the User Type drop-down return "Contractor".equals(FacesUtils.getListBindingValue(USER_TYPE_ATTRIBUTE, String.class)); }
public boolean isJobCodeSelected() { return FacesUtils.getAttributeBindingValue(JOB_CODE_NAME_ATTRIBUTE, String.class) != null; }