So you're saying that getXObject returns null even if there is a
matching object? Can you try it outside the context of your current
code?
Thanks,
Marius
On Tue, Jun 10, 2014 at 10:06 PM, Daniel Ebanja
<danielebanja(a)googlemail.com> wrote:
  Hi,
 i am adding Users to a group as shown below d want to prevent that a user
 be added to a group twice. It is not working this way.
 if( null == groupDoc.getXObject(groupDocumentReference, "member",
 xwikiname)){
                 // Add a member object to document
                 BaseObject memberObj = groupDoc.newXObject(
                         groupClass.getDocumentReference(), context);
                 memberObj.setStringValue("member", xwikiname);
                 context.getWiki().saveDocument(groupDoc, context);
                 }else
                     log.error("the user already existed in the requested
 group...");
 I will appreciate any help.
 Thanks
 _______________________________________________
 users mailing list
 users(a)xwiki.org
 
http://lists.xwiki.org/mailman/listinfo/users