With code like
... import oracle.jbo.client.Configuration; import oracle.jbo.ApplicationModule; ... String amDef = "model.AppModule"; String config = "AppModuleLocal"; ApplicationModule am = Configuration.createRootApplicationModule(amDef, config); ...
it is possible to instantiate an ApplicationModule in a standalone Java application (means, without the need to launch an application server and deploy the application).
Based on the created ApplicationModule instance, the View Objects and View Links defined in the Application Module's data model can be accessed and test cases for the common CRUD operations (Create, Read, Update, Delete) can be implemented against them. Executing (and debugging) these test cases is very simple since they can be launched as a standalone Java application.
However, when the application is configured with ADF security, the following error might occur when executing the above code, and creation of the ApplicationModule fails:
javax.security.auth.login.LoginException: Null or empty password was provided.
In order to solve this, we need to provide login credentials to the application module. They can be configured in the application module configuration:
Note: You should use a separate user for the test cases, and make sure that this user is not automatically deployed to any production environment!
Using the af:navigationPane and af:commandNavigationItem components, it is possible to create menus on a JSF page based on meta data. Setting up the necessary files and declarations for the menu meta data is quite simple: in JDeveloper, select a .jspx file in the project navigator and choose "Create Applications Menu" from the context menu. JDeveloper will take care of creating the necessary meta data entries. See Creating ADF Menus for Page Navigation for more information.
If something goes wrong, it is good to know how the data is wired in the background. The following diagram shows the structure of the meta data which is involved in application menu creation, and how the various parts are looked up once a browser request for a given view arrives:
When implementing the Oracle ADF UIShell, it is crucial to set the necessary grants for the UIShell template and the UIShell task flows imported from the ADF libraries. If these grants are not correctly assigned, the dynamic areas of the UIShell remain empty. If unsure, you can check if the dynamic areas are generally working at all by temporarily disabling ADF security. If they do, but then are again empty after re-enabling security, the grants are not properly set up.
To assign the necessary grants, open jazn-data.xml through JDeveloper's "Application/Secure/Resource Grants" menu and select "Resource Type: Web Page". Make sure to check "Show web pages imported from ADF libraries" - otherwise, only the pages from the project are shown, but not those which reside within ADF libraries. Assign the anonymous-role to oracle_apps_fnd_applcore_templates_UIShell:
Then, select "Resource Type: Task Flow", and again make sure that "Show task flows imported from ADF libraries" is checked. Assign the anonymous-role to the MainArea, RegionalArea and TasksList task flows as follows:
In JDeveloper, an application can be deployed to the internal weblogic server by selecting an entry in the project navigator and choosing "Run" from the context menu. JDeveloper then also prints the target URL through which the application can be accessed to its console.
Which file is actually used as the application's starting point and how the target URL is constructed can be defined in the "Run configuration" of the project (usually the ViewController project). Select the ViewController project, and then from the context menu choose "Project Properties". In the "Project Properties" dialog, select the "Run/Debug/Profile" section from the tree on the left, and then edit the run configuration. The "Edit Run Configuration" dialog is shown (click to enlarge):
In the "Edit Run Configuration" dialog, there are two sections which define the default run target: