Sunday 28 January 2018

Oracle ADF Case Insensitive Search

Oracle ADF Case Insensitive Search

   public String getViewCriteriaClause(boolean forQuery) {
    if (forQuery == false){
         // clause is for cache (in-memory) 
      // WARNING - It is possible to set the criteria mode to cache and the query mode
  // to database.  That will query for a larger result set, then immediately filter it down in-memory
  // queryModeDoesNotUseCache will be true in that case even though it performs a
  // in-memory filter after the fact.  Doing so is not recommended as it wastes memory unless you
              boolean queryModeDoesNotUseCache =
                ((getQueryMode() & ~QUERY_MODE_SCAN_DATABASE_TABLES) == 0);
            ViewCriteria[] vcs =
                getApplyViewCriterias(ViewCriteria.CRITERIA_MODE_CACHE);
            if (vcs != null && vcs.length > 0) {
                boolean criteriaForCacheModeOnlyFound = false; //
                for (ViewCriteria vc : vcs) {
                    criteriaForCacheModeOnlyFound |=
                            (vc.getCriteriaMode() == ViewCriteria.CRITERIA_MODE_CACHE);
                    if (vc.isUpperColumns() == false) {
                        vc.setUpperColumns(true);
                                 // puts UPPER(..) around the values for filtering in-memory
                    }
                }
                if (queryModeDoesNotUseCache &&
                    !criteriaForCacheModeOnlyFound) {
                    // if query mode does not apply to cache and criteria mode
                    // is not "cache only" mode (i.e not for both cache & database)
                    // don't apply any in-memory filter.
                    // This is needed in PS2 to prevent in-memory filtering of dates which causes
                    // no results because the time component is compared as well.
                    // see CustomSQLBuilderImpl which has a PS2 workaround to trunc the date
                    // so the date filters work (without comparing time component)
                    // trunc will fail if applied to a in-memory filter on PS2
                    return null;
                }
            }
    } else{
            ViewCriteria[] vcs =
          getApplyViewCriterias(ViewCriteria.CRITERIA_MODE_QUERY);
      if (vcs != null && vcs.length > 0) {
          for (ViewCriteria vc : vcs) {
              if (vc.isUpperColumns()) {
                  vc.setUpperColumns(false); // remove UPPER(..) around the values for database queryies
              }
          }         
      }
    }
        String clause = super.getViewCriteriaClause(forQuery);
        return clause;
    }
Posted by Don Kleppinger at 11:45 AM


Tuesday 23 January 2018

Git Commands

Git Commands

git log --oneline
git branch
git branch feature
git branch
git checkout feature
git branch
git checkout -b <new Branch>
git checkout -b extra
git branch
git status

git add .
git commit -m "new login signup files"
git log -oneline
git diff master..feature

git checkout master
git merge feature

To Delete Branch
git branch -d feature
git branch -D feature (Force Delete)


To display contents:
git log --oneline
git show <code>

Change latest commit Name
git commit -amend -m "<<commit messge>>" f1

git commit -am "f2 deleted"

rm f1
git status
git checkout f1  [recover deleted]

git rm filename  [it will be deleted permanetly]
git status
git commit -m "f1 deleted"

git log --oneline

mv f3 f5
git status
git add .
git commit -am "f3 to f5"

git mv f5 f3
git status

git commit -m "f5 rename as f3"
git log --oneline






Thursday 18 January 2018

Git Commands for Config

Git Commands for Config

git init
git config --global user.name "prasad"
git config --global user.email "prasad@gmail.com"

git config --list

Adding new file:
git add <filename>
git add .

git commit -m "Nagaraj Test1"
git commit -m "Nagaraj Test2"


git log
git log -n <number> ( list in first )

------------
md central
cd central
git init --bare --shared


----
In work directory (copy the path from central folder)
git push c:\central master


cd central
git log
===========================

git branch  (To list all branches)

git branch <newbranchName>
git branch <branchName>
git branch master-1
get branch
ls

Swap to another Branch:
git checkout <branchname>
git checkout master-1
git checkout master
get merge master-1

Remove Branch:
git branch -d <branchName>   This command need to execute from parent.
ex: git branch -d master-1

Create a New Branch and move to that Branch:
git checkout -b branch-2
( It will be created and move the cursor into that branch )
To List out: git branch

git clone https://github.com/polarapu/batch-10.git
cd batch-10
touch name
git add .
git commit -m "name"
git push

git pull

git show shacode

Monday 8 January 2018

Oracle ADF Step by Step Dependent LOV

