Hi,

On Wed, May 21, 2008 at 11:55 AM, saurav gangulyy
<[EMAIL PROTECTED]> wrote:
> Can u plz illustrate this with example code?
> Node nod = root.addNode("par7");
> Node chld = nod.addNode("chld1");
>
> wht do I need to do in order to ensure 'chld1' can't be added again?

You can define a custom node type for the "par7" node or use a
standard one like nt:folder that doesn't allow same name siblings.

For example:

    Node node = root.addNode("par7", "nt:folder");
    Node child = node.addNode("child1", "nt:file");

Note that nt:folder only allows nt:hierarchyNode children, so you need to:

a) make your content fit the nt:folder/nt:file structure (not that
nt:file allows an unstructured jcr:content child node),
b) add custom node types that extend nt:hierarchyNode, or
c) use a custom node type instead of nt:folder.

BR,

Jukka Zitting

Reply via email to