Tuesday, March 27, 2012

ViewObject Filtered Rows based on description / name /id

DCBindingContainer dcb = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = dcb.findIteratorBinding("EmployeeIterator");
ViewObject view = iter.getViewObject();
Row[] rr =view.getFilteredRows("lastName", "Bill");
for(int i=0;i < rr.length ; i++) {
System.out.println(rr[i].getAttribute("empid")+" "+rr[i].getAttribute("firstName")+ " "+rr[i].getAttribute("lastName") );
}

Monday, March 26, 2012

RowSetIterator Use

RowSetIterator is used to navigate through viewobject iterator. It also have useful operations defined in it like row.previous() etc which can be used to capture previous row.

RowSetIterator rs= viewobject.createRowSetIterator(null);
while(rs.hasNext()) {
Row row = rs.next();
if(row.getAttribute("Attr_Value").toString().equalsIgnoreCase(Comparison value.toString())){
Row prRow = rs.previous();
}}

Sunday, March 25, 2012

Iterator Row changed to change the values of respecting Attributes: Automatic PPR Initiated by the ADF Binding Layer

In Oracle JDeveloper 11g, the change event policy feature can be used to refresh UI components
automatically that are bound to an ADF binding when data has changed in the model layer. To
use this feature, you set the ChangeEventPolicy property of the ADF iterator binding and the
attribute bindings to ppr, which also is the default setting.

In pagebinding select Iterator | in properties- Advanced - Change Event Policy : select value "ppr". What will happen is the moment you select a record in table other respective attributes on UI which were pointing to individual attributes from this iterator will display the new values else not.

Friday, March 2, 2012

ADF Column Date Time Format

To display the timestamp attribute values in specific pattern, add convertDateTime tag to the respective attribte and specify the pattern you want to display.



Thursday, February 16, 2012

Programmatically Caputure Table values and update Viewobject

In case when data is coming from any webservice and you need to update any viewobject based on the updates the user is doing on UI table. The logic is to capture key of each row of UI table and find the key in the viewobject, get corresponding records and update the values as in table using below code. I have writtten it on button action.

public String cb1_action() {
// Add event code here...
RichTable table = this.getDtlTable();
System.out.println("Row Count:"+table.getRowCount());
Number keyValuePK;
// for (int i = 0; i < table.getRowCount(); i++)
// {
Row row = ((JUCtrlHierNodeBinding)table.getRowData(10)).getRow();
System.out.println(row.getAttribute(1)+" "+row.getAttribute(2));
keyValuePK = (Number)row.getAttribute("PrimaryFieldId"); //tenth row
System.out.println("Key Value: "+keyValuePK);
row.getAttribute("PrimaryFieldId");
//}

DCBindingContainer dbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = (DCIteratorBinding)dbc.findIteratorBinding("IteratorName");
Key k1 = new Key(new Object[]{keyValuePK}); //employee id
Row[] r1 = iter.getViewObject().findByKey(k1, 1);
System.out.println(r1[0].getAttribute("PrimaryFieldId")+" "+r1[0].getAttribute("AnyotherDesc"));
r1[0].setAttribute("UpdateAnyAttr", 99999);

// row = iter.findRowsByKeyValues((Key[])row.getAttribute("SubmHeadId")) ;

return null;
}

Wednesday, February 15, 2012

Map Example

package view;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class MapExample {

public static void main(String[] args) {

Map mp=new HashMap();

// adding or set elements in Map by put method key and value pair
mp.put(new Integer(2), "Two");
mp.put(new Integer(1), "One");
mp.put(new Integer(3), "Three");
mp.put(new Integer(4), "Four");

//Get Map in Set interface to get key and value
Set s=mp.entrySet();

//Move next key and value of Map by iterator
Iterator it=s.iterator();

while(it.hasNext())
{
// key=value separator this by Map.Entry to get key and value
Map.Entry m =(Map.Entry)it.next();

// getKey is used to get key of Map
int key=(Integer)m.getKey();

// getValue is used to get value of key in Map
String value=(String)m.getValue();

System.out.println("Key :"+key+" Value :"+value);
}
System.out.println("Check Value: "+mp.containsValue("One"));
System.out.println("Check Key: "+mp.containsKey(1));

}
}

Tuesday, February 7, 2012

Search Criteria - View Criteria

Create view criterias against a view object (you can also have lov in the view criteria fields i.e. by defining the attribute as selectively required, as in screeshot).

In your datacontrol panel inside named criteria

, you will see this viewcriteria drag and drop it as ADF Query panel with table.