Hello,
i programmed a class /Node/ which is here used as /n/ and a class /NodeType/
which is reference by Node. In the ClassBuilder from Node i use this method
to get the NodeType
try {
   List<XWikiDocument> docs =
getXWikiContext().getWiki().getStore().searchDocuments(" ",
getXWikiContext());
   for (XWikiDocument xWikiDocument : docs) {
      List<BaseObject> objects =
xWikiDocument.getXObjects(xWikiDocument.getDocumentReference());
      if (objects != null) {
         for (BaseObject bo : objects) {
           if (bo.getName().contains("QuarXs.NodeTypeClass")) {
             DefaultNodeType nt = new DefaultNodeType();
             nt.setName(bo.getStringValue("name"));
             nt.setGuid(bo.getGuid());
             n.setType(nt);
           }
         }
      }
   }
} catch (Exception ee) {
   System.out.println("Error: " + ee);
}
To test this i defined a class from a wiki-page named "NodeTypeClass" in
Space "QuarXs". But now i used  /AbstractMandatoryDocumentInitializer/ to
initialize everything. The Initialization works fine and looks great, but
now my upper method is not working. I can define objects and reference to
NodeType, but can't find objects of type "NodeType" with the upper method.
Can you give me a hint?
I checked it with
{{groovy}}
   import org.rogatio.quarxs.Node;
   for (Node node :
services.component.getComponentManager().getInstanceList(Node.class)) {
      println("* "+node.getPrettyId() )
         println("** "+node.getType()) // gives back null. Reason: No
BaseObject of class "QuarXs.NodeTypeClass" found with upper method
//      println("** "+node.getType().getName()) // worked fine when i made
the classes by hand
        }
{{/groovy}}
If you like i post my code.
Regards,
Matthias
--
View this message in context:
http://xwiki.475771.n2.nabble.com/Query-for-self-defined-objects-tp7587586.…
Sent from the XWiki- Dev mailing list archive at 
Nabble.com.