Posts

Showing posts from 2016

ADFUTIL Class

ADF Util Class This class is very much useful and from here and there I copy most of the methods and use almost in all the UI projects.  I am adding this to my blog to have a reference so that we need not to search all the places. Create a java class in your ADF UI project name ADFUtil and then copy the below content.  This class have some very important methods   1.  saveAndContinue :-   This method save the current frame and allow you to continue working on the frame.  2. evaluvateEL:-      This method used to get the value of the, el expression, like the employee name or any other value which is there in the page. 3. ExecuteEL     This is to execute the a method, with or without parameters. 4. SetEL    This to set the value of the El-expression. ===================== Class Starts ===================== import java.util.Map; import javax.el.ELContext; import javax.el.ExpressionFactory; import javax.el.MethodExpression; import javax.el.Va

Current Logged in User and Roles in ADF and Fusion Apps

A) Using the groovy Expression. We can set default expression in view object attribute as below  adf.context.securityContext.getUserPrincipal().getName()  adf.context.securityContext.getUserName()    For Roles use  adf.context.securityContext.getUserRoles() B) 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 userName = secCntx.getUserName(); String[] Roles = secCntx.getUserRoles(); C) Expression  Language You can bind ADF Faces componenets with the following EL to get logged User Name. #{securityContext.userName} #{securityContext.userRoles} D) In Fusion Applications (On Premise Implementation) ApplSession session = ApplSessionUtil.getSession(); String guid1 = session.getUserGuid();

Using Database sequence in the ADF for primary key attribute.

Image
There are multiple ways to use DB sequence in the ADF for generating ids. 1. Use the column as DB sequence and  mention the sequence name in the sequnce name filed. Post that ADF will take care of executing the sequence.    ADF framework will add a temporary negative number until you commit the information. 2.  Use SequenceImpl in the Adf, this can be used at mutiple places, this can be used    -- Create method.    --  Do DML method. ===============================================         SequenceImpl seq = new SequenceImpl("MSKILL_LOV_GEN_SEQ",this.getDBTransaction());                 Integer nextVal = Integer.parseInt(seq.getSequenceNumber().toString());                 this.setLovValueId(nextVal);                 super.doDML(operation, e); =================================== Using it dodml are more beneficial as it will create sequence duging save only hence we will see a sequence gap in records, which will come if we will use this code in create me