24 June, 2015

Display Calender in SQL and PLSQL

Today I will present how to display calendar specific month from oracle SQL or PLSQL like below image


So I will present the solution to do this

First I will create Object type to handle week days( Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday)
 CREATE OR REPLACE TYPE WEEK_DAY AS OBJECT  
   (SUN NUMBER (2),  
   MON NUMBER (2),  
   TUE NUMBER (2),  
   WED NUMBER (2),  
   THU NUMBER (2),  
   FRI NUMBER (2),  
   SAT NUMBER (2));  

03 June, 2015

ADF ::: Creating View Criteria Programmatically

We can add view criteria programmatically at run-time to ViewObject. So that we not only depend on Design View Criteria.

The following is an example used to create View Criteria in Application Module Impl

ViewObject empVO= this.findViewObject("EmpVO");
ViewCriteria vc = empVO.createViewCriteria();
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();

// ViewCriteriaRow attribute name is case-sensitive.
// ViewCriteriaRow attribute value requires operator and value.
// Note also single-quotes around string value.
ViewCriteriaItem enameItem= vcRow.ensureCriteriaItem("Ename");
enameItem.setOperator("=");
enameItem.getValues().get(0).setValue("Mahmoud Elsayed");
vc.add(vcRow);

empVO.applyViewCriteria(vc);

 

Thanks

02 June, 2015

ADF ::: Handle af:query search Button Programatically

The following code snippets is to execute search button in ADF Query search button programmatically without interact from User

    public void onQueryListener(QueryEvent queryEvent) {
        // Add event code here...
        try{
        FacesContext fcsCtx = FacesContext.getCurrentInstance();
        ELContext elCtx = fcsCtx.getELContext();
        ExpressionFactory expFactory = fcsCtx.getApplication().getExpressionFactory();
        MethodExpression mthdExp =
            expFactory.createMethodExpression(elCtx, "#{bindings.EmpVOCriteriaQuery.processQuery}", null,
                                              new Class[] { queryEvent.getClass() });
        mthdExp.invoke(elCtx, new Object[] { queryEvent });
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }

Thanks