Thanks Alex,

I got the issue resolved.

Actually, the problem is I am not at all passing the node type in my invokation.
All I have done is I invoked the verifyAndAddnode () like this
  Node account = 
verifyAndAddNode(session,candidatedocs,path,"lc:account","lc:account");
Since the last parameter will be treated as the node type and only then it will 
try to search through the node definitions
in the .cnd file.  Then it could learn that the node is of type lockable and I 
got true for
account.isNodeType("mix:lockable");

By the way thanks for your replies to my post.

Regards,
Sunil
________________________________________
From: Alexander Klimetschek [[email protected]]
Sent: Monday, November 23, 2009 11:29 PM
To: [email protected]
Subject: Re: Unable to lock Exception.

On Mon, Nov 23, 2009 at 10:06, Sunil Dhage <[email protected]> wrote:
>  public Node verifyAndAddNode(Session session,Node parent,String... 
> parameters) throws RepositoryException
>    {   Node node2Add = null;
>        //code review comment - to ensure parameters size is either 2 or 3.
>        if(parameters.length < 2 || parameters.length > 3)
>        {   throw new IllegalArgumentException("Number of parameters to 
> verify/add node invalid ");
>        }
>        NodeIterator iterator = queryForPath(session,parameters[0]);
>        if(iterator.hasNext())
>        {   log.info("Node exists in this path...");
>            node2Add = iterator.nextNode();
>        }else
>        {   if(parameters.length == 2)
>                node2Add = parent.addNode(parameters[1]);
>            else
>               node2Add = parent.addNode(parameters[1],parameters[2]);
>        }
>        return node2Add;
>    }

The "parameters" handling seems broken. You call the above method with

>           Node account = 
> verifyAndAddNode(session,candidatedocs,path,"lc:account");

in which case parameters.length = 2 and the addNode() call will be
done without the node type. Also, the indexes look wrong to me:
parameters[1], which is used as the node name in the addNode() call,
will be "lc:account" in your case - the nodetype.

Regards,
Alex

--
Alexander Klimetschek
[email protected]

Reply via email to