projectionTaskSubscription = (IncrementalSubscription) blackboard. subscribe(new ProjectionTaskPredicate(supplyType, getOrgName(), taskUtils));
if (blackboard.didRehydrate()) { checkDateOfBlackboard(); } projectionTaskSubscription = (IncrementalSubscription) blackboard.subscribe(new LocalTaskPredicate(supplyType, getOrgName(), Constants.Verb.ProjectSupply, taskUtils)); }   if (blackboard.didRehydrate() && myOrganization == null) { if (logger.isErrorEnabled()) { logger.error("Blackboard was rehydrated with null self organization, checkDateOfBlackboard" + " will not be called "); }
  protected void execute() {    if (myOrganization == null) {      myOrganization = getMyOrganization(selfOrganizations.elements());      if (myOrganization != null) {        projectionTaskSubscription = (IncrementalSubscription) blackboard.            subscribe(new ProjectionTaskPredicate(supplyType, getOrgName(), taskUtils));      }    }    /** TODO: MWD Remove     if(orgActivities.getCollection().isEmpty()) {     return;     }     else if((orgStartTime == -1) || (orgEndTime == -1)) {     computeOrgTimes(orgActivities.elements());     }     if (oplanSubscription.getCollection().isEmpty()) {     return;     }     **/    // get the Logistics OPlan (our homegrown version with specific dates).    if ((logOPlan == null) || logisticsOPlanSubscription.hasChanged()) {      Iterator opIt = logisticsOPlanSubscription.iterator();      if (opIt.hasNext()) {        //we only expect to have one        logOPlan = (LogisticsOPlan) opIt.next();      }    }    if (myOrganization == null) {      if (logger.isInfoEnabled()) {        logger.info("\n DemandGeneratorPlugin " + supplyType +                    " not ready to process tasks yet." +                    " my org is: " + myOrganization);      }      return;    }    //nothing for now    if (timerExpired()) {      long planTime = getStartOfPeriod();      if (logger.isInfoEnabled()) {        logger.info("Timer has gone off.  Planning for the next " + ((int) (period / getTimeUtils().MSEC_PER_HOUR)) + "hours from " + new Date(planTime));      }      for (long time = planTime; time<planTime+period; time += stepPeriod) {	  //filter and create task from time to time plus step period inclusive	  //(stepPeriod -1)        Collection relevantProjs = filterProjectionsOnTime(projectionTaskSubscription,                                                         time, time + (stepPeriod - 1));        //TODO: MWD Remove debug statements:        if ((getOrgName() != null) &&            (getOrgName().trim().equals("1-35-ARBN")) &&            (logger.isDebugEnabled())) {          logger.debug("I'm waking up - new period starts " + new Date(planTime) +                             " and step (start,dur) is (" + new Date(time) +                             "," + stepPeriod + ")" +                             " and Num of projections for " + getOrgName() +                             " is: " + relevantProjs.size());        }        relevantProjs = class9Scheduler.filterProjectionsToMaxSpareParts(relevantProjs);	//filter and create task from time to time plus step period inclusive	  //(stepPeriod -1)        List demandTasks = demandGenerator.generateDemandTasks(time, (stepPeriod - 1), relevantProjs);        if (demandOutputModule != null) {          demandOutputModule.writeDemandOutputToFile(demandTasks);        }      }      resetTimer();    }  }