Re: [xwiki-devs] Hashmap vs. Objects (Miscellaneous Questions)
On the same note, I also have the following questions: The answers will help implement whichever option we choose: 1) Is there a limit on the number of members that can belong to a group? 2) How can I create a "global" hashmap (xwiki.getHashMap()) that can be referenced anywhere (any page/space) to retrieve values based on keys? 3) Can I use the $context to add some more values(needed for our project) to the hashtable? 4) I came across the following code snippet int he Wiki editor of the PanelWizard: #set($categoryMap = $xwiki.getHashMap()) #foreach($category in $categoryList) $!categoryMap.put($category, $xwiki.getArrayList()) #end I do not understand the use of "!" in the put() method. what do we achieve with this! Thanks for all help! On 5/5/08, Kamna Jain <[email protected]> wrote:
Hi All,
This question "might" be related to the thread that has been active in the past couple of days about the data model. We have a similar situation with the only difference being that we want to create lists or collections (like Groups) of certain pre- created Objects. The Object as a whole may/will belong to more than one such collection - which means that if we were to use a Document to link a Collection and its contents, then every document will have a COPY of the same object and this is definitely not desirable for good performance - Right?
So, in that case, we have 2 alternatives: 1) Use the techiniques used in XWiki to create Groups: each group has objects of class XWikiGroup with just one field that refers to the Member name. OR 2) Use XWiki.getHashmap() and add the Collection and its members to the hashmap (as the Key and Value resp.)
The XWiki API indicates that the option #2 must be used in xwiki when Objects can not be created. My Question is: -> Even though I could use option #1 and create objects and add them to the document that would represent the Collection, can I still use option #2 because I think that it will provide better performance. Am I right in my assumption? What should I do?
Thanks a lot for all help!
participants (1)
-
Kamna Jain