Search This Blog

Populate Values From Data Controls using RowSetIterator and ViewObject


Populate Values From Data Controls  using RowSetIterator  and ViewObject


Using ADF BC ( Employees Table values populated  ) From HR schema


import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.jbo.Row;
import oracle.jbo.RowSetIterator;
import oracle.jbo.ViewObject;




public void getValues(ActionEvent actionEvent) {


DCBindingContainer dcBindings =(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dciter = dcBindings.findIteratorBinding("EmployeesView1Iterator");
ViewObject vo = dciter.getViewObject();
RowSetIterator RowSetI= vo.createRowSet(null);
RowSetI.reset();
while (RowSetI.hasNext()) {
Row row=RowSetI.next();
System.out.println("Employee Name ::::: " + row.getAttribute("FirstName"));
}
RowSetI.closeRowSetIterator();
}



OutPut :

Employee Name ::::: Sarath
Employee Name ::::: Clara
Employee Name ::::: Danielle
Employee Name ::::: Mattea
Employee Name ::::: David
Employee Name ::::: Sundar
Employee Name ::::: Amit
Employee Name ::::: Lisa
Employee Name ::::: Harrison
Employee Name ::::: Tayler
Employee Name ::::: William
Employee Name ::::: Elizabeth


Changing DB Name in ADF BC ( Data source )

 
Changing DB Name in ADF BC (JDBC URL to JDBC Datasource )   AppModule.xml  Free from Enviroment dependency


Most of Developer's having confusion how to change DB URL to different environment. Solution below 
 
For the database change issue :

1.Open the AM
2.Go to overview Section
3.Go to Configurations
4.In that u see AMLocal and AMShared
5.Make Default Configuration as AMLocal
6.Edit the AMLocal 
7.Change connection type from JDBC URL to JDBC Datasource
8.Enter the proper DatasourceName wirhout any spelling mistake or blank space
9.Make sure datasource name is same as in weblogic server where you are deploying the project.


Need to do the same for all AM's in your project.
 
 
 

Custom Error Handling ADF Screen using Java Code ( Oracle BPM 11g ) Taskflow


Custom Error Handling ADF Screen using Java Code ( Oracle BPM 11g ) Taskflow



   Most of the time try and catch block used in java code to handle error, but in terms of customer view Exception page has to be show in-order to avoid panic. Use below method and call any were from Catch block.


     import oracle.adf.controller.ControllerContext;

    ControllerContext controllerCtx = null;
    

   public  void setRedirectPageMethod(String custmMessage ,String StackTraceMessage) {
  
    FacesContext fcntx = FacesContext.getCurrentInstance();
    ExternalContext ectx = fcntx.getExternalContext();
    String viewId = "/faces/CustomErrorPage_Form.jspx";
    controllerCtx = ControllerContext.getInstance();
    String activityURL = controllerCtx.getGlobalViewActivityURL(viewId);
    try{
      ectx.redirect(activityURL);
         
    }
    catch(Exception e) {

    }
}




Your comments and suggestion are always welcome :-)