Issue #2566 Update BandwidthGraphDataAdaptor to handle case when there are no reservations.

Change-Id: Ie9eb7e3e1a5bc8ac4a8ccf9532686d97f584bf1c

Former-commit-id: 14171c13dd5f127df0b90a5db9a9e11b301ffc5f
This commit is contained in:
Brad Gonzales 2013-12-11 17:05:39 -06:00
parent 6f57e14406
commit 96dc3b65b1

View file

@ -61,6 +61,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
* Jul 11, 2013 2106 djohnson Use priority straight from the BandwidthSubscription.
* Sep 20, 2013 2397 bgonzale Add Map of Bucket Descriptions to BandwidthGraphData.
* Nov 27, 2013 2545 mpduff Get data by network
* Dec 11, 2013 2566 bgonzale handle case when there are no reservations.
*
* </pre>
*
@ -130,12 +131,14 @@ class BandwidthGraphDataAdapter {
final List<BandwidthReservation> bandwidthReservations = retrievalPlan
.getBandwidthReservationsForBucket(bucket);
for (BandwidthReservation reservation : bandwidthReservations) {
if (!reservations.containsKey(reservation.getId())) {
reservations.put(reservation.getId(),
new ArrayList<BandwidthReservation>());
if (bandwidthReservations != null) {
for (BandwidthReservation reservation : bandwidthReservations) {
if (!reservations.containsKey(reservation.getId())) {
reservations.put(reservation.getId(),
new ArrayList<BandwidthReservation>());
}
reservations.get(reservation.getId()).add(reservation);
}
reservations.get(reservation.getId()).add(reservation);
}
}
}
@ -177,9 +180,13 @@ class BandwidthGraphDataAdapter {
List<Long> binStartTimes = new ArrayList<Long>();
binStartTimes.add(retrieval.getStartTime().getTimeInMillis());
for (BandwidthReservation reservation : reservations.get(retrieval
.getIdentifier())) {
binStartTimes.add(reservation.getBandwidthBucket());
List<BandwidthReservation> retrievalReservations = reservations
.get(retrieval.getIdentifier());
if (retrievalReservations != null) {
for (BandwidthReservation reservation : retrievalReservations) {
binStartTimes.add(reservation.getBandwidthBucket());
}
}
window.setBinStartTimes(binStartTimes);
windowData.addTimeWindow(window);