protected MPlan createMPlan(BDIModel bdimodel, Plan p, MethodInfo mi, String name,
ClassInfo ci, ClassLoader cl, Map<ClassInfo, List<Tuple2<MGoal, String>>> pubs)
{
Body body = p.body();
ServicePlan sp = body.service();
MPlan mplan = bdimodel.getCapability().getPlan(name);
if(mplan==null)
{
MTrigger mtr = buildPlanTrigger(bdimodel, p.trigger(), cl, pubs);
MTrigger wmtr = buildPlanTrigger(bdimodel, p.waitqueue(), cl, pubs);
if(ci==null)
ci = Object.class.equals(body.value())? null: new ClassInfo(body.value().getName());
Class<? extends IServiceParameterMapper<Object>> mapperclass = (Class<? extends IServiceParameterMapper<Object>>)(IServiceParameterMapper.class.getName().equals(sp.mapper().getName())? null: sp.mapper());
MBody mbody = new MBody(mi, ci, sp.name().length()==0? null: sp.name(), sp.method().length()==0? null: sp.method(),
mapperclass==null? null: new ClassInfo(mapperclass), body.component().length()==0 ? null : body.component());
mplan = new MPlan(name, mbody, mtr, wmtr, p.priority());
}
return mplan;
}