Skip to main content

Overriding ViewObjectImpl::rowQualifies(...) for in memory filtering of child nodes of a tree component

You can override ViewObjectImpl::rowQualifies(ViewRowImpl vr) for filtering the uncommitted data rows based on some specific business use cases/conditions. This feature is pretty useful if you need to filter the child rows having uncommitted changes while executing the ViewLink(s). I'm sharing a simple example illustrating the usage of ViewObjectImpl::rowQualifies(ViewRowImpl vr) for filtering the rows in memory. Requirement is to not to show the Employee nodes of a 'Department-Employee Tree' component having status='DELETE'(even before committing the transaction). This example overrides rowQualifies(...) to restrict the employee entities with 'DELETED' status from adding to the query result.

 
/**  
 * Evaluates whether the view row qualifies the view object's row match  
 * and in-memory filter view criteria.  
 * <p>  
 *  
 * This method is invoked on new view rows as well as view rows coming  
 * from query to see if the view row should be added to the query collection.  
 *  
 * @param  vr  the view row to examine.  
 * @return a <code>boolean</code> value indicating whether the row qualifies  
 *     or not.  
 */  
 @Override  
 protected boolean rowQualifies(ViewRowImpl vr) {  
  Object attrValue =vr.getAttribute("StatusFlag");  
  if (attrValue != null) {  
   if ("DELETE".equals(attrValue))  
      return false;  
   else  
      return true;  
  }  
  return super.rowQualifies(vr);  
 }  

Download

You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R1 PS3 + HR Schema]

How to run this sample?

Run test.jspx. This page may let you to update the status of the employee entities by selecting a value from the 'status' list. Please note that 'Department-Employee' tree doesn't displays employee entities with 'DELETE' status. This is controlled by EmployeesViewImpl::rowQualifies(ViewRowImpl vr) method.

Comments

subu said…
help me.
https://forums.oracle.com/forums/forum.jspa?forumID=83

i follow ur blog: for my scenario
in my senario all r fine. but for hide the row based on the status.
ok.

each and every time i want to refresh the url or else re - run the jspx file. for hiding the row. i did all as you said partial submit partial trigger.
subu said…
problem i leaved out in this link.
https://forums.oracle.com/forums/thread.jspa?threadID=2299005&tstart=15


for hide the row. each n every time i want re-run the jspx file. or else refresh the url. what i do.
subu said…
This comment has been removed by the author.
subu said…
@Override
protected boolean rowQualifies(ViewRowImpl viewRowImpl)
{
Object attrValue =viewRowImpl.getAttribute("GlalStatus");
if (attrValue != null) {
if ( ("A".equals(attrValue)) || ("N".equals(attrValue)) || ("C".equals(attrValue)) )
return false;

else
return true;

}
return super.rowQualifies(viewRowImpl);
}

this is my code.

i dont choose the select onchoice. in button code of bean. it automaticaly changed the value of select one choice.

and i want to say. so i make thing.

dciter.dccontrolrefresh(). i write this in the button.

while using the iterator refresh. but sometimes all works fine. but sometimes row is not hiding.

but you doesnot handle this.

am struggling.struggling. i can t undertud.
subu said…
This comment has been removed by the author.
subu said…
here some more codes.

Popular posts from this blog

Happy New Year 2018 !

We can't go back and change the beginning, but we always can start where we are and change the ending. Believe in yourself and you will be unstoppable!

Wishing you and your family a very happy new year 2018 !!!

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…