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

  1. 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.

    ReplyDelete
  2. 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.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. @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.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete

Post a Comment