jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@adobe.com>
Subject Re: Create readonly property
Date Wed, 27 Apr 2011 13:50:36 GMT
On 15.04.11 04:29, "Kamil Nezval" <kamil.nezval@xitee.com> wrote:
>I'm trying to register my own node that contains a read-only property (set
>only when the node is created). So my CND definition looks like this:
>
>[test:nodeDef] > mix:versionable
>- test:protectedproperty (STRING) protected mandatory
>
>But then I do not know how to create the node and insert it into my
>repository. Because when I try this:
>
>Node rootnode = session.getRootNode();
>Node testNode = rootnode.addNode("testNode", "test:nodeDef");
>testnode.setProperty("test:protectedproperty", "my text");
>session.save();
>
>I get an error "javax.servlet.ServletException:
>javax.jcr.nodetype.ConstraintViolationException: Unable to perform
>operation. Node is protected."

Protected properties/nodes are only available to the implementation, you
can't define custom ones (as protected means that you can't change them
through the JCR API).

This was asked multiple times already:
http://markmail.org/message/x6meweddg4bys6tr

Regards,
Alex

-- 
Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel





Mime
View raw message