View ADF Application's Session Timeout value from Client Side using Firebug

Session Timeout value
The session timeout value of an ADF application can be modified in 3 different locations:
  • Weblogic.xml
  • Web.xml
  • Weblogc Server Console (Settings of the deployed Application)
The timeout value that is set is then converted to JavaScript and is attached to the Client side of the application, and when the inactivity duration reaches this value, the application ends the Session on the Client side. 

Firebug
We can verify from the Client side what the value of the timeout attribute is using Firebug in Firefox. The add-on can be downloaded via the Firefox plugins. 

Once it is installed, you can access its functionality by clicking the Firebug icon:


The Firebug panel will be displayed at the bottom of the browser:


Verify Application Timeout value
To view the Application's Timeout value, navigate to your ADF Application in the browser and click the Console tab of Firebug.

In the bottom box next to >>>, enter the following: AdfPage.PAGE._timeout and press enter:


Firebug then returns the Timeout value in milliseconds and you can convert to a desirable format. 

Conclusion
This process is particularly useful to verify modifications that you have made with the Session Timeout value in the 3 different sections where you can modify them. Weblogic Console seems to only show the Session Timeout value for the particular ADF Application that is set in the Web.xml, so if you was to leave it as default and modify the value in Weblogic.xml, you would be unable to confirm the exact Timeout value. 

So using this method allows you to confirm the value from the Client-side.

How to separate BPM 11g ADF Task page components from SOA/BPM to a new ADF managed server

If you haven't already, read this post. It gives a basic overview as to why we should split all ADF components from SOA/BPM, and the options available around this process as well as their pros and cons.

Oracle Documentation also provides a similar guide on this process (link). The difference is that this post is more specific and in-depth, trying to provide a more thorough guide from start to finish.

Versions of Oracle technology this post utilizes:
Weblogic: 10.3
JDeveloper: 11.1.1.6.0
BPM 11g

So we have a server (soa_server) and deployed to it are SOA + BPM processes + BPM ADF UI's (Human task pages) + an ADF application that manages the BPM solution. We shall be migrating all ADF components + BPM Task pages to a newly created managed server under the same server node, thus restoring the connection between the BPM process and its Task page over different server ports.

I will be referring to the SOA server that currently has all deployments as soa_server, and the newly created ADF/UI server as ui_server.


Pre-requisites
1. Un-deploy all UI (ADF + BPM task pages) from soa_server.


BPM Task page application - wf_client_config.xml
We need to include the above XML file into your BPM Task page application code so that when deployed to the ui_server, it will register to its corresponding BPM Process that resides on the soa_server. The property that refers to weblogic.jndi.WLInitialContextFactory will be created shortly.

Note: Each BPM Task page will require the insertion of this wf_client_config.xml file

1. We need to create a new XML file (if it does not already exist) called wf_client_config.xml under the directory: bpm_ui_code/public_html/WEB-INF/classes

2. Use the following template as the body of the code:

wf_client_config.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workflowServicesClientConfiguration  xmlns="http://xmlns.oracle.com/bpel/services/client" clientType="REMOTE">
   <server default="true" name="default">
      <localClient>
         <participateInClientTransaction>false</participateInClientTransaction>
      </localClient>
      <remoteClient>
         <serverURL>t3://server_hostname_address:8001</serverURL>
         <initialContextFactory>weblogic.jndi.WLInitialContextFactory</initialContextFactory>
         <participateInClientTransaction>false</participateInClientTransaction>
      </remoteClient>
      <soapClient>
         <rootEndPointURL>http://server_hostname_address:8001</rootEndPointURL>
         <identityPropagation mode="dynamic" type="saml">
            <policy-references>
               <policy-reference enabled="true" category="security" 
                uri="oracle/wss10_saml_token_client_policy"/>
            </policy-references>
         </identityPropagation>
      </soapClient>
   </server>
</workflowServicesClientConfiguration>

3. Do not forget to update the server_hostname_address for serverURL and rootEndPointURL. An example could be:

<serverURL>t3://tom.company-name.co.uk:8001</serverURL>
<rootEndPointURL>http://tom.company-name.co.uk:8001</rootEndPointURL>

4. Once complete, save the file. The rest of the configurations will take place inside the Server Console and EM.


Create new UI server
1. Log into your Server Console

2. Click servers and click New

3. Enter the following details:

