31 Aug 2013

ADF EMG Sunday at Oracle Open World 2013. Must Have on Your Schedule.

Going to attend OOW 2013? Looking for more ADF sessions? There is great news for you!

This year ADF Enterprise Methodology Group has arranged again a full day of ADF sessions. The room has been kindly donated by Oracle Development Tools Users Group (ODTUG).
Come to Moscone West 2003 on Sunday, September 22nd and dive deeply into solid ADF content! ADF only, and nothing else!
The full session list comes up with the following agenda:
  • Session 1. 8:00am-9:00am[UGF7001] Oracle ADF Task Flows Beyond the 10-Minute Demo.  John King

  • Session 2.  9:15am-10:15am. [UGF9898] Oracle on Your Browser or Phone: Design Patterns for Web and Mobile Oracle ADF Applications. Floyd Teter & Lonneke Dikmans

  • Session 3. 10:30am-11:30am. [UGF2737] ADF Performance Tuning War Stories. Stephen Johnson, Frank Houweling, Eugene Fedorenko

  • Session 4. 11:45am-12:45pm. [UGF9900] Top 10 Web App Vulnerabilities, and Securing Them with ADF. Brian Huff

  • Session 5. 2:15pm-3:15pm. [UGF9860] Worst Practices When Developing an ADF Application. Paco van der Linden & Wilfred van der Deijl

  • Session 6. 3:30pm-4:30pm. [UGF9908] WebCenter & ADF - Responsive and Adaptive Design for Desktop, Mobile & Tablet. John Sims 
All sessions are available at the content catalog and the full list of ADF content at OOW 2013 is summarized down here.

Before this great forum, on Saturday 21st, ADF EMG is going to host some warming-up event with fajitas, margaritas, cold Anchor Steam and conversations on ADF.  


See you in San Francisco at OOW 2013!

19 Aug 2013

About the Scope of EntityDef and ViewDef

Recently I was hunting an interesting bug. The bug was pretty confusing for users because it seemed that some data can be transfered across user sessions. The reason of the bug was very common mistake. Sometimes ADF developers consider Entity definitions (EntityDef) and View definitions (ViewDef) as session scoped objects. They change properties of EntityDefImpl and ViewDefImpl instances, or, which is more likely, properties of AttributeDefImpl and forget that these changes effect all users sessions. There is only one instance of particular EntityDefImpl per application instance. The same is correct for ViewDefImpl as well. 
Let's consider a simple task flow:
There is view activity BrowseView representing data in a table and allowing users to create new records. The default activity of the task flow is some method call setDefaultLastName. If we look at its code we'll see the following:

  //The method sets user's last name as
  //the default value of the "LastName" attribute 
  public void setDefaultLastName(String lastName) 
  {
    //Get Entity Definition
    EntityDefImpl ed = getDefinitionObject();
    
    //Find an attribute definintion 
    AttributeDefImpl ad = (AttributeDefImpl) ed.findAttributeDef("LastName");
    
    //Set the default value
    ad.setDefaultValue(lastName);
  }



So, when users start this task flow, the default value of the "LastName" attribute of the table becomes their last name. And, after that, when they create new records the value of the "LastName" is populated with their name. Cool! User, whose name is Stogova, entered the task flow, started to create new records and she is happy. So far. Another user, whose name is Smith, did the same. Stogova is still creating new records at BrowseView, and one moment she is realizing that she has become Smith. Cool!

The correct way to implement this use case is to define some groovy expression as the default value of the "LastName" attribute. Something like this:

adf.userSession.userData.lastName


And, for sure, user's last name should be passed somehow to the business service layer. For example, by invoking the following method:

  public void setupUserLastName(String lastName) 
  {
    ApplicationModule am = getApplicationModule();
    am.getSession().getUserData().put("lastName", lastName);   
  }


That's it!