Applying Programmatically View Criteria based on Like “%String%” and with IN Clause in Oracle ADF

Use the method below code to apply a view criteria programmatically that has IN clause and Like clause:

		
//Retrieving application module
String filterList="Comma,Separated,List"
ApplicationModule applicationModule =
	Configuration.createRootApplicationModule("","AppModuleLocal");
//retrieving view object

ViewObjectImpl vo =
	(ViewObjectImpl)applicationModule.findViewObject("");
	
//creating a view criteria
ViewCriteria criteria = vo.createViewCriteria();
//creating a view criteria row from criteria to set the condition(ViewCriteriaItem)
ViewCriteriaRow viewRow = criteria.createViewCriteriaRow();

String[] filerItemList = filterList.split(",");

ViewCriteriaItem viewObjectVCRowItem =
	viewRow.ensureCriteriaItem("");
viewObjectVCRowItem.setOperator(JboCompOper.OPER_IN);

for (int i = 0; i < filerItemList.length; i++) {
	viewObjectVCRowItem.setValue(i, filerItemList[i]);
}

ViewCriteriaItem secondVCRowItem =
	viewRow.ensureCriteriaItem("Status");
secondVCRowItem.setOperator(JboCompOper.OPER_LIKE);
	secondVCRowItem.setValue(status);
criteria.addElement(viewRow);
vo.applyViewCriteria(criteria);
vo.executeQuery();

Further manipulations can be done accordingly.

 Courtesy: Krishna Reddy Tumati

About Vineet Verma

Developer/Blogger/Gamer/Lazy Couch Potato...:P Need PDF Books: Knowledge Base
This entry was posted in Oracle ADF and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s