Server Name: ui_server
Server Port: 8020 (You can choose any new port number, as long as it is not already used)
Should this server belong to a cluster? No, this is a stand-alone server

4. Click Finish

5. Click on the newly created server: ui_server

6. Click on the drop down for Machine and select your domain address from the list

7. In Listen Address, type your domain address

8. Click Save, then Activate Changes

9. Click on Servers, click Lock & Edit, click the Control tab, select ui_server and then click Start, and click Yes on the next screen.


Apply the Java Runtime Files (JRF) Template
When the JRF Template is applied to a Managed Server, the ADR libraries are added to the server in order to run ADF based application successfully:

1. Log into your Server EM

2. Expand the Weblogic Domain

3. Expand your_domain and click on ui_server

4. On the main panel, there is a button at the top 'Apply JRF Template'. Click on the button

5. Return to the Server Console and restart ui_server.


Configure Data Sources for ui_server
You need to point any Data Sources (Databases, MDS repositories etc) that are used in the application to the new ui_server:

1. Log into your Server Console

2. Click on Data Sources, click on your_data_source, click the Targets tab and tick the ui_server target.  (Save and Activate changes)

3. Repeat the above step for all Data Sources that are used in your application.


Configure required Libraries for ui_server
Similar to configuring the Data Sources, we want to do the same for any libraries that are used by the ADF or BPM Task pages:

1. Log into your Server Console

2. Click on Deployments

3. You need to find out what specific libraries are used by your application. You can find some of the libraries by analysing the source code of weblogic-application.xml, which is found under every project (Application Resources -> Descriptors -> META-INF). The application I worked on used the following libraries:

- adf.oracle.domain
- adf.oracle.domain.webapp
- oracle.soa.workflow.wc
- oracle.soa.workflow
- oracle.soa.worklist.webapp
- oracle.soa.bpel
- oracle.bpm.runtime
- oracle.jsp.next
- jsf
- jstl

3. For each of the identified libraries, click on each one from the deployments list, then click the Targets tab and tick the ui_server target. (Activate changes after each one).


Create a new Foreign JNDI Provider
This new Foreign JNDI Provider is what the code in wf_client_config.xml will refer to, to allow the BPM Task page to communicate with its BPM Process on the soa_server

1. Log into your Server Console

2. Click on Services, click Foreign JNDI Providers and click New:

a. Set Name as: ForeignJNDIProvider-SOA
b. Click Next
c. Select the following as Targets - soa_server; ui_server
d. Click Finish
e. Click on the newly created Foreign JNDI Provider - ForeignJNDIProvider-SOA
f. Enter the following details:
 i) Initial Context Factory: weblogic.jndi.WLInitialContextFactory
 ii) Provider URL: t3://soa_hostname:soa_portnumber/soa-infra
 iii) User: Weblogic username (weblogic)
 iv) Password: Weblogic password (welcome1)
 vi) Save and Activate changes. 

3. Click the Links tab for the above ForeignJNDIProvider-SOA

4. For each of the 14 JNDI Links below, click New and create a Link with the specified information:

Name: ejb/bpel/services/workflow/TaskMetadataServiceBean
Local JNDI Name: ejb/bpel/services/workflow/TaskMetadataServiceBean_local
Remote JNDI Name: ejb/bpel/services/workflow/TaskMetadataServiceBean

Name: ejb/bpel/services/workflow/TaskServiceBean
Local JNDI Name: ejb/bpel/services/workflow/TaskServiceBean
_local
Remote JNDI Name: ejb/bpel/services/workflow/TaskServiceBean

Name: ejb/bpel/services/workflow/TaskServiceGlobal/TransactionBean
Local JNDI Name: ejb/bpel/services/workflow/TaskServiceGlobal/TransactionBean
_local
Remote JNDI Name: ejb/bpel/services/workflow/TaskServiceGlobal/TransactionBean

Name: ejb/bpm/services/BPMUserAuthenticationServiceBean
Local JNDI Name: ejb/bpm/services/BPMUserAuthenticationServiceBean
_local
Remote JNDI Name: ejb/bpm/services/BPMUserAuthenticationServiceBean

Name: ejb/bpm/services/InstanceManagementServiceBean
Local JNDI Name: ejb/bpm/services/InstanceManagementServiceBean
_local
Remote JNDI Name: ejb/bpm/services/InstanceManagementServiceBean

