Merge "Issue #2566 Update BandwidthGraphDataAdaptor to handle case when there are no reservations." into omaha_14.2.1

Former-commit-id: 71d88ca431 [formerly 247eb683e5] [formerly 91dc7825ce] [formerly 3cc5ebc43e [formerly 91dc7825ce [formerly 08a46b28d5fb5f2e5d28a5f4138ee4fea3fad05d]]]
Former-commit-id: 3cc5ebc43e
Former-commit-id: f3be58dab7723ab7f480a5a91a797293f8455ece [formerly 74c73c8ee1]
Former-commit-id: 7462693157
This commit is contained in:
Richard Peter 2013-12-11 18:00:10 -06:00 committed by Gerrit Code Review
commit 8c0e800811

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);