Oracle ADF Step by Step Dependent LOV:

Create DepartmentsRVO
  SELECT DEPARTMENT_ID,DEPARTMENT_NAME FROM DEPARTMENTS
Create EmployeeRVO
  SELECT EMPLOYEE_ID,FIRST_NAME,LAST_NAME,EMAIL,DEPARTMENT_ID FROM EMPLOYEES
DeptEmpRVO
  SELECT NULL DEPARTMENT_ID,NULL EMPLOYEE_NAME,NULL INFO FROM DUAL

Added DeptEmpRVO into AM.
Double click on EmployeesRVO, Select ViewCriteria, Click on + for Add New, Click on Add Item,
Select DepartmentId, Equals, BindVariable, Click on + Parameter, enter DepartmentIdBind, click on Ok.

Double click on DeptEmpRVO, Select Attributes,
select DepartmentID attribute, click on Listofvalues, select DepartmentRVO for LOV
Configuration: ViewAttribute:DepartmentID ListAttribute: DepartmentId
UI Hints: Default List Type: Input Text with List of Values.
Select Department Name.

Double click on DeptEmpRVO, Select Attributes,
Select EmployeeId attribute, click on listof values, select employeeRVO for LOV.
Select Accessors, Select employeeVO1, Click on Edit, select Available ViewCriteria, click on Select.
(Select value as DepartmentId.)

Create following method in AMImpl.
    public void setDepartmentIdSessionData(int dId) {
        System.out.println("*** DepartmentId="+dId+" ***");
        this.getSession().getUserData().put("DeptIdSessionValue",dId);
    }
Add above method into Client Listener, and add the method as MethodAction in Current page Bindings.
    public void execDeptId(String valueChangeEvent) {
    BindingContext bctx = BindingContext.getCurrent();
           BindingContainer bindings = bctx.getCurrentBindingsEntry();
           OperationBinding op =
               (OperationBinding)bindings.getOperationBinding("setDepartmentIdSessionData");
           int deptId=Integer.parseInt(valueChangeEvent);
           op.getParamsMap().put("dId",deptId);
           op.execute();
    }

    public void DepartmentIDVCE(ValueChangeEvent valueChangeEvent) {
        System.out.println("DepartmentIDVCE="+valueChangeEvent.getNewValue());
        execDeptId(valueChangeEvent.getNewValue().toString());
    }

Double click on EmployeeRVO, select Attributes, Click on Source, Select DepartmentID,
ViewAttribute="DepartmentId"
GenerateIsNullClauseForBindVars="false"
ContentStyle: width:200px;





Monday 1 January 2018

Oracle ADF Selected row value from Table in Backing Bean



How to get a selected row from af:table component in backing bean

This might be very common requirement for any ADF developer , to get a selected row(s) from <af:table> component in a backing bean.

// Table Binding
<af:table value="#{bindings.EmpVO.collectionModel}" var="row"
          rows="#{bindings. EmpVO .rangeSize}"
          emptyText="#{bindings. EmpVO .viewable ? 'No data to display.' : 'Access Denied.'}"
          fetchSize="#{bindings. EmpVO .rangeSize}"
          rowBandingInterval="0"
          rowSelection="multiple" id="t1"
          styleClass="AFStretchWidth" columnSelection="multiple"
          first="0" contentDelivery="immediate" autoHeightRows="10"
          binding="#{pageFlowScope.ExampleBean.employeeTable}">

Below approach is advisable, If multiple selection rows required 


      

// Get the instance for table component in backing bean
UIXTable table = getEmployeeTable();
// Get the Selected Row key set iterator
Iterator selectionIt = table.getSelectedRowKeys().iterator();
while(selectionIt.hasNext()){
Object  rowKey = selectionIt.next();
 table.setRowKey(rowKey);
 int index = table.getRowIndex();
      FacesCtrlHierNodeBinding row =
        (FacesCtrlHierNodeBinding) table.getRowData(index);
Row selectedRow = row.getRow();
}
      



-- Below approach is advisable if there is only single row selection is enabled.



      

// Get the instance for table component in backing bean
UIXTable table = getEmployeeTable();
// Get the Selected Row key set iterator
Iterator selectionIt = table.getSelectedRowKeys().iterator();
while(selectionIt.hasNext()){
Object  rowKey = selectionIt.next();
table.setRowKey(rowKey); int index = table.getRowIndex();
FacesCtrlHierNodeBinding row = (FacesCtrlHierNodeBinding) table.getRowData(index);
Row selectedRow = row.getRow();
}