Task wrapupTask = getEncapsulatedTask (anAsset, end, wrapupEnd); if (wrapupTask == null) logger.warn (getAgentIdentifier () + " - previous task " + previousTask.getUID() + " missing a wrapup task from " + end + " to " + wrapupEnd + "?"); else {  ((NewTask) wrapupTask).setDirectObject (directObject); publishChange (wrapupTask); }
addToPreviousSetupWrapup (anAsset, directObject, end, wrapupEnd, "wrapup");
  public boolean addToPrevious (Vector tasklist, Asset anAsset, Date start, Date end, Date setupStart, Date wrapupEnd) {    Task previousTask = getEncapsulatedTask (anAsset, start, end);    if (previousTask != null) { // found transport task      if (isDebugEnabled()) 	debug (getName () + ".addToPrevious - found previous task for asset " + 			    anAsset.getUID());      Vector directObjects = getDirectObjectsForAgg(tasklist);       // step 1 - add to d.o. of transport task      Asset directObject = addToDirectObject (previousTask, directObjects);      if (makeSetupAndWrapupTasks) {	if (setupStart.getTime() < start.getTime()) {	  Task setupTask = getEncapsulatedTask (anAsset, setupStart, start);	  if (setupTask == null)	    logger.warn (getAgentIdentifier () + " - previous task " + 			 previousTask.getUID() + " missing a setup task from " + setupStart + " to " +			 start + "?");	  else {	    // step 2 - add to d.o. of setup	    ((NewTask) setupTask).setDirectObject (directObject);	    publishChange (setupTask);	  }	}	if (wrapupEnd.getTime() > end.getTime()) {	  Task wrapupTask = getEncapsulatedTask (anAsset, end, wrapupEnd);	  if (wrapupTask == null)	    logger.warn (getAgentIdentifier () + " - previous task " + 			 previousTask.getUID() + " missing a wrapup task from " + end + " to " +			 wrapupEnd + "?");	  else {	    // step 3 - add to d.o. of wrapup	    ((NewTask) wrapupTask).setDirectObject (directObject);	    publishChange (wrapupTask);	  }	}      }      MPTask mpTask = getMPTask (previousTask.getParentTaskUID ());      if (mpTask == null)	return false; // the MP task was removed from the blackboard while scheduler was running      // step 4 - add to d.o. of MPTask parent      ((NewMPTask) mpTask).setDirectObject (directObject);      // step 5 - Make MP Task know of new parents      Enumeration parents = mpTask.getParentTasks ();      Vector parentsVector = enumToVector (parents);      ((NewMPTask)mpTask).setParentTasks (getEnumWithNewParents (parentsVector, tasklist));      publishChange (mpTask);      // step 6 - make aggregations for connecting parent tasks to MPTask      NewComposition comp = (NewComposition) mpTask.getComposition ();      addAggregations (comp, tasklist, start, end);      publishChange (comp);            return true;    }    return false;  }