Name: ejb/bpm/services/InstanceQueryServiceBean
Local JNDI Name: ejb/bpm/services/InstanceQueryServiceBean
_local
Remote JNDI Name: ejb/bpm/services/InstanceQueryServiceBean

Name: ejb/bpm/services/ProcessDashboardServiceBean
Local JNDI Name: ejb/bpm/services/ProcessDashboardServiceBean
_local
Remote JNDI Name: ejb/bpm/services/ProcessDashboardServiceBean

Name: ejb/bpm/services/ProcessMetadataServiceBean
Local JNDI Name: ejb/bpm/services/ProcessMetadataServiceBean
_local
Remote JNDI Name: ejb/bpm/services/ProcessMetadataServiceBean

Name: ejb/bpm/services/ProcessModelServiceBean
Local JNDI Name: ejb/bpm/services/ProcessModelServiceBean
_local
Remote JNDI Name: ejb/bpm/services/ProcessModelServiceBean

Name: RuntimeConfigService
Local JNDI Name: RuntimeConfigService
_local
Remote JNDI Name: RuntimeConfigService

Name: TaskEvidenceServiceBean
Local JNDI Name: TaskEvidenceServiceBean
_local
Remote JNDI Name: TaskEvidenceServiceBean

Name: TaskQueryService
Local JNDI Name: TaskQueryService
_local
Remote JNDI Name: TaskQueryService

Name: TaskReportServiceBean
Local JNDI Name: TaskReportServiceBean
_local
Remote JNDI Name: TaskReportServiceBean

Name: UserMetadataService
Local JNDI Name: UserMetadataService
_local
Remote JNDI Name: UserMetadataService


5. Save and Activate Changes

6. Click on the Targets tab for the newly created ForeignJNDIProvider-SOA

7. Ensure that soa_server and ui_server are ticked

8. Save and Activate changes

9. Restart both soa_server and ui_server (Shutdown then Start up).


Deployment of BPM Task pages + ADF
1a. If you are deploying your ADF/BPM Taskpage using JDeveloper, ensure you select the ui_server when selecting what managed server to deploy to

1b. If you are deploying using scripts (WLST), ensure you make the modifications required such as the name of the managed server or the port number to deploy to

2. Following the above deployment, your BPM Task should now be successfully registered with their corresponding BPM Processes that reside on the soa_server. Clicking on a task link should open the task page whose processing will take place on the ui_server.


Note
This process can also be followed during the architecture set up before any development takes place so that right from the beginning, all ADF deployments are on a separate server to any other non-ADF components.

When deploying to different environments further down the line (From a Development to Test environment), be sure to update any end points you have defined that initially point to a specific server. E.g. The server end points located in wf_client_config.xml (ServerURL and RootEndPointURL properties).

Any questions, feel free to ask.

Why should we separate ADF from SOA/BPM components onto multiple servers - Single node or Clustered?

This post explores at a high level why we should split all ADF related components (ADF/BPM UI task pages) from relating SOA/BPM components onto separate servers. The post concludes with a link to another post which shows the steps required to implement one of the offered solutions.

I worked on a BPM application that was made up of SOA, BPM processes, relating BPM UI's and an ADF application that managed the BPM solution. All of these components were initially deployed onto 1 managed  SOA server.

When the application was given to the client and it reached the UAT phase, the stress load on it increased as more users were using the system, this led to a massive drop in performance and left the application sometimes unusable. Due to the lack of resources whilst developing the application, we did not know that there would essentially be a performance issue as the number of users increased. After further investigation, we found that the initial architecture of having deployed all components on 1 server was a bad approach, and concluded that we needed the SOA/BPM and UI components onto separate managed servers so that each would have its own JVM and memory allocations, rather than 1 big memory allocation responsible for processing the whole application concurrently.

Architecture solution options
The solution offers essentially 2 architecture options:

Option A) A single node solution: This will lead to multiple managed servers running under 1 node (SOA/BPM server; ADF server). Each server will have its own port and the solution will lead to the BPM UI's successfully communicating with their respective BPM processes on the SOA server.

Pro's: Each server will have its own JVM and RAM allocation.

Con's: Each server will share the overall CPU power available on the system and cannot be allocated to 1 server more than the other.

Option B) A multiple node solution (Clustered): This will involve multiple servers and each server will have multiple nodes. Each server will run only specific components (SOA/BPM; ADF). Load balancing can be implemented to support multiple nodes under each server.

