Hi,
I'd like to do a kind of SQL request with XWiki in order to get a data store
in an Object.
Here's my problem :
1 I've created a Class in XWiki in order to create a form for users. In this
class I've named one of a property ID that should allow me to distinct
objects.
2. I've created a template associated to this class that contain a single
Object of this class.
3. I've created a Form to allow users to fill the data. The problem I have is
that I have to give a unique name for the document created. Thus I thought to
use to ID property that I've created. So I wanted to do a SQL Query to get
the maximum id and by this way my new document name would be Data.Doc"ID+1".
The problem is that I don't know how to access the desired property with
XWiki. I've read the documentation about the data model :
http://www.xwiki.org/xwiki/bin/view/DevGuide/Database+Schema but I didn't
find the solution to my problem.
If I execute the following Query (my class is XWiki.CFPClass):
#set ($sql = "select distinct obj from XWikiDocument as doc, BaseObject as obj
where obj.name=doc.fullName and obj.className='XWiki.CFPClass' and
doc.name!='CFPClassTemplate'")
with this code :
#foreach ($item in $xwiki.search($sql))
$item <br />
#end
I get fine my objects :
CFP.Test 0 XWiki.CFPClass
CFP.Test1 0 XWiki.CFPClass
But I don't know how can I reach the property ? The property class seems to be
'BaseProperty' but I don't know how can I add it with the query.
if I test a query like this :
select distinct prop.name from XWikiDocument as doc, BaseObject as obj,
BaseProperty as prop where obj.name=doc.fullName and
obj.className='XWiki.CFPClass' and doc.name!='CFPClassTemplate'
I get all the existing properties even the ones which aren't in the class
XWiki.CFPClass.
Any Idea ?
--
Xavier MOGHRABI - Consortium ObjectWeb
Email: xavier.moghrabi at
objectweb.org
Phone: +33 4 76 61 52 35 - Skype ID: xavier.moghrabi.bureau