jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kamil Nezval" <kamil.nez...@xitee.com>
Subject Create readonly property
Date Fri, 15 Apr 2011 11:29:15 GMT

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");

I get an error "javax.servlet.ServletException:
javax.jcr.nodetype.ConstraintViolationException: Unable to perform
operation. Node is protected."

So is there a way how to create a node, set its properties and then insert
it into a repository? Or how should I reach my goal?

Thanks a lot for any help.



View raw message