Pro's: Each server will have its own JVM, RAM and CPU power allocation. It is a future proof solution as it is easier to scale up, e.g. If the number of users increase, we can install more memory for a certain component and increase the number of nodes that will process the required work. This option provides a very flexible and recommended architecture.

Con's: More expensive and a little more complex to implement than option A. This option may require more licenses from Oracle due to the extra CPU cores utilized.

Conclusion
Obviously, utilizing any of the above solutions will result in much better performance compared to having everything deployed under 1 server. The solutions lead to ADF being less dependence on the SOA components, thus minimizing the workload for all separate components. However, you must weigh up the pro's and con's of each and decide given your requirements/constraints what solution to implement. I believe that option B will be the solution that would be recommended by Oracle due to it offering the best working practices from a future proof perspective.

Steps to implement solution option A
Due to time and budget constraints, we agreed to go ahead and offer + implement a solution for Option A. The following post link highlights what is required to separate the ADF UI components from the SOA server to fulfill Option A. We will create a new UI server, configure server settings, make a change to the application code, and then re-deploy the UI components to the new UI managed server (different port number).

How to separate BPM 11g ADF Task page components from SOA/BPM to a new ADF managed server

Use ojdeploy to build ADF EAR file from source code, at command line

(Note: This post does not make use of Apache Ant. More details regarding this are given at the end of the post).

You may have an ADF application's source code on your machine and want to build its EAR file (for deploying else where), without opening the JDeveloper IDE. This may be the requirement if you want to script the build process, and to do this you cannot open the JDeveloper IDE.

This can be easily done, BUT JDeveloper needs to be installed on the machine you want to do this because you need to make use of the ojdeploy command, which is located within the JDeveloper libraries. Using ojdeploy essentially offers the build commands you may be familiar with from the UI level, but without the UI needing to be open. (Usually referred to as running JDeveloper in 'headless' mode).

(Note: It is possible to do this without having to install JDeveloper on the machine you want to build from, BUT you need to ensure that you have ALL the libraries and classes available to make use of ojdeploy. This can end up being a time consuming and complex task because many different libraries and classes at different folder structures are used. You may have to repeat the process at every new JDeveloper release as libraries and file structures may change. It may be worth going down this path if you are performing this task on a production environment and requirements forbid you from installing JDeveloper on the machine. 9 times out of 10, the benefits of installing JDeveloper are far greater than not doing so. But this is an entirely different discussion).

From the command line, the command that performs the EAR build is:

C:\> full_path_to_ojdeploy.exe -workspace full_path_to_project.jws -profile application_profile_name




The application_profile_name is the name given to the Deployment profile of the application that has been set up. This can be obtained from within the JDeveloper IDE. Click on Application, then Application Properties. Then click on the Deployment tab, and use the name under a Deployment Profile. Example shown below:



The below screenshot of the command line shows how I would get the ojdeploy command executed on my machine. Simply replace the paths for own your build:



Press enter and allow the application to build. The output of the EAR should be in its default location: project_path/deploy. (The location can be modified under the Application Properties by double clicking on the EAR Deployment profile and modifying the output directory).

The following shows the message that we are all happy to see when performing build or deploy tasks, Deployment finished. It also shows you the directory where the EAR file has been deployed to:




Now that you have the EAR, you can manually deploy the file through the server Console or EM. Or you can script the process, which takes the EAR file and then deploys to a specified server. This is particularly useful for build automation tasks, and is usually implemented by using Apache Ant.

Apache Ant
The above process is the most simplistic way of building application EAR files from the command line. But you can combine the above process to call it from ANT tasks/targets and combine the build and deploy process. This involves building a build.xml and build.properties file, which is typically done within the JDeveloper IDE on the current project. These files make use of the ojdeploy command we used earlier. The build.properties file will include paths to certain libraries and folders, again, some of these will be the parameters we passed in with the ojdeploy command.

Configuring the build and deploy process with Ant is a separate task and is out of scope from this post. So I may write a post that further extends this topic in future.

Update Date value in Database table/VO through a Managed Bean

A lot of time can be spent trying to convert objects to different types to make them compatible to different reference points. I had a problem where I had to update the Date value in a VO through a managed bean and spent a fair amount of time getting the types correct. So here is the code to do so:

