Originally posted by Isomorphic
View Post
While you may have other suggests, here is how the client code works. When it starts, it sends a query looking for a node named Global in the tree. If the results is empty, it will then use addData to create a rootNode with the name "Global". It does this only after the results of the initial query is returned.
I suspect that there is an implicit fetch issued by the treeGrid to get the contents of the tree (which on the initial run of the app, should be empty). Perhaps to make things cleaner, I should spawn the initial query/addData for the Global node after the treeGrid renders and has loaded its empty tree from the server.
After the global node was created and shows up in the tree, there is a contextMenu added to the nodes that lets me (a) create a subdomain/node under the selected domain/node (b) remove the selected node, (c) create another root domain/node. It is when I select "add subdomain" from the global node that I see the numberformatexception. When the add subdomain menu is selected, I grab the Id of the selected node, add that to the record with a name of "parentDomainId" along with a default name "new-domain" and send that to the server using addData.
In both cases (adding root node or a sub node), I get a NPE when the server attempts to create the results to send back to the client.
I never, ever specify an id for the record (only the parentId). That is assigned by JPA/Hibernate and is returned in the results via your RPC mechanism.
If you have a different/better way of adding a node to the tree other than addData() with a record holding the name and parentId property I'm all ears.
As to adding new Root domain nodes, I use the same strategy but I set the parentDomainId property in the record to "null" since that is the "treerootvalue".
As to the server logs, I'm guilty. Rather than crank up log4j, I just used System.out.println(). You lose the timestamp, but the order in the log file is likely correct since log4j uses the System printer to write to the same log file.
And I can assure you, I don't get any NPE in my getters/setters. The first and the last thing they do before returning is to write their values to System.out - those output lines are always there.
I've included the source files to this message.
Comment