publishAdd(subtask);
boolean didAddSub = publishAdd(subtask); if (logger.isDebugEnabled()) { logger.debug("Agent: " + getAgentIdentifier().toString() + "Inv Plugin[" + supplyType+"]" + "publish adding a " + subtask.getVerb() + " subtask: " + subtask.getUID()+ "publishAdd returned: " + didAddSub); }
  public void publishAddToExpansion(Task parent, Task subtask) {    //attach the subtask to its parent and the parent's workflow    PlanElement pe = parent.getPlanElement();    Expansion expansion;    NewWorkflow wf;    ((NewTask) subtask).setParentTask(parent);    ((NewTask) subtask).setContext(parent.getContext());    ((NewTask) subtask).setPlan(parent.getPlan());    // Task has not been expanded, create an expansion    if (pe instanceof Disposition) {      publishRemove(pe);      pe = null;    }    if (pe == null) {      PlanningFactory factory = getPlanningFactory();      // Create workflow      wf = (NewWorkflow) factory.newWorkflow();      wf.setParentTask(parent);      wf.setIsPropagatingToSubtasks(true);      wf.addTask(subtask);      ((NewTask) subtask).setWorkflow(wf);      // Build Expansion      expansion = factory.createExpansion(parent.getPlan(), parent, wf, null);      // Publish Expansion      publishAdd(expansion);    }    // Task already has expansion, add task to the workflow and publish the change    else if (pe instanceof Expansion) {      expansion = (Expansion) pe;      wf = (NewWorkflow) expansion.getWorkflow();      wf.addTask(subtask);      ((NewTask) subtask).setWorkflow(wf);      publishChange(expansion);    } else {      if (logger.isErrorEnabled()) {        logger.error("publishAddToExpansion: problem pe not Expansion? " + pe);      }    }    // Publish new task    publishAdd(subtask);    if ((subtask.getVerb().equals(Constants.Verb.SUPPLY)) ||        (subtask.getVerb().equals(Constants.Verb.PROJECTSUPPLY))) {      newRefills.add(subtask);    }  }