TreeTable funny nodes

I have a tree table that is acting strangely.
When I click on one node a different one
expands. I printed out the value being
returned in getValueAt in the TreeTableModelAdapter
and first it prints the row I click on and then the
next row or a few rows and it only expands the
last one that it prints. I'm making sure to keep
my pointer on just one node. Is any one experiencing
the same thing? Or do you have any advice?

Can someone please help?

Similar Messages

  • Leaf node in treeTable

    Hi,
    I have created a tree structure like below example, now I want to call a java function once i click leaf node only and want to get all node values i traveled to reach leaf node.
    i.e when i click on leaf node A.1.1, i want to call bean function and want to get all values like A->A1->A1.1,So do i call this function,Please advice...
    A
    |-A1
    |-A1.1
    Thanks

    Hi,
    You can do it the other way as well. You can see if the node is a leaf node or not using node.getChildren()(returns null if it is a leaf node) method and display outputText if not a leaf node else display a command link.
    To get the nodes you have travelled through, you can use node.getKeyPath() method which gives the list of the keys(oracle.jbo.Key) you have traversed through.
    Sample Code:
    <!-- Faces page -->
    <af:treeTable var="node"  ..>
        <f:facet name="nodeStamp">
         <af:column id="c1">
           <af:switcher facetName="#{node.children eq null ? 'leaf' : 'non-leaf'}" defaultFacet="non-leaf">            
             <f:facet name="non-leaf">
               <af:outputText value="#{node}"/>
             </f:facet>
             <f:facet name="leaf">
               <af:commandLink text="#{node}" actionListener="#{MyBean.leafSelected}" partialSubmit="true">
              <!-- getKeyPath() method on node gives the list of the keys(oracle.jbo.Key) you have traversed through -->
              <af:setActionListener from="#{node.keyPath}" to="#{MyBean.keyPath}"/>
               </af:commandLink>
             </f:facet>
           </af:switcher>
         </af:column>
        </f:facet>
    </af:treeTable>
    <!-- Inside Bean -->
    private List keyPath;
    //Add getter and setter methods for keyPath
    //ActionListener method
    public void leafSelected(ActionEvent ae){
       //From the key you can get the primary key using getAttribute(0)
       /*Eg.
         for(int index = 0; index < keyPath.size(); index++){
            Key key = (Key)keyPath.get(index);
            System.out.println("Primary Key of the selected node in level "+index+" is: "+key.getAttribute(0));
    }Sireesha

  • Dynamic Columns in TreeTable

    I am trying to create a treetable with some dynamic columns. The extra columns I need to show have been added as attributes to the node. So within the facet "nodeStamp" I display the label and need to add other columns dynamically reading the attribute list. The following code does not work for me :(
    <af:treeTable var="node" value="#{attrs.model.selectedModel}" binding="#{attrs.model.selectedTreeTable}"
    columnStretching="column:selLabel" verticalGridVisible="false" horizontalGridVisible="false"
    columnSelection="none" rowSelection="multiple" disclosedRowKeys="#{attrs.model.disclosedRows}"
    columnBandingInterval="0" selectionListener="#{attrs.model.selectionListener}"
    rowBandingInterval="0">
    <f:facet name="nodeStamp">
    <af:column id="selLabel">
    <af:panelGroupLayout>
    <af:image source="/images/blank.png" inlineStyle="width:12px; height:12px;"/>
    <af:outputText value="#{node.element.label}" inlineStyle="margin-left:3px;"/>
    </af:panelGroupLayout>
    </af:column>
    </f:facet>
    <c:forEach items="${node.attributeNames}" var="attrName">
    <af:column id="attr" headerText="#{attrName}">
    <af:outputText value="#{node.attributes[attrName]}"/>
    </af:column>
    </c:forEach>
    Any help is appreciated.
    Thanks,
    Suneetha.

    I have not been able to follow your suggestion, the compilation complains that the switcher is not a valid child of the treetable component. I am running out of options here , anybody else have any suggestions ?
    Suneetha.

  • Some issue wid af:treeTable

    hi
    i am making sample page to explore af:treeTable
    the issue is that the page is showing only one row ...
    and
    when i click on expand all option i get javascript error
    Line : 2
    Char : 1
    Error : uixt_id0 is undefined
    i guess its coz there is one record
    although i tried making another page using same beans wid af:table
    i dont face any issues in that
    so the bean code is correct ....
    any issues wid the code ??
    <af:treeTable var="node" value="#{myBean.employees}" >
    <f:facet name="nodeStamp">
    <af:column>
    <f:facet name="header">
    <af:outputText value="Employee Name"/>
    </f:facet>
    <af:outputText value="#{node.name}"/>
    </af:column>
    </f:facet>
    <af:column>
    <f:facet name="header">
    <af:outputText value="Employee Id"/>
    </f:facet>
    <af:outputText value="#{node.id}"/>
    </af:column>
    <af:column>
    <f:facet name="header">
    <af:outputText value="Age"/>
    </f:facet>
    <af:outputText value="#{node.age}"/>
    </af:column>
    </af:treeTable>

    i went through the code thats generated
    the page tries to refer to a file Common10_1_3_0_4.js
    but this file is not there in my project
    guess its generated to support client side functions in a ADF page
    but couldnt understand why isnt this being generated in my project ??
    is this the reason that i get only one record in my page.... ??

  • Very Slow Query with CTE inner join

    I have 2 tables (heavily simplified here to show relevant columns):
    CREATE TABLE tblCharge
    (ChargeID int NOT NULL,
    ParentChargeID int NULL,
    ChargeName varchar(200) NULL)
    CREATE TABLE tblChargeShare
    (ChargeShareID int NOT NULL,
    ChargeID int NOT NULL,
    TotalAmount money NOT NULL,
    TaxAmount money NULL,
    DiscountAmount money NULL,
    CustomerID int NOT NULL,
    ChargeShareStatusID int NOT NULL)
    I have a very basic View to Join them:
    CREATE VIEW vwBASEChargeShareRelation as
    Select c.ChargeID, ParentChargeID, s.CustomerID, s.TotalAmount, isnull(s.TaxAmount, 0) as TaxAmount, isnull(s.DiscountAmount, 0) as DiscountAmount
    from tblCharge c inner join tblChargeShare s
    on c.ChargeID = s.ChargeID Where s.ChargeShareStatusID < 3
    GO
    I then have a view containing a CTE to get the children of the Parent Charge:
    ALTER VIEW [vwChargeShareSubCharges] AS
    WITH RCTE AS
    SELECT ParentChargeId, ChargeID, 1 AS Lvl, ISNULL(TotalAmount, 0) as TotalAmount, ISNULL(TaxAmount, 0) as TaxAmount,
    ISNULL(DiscountAmount, 0) as DiscountAmount, CustomerID, ChargeID as MasterChargeID
    FROM vwBASEChargeShareRelation Where ParentChargeID is NULL
    UNION ALL
    SELECT rh.ParentChargeID, rh.ChargeID, Lvl+1 AS Lvl, ISNULL(rh.TotalAmount, 0), ISNULL(rh.TaxAmount, 0), ISNULL(rh.DiscountAmount, 0) , rh.CustomerID
    , rc.MasterChargeID
    FROM vwBASEChargeShareRelation rh
    INNER JOIN RCTE rc ON rh.PArentChargeID = rc.ChargeID and rh.CustomerID = rc.CustomerID
    Select MasterChargeID as ChargeID, CustomerID, Sum(TotalAmount) as TotalCharged, Sum(TaxAmount) as TotalTax, Sum(DiscountAmount) as TotalDiscount
    from RCTE
    Group by MasterChargeID, CustomerID
    GO
    So far so good, I can query this view and get the total cost for a line item including all children.
    The problem occurs when I join this table. The query:
    Select t.* from vwChargeShareSubCharges t
    inner join
    tblChargeShare s
    on t.CustomerID = s.CustomerID
    and t.MasterChargeID = s.ChargeID
    Where s.ChargeID = 1291094
    Takes around 30 ms to return a result (tblCharge and Charge Share have around 3.5 million records).
    But the query:
    Select t.* from vwChargeShareSubCharges t
    inner join
    tblChargeShare s
    on t.CustomerID = s.CustomerID
    and t.MasterChargeID = s.ChargeID
    Where InvoiceID = 1045854
    Takes around 2 minutes to return a result - even though the only charge with that InvoiceID is the same charge as the one used in the previous query.
    The same thing occurs if I do the join in the same query that the CTE is defined in.
    I ran the execution plan for each query. The first (fast) query looks like this:
    The second(slow) query looks like this:
    I am at a loss, and my skills at decoding execution plans to resolve this are lacking.
    I have separate indexes on tblCharge.ChargeID, tblCharge.ParentChargeID, tblChargeShare.ChargeID, tblChargeShare.InvoiceID, tblChargeShare.ChargeShareStatusID
    Any ideas? Tested on SQL 2008R2 and SQL 2012

    >> The database is linked [sic] to an established app and the column and table names can't be changed. <<
    Link? That is a term from pointer chains and network databases, not SQL. I will guess that means the app came back in the old pre-RDBMS days and you are screwed. 
    >> I am not too worried about the money field [sic], this is used for money and money based calculations so the precision and rounding are acceptable at this level. <<
    Field is a COBOL concept; columns are totally different. MONEY is how Sybase mimics the PICTURE clause that puts currency signs, commas, period, etc in a COBOL money field. 
    Using more than one operation (multiplication or division) on money columns will produce severe rounding errors. A simple way to visualize money arithmetic is to place a ROUND() function calls after 
    every operation. For example,
    Amount = (Portion / total_amt) * gross_amt
    can be rewritten using money arithmetic as:
    Amount = ROUND(ROUND(Portion/total_amt, 4) * 
    gross_amt, 4)
    Rounding to four decimal places might not seem an 
    issue, until the numbers you are using are greater 
    than 10,000. 
    BEGIN
    DECLARE @gross_amt MONEY,
     @total_amt MONEY,
     @my_part MONEY,
     @money_result MONEY,
     @float_result FLOAT,
     @all_floats FLOAT;
     SET @gross_amt = 55294.72;
     SET @total_amt = 7328.75;
     SET @my_part = 1793.33;
     SET @money_result = (@my_part / @total_amt) * 
    @gross_amt;
     SET @float_result = (@my_part / @total_amt) * 
    @gross_amt;
     SET @Retult3 = (CAST(@my_part AS FLOAT)
     / CAST( @total_amt AS FLOAT))
     * CAST(FLOAT, @gross_amt AS FLOAT);
     SELECT @money_result, @float_result, @all_floats;
    END;
    @money_result = 13525.09 -- incorrect
    @float_result = 13525.0885 -- incorrect
    @all_floats = 13530.5038673171 -- correct, with a -
    5.42 error 
    >> The keys are ChargeID(int, identity) and ChargeShareID(int, identity). <<
    Sorry, but IDENTITY is not relational and cannot be a key by definition. But it sure works just like a record number in your old COBOL file system. 
    >> .. these need to be int so that they are assigned by the database and unique. <<
    No, the data type of a key is not determined by physical storage, but by logical design. IDENTITY is the number of a parking space in a garage; a VIN is how you identify the automobile. 
    >> What would you recommend I use as keys? <<
    I do not know. I have no specs and without that, I cannot pull a Kabbalah number from the hardware. Your magic numbers can identify Squids, Automobile or Lady Gaga! I would ask the accounting department how they identify a charge. 
    >> Charge_Share_Status_ID links [sic] to another table which contains the name, formatting [sic] and other information [sic] or a charge share's status, so it is both an Id and a status. <<
    More pointer chains! Formatting? Unh? In RDBMS, we use a tiered architecture. That means display formatting is in a presentation layer. A properly created table has cohesion – it does one and only one data element. A status is a state of being that applies
    to an entity over a period time (think employment, marriage, etc. status if that is too abstract). 
    An identifier is based on the Law of Identity from formal logic “To be is to be something in particular” or “A is A” informally. There is no entity here! The Charge_Share_Status table should have the encoded values for a status and perhaps a description if
    they are unclear. If the list of values is clear, short and static, then use a CHECK() constraint. 
    On a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, this is literally that silly and wrong. 
    >> I understand what a CTE is; is there a better way to sum all children for a parent hierarchy? <<
    There are many ways to represent a tree or hierarchy in SQL.  This is called an adjacency list model and it looks like this:
    CREATE TABLE OrgChart 
    (emp_name CHAR(10) NOT NULL PRIMARY KEY, 
     boss_emp_name CHAR(10) REFERENCES OrgChart(emp_name), 
     salary_amt DECIMAL(6,2) DEFAULT 100.00 NOT NULL,
     << horrible cycle constraints >>);
    OrgChart 
    emp_name  boss_emp_name  salary_amt 
    ==============================
    'Albert'    NULL    1000.00
    'Bert'    'Albert'   900.00
    'Chuck'   'Albert'   900.00
    'Donna'   'Chuck'    800.00
    'Eddie'   'Chuck'    700.00
    'Fred'    'Chuck'    600.00
    This approach will wind up with really ugly code -- CTEs hiding recursive procedures, horrible cycle prevention code, etc.  The root of your problem is not knowing that rows are not records, that SQL uses sets and trying to fake pointer chains with some
    vague, magical non-relational "id".  
    This matches the way we did it in old file systems with pointer chains.  Non-RDBMS programmers are comfortable with it because it looks familiar -- it looks like records and not rows.  
    Another way of representing trees is to show them as nested sets. 
    Since SQL is a set oriented language, this is a better model than the usual adjacency list approach you see in most text books. Let us define a simple OrgChart table like this.
    CREATE TABLE OrgChart 
    (emp_name CHAR(10) NOT NULL PRIMARY KEY, 
     lft INTEGER NOT NULL UNIQUE CHECK (lft > 0), 
     rgt INTEGER NOT NULL UNIQUE CHECK (rgt > 1),
      CONSTRAINT order_okay CHECK (lft < rgt));
    OrgChart 
    emp_name         lft rgt 
    ======================
    'Albert'      1   12 
    'Bert'        2    3 
    'Chuck'       4   11 
    'Donna'       5    6 
    'Eddie'       7    8 
    'Fred'        9   10 
    The (lft, rgt) pairs are like tags in a mark-up language, or parens in algebra, BEGIN-END blocks in Algol-family programming languages, etc. -- they bracket a sub-set.  This is a set-oriented approach to trees in a set-oriented language. 
    The organizational chart would look like this as a directed graph:
                Albert (1, 12)
        Bert (2, 3)    Chuck (4, 11)
                       /    |   \
                     /      |     \
                   /        |       \
                 /          |         \
            Donna (5, 6) Eddie (7, 8) Fred (9, 10)
    The adjacency list table is denormalized in several ways. We are modeling both the Personnel and the Organizational chart in one table. But for the sake of saving space, pretend that the names are job titles and that we have another table which describes the
    Personnel that hold those positions.
    Another problem with the adjacency list model is that the boss_emp_name and employee columns are the same kind of thing (i.e. identifiers of personnel), and therefore should be shown in only one column in a normalized table.  To prove that this is not
    normalized, assume that "Chuck" changes his name to "Charles"; you have to change his name in both columns and several places. The defining characteristic of a normalized table is that you have one fact, one place, one time.
    The final problem is that the adjacency list model does not model subordination. Authority flows downhill in a hierarchy, but If I fire Chuck, I disconnect all of his subordinates from Albert. There are situations (i.e. water pipes) where this is true, but
    that is not the expected situation in this case.
    To show a tree as nested sets, replace the nodes with ovals, and then nest subordinate ovals inside each other. The root will be the largest oval and will contain every other node.  The leaf nodes will be the innermost ovals with nothing else inside them
    and the nesting will show the hierarchical relationship. The (lft, rgt) columns (I cannot use the reserved words LEFT and RIGHT in SQL) are what show the nesting. This is like XML, HTML or parentheses. 
    At this point, the boss_emp_name column is both redundant and denormalized, so it can be dropped. Also, note that the tree structure can be kept in one table and all the information about a node can be put in a second table and they can be joined on employee
    number for queries.
    To convert the graph into a nested sets model think of a little worm crawling along the tree. The worm starts at the top, the root, makes a complete trip around the tree. When he comes to a node, he puts a number in the cell on the side that he is visiting
    and increments his counter.  Each node will get two numbers, one of the right side and one for the left. Computer Science majors will recognize this as a modified preorder tree traversal algorithm. Finally, drop the unneeded OrgChart.boss_emp_name column
    which used to represent the edges of a graph.
    This has some predictable results that we can use for building queries.  The root is always (left = 1, right = 2 * (SELECT COUNT(*) FROM TreeTable)); leaf nodes always have (left + 1 = right); subtrees are defined by the BETWEEN predicate; etc. Here are
    two common queries which can be used to build others:
    1. An employee and all their Supervisors, no matter how deep the tree.
     SELECT O2.*
       FROM OrgChart AS O1, OrgChart AS O2
      WHERE O1.lft BETWEEN O2.lft AND O2.rgt
        AND O1.emp_name = :in_emp_name;
    2. The employee and all their subordinates. There is a nice symmetry here.
     SELECT O1.*
       FROM OrgChart AS O1, OrgChart AS O2
      WHERE O1.lft BETWEEN O2.lft AND O2.rgt
        AND O2.emp_name = :in_emp_name;
    3. Add a GROUP BY and aggregate functions to these basic queries and you have hierarchical reports. For example, the total salaries which each employee controls:
     SELECT O2.emp_name, SUM(S1.salary_amt)
       FROM OrgChart AS O1, OrgChart AS O2,
            Salaries AS S1
      WHERE O1.lft BETWEEN O2.lft AND O2.rgt
        AND S1.emp_name = O2.emp_name 
       GROUP BY O2.emp_name;
    4. To find the level and the size of the subtree rooted at each emp_name, so you can print the tree as an indented listing. 
    SELECT O1.emp_name, 
       SUM(CASE WHEN O2.lft BETWEEN O1.lft AND O1.rgt 
       THEN O2.sale_amt ELSE 0.00 END) AS sale_amt_tot,
       SUM(CASE WHEN O2.lft BETWEEN O1.lft AND O1.rgt 
       THEN 1 ELSE 0 END) AS subtree_size,
       SUM(CASE WHEN O1.lft BETWEEN O2.lft AND O2.rgt
       THEN 1 ELSE 0 END) AS lvl
      FROM OrgChart AS O1, OrgChart AS O2
     GROUP BY O1.emp_name;
    5. The nested set model has an implied ordering of siblings which the adjacency list model does not. To insert a new node, G1, under part G.  We can insert one node at a time like this:
    BEGIN ATOMIC
    DECLARE rightmost_spread INTEGER;
    SET rightmost_spread 
        = (SELECT rgt 
             FROM Frammis 
            WHERE part = 'G');
    UPDATE Frammis
       SET lft = CASE WHEN lft > rightmost_spread
                      THEN lft + 2
                      ELSE lft END,
           rgt = CASE WHEN rgt >= rightmost_spread
                      THEN rgt + 2
                      ELSE rgt END
     WHERE rgt >= rightmost_spread;
     INSERT INTO Frammis (part, lft, rgt)
     VALUES ('G1', rightmost_spread, (rightmost_spread + 1));
     COMMIT WORK;
    END;
    The idea is to spread the (lft, rgt) numbers after the youngest child of the parent, G in this case, over by two to make room for the new addition, G1.  This procedure will add the new node to the rightmost child position, which helps to preserve the idea
    of an age order among the siblings.
    6. To convert a nested sets model into an adjacency list model:
    SELECT B.emp_name AS boss_emp_name, E.emp_name
      FROM OrgChart AS E
           LEFT OUTER JOIN
           OrgChart AS B
           ON B.lft
              = (SELECT MAX(lft)
                   FROM OrgChart AS S
                  WHERE E.lft > S.lft
                    AND E.lft < S.rgt);
    7. To find the immediate parent of a node: 
    SELECT MAX(P2.lft), MIN(P2.rgt)
      FROM Personnel AS P1, Personnel AS P2
     WHERE P1.lft BETWEEN P2.lft AND P2.rgt 
       AND P1.emp_name = @my_emp_name;
    I have a book on TREES & HIERARCHIES IN SQL which you can get at Amazon.com right now. It has a lot of other programming idioms for nested sets, like levels, structural comparisons, re-arrangement procedures, etc. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Stored Procedure- Multil level employee hierarchy in the same row

    I have an employee table where I have employee details  which includes the following properties:
    EmployeeID, EmployeeName, ManagerID, DesignationCode.
    ManagerID maps to EmployeeID in the Emp table. DesignationCode is to identify the employee designation.
    The topmost person of the organization could be identified by : whose DesignationCode is 'XX' and ManagerID=EmplyeeID.
    Here, 'XX' is fixed and will not change.
    Also, we know there could be a maximum of 10 level for each hierarchy.
    Example: Employee1 reports to Manager1 who reports to Manager2 who reports to Manager 3 ..... who reports to ManagerN.
    I need to pull a hierarchy in the below format:
    EmpName  MgrName0   MagrName1   MgrName2 ..........MgrName7  MgrName8 
    MgrName9
    SAMRAT                                                                      
                                XXX                XXX
    SUDHAKAR                                                                   
      XXX                 XXX                XXX
    SATESWAR                                                                   
                              XXX                XXX
    SRINI               XXX                  XXX                      
              XXX                 XXX                XXX
    IMPORTANT POINT: We need to identify the reporting hierarchy level for each employee's manager and then place the manager names accordingly based on the columns.
    Example:
    If an employee's manager has only 1 reporting manager(who is at top level), then he would be placed at the column "ManagerName8" and ManageName9 would be the topmost employee of the organization
    In short, we need to identify the reporting level at which the employees manager belongs and then start filling the columns values for that row ( employee details)
    I am stuck and unable to do the same. Please help.
    Thank you.

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    >> I have an employee table where I have employee details <<
    An SQL programmer would have a Personnel table instead. What you have said is that you have only one employee! 
    >> which includes the following properties:
    emp_id, emp_name, manager_emp_id, designation_code.<<
    Why do you think that a manager is an attribute of an employee? This is absurd! They have a relationship; where is the table that models that relationship? It is missing from this non-normalized, improperly designed table. 
    There are many ways to represent a tree or hierarchy in SQL. YOU are trying to use an adjacency list model. This approach will wind up with really ugly code -- CTEs hiding recursive procedures, horrible cycle prevention code, etc.  
    Another way of representing trees is to show them as nested sets. 
    Since SQL is a set oriented language, this is a better model than the usual adjacency list approach you see in most text books. Let us define a simple OrgChart table like this.
    CREATE TABLE OrgChart 
    (emp_name CHAR(10) NOT NULL PRIMARY KEY, 
     lft INTEGER NOT NULL UNIQUE CHECK (lft > 0), 
     rgt INTEGER NOT NULL UNIQUE CHECK (rgt > 1),
      CONSTRAINT order_okay CHECK (lft < rgt));
    OrgChart 
    emp_name         lft rgt 
    ======================
    'Albert'      1   12 
    'Bert'        2    3 
    'Chuck'       4   11 
    'Donna'       5    6 
    'Eddie'       7    8 
    'Fred'        9   10 
    The (lft, rgt) pairs are like tags in a mark-up language, or parens in algebra, BEGIN-END blocks in Algol-family programming languages, etc. -- they bracket a sub-set.  This is a set-oriented approach to trees in a set-oriented language. 
    The organizational chart would look like this as a directed graph:
                Albert (1, 12)
        Bert (2, 3)    Chuck (4, 11)
                       /    |   \
                     /      |     \
                   /        |       \
                 /          |         \
            Donna (5, 6) Eddie (7, 8) Fred (9, 10)
    The adjacency list table is denormalized in several ways. We are modeling both the Personnel and the Organizational chart in one table. But for the sake of saving space, pretend that the names are job titles and that we have another table which describes the
    Personnel that hold those positions.
    Another problem with the adjacency list model is that the boss_emp_name and employee columns are the same kind of thing (i.e. identifiers of personnel), and therefore should be shown in only one column in a normalized table.  To prove that this is not
    normalized, assume that "Chuck" changes his name to "Charles"; you have to change his name in both columns and several places. The defining characteristic of a normalized table is that you have one fact, one place, one time.
    The final problem is that the adjacency list model does not model subordination. Authority flows downhill in a hierarchy, but If I fire Chuck, I disconnect all of his subordinates from Albert. There are situations (i.e. water pipes) where this is true, but
    that is not the expected situation in this case.
    To show a tree as nested sets, replace the nodes with ovals, and then nest subordinate ovals inside each other. The root will be the largest oval and will contain every other node.  The leaf nodes will be the innermost ovals with nothing else inside them
    and the nesting will show the hierarchical relationship. The (lft, rgt) columns (I cannot use the reserved words LEFT and RIGHT in SQL) are what show the nesting. This is like XML, HTML or parentheses. 
    At this point, the boss_emp_name column is both redundant and denormalized, so it can be dropped. Also, note that the tree structure can be kept in one table and all the information about a node can be put in a second table and they can be joined on employee
    number for queries.
    To convert the graph into a nested sets model think of a little worm crawling along the tree. The worm starts at the top, the root, makes a complete trip around the tree. When he comes to a node, he puts a number in the cell on the side that he is visiting
    and increments his counter.  Each node will get two numbers, one of the right side and one for the left. Computer Science majors will recognize this as a modified preorder tree traversal algorithm. Finally, drop the unneeded OrgChart.boss_emp_name column
    which used to represent the edges of a graph.
    This has some predictable results that we can use for building queries.  The root is always (left = 1, right = 2 * (SELECT COUNT(*) FROM TreeTable)); leaf nodes always have (left + 1 = right); subtrees are defined by the BETWEEN predicate; etc. Here are
    two common queries which can be used to build others:
    1. An employee and all their Supervisors, no matter how deep the tree.
     SELECT O2.*
       FROM OrgChart AS O1, OrgChart AS O2
      WHERE O1.lft BETWEEN O2.lft AND O2.rgt
        AND O1.emp_name = :in_emp_name;
    2. The employee and all their subordinates. There is a nice symmetry here.
     SELECT O1.*
       FROM OrgChart AS O1, OrgChart AS O2
      WHERE O1.lft BETWEEN O2.lft AND O2.rgt
        AND O2.emp_name = :in_emp_name;
    3. Add a GROUP BY and aggregate functions to these basic queries and you have hierarchical reports. For example, the total salaries which each employee controls:
     SELECT O2.emp_name, SUM(S1.salary_amt)
       FROM OrgChart AS O1, OrgChart AS O2,
            Salaries AS S1
      WHERE O1.lft BETWEEN O2.lft AND O2.rgt
        AND S1.emp_name = O2.emp_name 
       GROUP BY O2.emp_name;
    4. To find the level and the size of the subtree rooted at each emp_name, so you can print the tree as an indented listing. 
    SELECT O1.emp_name, 
       SUM(CASE WHEN O2.lft BETWEEN O1.lft AND O1.rgt 
       THEN O2.sale_amt ELSE 0.00 END) AS sale_amt_tot,
       SUM(CASE WHEN O2.lft BETWEEN O1.lft AND O1.rgt 
       THEN 1 ELSE 0 END) AS subtree_size,
       SUM(CASE WHEN O1.lft BETWEEN O2.lft AND O2.rgt
       THEN 1 ELSE 0 END) AS lvl
      FROM OrgChart AS O1, OrgChart AS O2
     GROUP BY O1.emp_name;
    5. The nested set model has an implied ordering of siblings which the adjacency list model does not. To insert a new node, G1, under part G.  We can insert one node at a time like this:
    BEGIN ATOMIC
    DECLARE rightmost_spread INTEGER;
    SET rightmost_spread 
        = (SELECT rgt 
             FROM Frammis 
            WHERE part = 'G');
    UPDATE Frammis
       SET lft = CASE WHEN lft > rightmost_spread
                      THEN lft + 2
                      ELSE lft END,
           rgt = CASE WHEN rgt >= rightmost_spread
                      THEN rgt + 2
                      ELSE rgt END
     WHERE rgt >= rightmost_spread;
     INSERT INTO Frammis (part, lft, rgt)
     VALUES ('G1', rightmost_spread, (rightmost_spread + 1));
     COMMIT WORK;
    END;
    The idea is to spread the (lft, rgt) numbers after the youngest child of the parent, G in this case, over by two to make room for the new addition, G1.  This procedure will add the new node to the rightmost child position, which helps to preserve the idea
    of an age order among the siblings.
    6. To convert a nested sets model into an adjacency list model:
    SELECT B.emp_name AS boss_emp_name, E.emp_name
      FROM OrgChart AS E
           LEFT OUTER JOIN
           OrgChart AS B
           ON B.lft
              = (SELECT MAX(lft)
                   FROM OrgChart AS S
                  WHERE E.lft > S.lft
                    AND E.lft < S.rgt);
    7. To find the immediate parent of a node: 
    SELECT MAX(P2.lft), MIN(P2.rgt)
      FROM Personnel AS P1, Personnel AS P2
     WHERE P1.lft BETWEEN P2.lft AND P2.rgt 
       AND P1.emp_name = @my_emp_name;
    I have a book on TREES & HIERARCHIES IN SQL which you can get at Amazon.com right now. It has a lot of other programming idioms for nested sets, like levels, structural comparisons, re-arrangement procedures, etc. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to differentiate parent and child node in af:treeTable ?

    Greetings,
    I have a requirement, I display master child view objects using <af:treeTable> component, When user expands a parent row, I have to make parent row is in read only and expanded(child) row in editable. To accomplish this I have to identify the 'node' whether it belongs to parent or child view object. In this example Tree table binds with EmpVO, There is a view link beteween EmpVO and DepartmentVO.
    <af:treeTable value="#{bindings.EmpVO.treeModel}"
    var="node"
    rowSelection="single" id="tEqSum"
    summary="Employee Summary"
    <af:column sortProperty="#{bindings.EmpVO.hints.LocCity.name}"
    filterable="true" sortable="true" width="90"
    headerText="#{bindings.EmpVO.hints.LocCity.label}"
    id="c3">
    <af:outputText value="#{node.LocCity}" id="ot21"/>
    expandAllEnabled="false">
    </af:treeTable>
    Thanks in Advance,

    Hi,
    You can find out the node depth by using
    #{bindings.<your_tree_binding>.treeModel.depth}Based on the depth, you can decide whether its a parent node or child node (for a 1 level tree- say dept and emp, the depth for parent would be 0 and for the child it would be 1).
    -Arun

  • Issue with child node edit on TreeTable

    Hello,
    I have a treeTable which is based on single VO. My problem is such that, when i select the child node and click on edit, i get values of it's parent :( ....
    but when i have once  edit on any node (either rollback/commit) and hit the browser refresh button now it works as expected and no more issue....
    what the heck is that. I have used backingBean scope and i have jdev 11.1.1.3.0
    Thanks
    Raj

    Hello Frank,
    Thank you so much for the help.. I have 2 iterator as explained in http://www.oracle.com/technetwork/developer-tools/adf/learnmore/sept2011-otn-harvest-508189.pdf .
    As my treeTable is based on single VO , whenever i select a child node and hit the toolbar edit and/or context menu edit, i get parent node info in the edit form. and this happens until i hitting browser refresh. after that it works as expected....
    when selection is made and edit button is clicked i call the managed bean method to call service operation as:
    public void onTreeTableEditClicked(ActionEvent actionEvent)
    Number id = getSelectedIdFromTree(); // my problem is here ... i am getting parent id until once edit is done(either rollback/commit) and browser refresh is hit. after that i am getting selected it.
    if (id!= null)
    OperationBinding opr =
    ADFBindingUtils.getDCBindingContainer().getOperationBinding("selectMyMethod");
    opr.getParamsMap().put("id", id);
    opr.execute();
    _showPopup(getEditPopup());*
    else
    // show warning.
    public Number getSelectedIdFromTree()
    RowKeySet rks2 = myTreeTable.getSelectedRowKeys();
    Iterator rksIterator = rks2.iterator();
    if (rksIterator.hasNext())
    List<Key> list = (List<Key>) rksIterator.next();
    return ((DBSequence) (list.get(list.size() -
    1).getKeyValues()[0])).getSequenceNumber();
    return null;
    // in the application Module
    public void selectMyMethod(Number id)
    MYVOImpl pvo = getEditMyVOImpl();
    MYVORowImpl row =
    (MYVORowImpl ) pvo.findByKey(new Key(new Object[]
    { new DBSequence(id) }), 1)[0];
    pvo.setCurrentRow(row);
    and the edit popup has value referenced by editIterator...
    Please let me know where i am wrong, or is there something i am missing.
    Thank you
    Edited by: MavenDev on Nov 8, 2011 8:34 AM

  • Refresh Child Nodes of an af:treeTable

    I have two VOs with a master/detail relationship defined with a View Link. The master VO has a bind variable to change which set of master rows to return.
    I have an af:panelStretchLayout. The top facet has a form created by dragging the ExecuteWithParms from the Data Control for the master VO as a parameter form, and the center facet has an af:treeTable derived from the master VO with child nodes derived from the detail VO.
    When you see this on first page load, it is right: bind variable was set from the default for the bind variable, tree table shows correct information.
    But when I choose a different value for the bind variable and click the button to re-execute the query, the parent nodes are refreshed, but any parent nodes that weren't in the initial query results have no children, even though there ARE child rows in the database. In short, it re-queries the master VO, refreshes the treeTable, but does NOT re-query the detail VO.
    Now, I know that this is expected behavior - for better performance, ADF caches results and since the initial query didn't include children for these parents, there is no data to show. So my first thought was to add CacheResults="false" to the iterator. Nope. Tried a few different settings for Refresh attribute - nope (since the parent nodes ARE refreshing, I figured this wouldn't help, but it was worth a try). I tried the following method in the backing bean based on a suggestion in a blog entry:
    * Executes the query with the new parameter, then requeries the codes for each category.
    * @param actionEvent
    public void requeryServices(ActionEvent actionEvent) {
        DCBindingContainer bindings = (DCBindingContainer)JSFUtils.resolveExpression("#{bindings}");
        // First execute the query for the Categories
        bindings.getOperationBinding("ExecuteWithParams").execute();
        // Get the iterator and its View Object
        DCIteratorBinding categoriesViewIterator = bindings.findIteratorBinding("ServiceCategoriesView1Iterator");
        ViewObject categoriesView = categoriesViewIterator.getViewObject();
        // From the VO, get all the category rows.
        Row[] categoryRows = categoriesView.getAllRowsInRange();
        // For each category, find the ViewLinkAccessor, and execute the query for the codes.
        for (Row thisCategory : categoryRows) {
            RowSet codes = (RowSet)thisCategory.getAttribute("ServiceCodesView");
            codes.executeQuery();
        // Refresh the treeTable
        AdfFacesContext.getCurrentInstance().addPartialTarget(getServicesSelectionTree());
    }This doesn't work either - same results - parent is re-queried, children are not.
    What should I try next to get the child nodes to refresh?

    Sure, I know that I can get the binding container the other way - the sample code I was copying just happened to use JSFUtils, and I just happened to have it.
    Using JDev 11.1.2.3.
    The code I showed was just one of the ways I tried to solve this. The problem is that when I do an ExecuteWithParams on the tree binding, the children of that tree don't get re-executed. Suppose I have a tree table that looks like this when the page first displays and the tree is expanded:
    Item One
    <ul>
    <li>Child OneDotOne</li>
    <li>Child OneDotTwo</li>
    <li>Child OneDotThree</li>
    </ul>
    Item Two
    <ul>
    <li>Child TwoDotOne</li>
    <li>Child TwoDotTwo</li>
    <li>Child TwoDotThree</li>
    </ul>
    Item Four
    <ul>
    <li>Child FourDotOne</li>
    <li>Child FourDotTwo</li>
    <li>Child FourDotThree</li>
    </ul>
    Now I re-execute the parent query (using ExecuteWithParams) and give it a parameter that should give me:
    Item Two
    <ul>
    <li>Child TwoDotOne</li>
    <li>Child TwoDotTwo</li>
    <li>Child TwoDotThree</li>
    </ul>
    Item Three
    <ul>
    <li>Child ThreeDotOne</li>
    <li>Child ThreeDotTwo</li>
    <li>Child ThreeDotThree</li>
    </ul>
    Item Four
    <ul>
    <li>Child FourDotOne</li>
    <li>Child FourDotTwo</li>
    <li>Child FourDotThree</li>
    </ul>
    But what I actually get is:
    Item Two
    <ul>
    <li>Child TwoDotOne</li>
    <li>Child TwoDotTwo</li>
    <li>Child TwoDotThree</li>
    </ul>
    Item Three
    Item Four
    <ul>
    <li>Child FourDotOne</li>
    <li>Child FourDotTwo</li>
    <li>Child FourDotThree</li>
    </ul>
    Notice that even though Item Three has children, they don't show. The difference is that Items Two and Four were in the original results, but Item Three wasn't. If I browse the VOs in the AM Tester, Item Three's children show when I execute the parent with different parameters.
    I suppose I could try to replicate this problem with the HR schema. I'll try it Monday.

  • Error adding new node to treetable automatically

    We implemented a page with a treetable. We don't use a ViewObject/Query to build the tree but a pojo method, because we have a complex data model to display on the tree (dynamic tree level, multiple object types on one tree level, etc.). So we created a pojo method to build the tree -> created a data control for this method/class and dragged the method onto the tree component.
    In a second step we impemented several buttons on the page to delete nodes, set values, change style, etc. which works fine.
    We got stuck extending the page for a function to add a new node. When the tree is displayed for the first time we can add new nodes on every existing node. Adding a node to a new node only works if we decollapse the new node first. We get an error if we create a new node A and then try to add another node on the new node A without decollapsing node A in advance.
    As follows the code and the error stack. Any ideas?
        public void btnAddNode(ActionEvent actionEvent) {
            RichTreeTable tree = (RichTreeTable) this.getTt1();
            RowIterator ri = this.getSelectedNodeRowIterator(tree);
            Key selectedNodeKey = this.getSelectedNodeRowKey(tree);
            if (ri != null && selectedNodeKey != null) {
               Row last = ri.last();
               Key lastRowKey = last.getKey();
               // if the select row is not the last row in the row iterator...
               Row[] found = ri.findByKey(selectedNodeKey, 1);
               if (found != null && found.length == 1) {
                 Row foundRow = found[0];
                 this.insertRow(foundRow, "Modified", "31.06.2013");
             AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
             adfFacesContext.addPartialTarget(tree);        
        private Row insertRow(Row targetRow, String label, String value) {
            RowSet children = (RowSet) targetRow.getAttribute("children");
            Row newRow = children.createRow();
            newRow.setAttribute("nodeLabel", label);
            newRow.setAttribute("nodeValue", value);
            children.insertRow(newRow);
            return newRow;
    <AdfcExceptionHandler> <handleException> ADFc: Bei der Verarbeitung einer Exception hat der Exception Handler der Anwendung eine neue Exception ausgelöst.
    javax.faces.el.EvaluationException: java.lang.NullPointerException
    at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:58)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1415)
    at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:957)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:427)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:207)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.NullPointerException
    at oracle.adf.model.bean.DCDataVO.initFKs(DCDataVO.java:625)
    at oracle.adf.model.bean.DCDataVO.createInstance(DCDataVO.java:596)
    at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:2058)
    at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2544)
    at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2589)
    at oracle.jbo.server.ViewRowSetImpl.createRow(ViewRowSetImpl.java:2566)
    at com.euroscript.tc.view.backing.TreeTable.insertRow(TreeTable.java:369)
    at com.euroscript.tc.view.backing.TreeTable.btnAddNode(TreeTable.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.el.parser.AstValue.invoke(Unknown Source)
    at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
    at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
    ... 44 more
    <AdfcExceptionHandler> <handleException> ADFc: Beim Versuch der Verarbeitung dieser Exception war der Exception Handler der Anwendung nicht erfolgreich.
    javax.faces.el.EvaluationException: java.lang.NullPointerException
    at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:58)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1415)
    at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:957)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:427)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:207)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.NullPointerException
    at oracle.adf.model.bean.DCDataVO.initFKs(DCDataVO.java:625)
    at oracle.adf.model.bean.DCDataVO.createInstance(DCDataVO.java:596)
    at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:2058)
    at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2544)
    at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2589)
    at oracle.jbo.server.ViewRowSetImpl.createRow(ViewRowSetImpl.java:2566)
    at com.euroscript.tc.view.backing.TreeTable.insertRow(TreeTable.java:369)
    at com.euroscript.tc.view.backing.TreeTable.btnAddNode(TreeTable.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.el.parser.AstValue.invoke(Unknown Source)
    at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
    at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
    ... 44 more
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces-Gültigkeitsdauer empfängt nicht behandelte Exceptions in Phase INVOKE_APPLICATION 5
    javax.faces.el.EvaluationException: java.lang.NullPointerException
    at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:58)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1415)
    at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:957)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:427)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:207)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.NullPointerException
    at oracle.adf.model.bean.DCDataVO.initFKs(DCDataVO.java:625)
    at oracle.adf.model.bean.DCDataVO.createInstance(DCDataVO.java:596)
    at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:2058)
    at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2544)
    at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2589)
    at oracle.jbo.server.ViewRowSetImpl.createRow(ViewRowSetImpl.java:2566)
    at com.euroscript.tc.view.backing.TreeTable.insertRow(TreeTable.java:369)
    at com.euroscript.tc.view.backing.TreeTable.btnAddNode(TreeTable.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.el.parser.AstValue.invoke(Unknown Source)
    at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
    at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
    ... 44 more
    <XmlErrorHandler> <handleError> ADF_FACES-60096:Server-Exception während PPR, #1
    javax.servlet.ServletException
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.NullPointerException
    at oracle.adf.model.bean.DCDataVO.initFKs(DCDataVO.java:625)
    at oracle.adf.model.bean.DCDataVO.createInstance(DCDataVO.java:596)
    at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:2058)
    at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2544)
    at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2589)
    at oracle.jbo.server.ViewRowSetImpl.createRow(ViewRowSetImpl.java:2566)
    at com.euroscript.tc.view.backing.TreeTable.insertRow(TreeTable.java:369)
    at com.euroscript.tc.view.backing.TreeTable.btnAddNode(TreeTable.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.el.parser.AstValue.invoke(Unknown Source)
    at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
    at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1415)
    at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:957)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:427)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:207)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    ... 36 more

    You can have machines different in hardware... but they have to use the same software.

  • Af:treeTable component: API to return list of expanded nodes?

    Hi,
    In my UI design, I am using a tree table (af:treeTable component). Does the framework support API to return (at any given time) a list of all expanded nodes?
    I realize that I can build logic to 1. return the currently selected node, then 2. query up all of the child nodes of this selected node. However, I'm wondering if, say at a particular instant, multiple nodes have been expanded, and I need a list of all of these nodes for every level in the tree table?
    Thanks in advance,
    Monica

    Hi John,
    I am using 11g. From the javadoc, I see that getDisclosedRowKeys() returns "set of disclosed rows for [tree-table] component" and "each entry in the set is a rowKey."
    What exactly is the definition of a "disclosed row"? I'm guessing this means any & all rows shown from UI, which would return all rows (including parent nodes of newly expanded nodes)?
    Is there a way to return all child nodes (newly displayed rows) of expanded nodes? To clarify, I'm trying to gather rows level by level. If a node has been expanded at level n, I would like to get a new list of nodes at level (n+1).
    Thanks,
    Monica

  • Selecting node in af:treeTable

    Hi! My task is to alter custom selection function on af:table and make it work for treeTable. Make current method I took from this tutorial http://www.oracle.com/technetwork/developer-tools/adf/learnmore/25-generic-tree-selection-listener-169164.pdf
    And here is a method that I have to change:
    public void TblStagesOnSelect(SelectionEvent selectionEvent) {
    GeneralFunction.makeCurrent(selectionEvent);
    if(treeTable.getRowAtRangeIndex(treeTable.getCurrentRowIndex()).getAttribute("IdParentStage") == null){
    parentUser.setAttributeValue(tf_idUserRespRequest.getValue());
    } else{
    for (int i=0;i<=treeTable.getEstimatedRowCount()-1;i++){
    if (treeTable.getRowAtRangeIndex(treeTable.getCurrentRowIndex()).getAttribute("IdParentStage").equals(treeTable.getRowAtRangeIndex(i).getAttribute("IdStage")))
    parentUser.setAttributeValue(treeTable.getRowAtRangeIndex(i).getAttribute("IdUserResp"));
    break;
    This method was written for table, but it doesn't work on treeTable. Can anyone help?

    did u check this
    Jdeveloper,Oracle ADF &amp;amp; Java: Tree Table Component in Oracle ADF(Hierarchical Representation)
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/26-get-selected-tree-node-data-169165.pdf

  • TreeTable determining parent node

    Is it possible to determine whether a TreeTable row is the parent or child in an EL expression?
    Thanks

    you can have an attribute(isParent) in your tree model that define that i.e. in master view it will teturn 'true' and in detail 'false'.
    then you can use it in el expression #{node.isParent}

  • How to make visible context menu for nodes of the given level of treeTable?

    Hello
    I'm using JDeveloper 11g 10.1.1.4
    I have a TreeTable component with 4 different levels (Contry-Branch-Town-Object).
    I need to show custom elements of the context menu (right click of the muse) only for rows with "Object".
    Now, I'm doing it with the aid of property "visible":
                <af:commandMenuItem text="Open" id="cmi1" immediate="true"
                                    visible="#{backingBeanScope.mbMObjectsRegistry.MObjectNode}"
                                    actionListener="#{backingBeanScope.mbMObjectsRegistry.btOpenMObject}"/>
        public boolean isMObjectNode() {
            Object oldRowKey = treeTableMObjectsRegistry.getRowKey();
            try {
                AppViewRowImpl row =
                    BindingUtils.getSelectedRowTreeTable(treeTableMObjectsRegistry);
                if (row == null || !isMOBjectRow(row)) {
                    return false;
                return isMOBjectRow(row);
            } finally {
                treeTableMObjectsRegistry.setRowKey(oldRowKey);
        private boolean isMOBjectRow(AppViewRowImpl row) {
            return (row != null) && (row instanceof MObjectsRegisterMORowImpl);
        }That works, but the problem is that it works a little bit slow, particulary if I have 5 or more menu items.
    Each menu item calls the metod isMObjectNode() 3 times per one opening of the menu.
    The question is: maybe, there is a method to calculate level of the selected node? Or, there is other variant?
    Anatolii

    You can use the following sample to develop your usecase.
    Here, we would show menu items only for the nodes at level 3.
    You can also download the entire sample based on POJO at
    http://adfsampleapplications.googlecode.com/svn/trunk/TreeSampleApplication.zip
    The code is self explanatory.
    Let know, if you have any specific questions.
    <af:form id="f1">
    <af:treeTable value="#{bindings.continents.treeModel}" var="node"
    selectionListener="#{bindings.continents.treeModel.makeCurrent}"
    rowSelection="single" id="tt1" columnStretching="last">
    <f:facet name="nodeStamp">
    <af:column id="c1">
    <af:outputText value="#{node}" id="ot2"/>
    </af:column>
    </f:facet>
    <f:facet name="pathStamp">
    <af:outputText value="#{node}" id="ot1"/>
    </f:facet>
    *<f:facet name="contextMenu">*
    *<af:popup id="p1" contentDelivery="lazyUncached">*
    *<af:setPropertyListener from="#{bindings.continents.treeModel.depth}"*
    *to="#{pageFlowScope.CurrentDepth}"*
    *type="popupFetch"/>*
    *<af:menu text="menu 1" id="m2">*
    *<af:commandMenuItem text="View Districts" id="cmi1"*
    *visible="#{pageFlowScope.CurrentDepth == 2 ? true : false}"/>*
    *<af:commandMenuItem text="View Attractions" id="cmi2"*
    *visible="#{pageFlowScope.CurrentDepth == 2 ? true : false}"/>*
    *</af:menu>*
    *</af:popup>*
    *</f:facet>*
    </af:treeTable>
    </af:form>
    Thanks,
    Navaneeth

  • Root Handles (icons next to the node) not visible in TreeTable

    Hi i am using the example provided at www.java.sun.com for TreeTable. I have a tree table and when i add new nodes the data is visible in the table but the handles are not visible. I don't know how to resolve this problem. Below is my code where i'm adding new data.
    private void addNewNode(MyNode _root) {
    NodeInfo info = new NodeInfo();
    info.order= "Pending";
    info.qty = "200";
    info.price = "20,000";
    MyNode node = new MyNode(info);
    _root.add(node);
    tree.expandPath(new TreePath(_root.getPath()));

    Sorry my mistake...i was not returning TreeTableModel.class in getColumnClass() of my custom treetable model class.

Maybe you are looking for