You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Blanco Emanuele <e....@reply.it> on 2008/10/28 16:21:31 UTC

properties declaration in CND

Hi there,

I need two properties for a CND: one that is a single valued reference, and one that is a multi valued reference.

I tried something like this:

- ns:prop1 (reference) multiple
- ns:prop2 (reference)

But it doesn't work when I try to set the ns:property1 via the APIs (got a property doesn't exist exception or something similar).

Am I missing something in the CND or there's something wrong with my code?

Thank you.

--
Emanuele Blanco

________________________________
--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

Re: properties declaration in CND

Posted by Julian Reschke <ju...@gmx.de>.
Blanco Emanuele wrote:
> ...
> <ns='http://www.mynamespace.org/1.0'>
> ...

Unrelated to your problem, but still important: this is not a good 
namespace name (unless you own the domain "mynamespace.org").

BR, Julian

Re: properties declaration in CND

Posted by Julian Reschke <ju...@gmx.de>.
Blanco Emanuele wrote:
> It worked. Thanks a lot.
> 
> And my namespace is something I really own, but I just changed it for posting here :)
> ...

OK, so apologies for the false alarm.

Recommendation: in example namespace names use domain names which are 
reserved for the purpose of examples, such as example.org (see 
<http://tools.ietf.org/html/rfc2606>).

BR, Julian

RE: properties declaration in CND

Posted by Blanco Emanuele <e....@reply.it>.
It worked. Thanks a lot.

And my namespace is something I really own, but I just changed it for posting here :)

Thank you.

--
Emanuele Blanco


-----Original Message-----
From: stefan.guggisberg@gmail.com [mailto:stefan.guggisberg@gmail.com] On Behalf Of Stefan Guggisberg
Sent: mercoledì 29 ottobre 2008 9.41
To: users@jackrabbit.apache.org
Subject: Re: properties declaration in CND

On Wed, Oct 29, 2008 at 9:05 AM, Blanco Emanuele <e....@reply.it> wrote:
> I'm customizing an application.
>
> My CND is:
>
> <drools = 'http://www.jboss.org/drools-repository/1.0'>
> <nt='http://www.jcp.org/jcr/nt/1.0'>
> <mix='http://www.jcp.org/jcr/mix/1.0'>
> <ns='http://www.mynamespace.org/1.0'>
>
> [ns:tipologia]
>
>> 'nt:hierarchyNode','mix:referenceable'
>
> - ns:figli (reference) multiple
> - ns:padre (reference)
>
>
> And the code I'm using is:
>
>        Node padreNode = RulesRepository.addNodeIfNew(tipologieRootNode, "padre", "ns:tipologia");
>        Node figlioNode = RulesRepository.addNodeIfNew(tipologieRootNode, "figlio", "ns:tipologia");
>        padreNode.setProperty("ns:figli", figlioNode); <---- got exception here

multi-value properties are always set using arrays of values. however,
since there's no
javax.jcr .Node#setProperty(String, javax.jcr.Node[]) signature you'll
have to pass an
array of uuid's instead. [1] provides an example.

cheers
stefan

[1] http://markmail.org/message/pkepzffwxpbxvdma

