Monday, January 23, 2012

Key Sample: How to find row from viewobject based on key attribute

DCBindingContainer dbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = dbc.findIteratorBinding("EmployeeIterator");
Key k1 = new Key(new Object[]{100}); //employee id
Row[] r1 = iter.getViewObject().findByKey(k1, 1);
for(Row r: r1){
System.out.println(r.getAttribute(0)+" "+r.getAttribute(1));
}

TaskFlow as Popup Window

TaskFlow in Popup

You can run a taskflow like a popup window and also return value:
Two things to be taken care of 1) Create a bounded task flow (one which will be displayed in popup). In properties window for this taskflow, in behaviour tab set run as Dialog property to true and display type as inline popup. 2) The button, on click of which this should appear as popup. Select the button and in property window set below properties: - Use window : true - Window Height: 300 - Window Width:300 You can also set parameters as under. 1)In 1st taskflow definition drag and drop the taskflow which you want to run like a popup window
2) select that taskflow and in properties panel in return parameter you can specify a parameter, if you plan to return something
- In behaviour tab set Run as Dialog property to True & display type default(external window)

and then you can set pageflow scope varible to return value from here for selected record.
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("parameter", value);

AutoSuggest TextField (InputText Field).


AutoSuggest Behaviour on Text Fields

1) In ViewObjext definition create a new attribute (transient attribute, because autosuggest will work on the description / id lov for e.g. if you define the lov on any id field and you are displaying description / name as label then in that case the sorting will happen on ids and not on descripti

on).
To avoid this problem define transient attribute, name it accordingly and in lov Configuration Select that id attribute (employee id) as well as description, so what will happen is based on the description selected corresponding id will also be selected).

In UI Hints you can select the name/descirption field to display and List Type should be InputText with List of Values.

2) Now on you JSF page, lets say that you have dragged and dropped this viewobjects datacontrol as table and for this field you select it as textfild(default will be combo etc).
Add this code for you field

e.g.




Once you drag and drop view as table then the tree node is created in table and this expressions will work.

findRowByIteratorAttribute - Find a row within Iterator with some attribute value

Once we get hold of iterator and when we need to find a row in iterator based on any attribute value, we can use below code

String lName = "Joe";
DCBindingContainer dbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = dbc.findIteratorBinding("EmployeesIterator");
RowIterator rIter= iter.findRowsByAttributeValue("LastName", true, lName);
String empId = rIter.first().getAttribute("AcctId").toString();

Sunday, January 22, 2012

Setting PageFlowScope Parameters from Button ActionListener withoout code

1) When we want to set pageflowscope parameters without writing code

- Attach SetActionListener Operation to button




The EmployeeId is defined against employee id attribute against employee iterator on pagedefinition.

We can have n number of the variables defined here to pass pageflow scope variables.

Monday, December 19, 2011

ADF TaskFlow Method Call On page load

In taskflow we can drop execute with parama e.g. employees with dept 10 from datacontrols. You can even right click and say create page definition and define operations there for taskflow.

The binding for this will be with method now you need to change this binding and update it to backing bean method (binding value: #{backingBeanScope.MethodCall.CalledMethod}) and now you can execute the execute this mehtod from operation binding as in below code

public void CalledMethod() {

DCBindingContainer dc = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = dc.getOperationBinding("ExecuteWithParams");
operationBinding.execute();
}

In this way you intitialize your page.

Thursday, December 15, 2011

Passing values between ADF Task Flow

1) IF we have one taskflow inside another taskflow. The PageflowScope can be use to set values into variables i.e.
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("varName","varValue");
and select the child taskflow(this task flow should have relevant parameters defined) and in properties give value to parameter value as #{pageFlowScope.varName}
2) When we have Jsff (region) within which we have taskflow pulled and we need to pass value to this taskflow then go to pagedefinition for the page/region and select this taskflow from executables and in properties you provide value to particular variable like #{pageFlowScope.varName}