[xwiki-dev] XWiki classes question
Sergiu Dumitriu
sergiu.dumitriu at gmail.com
Sat Apr 28 23:16:35 CEST 2007
Hi,
The property type you are looking for is Database List Class. It allows you
to create a list containing items of your choice.
So, what you need to do, is:
- Make a class called MediaHasActor, with two DBList properties, one called
Media, one called Person.
- The field called "Hibernate Query" should contain something like:
select
prop.value
from
BaseObject as obj,
StringProperty as prop
where
obj.className='XWiki.MediaClass' and (replace with '
XWiki.PersonClass' for the Person field
prop.id.id = obj.id and
prop.id.name='name' and
obj.name <> 'XWiki.MovieTemplate' (replace with '
XWiki.PersonTemplate' for the Person field
Now the relating object will display two list boxes, one with movies and the
other with actors. Of course, when you'll have thousands of movies and
actors, a select won't be the best option, so you will need to use an
AJAX-powered Suggest input.
On 4/28/07, evelyne24 at gmail.com <evelyne24 at gmail.com> wrote:
>
> Hello,
>
> I have the following question regarding relationing 2 classes in xwiki. I
> made a class Person with 2 properties (firstName, lastName) and a class
> Media with a prop. (title) and then I made an object "Richard Gere" of class
> person and 2 objects "Pretty Woman" and "Autumn at New York" of class Media.
> Now I would like to link somehow the 3 objects, i.e to say that Richard
> Gere played in "Pretty Woman" and also in the other movie (media). How can I
> do that? I don't seem to understand how to link the already created objects
> one with another. For instance, I cannot create another class with 2
> properties, one of type Media and one of type Person, because these types
> don't appear under "Type" on "Add Property" panel.
> Please help me understand how can I do that in xwiki.
>
> Ps. I heard something about attachments but I don't really understand
> how...
> Thank you.
>
> Evelina Slatineanu
>
>
Sergiu
--
http://purl.org/net/sergiu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xwiki.org/pipermail/devs/attachments/20070429/122d5397/attachment.htm
More information about the devs
mailing list