Showing posts with label #ViewObject. Show all posts
Showing posts with label #ViewObject. Show all posts

Monday, 2 December 2019

What is a View Object in Oracle ADF??

View Object is used to view and update data in ADF Applications.

We need a database query to perform CRUD operation in the database, that query is represented by ViewObject in oracle ADF Application.

Analogy: In database if what has to perform CRUD operation, then what would you do? You will write a Query. Right?? That query is represented by ViewObject in ADF.

It basically contains database query to fetch or update the records.

View Object are basically of 4 types.

1. Entity based ViewObject

Entity based ViewObject is based on EntityObject of ADF application and can be used to create, read, update and delete or in short perform CRUD operation a database.

how to create an Entity based ViewObject??

2.  Query based ViewObject.

Query-based ViewObject is based on Query and can be used to view the record. 

3.  Static ViewObject.

Static ViewObject is based on the static Values defined in the ViewObject. This can be used to show static content.

4. Programmatic ViewObject.

Programmatic ViewObject is used where data is populated in the ViewObject programmatically. This data is populated by using the POJO class or some database Cursor or Procedure.

how to create a Programmatic ViewObject??




Monday, 21 September 2015

ADF : Implementing Contains Search in AutoSuggest | Change the default "STARTSWITH" behaviour of AutSuggest to "CONTAINS" in ADF

Hello all,

This post is about changing the default AutoSuggest behaviour in ADF Components.

We had a requirement to implement AutoSuggest search on "CONTAINS" basis. Normally the AutoSuggest component in ADF works on "STARTSWITH" basis but we had a requirement in which we had to implement contains search in ADF.

Whenever AutoSuggest is invoked a method applyViewCriteria(ViewCriteria, boolean) in ViewObjectImpl is called.

So to change the behaviour of AutoSuggest we have to override this method in ViewObjectImpl.

Go to the ViewObjectImpl class of the ViewObject on the basis of whome LOV is made and paste the following code.


    @Override
    public void applyViewCriteria(ViewCriteria viewCriteria, boolean b) {
        super.applyViewCriteria(supressStartsWithClauseForLov(viewCriteria), b);
    }
    
    public ViewCriteria supressStartsWithClauseForLov(ViewCriteria vc){
        if(vc != null && vc.getName().contains("__lov__filterlist__vcr__")){
            ViewCriteriaRow currentRow = (ViewCriteriaRow)vc.getCurrentRow();
            if(currentRow != null){
                List criteriaItems = currentRow.getCriteriaItems();
                for(int i = 0 ; i < criteriaItems.size() ; i++){
                    ViewCriteriaItem object = (ViewCriteriaItem)criteriaItems.get(i);
                    if(object != null){
                        System.out.println("Operator is : "+object.getOperator());
                        if("STARTSWITH".equals(object.getOperator())){
                            object.setOperator("CONTAINS");
                        }
                    }
                }
            }
        }
        return vc;
    }


Now, you are ready to go.

References : http://andrejusb.blogspot.in/2014/11/suppressing-adf-lov-like-operator.html