Tuesday, September 18, 2012

How to use

Use case - Upon clicking on some button, Set a value to specific attribute

Solution : <af:setPropertyListener> component allows you to set a specific value to a attribute upon clicking on a button or changing a value for any component.

Ex :


              <af:commandButton text="Save" id="cb1"
                                action="#{pageFlowScope.EmployeeBean.addEmployee}"
                                immediate="true">
                <af:setPropertyListener from="#{bindings.EmpName.inputValue}"
                                        to="#{sessionScope.EmpName}"
                                        type="action"/>
              </af:commandButton>

from/to - This value can be anything, hard coded value, binding value or from any scope variable.


Wednesday, September 12, 2012

Filtering af:table Without Using ADF Model



I would like to share below URL, This is very useful especially if you want to perform 'Filter' on <af:table> component without using ADF Model.

http://jobinesh.blogspot.in/2012/03/filtering-aftable-without-using-adf.html


Tuesday, September 4, 2012

How to invoke various methods using Groovy Expressions

One of the interesting feature in ADF is using 'Groovy Expressions' , Using these expressions we can invoke various methods defined in ViewObjectImpl or Application Module Impl or access Application Module UserData session object

1. How to invoke a method defined in ViewObjectImpl class for a given specific attribute which is part of the same view object

You can define any method in ViewObject Impl something like as below

             public String getEmployeeName(){
                         return "EMP123"
             }

Define an attribute in a view object and modify its value (Groovy expression) as below
        adf.object.viewObject.getEmployeeName() - This will invoke the method defined in ViewObjectImpl class and hold the returned value.

2. How to access userData session object using Groovy expressions

Get the userData hash table in AM Impl class, and store whatever values you need as shown below

             Hashtable userData = getDBTransaction().getSession().getUserData();
             userData.put("employeeID","1234");

Use below groovy expression in any of the View objects which are part of respective application module , and access the data stored in userData session object.

          adf.userSession.userData.employeeID
Below is sample code how to get the user Session Data in App Module
Hashtable userdata = getDBTransaction().getSession().getUserData();

3. How to access a method defined in Application Module in any view object

    use below groovy expression in any of the view object which is part of respective application module
        adf.object.applicationModule.getEmployeeIDByName()

Monday, September 3, 2012

Jdeveloper Shortcut Keys

Below Jdeveloper Shortcut keys may helpful during development

1.If you have a larger application and you don't know specific class/object located , Go to Source of the file, then press Alt+Home button - This will take you to the corresponding project & Package where the selected file belongs.

Friday, August 24, 2012

How to increase Local weblogic server log level


If you have to see the more detailed logs in your  local weblogic server ( Jdeveloper) logs, set the below -D property in a project


- Right click on the project, ( If you are running any UI component, then choose ViewController) Project Properties -> Run/Debug/Profile -> Select 'Default' Configuration -> Edit
- Paste below -D command as shown below.

-Djbo.debugoutput=console


How to change the Log level in EM

login to EM via:  https://fortunemindssoa.com/em

2) navigate on the left side:  WebCenter -> Portal -> Spaces

3) select WebCenter Portal (11.1.1) (WC_Spaces1)

4) from pulldown menu at top navigate:  Logs -> Log Configuration

5) Make sure Runtime Loggers view is selected

6) For  Root Logger  change from  TRACE:32 (FINEST) to WARNING:1 (WARNING)

7) click APPLY

8) select WebCenter Portal (11.1.1) (WC_Spaces2)

9) from pulldown menu at top navigate:  Logs -> Log Configuration

10) Make sure Runtime Loggers view is selected

11) For  Root Logger  change from  TRACE:32 (FINEST) to WARNING:1 (WARNING)

Monday, August 6, 2012

How to create a new row at specific index

Greetings !!

  I would like to briefly explain about inserting a new row in a view object at a specified index.


Create a method like below in VOImpl, and invoke this method by passing 'Row' and index.


  public void insertRow(EmpVORowImpl pRow,int pIndex)
  {
    int rangesize = getViewObject().getRangeSize();
    getViewObject().setRangeSize(-1);
    super.insertRowAtRangeIndex( pIndex , pRow);
    getViewObject().setCurrentRow(pRow);
    getViewObject().setRangeSize(rangesize);
  }



 

Wednesday, August 1, 2012

How to identify whether a row has been modified or not

There is an easy way to find whether a row has been modified/deleted/created in ADF framework, This works only for Entity based view objects which are based on entity object.


      Iterator tbiter =
        EmployeeEOImpl.getDefinitionObject().getAllEntityInstancesIterator(getDBTransaction());
      while (tbiter.hasNext())
      {
        
EmployeeEOImpl eoImpl = (EmployeeEOImpl) tbiter.next();
if (eoImpl.getEntityState() == Entity.STATUS_NEW || eoImpl.getEntityState() == Entity.STATUS_MODIFIED || eoImpl.getEntityState() == Entity.STATUS_DELETED) {
                  // Add your logic here
        }