Task drTask = findSingleDetermineRequirementsTask(drTasksSub.elements());  if ((drTask != null) && (drTask.getPlanElement() == null)) {  unhandledDetermineRequirementsTask = new WaitingTask(delayReprocessMillis, drTask);   if (getDeployPlan() != null) { wakeAfterRealTime(delayReprocessMillis); } } else if (drTask != null) { DeployPlan dp = getDeployPlan (); dp.detReqsTask = drTask; dp.expandedWorkflow = (NewWorkflow) ((Expansion) drTask.getPlanElement()).getWorkflow();  if (dp.expandedWorkflow == null) logger.error ("??? No workflow found for d.r. task " + drTask.getUID()); }
  protected void setupSubscriptions() {    if (logger.isInfoEnabled()) {      printInfo(getClass()+" setting up subscriptions");    }    setDefaults(getParameters().elements());    selfOrgsSub = (IncrementalSubscription) subscribe(newSelfOrgPred());    orgDeployActsSub = (IncrementalSubscription)       subscribe(newOrgDeployActsPred());    drTasksSub = (IncrementalSubscription)       subscribe(newDRTasksPred());                    transAssetsPersonSub = (IncrementalSubscription)       subscribe(newTransPersonPred());    transAssetsEquipmentSub = (IncrementalSubscription)       subscribe(newTransEquipmentPred());    failedDRAllocsSub = (IncrementalSubscription)       subscribe(newFailedDRAllocPred());      expansionsSub = (IncrementalSubscription) subscribe(newExpansionsPred());    if (originFile != null) {      overrideFromLocation = getGeoLoc(originFile);    }    unhandledDetermineRequirementsTask = null;    // Fill in state from subscriptions if rehydrating    if (didRehydrate()) {      // Try to fill in self org info      if (!selfOrgsSub.isEmpty()) {        watchAddedSelfOrgs(selfOrgsSub.elements());;      }      //Initialize deployPlan       if (!orgDeployActsSub.isEmpty()) {        OrgActivity selfOrgAct = findSelfOrgDeployAct(orgDeployActsSub.elements());        if (selfOrgAct != null) {          replaceDeployPlan(selfOrgAct);        }      }      // Need to fill in unhandled      Task drTask = findSingleDetermineRequirementsTask(drTasksSub.elements());      // Assume we only worry about dr task where plan element is null      if ((drTask != null) && (drTask.getPlanElement() == null)) {        // Put on unhandled list so we know about it        unhandledDetermineRequirementsTask = new WaitingTask(delayReprocessMillis,                                                             drTask);        // Have a deploy plan so we should be able to process the task.        // Set up alarm so that we handle in execute loop        if (getDeployPlan() != null) {          wakeAfterRealTime(delayReprocessMillis);        }      }      else if (drTask != null) { // it had a plan element - fix for bug #2376	  DeployPlan dp = getDeployPlan ();	  dp.detReqsTask = drTask;	  dp.expandedWorkflow = 	      (NewWorkflow) ((Expansion) drTask.getPlanElement()).getWorkflow();	  if (dp.expandedWorkflow == null) 	      logger.error ("??? No workflow found for d.r. task " + 			    drTask.getUID());      }    }  }        