>
> The exception is:
>
> javax.jcr.nodetype.ConstraintViolationException: no matching property definition
>  found for {http://www.mynamespace.org/1.0}figli
>
> RulesRepository.addNodeIfNew() is an utility method from the JBoss Drools BRMS (which I'm going to customize), and it simply creates a Node.
>
> Thank you.
>
> --
> Emanuele Blanco
>
> Open Reply s.r.l.
> C.so Francia 110, Torino
> C e-mail: e.blanco@reply.it
>
> -----Original Message-----
> From: Alexander Klimetschek [mailto:aklimets@day.com]
> Sent: martedì 28 ottobre 2008 18.53
> To: users@jackrabbit.apache.org
> Subject: Re: properties declaration in CND
>
> On Tue, Oct 28, 2008 at 4:21 PM, Blanco Emanuele <e....@reply.it> wrote:
>> But it doesn't work when I try to set the ns:property1 via the APIs (got a property doesn't exist exception or something similar).
>>
>> Am I missing something in the CND or there's something wrong with my code?
>
> I think it would be helpful if you could post your CND, the code and
> the actual exception you get.
>
> Since you use reference properties, did you set a target node with
> node.setProperty(String, Node)?
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>
> --
> The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
>

--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

Re: properties declaration in CND

Posted by Stefan Guggisberg <st...@day.com>.
On Wed, Oct 29, 2008 at 9:05 AM, Blanco Emanuele <e....@reply.it> wrote:
> I'm customizing an application.
>
> My CND is:
>
> <drools = 'http://www.jboss.org/drools-repository/1.0'>
> <nt='http://www.jcp.org/jcr/nt/1.0'>
> <mix='http://www.jcp.org/jcr/mix/1.0'>
> <ns='http://www.mynamespace.org/1.0'>
>
> [ns:tipologia]
>
>> 'nt:hierarchyNode','mix:referenceable'
>
> - ns:figli (reference) multiple
> - ns:padre (reference)
>
>
> And the code I'm using is:
>
>        Node padreNode = RulesRepository.addNodeIfNew(tipologieRootNode, "padre", "ns:tipologia");
>        Node figlioNode = RulesRepository.addNodeIfNew(tipologieRootNode, "figlio", "ns:tipologia");
>        padreNode.setProperty("ns:figli", figlioNode); <---- got exception here

multi-value properties are always set using arrays of values. however,
since there's no
javax.jcr .Node#setProperty(String, javax.jcr.Node[]) signature you'll
have to pass an
array of uuid's instead. [1] provides an example.

cheers
stefan

[1] http://markmail.org/message/pkepzffwxpbxvdma

>
> The exception is:
>
> javax.jcr.nodetype.ConstraintViolationException: no matching property definition
>  found for {http://www.mynamespace.org/1.0}figli
>
> RulesRepository.addNodeIfNew() is an utility method from the JBoss Drools BRMS (which I'm going to customize), and it simply creates a Node.
>
> Thank you.
>
> --
> Emanuele Blanco
>
> Open Reply s.r.l.
> C.so Francia 110, Torino
> C e-mail: e.blanco@reply.it
>
> -----Original Message-----
> From: Alexander Klimetschek [mailto:aklimets@day.com]
> Sent: martedì 28 ottobre 2008 18.53
> To: users@jackrabbit.apache.org
> Subject: Re: properties declaration in CND
>
> On Tue, Oct 28, 2008 at 4:21 PM, Blanco Emanuele <e....@reply.it> wrote:
>> But it doesn't work when I try to set the ns:property1 via the APIs (got a property doesn't exist exception or something similar).
>>
>> Am I missing something in the CND or there's something wrong with my code?
>
> I think it would be helpful if you could post your CND, the code and
> the actual exception you get.
>
> Since you use reference properties, did you set a target node with
> node.setProperty(String, Node)?
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>
> --
> The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
>

RE: properties declaration in CND

Posted by Blanco Emanuele <e....@reply.it>.
I'm customizing an application.

My CND is:

<drools = 'http://www.jboss.org/drools-repository/1.0'>
<nt='http://www.jcp.org/jcr/nt/1.0'>
<mix='http://www.jcp.org/jcr/mix/1.0'>
<ns='http://www.mynamespace.org/1.0'>

[ns:tipologia]

> 'nt:hierarchyNode','mix:referenceable'

- ns:figli (reference) multiple
- ns:padre (reference)


And the code I'm using is:

        Node padreNode = RulesRepository.addNodeIfNew(tipologieRootNode, "padre", "ns:tipologia");
        Node figlioNode = RulesRepository.addNodeIfNew(tipologieRootNode, "figlio", "ns:tipologia");
        padreNode.setProperty("ns:figli", figlioNode); <---- got exception here

The exception is:

javax.jcr.nodetype.ConstraintViolationException: no matching property definition
 found for {http://www.mynamespace.org/1.0}figli

RulesRepository.addNodeIfNew() is an utility method from the JBoss Drools BRMS (which I'm going to customize), and it simply creates a Node.

Thank you.

--
Emanuele Blanco

Open Reply s.r.l.
C.so Francia 110, Torino
C e-mail: e.blanco@reply.it

-----Original Message-----
From: Alexander Klimetschek [mailto:aklimets@day.com]
Sent: martedì 28 ottobre 2008 18.53
To: users@jackrabbit.apache.org
Subject: Re: properties declaration in CND

On Tue, Oct 28, 2008 at 4:21 PM, Blanco Emanuele <e....@reply.it> wrote:
> But it doesn't work when I try to set the ns:property1 via the APIs (got a property doesn't exist exception or something similar).
>
> Am I missing something in the CND or there's something wrong with my code?

I think it would be helpful if you could post your CND, the code and
the actual exception you get.

Since you use reference properties, did you set a target node with
node.setProperty(String, Node)?

Regards,
Alex

--
Alexander Klimetschek
alexander.klimetschek@day.com

--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

Re: properties declaration in CND

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Oct 28, 2008 at 4:21 PM, Blanco Emanuele <e....@reply.it> wrote:
> But it doesn't work when I try to set the ns:property1 via the APIs (got a property doesn't exist exception or something similar).
>
> Am I missing something in the CND or there's something wrong with my code?

I think it would be helpful if you could post your CND, the code and
the actual exception you get.

Since you use reference properties, did you set a target node with
node.setProperty(String, Node)?

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com