Search This Blog

Group Check and Group Unchecked ADF Table ( Using Data controls ) RichTable tableBinding - PartialTarget

Group Check and Group Unchecked ADF Table ( Using Data controls ) using Java code  -
PartialTarget



Simple requirement Select all and un selected all row in ADF Table







Java code :


package view;
import javax.faces.event.ValueChangeEvent;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.jbo.Row;
import oracle.jbo.RowSetIterator;
import oracle.jbo.ViewObject;

public class ClassDemo {

    private boolean masterCheckbox=false;
    private RichTable tableBinding;
   
    public void DemoValueChange(ValueChangeEvent valueChangeEvent) {
     
        String NewVal = valueChangeEvent.getNewValue().toString();
        DCBindingContainer dcBindings =(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
        DCIteratorBinding dciter = dcBindings.findIteratorBinding("userDetailsIterator");
        ViewObject vo = dciter.getViewObject();
        RowSetIterator RowSetI= vo.createRowSet(null);
        RowSetI.reset();
        while (RowSetI.hasNext()) {
        Row row=RowSetI.next();
        row.setAttribute("usercheckList", NewVal);
        }
        RowSetI.closeRowSetIterator();
        AdfFacesContext.getCurrentInstance().addPartialTarget(tableBinding);
    }

    public void setMasterCheckbox(boolean masterCheckbox) {
        this.masterCheckbox = masterCheckbox;
    }

    public boolean isMasterCheckbox() {
        return masterCheckbox;
    }

    public void setTableBinding(RichTable tableBinding) {
        this.tableBinding = tableBinding;
    }

    public RichTable getTableBinding() {
        return tableBinding;
    }
}



JSPX Code :

   <af:selectBooleanCheckbox
                                      label="Group Check Box" id="sbc2"
                                      autoSubmit="true"
                                      valueChangeListener="#{pageFlowScope.CheckBoxMbean.DemoValueChange}"
                                      value="#{pageFlowScope.CheckBoxMbean.masterCheckbox}"
                                      partialTriggers="t1"/>




Table Property :


 <af:table value="#{bindings.userDetails.collectionModel}" var="row" contentDelivery="immediate"
                      rows="#{bindings.userDetails.rangeSize}"
                      emptyText="#{bindings.userDetails.viewable ? 'No data to display.' : 'Access Denied.'}"
                      fetchSize="#{bindings.userDetails.rangeSize}"
                      rowBandingInterval="0"
                        binding="#{pageFlowScope.CheckBoxMbean.tableBinding}"
                      selectedRowKeys="#{bindings.userDetails.collectionModel.selectedRow}"
                      selectionListener="#{bindings.userDetails.collectionModel.makeCurrent}"
                      rowSelection="single" id="t1">




Data now refresh using java code .


Happy Coding :-)

Ojdeploy ADF Build Utility with out open Jdevloper create EAR using CMD and Ant Scripts

Ojdeploy ADF Build Utility with out open Jdevloper create EAR using CMD and Ant Scripts


Normally in Production Env using ant scripts Admin will deploy the code . But before deploy the code using Ant Script . we need EAR files in Application deploy folder.

If you are committing code in SVN with EAR file is not a good practice. In Prod server most of the things done using scripts. If I open Jdeveloper in prod server un necessarily I am wasting server memory . How to over this problem ?


Solution :  

Oracle came up with solution using Ojdeploy ADF Build Utility 




C:\Oracle\Middleware\Jdev11\jdeveloper\jdev\bin>ojdeploy -workspace c:\JDeveloper\mywork\DemoApplicationTWo\DemoApplicationTWo.jws -profile  DemoAppli

cationTWo_application1
  


  Explanation:

ojdeploy              - utility Name 
workspace          -  Workspace location
profile                 -  Name of the EAR  create


-------------------------------------------------------------------------------------------------------------------

Deploy using ANT Scripts with the help of OJdeploy Utility :


Select view Controller Project --> New --> Ant --> Build File from  Project



 

 check  ( Include  Packaging  Tasks Use ojdeploy )


 Buil.xml and Build.Properties create under Resource Folder

Inside Build.xml ojdeploy option included


  <target name="deploy" description="Deploy JDeveloper profiles" depends="init">
    <taskdef name="ojdeploy"
             classname="oracle.jdeveloper.deploy.ant.OJDeployAntTask"
             uri="oraclelib:OJDeployAntTask"
             classpath="${oracle.jdeveloper.ant.library}"/>
    <ora:ojdeploy xmlns:ora="oraclelib:OJDeployAntTask"
                  executable="${oracle.jdeveloper.ojdeploy.path}"
                  ora:buildscript="${oracle.jdeveloper.deploy.dir}/ojdeploy-build.xml"
                  ora:statuslog="${oracle.jdeveloper.deploy.dir}/ojdeploy-statuslog.xml">
      <ora:deploy>
        <ora:parameter name="workspace"
                       value="${oracle.jdeveloper.workspace.path}"/>
        <ora:parameter name="project"
                       value="${oracle.jdeveloper.project.name}"/>
        <ora:parameter name="profile"
                       value="${oracle.jdeveloper.deploy.profile.name}"/>
        <ora:parameter name="nocompile" value="false"/>
        <ora:parameter name="outputfile"
                       value="${oracle.jdeveloper.deploy.outputfile}"/>
      </ora:deploy>
    </ora:ojdeploy>




 Note : Remove Yellow shaded line from build.xml

Happy codding :-)

Seesion Scope to Handle Data in ADF Application



 ADF Provided different scope to handle data :

1. Request Scope
2. Session Scope 
3. Application Scope 
4. PageFlow Scope
5.  BackingBean Scope 
6. View Scope


Session Scope  to store values through out the session 

Note : Try to avoid Session Scope in Application as much as possible


FacesContext context = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession)
context.getExternalContext().getSession(false);
session.setAttribute(Attribute, value);
session.getAttribute(Attribute);


Example :


session.setAttribute("UserName", "Krishna");
session.getAttribute("UserName");


Happy coding :-)
 

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.