//imports for following code
import java.sql.Timestamp;
import java.util.Date;
import oracle.adf.model.AttributeBinding;

//Get current date/time to be used to update VO date value
Date currentDate = new Date();

//Convert date variable to DB Date type
oracle.jbo.domain.Date date = new oracle.jbo.domain.Date(newTimestamp(currentDate.getTime())); 

//Get the attribute that the Date is set to in your page
AttributeBinding dateTimeAttr = AttributeBinding)bindings.getControlBinding("DateTime"); 

//Set the attribute with the newly created date variable
noteCreatedDateAttr.setInputValue(date);

Configure Android SDK with JDeveloper 11.1.2.4.0 for ADF Mobile Application Development

I spent several hours trying to figure out how to deploy an ADF Mobile application to my running desktop Android SDK emulator. I thought it would be worthwhile documenting the process as there are a few tweaks required and I could not find a straight forward guide online. This blog post guides you through the configurations required and assumes that you have a deploy-able ADF Mobile application.

I can provide you with a simple ADF Mobile application if you require it - leave me a comment with your email address.

Installations:
  1. Download Oracle JDeveloper 11.1.2.4.0 (Link)
  2. Download the Android SDK (Link)

AndroidSDK extraction:
  1. Extract the AndroidSDK download to C:/AndroidSDK
  2. Open SDK Manager found in C:/AndroidSDK
  3. Tick Google Cloud Messaging for Android Library, located under the Extras folder (Resolves this bug)

  4. Click Install Package(s), Accept License then click Install


Deployment bug resolution: (Source 1 Source 2)
There is a known bug at the deployment stage that requires the following actions to be performed to resolve:
  1. From C:/AndroidSDK/sdk/build-tools/android-4.2.2, copy the following files and directories:

    - Aapt.exe
     - Dx.bat
    - /libs

  2. Copy the above to C:/AndroidSDK/sdk/platform-tool


Setting up the AndroidSDK emulator with an AVD configuration: (Source)
  1.  Open a Command Prompt and change directory to C:/AndroidSDK/sdk/tools
  2. Enter the following command:
    android list targets

  3.  Record the ID of the Android Platform that you would like to utilise. (Typically, we will only have one and its ID will be 1)
  4.  Enter the following command to create the AVD configuration file: 
    android create avd –n <name> -t <targetID>

    Replace <name> with the name you want for the AVD and <targetID> with the ID recorded from earlier.

    The AVD configuration files will be written to C:/Users/<username>/.android/avd by default.

    To customise the AVD configuration file path, use the following command to create the AVD:

    android create avd –n <name> -t <targetID> -p C:/Path/To/AVD

    5.   The following prompt will appear:
    Do you wish to create a custom hardware profile [no]

    We want to select default, so press Enter.

Running the Android Emulator using an AVD configuration file
  1. Navigate to C:/AndroidSDK/sdk/tools
  2. Use the following command to run an instance of the emulator

    emulator –avd <avd_name>

    Replace <avd_name> with one of the AVD’s you created earlier.
  3. This will boot up the Android Emulator in a new window as shown below:
     Note: Closing the command prompt window that is used to run the emulator will also automatically close the emulator. (I learnt this the hard way!)



Configuring the AndroidSDK within JDeveloper
  1. Open JDeveloper 11.1.2.4.0
  2. Click Tools, then Preferences
  3.  Click ADF Mobile, then Platforms
  4. Select Android under Supported Platforms
  5. Configure the Android SDK Location and Android Platform Location to point to your extracted AndroidSDK location, as shown below:

                    6.  Click OK to finish the configuration.



Create a local key store to use Release Mode (Improved performance)
  1. Open command prompt and change directory to the JDK/bin used by your JDeveloper 11.1.2.4.0

    My path is:
    C:\Middleware2\11_1_2_4_0\jdk160_24\bin
  2. Type the following command into the command prompt (Note: you must type it, not copy):

    keytool –genkey –v –keystore <Keystore Name>.keystore –alias <Alias Name> -keyalg RSA –keysize 2048 –validity 10000

    Replace <Keystore Name> and <Alias Name> with a custom name. I used ‘employees’ for both variables for my setup.

  3. You will be prompted for several values such as a keystore password, your name, city, state etc.
    Enter
    oracle for the keystore password, and enter values for the other prompts. They do not have to be ‘correct’ values.
    Another final password prompt is asked for your <keystore_name> password, enter
    oracle again.
  4. The keystore is ready to use, we now need to configure the connection inside JDeveloper.
  5. Open JDeveloper 11.1.2.4.0. Click Tools, Preferences, ADF Mobile, Platforms and then click on the Release Tab under Signing Credentials.
  6. Enter the required details as shown below. 

