Wednesday, September 28, 2011

Funny job posing I saw on linked in

Just saw a job post reading "IBM Mexico are currently recruiting for Oracle CRM On Demand Consultant ..." made me laugh

Monday, September 26, 2011

ADF : On the hunt for connection leaks

We changed our connection pool to only use connection pools in weblogic and also to swap connection pool depending on a login selection (

We are now running out of connections at a rapid rate - each task flow seems to create 2 new connections so off to weblogic console I go. (Enviroment\Servers\[YourServer]\Monitioring\JDBC).

To monitor the info I used the dashboard (dont forget to push the play button):
http://[your server]:7101/console/dashboard

Will update this thread as the hunting progresses.

Ok so my hunting ended in disappointment today - there where no connection leaks here is my scenario:
We had multiple AM's working off the same Data source. Each Application module had the value of Referenced Pool Size set to ten. Each request to a taskflow created a new application module and thus a new connection only once the Referenced Pool Size value of connections where reached did it start reusing AMs and connections.

So lessons learned and an important exercise.

Initial Info used:

Thursday, September 22, 2011

When mapping a checkbox (Database value 'Y' or 'N') to a lov first map the UI hint Control Type to Checkbox.

This is due to the fact ADF disables this field and set it to Choice List automatically when a lov is mapped.

Wednesday, September 14, 2011

ADF: Rollback findings - generic rollback ordering of iterators

Ok so a couple of our screens where not working with the generic rollback I wrote.
I was getting a key not found exception.
Through a bit of debugging i found the problem, I was using getDCBindingContainer().getAllIterBindingList() to get a list of iterators use in the page I was on - the problem with this is if the bindings on your page are not in order you could end up refreshing the child iterator before refreshing the parent and thus your keys will not be correct.

I swapped the order of my iterators in the page binding and it all worked.

I now need to write some code to refresh the parents first then the children.

Here we go


ArrayList list = ADFUtils.getDCBindingContainer().getAllIterBindingList();
for(Object listItem : list) {
  if(bondage.getViewObject() instanceof ViewObjectImpl) {
    ViewObjectImpl vo = (ViewObjectImpl) bondage.getViewObject();
      if(vo.isPagePositionSet()) {
        RowSetIterator[] mrsi = vo.getMasterRowSetIterators();
        if(mrsi != null) {
          for(RowSetIterator parentIterator : mrsi) {
            if(parentIterator instanceof ViewObjectImpl) {
              ViewObjectImpl parentVO = (ViewObjectImpl) parentIterator;

ADF A refreshing graph with a af:poll

I wanted to have my adf graph component refresh every 10 seconds or so to reflect the latest info.
I wasn't really interested in Active data to push the info to me when it changed as it changed too often.

So this is super simple and involved the following steps:

1) Drag on a poll component (Component pallet --> operations --> poll)

2) Add a partial trigger to your graph. ( partialTriggers="::poll1") where poll1 is the id of the poll component.

3) viola it just works.

Poll Properties
interval - How long in miliseconds between polls

timeout - Amount of time before the poll stops due to inactivity this will make sure a users session can timeout on this page due to inactivity as a poll is seen as activity (-1 infinite).

pollListener - Add some custom code to each poll event.
  public void yourPoll(PollEvent pollEvent) {

Tuesday, September 13, 2011

DVT stuff

I am currently playing around with some of the gauge, graph and data visualization components in ADF.

At the moment it is all going well provided I drag the ADF BC components on the screen, the custom stuff takes a bit of work.

Here is a silly example to show the number of days until password expiry in a gauge:

<dvt:gauge id="gauge1" gaugeType="DIAL"
value="#{viewScope.dashboardBean.gaugeValue}">   <dvt:gaugeBackground>     <dvt:specialEffects/>   </dvt:gaugeBackground>   <dvt:thresholdSet> <dvt:threshold thresholdMaxValue="5" fillColor="#ff0000"/> <dvt:threshold thresholdMaxValue="15" fillColor="#FF7F27"/> <dvt:threshold fillColor="#00ff00"/>   </dvt:thresholdSet>   <dvt:gaugeFrame/>   <dvt:indicator/>   <dvt:indicatorBase/>   <dvt:gaugePlotArea/>   <dvt:tickLabel/>   <dvt:tickMark/>   <dvt:topLabel text="Number of days until password change"/>
  <dvt:metricLabel position="LP_WITH_BOTTOM_LABEL"/>

  public Integer getGaugeValue() {     OperationBinding resultBinding = 
      ADFUtils.executeOperationBindingWithoutException(       "calculateDashboard", null);     if(resultBinding.getErrors() != null && 
      resultBinding.getErrors().size() < 1) {
      return (Integer) resultBinding.getResult();
    return new Integer(0);

public Integer calculateDashboard() {
    + "as diff   FROM USERS u WHERE u.userid = ?";
  BigDecimal count = (BigDecimal) DbUtils.getSingleResult(
    this.getDBTransaction(), sql, getUserPrincipalName());
  return count.intValue();

JDeveloper autocommit off on SQL worksheet

Goto tools / Prefrences in the top menu in Jdeveloper

Select Database/ Worksheets

Check AutoCommit in SQL Worksheet off / on as you wish

Thursday, September 8, 2011

ADF to service enabled bindings : findings

Service enablement
It is very easy to expose your adf code in any application module as services with just a couple of clicks.
(Although this may not be the best thing to do without thought)
This could allow you to leverage your existing investment in ADF and publish the existing code
as needed to your SOA enviroment.

EO bindings
You can base Entity Objects on services and have all the same rich functionaltiy adf provides yet using a service backed entity.

Webservice data control
This control allows you to incorporate web services in any ADF page simply and quickly

Pojo custom control
This allows you the most flexibility you can create a custom data control off a pojo and use this to call you web services.

With these tools you can integrate any third party or internal services into your adf application quickly and easily.
All in all I was pleasantly surprised with the service integration in ADF.
Although there are a couple of things that where tricky (custom LOV's etc) you should be able to achieve
what you need with the minimum of fuss.

Wednesday, September 7, 2011

ADF Calling a Find on your service based AM

So I struggled a bit to do this code because I was unfamiliar with eclipselink SDO stuff so hope this saves you some time.

I just wanted to call the AM service find from my backing bean.
The first parameter of the defineSchema method is the fully qualified path to your Application Module xsd.
The second parameter is your xsd name.

import oracle.jbo.common.sdo.SDOHelper; import oracle.jbo.common.service.types.FindControl; import oracle.jbo.common.service.types.FindCriteria; ...
  SDOHelper.INSTANCE.defineSchema(     "za/co/transcode/adf/mdm/model/common/serviceinterface/",      "MDMAppModuleService.xsd");   FindControl fci =     (FindControl)DataFactory.INSTANCE.create(FindControl.class);   fci.setRetrieveAllTranslations(false);   FindCriteria fcrit =     (FindCriteria)DataFactory.INSTANCE.create(FindCriteria.class);  
  Map paramMap = new HashMap();   fcrit.setFetchSize(1);   fcrit.setFetchStart(0);   paramMap.put("findCriteria", fcrit);   paramMap.put("findControl", fci);
  //normal execute operation just move it into a util class   ADFUtils.executeOperationBindingWithoutException(
    "findYourVO", paramMap);

The next thing I need to do is get this to work as I expect and to populate the Find Criteria from a query component - I will post this once I am done.

Tuesday, September 6, 2011

ADF: Useful demo code links

1) Oracle ADF Faces Components Demo

 Find the (Oracle ADF Faces Components Demo)  section and click download:

2) Oracle Fusion Order Demo Application

There is some really helpful examples here that will point you in the right direction.

ADF 11.1.2 rollback again

I have an editable list with a child editable list and wanted all my list to retain there position on rollback so I wrote some code.

Had to be slightly tweaked from what I user to have.
The first method saves all current iterator binding positions to a IteratorPosition class (just a pojo with range start etc getters and setters - nothing fancy)
The second method restores those positions to the iterator bindings and all is now working as I want.

Also remember this button is a toolbarbutton with the following: partialSubmit="false" immediate="true"
and a resetactionlistener - without these things it may not work correctly.

public static Map saveBindings() {   Map returnValues = new HashMap();   ArrayList list = ADFUtils.getDCBindingContainer().getAllIterBindingList();   for(Object listItem : list) {     if(listItem instanceof JUIteratorBinding &&
      !"listIter".equalsIgnoreCase(((JUIteratorBinding) listItem).getName())) {       JUIteratorBinding bondage = (JUIteratorBinding) listItem;       Row row = bondage.getCurrentRow();       int rangeSize = bondage.getRangeSize();       int rangeStart = bondage.getRangeStart();       int currentRowIndexInRange = bondage.getCurrentRowIndexInRange();       if(row != null && rangeSize > 0) {         IteratorPosition pos =
          new IteratorPosition(rangeSize, rangeStart, 
            currentRowIndexInRange, bondage.getCurrentRowKeyString(), row);         returnValues.put(bondage.getName(), pos);       }     }   }   return returnValues; } public static void restoreBindings(Map bindings, boolean isDelete) {   if(bindings != null) {     ArrayList list = ADFUtils.getDCBindingContainer().getAllIterBindingList();     for(Object listItem : list) {       if(listItem instanceof JUIteratorBinding) {         JUIteratorBinding bondage = (JUIteratorBinding) listItem;         IteratorPosition pos = bindings.get(bondage.getName());         if(pos != null) {           if(isDelete) {             ViewObject vo = bondage.getViewObject();             bondage.setCurrentRowIndexInRange(pos.getCurrentRowIndexInRange());             vo.setRangeStart(pos.getRangeStart());             if(!pos.getCurrentRow().isDead()) {               Row[] rows = vo.findByKey(pos.getCurrentRow().getKey(), 1);               if(rows != null && rows.length == 1) {                 int ridx = vo.getRangeIndexOf(rows[0]);                 if(ridx != -1) {                   vo.scrollRangeTo(rows[0], ridx);                   vo.setCurrentRowAtRangeIndex(ridx);                 }               }             }           } else {               bondage.setRangeSize(pos.getRangeSize());               bondage.setRangeStart(pos.getRangeStart());               bondage.setCurrentRowIndexInRange(
                pos.getCurrentRowIndexInRange());           }         }       }     }   } }