jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Kiessler <oliver.kiess...@gmail.com>
Subject Re: Referenceable nodes
Date Fri, 17 Dec 2004 13:08:53 GMT
On Fri, 17 Dec 2004 11:39:43 +0100, Peeter Piegaze
<peeter.piegaze@gmail.com> wrote:
> Yes, referenceable nodes are available. You create one by adding a
> mixin node type to an existing node
> 
> someNode.addMixin("mix:referenceable")
> 
> What you are referring to is an old method no longer available that
> supported "hardlinks" which allowed a node to have more than one
> parent.
> 
> Being referencable was a precondition of being hardlinked, but
> hardlinks have been removed from the spec.
> 
> But referenceable-ness is still significant because it allows a node
> to pointed to by a property of type REFERENCE elsewhere in WS.
> 
> Once you have your node with mixin mix:referenceable you can create a
> REFERENCE property that points to it like this
> 
> someOtherNode.addProperty("myRefProp", someNode)
> 
> Then you can traverse that link like this
> 
> Property myRefProp = someOtherNode.getProperty("myRefProp")
> Node myNode = myRefProp.getNode();
> 
> At this point myNode and someNode are distinct objects that represent
> the same actual node in the repository.
> 
> Hope this helps
> 
> Cheers,
> Peeter

thanks, peeter!
It works fine, this is what the nodes look like:

/global/users
 ->/global/users/jcr:primaryType=nt:unstructured
 ->/global/users/jcr:mixinTypes=mix:referenceable
 ->/global/users/jcr:mixinTypes=mix:versionable
 ->/global/users/jcr:uuid=3f78f1e6-7bd5-41dc-8f49-4c1478cf1e96
 ->/global/users/description=Global users node.
 ->/global/users/jcr:versionHistory=c1f19b79-8347-4273-be21-5aca8879085e
 ->/global/users/jcr:baseVersion=2d1a5200-9d81-4faf-8135-b6bb6be6321a
 ->/global/users/jcr:isCheckedOut=true
 ->/global/users/jcr:predecessors=2d1a5200-9d81-4faf-8135-b6bb6be6321a

/global/users/oliver
 ->/global/users/oliver/jcr:primaryType=nt:unstructured
 ->/global/users/oliver/jcr:mixinTypes=mix:referenceable
 ->/global/users/oliver/jcr:uuid=221257ce-22ff-4037-bf9e-1a7b99af1c71
 ->/global/users/oliver/password=test

/domains/default/users/oliver
 ->/domains/default/users/oliver/jcr:primaryType=nt:unstructured
->/domains/default/users/oliver/globalUserReference=221257ce-22ff-4037-bf9e-1a7b99af1c71

cheers,
oliver

Mime
View raw message