Issue #2290 - fix subscription status
Change-Id: I93ca6074af9eeec1b2cda9145418daa569817d10 Former-commit-id: f2cd68bf1a7a21ed7d21d2c0f81ea54cca9a55dd
This commit is contained in:
parent
b4ccff3f5f
commit
a6d5ff3e2c
3 changed files with 67 additions and 45 deletions
|
@ -49,6 +49,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 18, 2013 1653 mpduff Initial creation
|
||||
* Aug 21, 2013 2248 bgonzale Changed label to minutes.
|
||||
* Aug 28, 2013 2290 mpduff Changed output to work with unscheduled subs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -168,10 +169,15 @@ public class SubscriptionStatusDlg extends CaveSWTDialog {
|
|||
l3.setText("Start Time: ");
|
||||
|
||||
Calendar cal = TimeUtil.newGmtCalendar();
|
||||
cal.setTimeInMillis(summary.getStartTime());
|
||||
Label l33 = new Label(sumComp, SWT.NONE);
|
||||
l33.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, true, false));
|
||||
l33.setText(sdf.format(cal.getTime()));
|
||||
if (summary.getStartTime() != SubscriptionStatusSummary.MISSING_VALUE) {
|
||||
cal.setTimeInMillis(summary.getStartTime());
|
||||
l33.setText(sdf.format(cal.getTime()));
|
||||
} else {
|
||||
l33.setText("");
|
||||
|
||||
}
|
||||
|
||||
Label l4 = new Label(sumComp, SWT.NONE);
|
||||
l4.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, false, false));
|
||||
|
@ -180,6 +186,10 @@ public class SubscriptionStatusDlg extends CaveSWTDialog {
|
|||
cal.setTimeInMillis(summary.getEndTime());
|
||||
Label l44 = new Label(sumComp, SWT.NONE);
|
||||
l44.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, true, false));
|
||||
l44.setText(sdf.format(cal.getTime()));
|
||||
if (summary.getEndTime() != SubscriptionStatusSummary.MISSING_VALUE) {
|
||||
l44.setText(sdf.format(cal.getTime()));
|
||||
} else {
|
||||
l44.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import com.raytheon.uf.common.util.StringUtil;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 17, 2013 1653 mpduff Initial creation
|
||||
* Aug 28, 2013 2290 mpduff Added default missing values.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -44,17 +45,22 @@ import com.raytheon.uf.common.util.StringUtil;
|
|||
*/
|
||||
@DynamicSerialize
|
||||
public class SubscriptionStatusSummary {
|
||||
@DynamicSerializeElement
|
||||
private long dataSize;
|
||||
/**
|
||||
* Missing data value.
|
||||
*/
|
||||
public static final long MISSING_VALUE = -9999;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private long startTime;
|
||||
private long dataSize = MISSING_VALUE;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private long endTime;
|
||||
private long startTime = MISSING_VALUE;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private long latency;
|
||||
private long endTime = MISSING_VALUE;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private long latency = MISSING_VALUE;
|
||||
|
||||
/**
|
||||
* @return the dataSize
|
||||
|
|
|
@ -62,6 +62,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
|||
* Jun 13, 2013 2095 djohnson Implement ability to store a collection of subscriptions.
|
||||
* Jun 24, 2013 2106 djohnson Implement new methods.
|
||||
* Jul 18, 2013 1653 mpduff Added getSubscriptionStatusSummary.
|
||||
* Aug 28, 2013 2290 mpduff Check for no subscriptions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -528,47 +529,52 @@ public class HibernateBandwidthDao implements IBandwidthDao {
|
|||
|
||||
List<BandwidthSubscription> bandwidthSubList = this
|
||||
.getBandwidthSubscription(sub);
|
||||
Collections.sort(bandwidthSubList,
|
||||
new Comparator<BandwidthSubscription>() {
|
||||
@Override
|
||||
public int compare(BandwidthSubscription o1,
|
||||
BandwidthSubscription o2) {
|
||||
Calendar date1 = o1.getBaseReferenceTime();
|
||||
Calendar date2 = o2.getBaseReferenceTime();
|
||||
if (date1.before(date2)) {
|
||||
return -1;
|
||||
} else if (date1.after(date2)) {
|
||||
return 1;
|
||||
|
||||
if (bandwidthSubList != null && !bandwidthSubList.isEmpty()) {
|
||||
Collections.sort(bandwidthSubList,
|
||||
new Comparator<BandwidthSubscription>() {
|
||||
@Override
|
||||
public int compare(BandwidthSubscription o1,
|
||||
BandwidthSubscription o2) {
|
||||
Calendar date1 = o1.getBaseReferenceTime();
|
||||
Calendar date2 = o2.getBaseReferenceTime();
|
||||
if (date1.before(date2)) {
|
||||
return -1;
|
||||
} else if (date1.after(date2)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
List<SubscriptionRetrieval> subRetrievalList = this
|
||||
.querySubscriptionRetrievals(bandwidthSubList.get(0));
|
||||
Collections.sort(subRetrievalList,
|
||||
new Comparator<SubscriptionRetrieval>() {
|
||||
@Override
|
||||
public int compare(SubscriptionRetrieval o1,
|
||||
SubscriptionRetrieval o2) {
|
||||
Calendar date1 = o1.getStartTime();
|
||||
Calendar date2 = o2.getStartTime();
|
||||
if (date1.before(date2)) {
|
||||
return -1;
|
||||
} else if (date1.after(date2)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
List<SubscriptionRetrieval> subRetrievalList = this
|
||||
.querySubscriptionRetrievals(bandwidthSubList.get(0));
|
||||
Collections.sort(subRetrievalList,
|
||||
new Comparator<SubscriptionRetrieval>() {
|
||||
@Override
|
||||
public int compare(SubscriptionRetrieval o1,
|
||||
SubscriptionRetrieval o2) {
|
||||
Calendar date1 = o1.getStartTime();
|
||||
Calendar date2 = o2.getStartTime();
|
||||
if (date1.before(date2)) {
|
||||
return -1;
|
||||
} else if (date1.after(date2)) {
|
||||
return 1;
|
||||
}
|
||||
summary.setStartTime(subRetrievalList.get(0).getStartTime()
|
||||
.getTimeInMillis());
|
||||
summary.setEndTime(subRetrievalList
|
||||
.get(subRetrievalList.size() - 1).getEndTime()
|
||||
.getTimeInMillis());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
summary.setStartTime(subRetrievalList.get(0).getStartTime()
|
||||
.getTimeInMillis());
|
||||
summary.setEndTime(subRetrievalList.get(subRetrievalList.size() - 1)
|
||||
.getEndTime().getTimeInMillis());
|
||||
summary.setDataSize(sub.getDataSetSize());
|
||||
summary.setLatency(sub.getLatencyInMinutes());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue