Showing posts with label Expression Language. Show all posts
Showing posts with label Expression Language. Show all posts

26 June, 2012

ADF : Get Current Logged User Name

Sometime we need getting current authenticated user name in ADF application.
To get user name we can do it using three ways

1- Using Groovy 
We can set default expression in view object attribute as below
adf.context.securityContext.getUserPrincipal().getName() 
or
adf.context.securityContext.getUserName() 

2- Java Code
You can get User Name in Java code also using the following code.

     ADFContext adfCtx = ADFContext.getCurrent();  
     SecurityContext secCntx = adfCtx.getSecurityContext();  
     String user = secCntx.getUserPrincipal().getName();  
     String _user = secCntx.getUserName();  

3-Expression Lnagugae
You can bind ADF Faces componenets with the following EL to get logged User Name.

 #{securityContext.userName}  

Thanks

15 September, 2011

Default Value for View Object Rows Attributes

Hi all,
Introduction
As usual in all programming tools we need to set default values for columns.
>>In oracle database we can do that by DDL
ALTER TABLE Table_name MODIFY(column_name  DEFAULT default_value);
>>In oracle forms tool we can do that by setting initial value of item in block.

So I will present how to set deafult value of attribute in VO at ADF.
We can do that by 3 ways
1-Using a Groovy expression
2-Getter of attribute
3-Override view object create() method

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...