Question How do I retrieve properties from a class?
Answer It is a powerful XWiki feature to create new classes, thus new documents holding the properties of this new class. For instance you can create a class Contacts.ContactClass with three string properties "firstname", "surname" and "phone" and use it to create new documents. Each of them will hold all of some of these three piece of information. To have a better idea about how to do that, you might be want to follow the FAQs tutorial

It is frequent that once you have a number of this newly created documents, you want to retrieve a list/table with the available information filtered or not. XWiki has at least two methods that allow you to do that:

  • $xwiki.searchDocument, the first part of the HQL sentence comes given by the method itself.
  • $xwiki.search, it will accept any HQL or XPath sentences as parameter.
You will find this clearly documented in the API documentation. Here a link to 1.3.2 API

Be aware that the API changes. The update documentation is generated every. Check this out if you are having some problem/doubt when working with these methods.

This article also contents a tutorial where you will find samples of code you can adapt to your environment.

Tags:
Created by Ricardo Rodríguez on 2008/04/16
   

Get Connected