/** * Initiate the bulk link calls. */ protected void handleBulkLinking(List childs, Object parent, AReadContext context, QName[] pathname, List linkdatas, int startidx) throws Exception { if(childs.size()>1) { try { bulkLinkObjects(childs, parent, ((LinkData)linkdatas.get(startidx)).getLinkinfo(), pathname, context); } catch(Exception e) { context.getReporter().report("Warning. Bulk link initiated but not successful: "+childs+" "+parent+" "+e, "warning", context, context.getLocation()); for(int i=0; i<childs.size(); i++) { linkObject(childs.get(i), parent, ((LinkData)linkdatas.get(startidx+i)).getLinkinfo(), pathname, context); } } } else { linkObject(childs.get(0), parent, ((LinkData)linkdatas.get(startidx)).getLinkinfo(), pathname, context); } }
public void linkObject(Object object, Object parent, Object linkinfo, QName[] pathname, AReadContext context) throws Exception { if(object instanceof String && parent instanceof MBelief)// && context.getStackElement(context.getStackSize()-4).getObject() instanceof BDIXModel) { BDIXModel model = (BDIXModel)context.getStackElement(context.getStackSize()-4).getObject(); model.getCapability().addBeliefReference(MElement.internalName((String)object), ((MElement)parent).getName()); } // goals in condlinker else if(object instanceof String && parent instanceof MMessageEvent)// && context.getStackElement(context.getStackSize()-4).getObject() instanceof BDIXModel) { BDIXModel model = (BDIXModel)context.getStackElement(context.getStackSize()-4).getObject(); model.getCapability().addEventReference(MElement.internalName((String)object), ((MElement)parent).getName()); } else if(object instanceof String && parent instanceof MInternalEvent)// && context.getStackElement(context.getStackSize()-4).getObject() instanceof BDIXModel) { BDIXModel model = (BDIXModel)context.getStackElement(context.getStackSize()-4).getObject(); model.getCapability().addEventReference(MElement.internalName((String)object), ((MElement)parent).getName()); } else { super.linkObject(object, parent, linkinfo, pathname, context); } } };