Hi Paul, every node, which is referenceable has a UUID. This ID is used for references. The created value (by the ValueFactory) should be a String. This String contains the UUID.
In my example the record node has a property "forge:reference". There you can place the references. <propertyDefinition name="forge:Reference" requiredType="Reference" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/> My document node is referenceable. So it has an unique ID. <supertype>mix:referenceable</supertype> So take the node which should hold the refernce (in my example the record) and take the node which you want to reference to and create a Reference Value with the help of the ValueFactory. This value has to be set for the "forge:Reference" property. Enough?! :) Daniel 2009/7/1 BOWLER Paul <[email protected]> > Daniel, > > Thanks for the reply, but I don't see how this uses the REFERENCE property > to point to another node? > > Can anyone else enlighten me? > > Thanks, > > Paul. > > -----Original Message----- > From: Daniel Manzke [mailto:[email protected]] > Sent: 01 July 2009 16:57 > To: [email protected] > Subject: Re: Newbie: PropertyType.REFERENCE > > Hi Paul, > here is a snippet. > > Node rootNode = session.getRootNode(); > Node record = rootNode.getNode(recordPath); //retrieves a node for an > electronical record > Node document = rootNode.getNode(documentPath); //retrieves a node for an > document in another record > *Value value = session.getValueFactory().createValue(document); //creates > the reference value* > *record.setProperty("forge:Referenzen", new Value[]{value}); //setting the > reference property* > session.save(); > > > I don't know if this is the best way. If I remember right, I took the way > out of the TCK-Tests. ;) > > > Greets, > Daniel > > 2009/7/1 BOWLER Paul <[email protected]> > > > Can anyone demonstrate (in code) how to set one Node to point to another > > Node using node.setProperty(xxx, xxx, PropertyType.REFERENCE). > > > > I can't find any examples anywhere on how to do this! > > > > Thanks, > > > > Paul. > > > > P.S. Is there a good JCR book available that I can read? > > > > > > -- > Mit freundlichen Grüßen > > Daniel Manzke > -- Mit freundlichen Grüßen Daniel Manzke
