if(!detReqSubscription.getCollection.isEmpty()) { Iterator detReqIt = detReqSubscription.getCollection.iterator(); Task detReqTask = (Task) detReqIt.next(); processDetReq = (!(detReqTask.getPlanElement() == null)); }        if(((!orgActivities.getAddedCollection().isEmpty()) && (!processedDetReq)) || (!detReqSubscription.getAddedCollection().isEmpty())) { processDetReq(detReqSubscription.getCollection(), assetsWithPGSubscription.getCollection()); }  else if(!assetsWithPGSubscription.getAddedCollection().isEmpty()) { processDetReq(detReqSubscription.getCollection(), assetsWithPGSubscription.getAddedCollection()); } else if(!assetsWithPGSubscription.getRemovedCollection().isEmpty()) { removeFromDetReq(detReqSubscription.getCollection(), assetsWithPGSubscription.getRemovedCollection());  }  if (myOrganization == null) { myOrganization = getMyOrganization(selfOrganizations.elements()); }  if (myOrganization == null) { if (logger.isInfoEnabled()) { logger.info("\n DemandForecastPlugin " + supplyType + " not ready to process tasks yet." + " my org is: " + myOrganization); } return; }
if(!detReqSubscription.getCollection().isEmpty()) { Iterator detReqIt = detReqSubscription.getCollection().iterator(); Task detReqTask = (Task) detReqIt.next(); processDetReq = (!(detReqTask.getPlanElement() == null));
    protected void execute() {	if((orgActivities.getCollection().isEmpty()) || (detReqSubscription.getCollection().isEmpty())) {	    processDetReq = false;	    return;	}	if(!detReqSubscription.getCollection.isEmpty()) {	    Iterator detReqIt = detReqSubscription.getCollection.iterator();	    Task detReqTask = (Task) detReqIt.next();	    processDetReq = (!(detReqTask.getPlanElement() == null));	}		//There should be both a determineRequirements task	//and an oplan before kicking off the expander for the first time.	//from then on out we should be catching additional assets added, or removed.	//It is also possible that this agent has no assets and the expander has to dispose of the detReqTask.		//if there is a new determine requirements task or new oplan do this	if(((!orgActivities.getAddedCollection().isEmpty()) &&	    (!processedDetReq)) ||	   (!detReqSubscription.getAddedCollection().isEmpty())) {	    processDetReq(detReqSubscription.getCollection(),			  assetsWithPGSubscription.getCollection());	}	//otherwise just issue a new 	else if(!assetsWithPGSubscription.getAddedCollection().isEmpty()) {	    processDetReq(detReqSubscription.getCollection(),			  assetsWithPGSubscription.getAddedCollection());	}	else if(!assetsWithPGSubscription.getRemovedCollection().isEmpty()) {	    removeFromDetReq(detReqSubscription.getCollection(),			     assetsWithPGSubscription.getRemovedCollection());	    	}	        if (myOrganization == null) {            myOrganization = getMyOrganization(selfOrganizations.elements());        }	        if (myOrganization == null) {            if (logger.isInfoEnabled()) {                logger.info("\n DemandForecastPlugin " + supplyType +                            " not ready to process tasks yet." +                            " my org is: " + myOrganization);            }            return;        }	    }