Keystore Location: Located under JDK/bin/<Keystore_Name_Chosen>
Keystore Password: oracle
Key Alias: <Alias_Name_Chosen>
Key Password: oracle


         7.   JDeveloper now knows about the keystore, which enables you to select the Release mode in the       deployment profiles


Deploy ADF Mobile App to the Android Emulator 
  1. In JDeveloper, from the Application menu, Select Deploy > New Deployment Profile.
  2. Click Android Options, select Release for the Build Mode, and click OK.
  3. From the Application menu, select Deploy > Above_Deployment_Profile_Name.
  4. Select Deploy application to emulator, click Next, then click Finish.
  5. Wait for Deployment to finish, then switch to the Android Emulator you have running and select your deployment application from the Androids’ apps.

Adding custom JavaScript to ADF .jspx page

JavaScript code can be easily implemented into an ADF page. Once implemented, you can control how it is triggered by using a Client Listener.


1. Insert a 'Resource' component into your page structure, then select the type as 'javascript':


2. Add an OutputText component under the Resource component:


3. Paste your JavaScript function directly into the OutputText component. This can be done via Property Inspector, or the Source code

4. Add a ClientListener component into your page structure:


5. The method refers to the JavaScript function you declared under the Resource component, and the Type refers to the type of event that triggers the function:


Behaviour of above scenario: When the above jspx page is opened, it will resize the window to a width of 100 and height of 200.

The way in which the JavaScript is called can be easily manipulated. E.g. The ClientListener component can be added under a CommandButton, and the Type changed to 'click'. In the above scenario, the page would resize to (100,200) when that Button is clicked.

Invalid column index error

After deploying my ADF application and navigating to a certain page, I have been faced with the following error message on screen several times:


The reason for this is due to the following scenario:
  1. Create an Entity Object (EO) from a table.
  2. Create a View Object (VO) from that EO.
  3. Now a new Date column has been added to that table.
  4. The newly added Date column is updated in the EO and VO.
  5. Now from the Data Controls, you drag and drop the Date field onto the page.
  6. Deploy the application and navigate to the page and now you are presented with the above error.
The issue: The above View Object (VO) query is not automatically updated and does not return the column that you are trying to show on the page. In other words, this is the equivalent of a Null pointer exception.

The solution: Manually update the VO query with the newly added Date query, rebuild and then re-deploy.

Convert code snippets into HTML - to insert into Blog Posts

Came across a website whilst writing some of my posts that converts any code snippets into a neat HTML format. The HTML can be easily embedded into blog posts, emails and websites:


http://hilite.me/

Get/Set PageFlowScope values

Following Get/Set Java methods can be used within a Managed Bean:

  • Get PageFlowScope value:
  public Object getPageFlowScopeValue(String name) {
    ADFContext adfCtx = ADFContext.getCurrent();
    Map pageFlowScope = adfCtx.getPageFlowScope();
    Object val = pageFlowScope.get(name); //Name = PageFlowScope value name

    if (val == null) { //Avoid null pointer exception
      return null;
    } else {
      return val;
    }
  }

  • Set PageFlowScope value:
  public Object getPageFlowScopeValue(String name) {
    ADFContext adfCtx = ADFContext.getCurrent();
    Map pageFlowScope = adfCtx.getPageFlowScope();
    Object val = pageFlowScope.get(name); //Name = PageFlowScope value name

    if (val == null) { //Avoid null pointer exception
      return null;
    } else {
      return val;
    }
  }





Get current logged in user

To return the current logged in user in the application, it can be obtained using Java Code, or Expression Language:

  • Java Code - from inside a Managed Bean:
ADFContext adfCtx = ADFContext.getCurrent(); 
SecurityContext secCntx = adfCtx.getSecurityContext(); 
String username1 = secCntx.getUserPrincipal().getName(); 
String username2 = secCntx.getUserName(); 

  • Expression Language - from the Property Inspector or from the Model View Object attribute level:
#{securityContext.userName}