Hi Xwiki Team,
I'm building an application on XE 7.1.2 and it uses classes with 1:N relations between
them through Database List and (potentially) Database Tree property. The relation using
Database Tree is not working. For illustration of my use case, I have the following
classes:
Space.Info0Class with properties:
"info0ID" type String
"info0Name" type String
Space.Info1Class with properties:
"info1ID" type String
"info1Name" type String
"relatedInfo0" type Database List -> with Xwiki Class Name=Space.Info0Class,
Id Field Name=info0ID and Value Field Name=info0Name
Space.Info2Class with properties:
"info2ID" type String
"info2Name" type String
"relatedInfo1" type Database Tree List -> with Xwiki Class
Name=Space.Info1Class, Id Field Name=info1ID, Value Field Name=info1Name and Parent Field
Name=relatedInfo0
The relation I want to build is, then: 1 Instance of Info0Class can be related to (0...N)
Info1Class, which then can be related to (0...N) Info2Class.
When creating a new instance of Info2Class, I would like to show the information on
relatedInfo1's select box in a tree view manner, where the "relatedInfo0"
instance name is the aggregator and all the related Info1Class instances are the leafs.
Thus, the user can get a much better idea of which Info1Class she/he can select for
relatedInfo1 field.
I've used, since then, only the default pages and codes generated by class editor
(default sheet to display class properties and default template). I got the relation
working like a charm between Info1Class and Info0Class, but things are not working with
Info2Class and Info1Class. Creating a new instance of Info2Class triggers a
"org.apache.velocity.exception.MethodInvocationException: Invocation of method
'display' in class com.xpn.xwiki.api.Document threw exception
java.lang.StackOverflowError" and infinite
"com.xpn.xwiki.objects.classes.DBTreeListClass.addToSelect(DBTreeListClass.java:319)"
calls. In this way, I could not even check if this use case is valid for the Database Tree
List.
I've searched deeply and really could not find any further documentation about
Database Tree Usage, neither examples, nor detailed information on how to get this
working. The only reference is a brief description on the XWiki Data Model Page mentioning
the Yahoo Javascript Tree Library.
So, the questions for the team are:
1) Where can I find more information (a good tutorial/documentation/usage example)
about Database Tree List?
2) Is it suitable for this use case? Am I doing it right?
3) What do I need to get a Database Tree property/relation to work?
Thanks in advance for your help.
Best Regards,
Ramon Brandão