Sunday, February 27, 2011

PageFlowScope variables

Drag and drop Set Property lister from operations pallette onto any component on your page. This gives flexibility to assign values to variables on the go whithout declaring them anywhere.

The value "test" will be assigned to variable demo, note the demo variable is not declated anywhere.

This can be used in many places e.g in menuitems create command menu items and you can drag and drop property listener on each of them. On clicking any of the items you assign different values to just one variable everywhere say #{pageFlowScope.menuClicked} and values as user defined.

Now in bounded taskflow say adfc-config.xml you can define controlflow for each of these values

You can also programmatically access pageFlowScope variables:
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("user_var","value" );
System.out.println("value"+AdfFacesContext.getCurrentInstance().getPageFlowScope().get("user_var")); //user defined variables as first argument.

This can be used in lot of places e.g. if you three tabs add, update, delete you can use single interface with all the buttons setting the buttons rendered property to values of this variable like this:

#{pageFlowScope.selectedTab == 'addTab'}

Monday, February 21, 2011

Oracle ADF View Criteria

We can have one view object to have multiple view criterias which can be used to execute at run time. Define the view criteria at desin time and use following code to execute any of the view criteria:
DCBindingContainer dc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
ViewObject vo=dc.findIteratorBinding("SubmissionViewRptPrdVO1Iterator").getViewObject();
System.out.println("View name: "+vo.getName());
ViewCriteriaManager vcm = vo.getViewCriteriaManager();
ViewCriteria vc=vcm.getViewCriteria("RptPrdForUser");
VariableValueManager vm=vo.ensureVariableManager();
vm.setVariableValue("userId", "3");
vo.applyViewCriteria(vc);
vo.executeQuery();

Monday, February 14, 2011

Database(Tables Objects) with data export steps.

Select all tables you need to export -> right click -> upload
this will create the sql script file. Which you can execute on your local database.

Friday, February 4, 2011

ADF Timestamp & Date

In view object attribute value specify type as expression and give value as

adf.currentDate
adf.currentDateTime

Wednesday, February 2, 2011

ADF Sequence number

Create java classes for entity object and for the attribute setter method put below code and your sequence name instead of seq1.

SequenceImpl s = new SequenceImpl("seq1",getDBTransaction());
setAttributeInternal(SUBMHEADID, s.getSequenceNumber());

Note: you need to provide some dummy value like -1 in the display to avoid madatory validation. At the time of insert it will take value from sequence.