You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by sriraj paul <sr...@yahoo.co.uk> on 2010/09/01 11:39:00 UTC
Adding new properties to a node
Hi,
I want to add new properties to nodes.
For example : "nt:folder" type had properties like "jcr:created",
"jcr:createdby" etc. I want to add some additional new properties to nt:folder.
for example: Node n = session.getRootNode().addNode("test","nt:folder");
n.setProperty("Atitle", "Chasing Jackrabbit article");
This is giving exception : no matching property definition found for {}Atitle
javax.jcr.nodetype.ConstraintViolationException
It is allowing to add any property to "nt:unstructured" nodes
For example:
Node n = session.getRootNode().addNode("test");
n.setProperty("title", "Chasing Jackrabbit article");
will work fine.
How to add new properties to "nt:folder" nodetype.
Thank you
sriraj
Re: Adding new properties to a node
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
On Wed, Sep 1, 2010 at 11:39 AM, sriraj paul <sr...@yahoo.co.uk> wrote:
> ...For example : "nt:folder" type had properties like "jcr:created",
> "jcr:createdby" etc. I want to add some additional new properties to
> nt:folder...
The nt:folder node type does not allow for arbitrary properties.
You can either use nt:unstructured instead, or derive your own node
type from nt:folder, as done in [1]
(and that would be a question for users@, not dev@)
-Bertrand
[1] http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/resource/src/main/resources/SLING-INF/nodetypes/folder.cnd