Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

loop through parent table and detail table in backing bean

393979Jul 16 2008 — edited Jul 17 2008
Hi

I have an ADF BC application written in jdev 10.1.3.3

In the application is an order page where the user views the items in their basket and enters quantities to order. If any of the quantities exceeds stock I want to prevent the order being placed.

The page has an items table and its child - an options table. The items and options VOs are linked via a view link. I want to loop through each row of the items table and check that none of the quantities entered for the related options exceed stock.

I am doing this in a backing bean using the following code which seems to work
    FacesContext fc = FacesContext.getCurrentInstance();
    Application app = fc.getApplication();
    ValueBinding bind = app.createValueBinding("#{bindings}");
    DCBindingContainer bindings2 = (DCBindingContainer)bind.getValue(fc);
    DCIteratorBinding iter = bindings2.findIteratorBinding("WsOrderItemsView1Iterator");
    RowSetIterator rsi = iter.getRowSetIterator();
    
    for (Row row = rsi.first(); row != null; row = rsi.next())
    {
       System.out.println("@tot val <"+row.getAttribute("TotalValue")+">");
        System.out.println("@col size <"+row.getAttribute("WsColourSizeView")+">");
        
         DCIteratorBinding iter2 = bindings2.findIteratorBinding("WsColourSizeView1Iterator");
         RowSetIterator rsi2 = iter2.getRowSetIterator();
         for (Row row2 = rsi2.first(); row2 != null; row2 = rsi2.next())
         {
           System.out.println("sty <"+row2.getAttribute("StyName")+">");
         }
However I noticed that WsColourSizeView (the options VO) was listed as an attribute of the WsOrderItemsView1Iterator (items VO). I wondered if it is possible to use that attribute to point to the rows of the options VO related to the current row of the items VO? It would be more elegant than grabbing another iterator from the bindings.

thanks
paul
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 14 2008
Added on Jul 16 2008
4 comments
808 views