System.err.println("Error publishing expansion - " + expan.getUID());
System.err.println("Error publishing expansion - " + expan.getUID() + ".\n" + "Task: " + expan.getTask().getUID() + " task commit date: " + expan.getTask().getCommitmentDate() + " task plan element: " + expan.getTask().getPlanElement());
  public void createExpansion(Iterator tasksForWorkflow, Task parentTask) {    // this needs to publish the Expansion, all the subtasks and    // the workflow    if (parentTask.getPlan() == null) {      throw (new RuntimeException("Unable to find plan for expansion - parentTask is " + parentTask.getUID()));    }        NewWorkflow workflow = getFactory().newWorkflow();    workflow.setIsPropagatingToSubtasks(true);    workflow.setParentTask(parentTask);    workflow.setAllocationResultAggregator(AllocationResultAggregator.DEFAULT);        while(tasksForWorkflow.hasNext()) {      NewTask subTask = (NewTask)tasksForWorkflow.next();      subTask.setWorkflow(workflow);      workflow.addTask(subTask);      if (!publishAdd(subTask)) {	System.err.println("Error publishing task - " + subTask.getUID());      }    }    if (!publishAdd(workflow)) {      System.err.println("Error publishing workflow - " + workflow);    }        Expansion expan = getFactory().createExpansion(parentTask.getPlan(),                                                    parentTask, workflow,                                                    null);    if (!publishAdd(expan)) {      System.err.println("Error publishing expansion - " + expan.getUID());    }    return;  }