MessageAddress maTarget = relay.getTarget(); String relTargetAddr = (String)maTarget.getAddress();  Asset otherAsset = getAsset(myAssetClassName, opConItemId, opConTypeId, maTarget.getAddress()); Relationship relationship = myPlanningFactory.newRelationship((Constants.Role.OPERATIONALSUBORDINATE), (HasRelationships) myLocalAsset, (HasRelationships) otherAsset, content.getStartTime(), content.getEndTime()); report(relationship); publishRemove(relay);
if (relayMap.containsKey(opConItemId)) { if (myLogger.isInfoEnabled()) { myLogger.info(getAgentIdentifier() + ": ignoring OpConInfoRelay " + relay + " already added required RFDs."); } } else { relayMap.put(opConItemId, relay); boolean usedRelay = false;     for (Iterator iterator = opconInfos.iterator(); iterator.hasNext(); ) { OpConInfo opconInfo = (OpConInfo) iterator.next();    if (opconInfo.getOpCon().equals(opConItemId)) {  Collection affectedRFDInfos = rfdInfos.intersectingSet(opconInfo);  if (!(affectedRFDInfos.isEmpty())) {    continue; }   MessageAddress maTarget = relay.getTarget(); String relTargetAddr = (String)maTarget.getAddress();  Asset otherAsset = getAsset(myAssetClassName, opConItemId, opConTypeId, maTarget.getAddress()); Relationship relationship = myPlanningFactory.newRelationship((Constants.Role.OPERATIONALSUBORDINATE), (HasRelationships) myLocalAsset, (HasRelationships) otherAsset, opconInfo.getStartTime(), opconInfo.getEndTime()); report(relationship);  if (myLogger.isInfoEnabled()) { myLogger.info(getAgentIdentifier() + " published RFD to " + maTarget + " for " + new Date(opconInfo.getStartTime()) + " to " + new Date(opconInfo.getEndTime())); }  usedRelay = true; } }  if ((!usedRelay) && (myLogger.isInfoEnabled())) { myLogger.info(getAgentIdentifier() + ": ignoring OpConInfoRelay " + relay + " required RFDs already exist."); } }
  protected void createOperationalRFDs (Collection changedOpConInfoRelays) {    for (Iterator changes = changedOpConInfoRelays.iterator();	 changes.hasNext();) {      OpConInfoRelay relay = (OpConInfoRelay) changes.next();      //We don't want to pick up changes that we ourselves put on this relay       // i.e. when we are the target      //We only want to get the relay response here when we are the      // source.      TimeSpan content = (TimeSpan) relay.getContent();      ArrayList response = (ArrayList) relay.getResponse();      if (myLogger.isInfoEnabled()) {	myLogger.info(getAgentIdentifier() + " OpConInfoRelay content = " + content +		       " response = " + response);      }            if ((response == null) || 	  (response.size() < 2)) {	if (myLogger.isDebugEnabled()) {	  myLogger.debug(getAgentIdentifier() + " ignoring invalid response.");	}      } else {	String opConItemId = (String)response.get(0);	String opConTypeId = (String)response.get(1);	MessageAddress maTarget = relay.getTarget();	String relTargetAddr = (String)maTarget.getAddress();		Asset otherAsset =	  getAsset(myAssetClassName, opConItemId, opConTypeId, maTarget.getAddress());	Relationship relationship = 	  myPlanningFactory.newRelationship((Constants.Role.OPERATIONALSUBORDINATE),					    (HasRelationships) myLocalAsset,					    (HasRelationships) otherAsset,					    content.getStartTime(),					    content.getEndTime());	report(relationship);	publishRemove(relay);      }    }  }