[xwiki-devs] Link between 2 XWiki objects using BaseObject ID
Hello, I want to do the following: I create a class with one LongProperty field containing a long ID of another BaseObject. The idea is to link an object to another object by simply using its hashcode ID and not the whole docname+classname+nb string. A one-to-one association if you prefer. $xwiki.search("from BaseObject as obj...") will return a BaseObject so I can get the ID here. But in velocity, I access objects using $doc.getObject() which returns a Object API. I can't find any simple way to retrieve the ID of the nested BaseObject from Object API because getBaseObject requires programming rights. Do you have an idea for me? Is it mandatory to use the docname+classname+nb string to identify an object from velocity? regards Pascal
Pascal Voitot wrote:
Hello, I want to do the following: I create a class with one LongProperty field containing a long ID of another BaseObject. The idea is to link an object to another object by simply using its hashcode ID and not the whole docname+classname+nb string. A one-to-one association if you prefer.
$xwiki.search("from BaseObject as obj...") will return a BaseObject so I can get the ID here. But in velocity, I access objects using $doc.getObject() which returns a Object API.
I can't find any simple way to retrieve the ID of the nested BaseObject from Object API because getBaseObject requires programming rights.
Do you have an idea for me? Is it mandatory to use the docname+classname+nb string to identify an object from velocity?
If you don't want to use programming rights, then yes. The object ID is internal, and should not be used directly. -- Sergiu Dumitriu http://purl.org/net/sergiu/
On Wed, Sep 24, 2008 at 10:36 AM, Sergiu Dumitriu <[email protected]> wrote:
Pascal Voitot wrote:
Hello, I want to do the following: I create a class with one LongProperty field containing a long ID of another BaseObject. The idea is to link an object to another object by simply using its hashcode ID and not the whole docname+classname+nb string. A one-to-one association if you prefer.
$xwiki.search("from BaseObject as obj...") will return a BaseObject so I can get the ID here. But in velocity, I access objects using $doc.getObject() which returns a Object API.
I can't find any simple way to retrieve the ID of the nested BaseObject from Object API because getBaseObject requires programming rights.
Do you have an idea for me? Is it mandatory to use the docname+classname+nb string to identify an object from velocity?
If you don't want to use programming rights, then yes. The object ID is internal, and should not be used directly.
One thing I don't understand well: you retrieve the first object and then the property containing the ID of the second object. why are programming rights required just to find and view the second object and the link between these 2 objects? In fact, my question is : how to simply design a link between 2 objects in XWiki outside custom mapping?
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Pascal Voitot -
Sergiu Dumitriu