Issue #2064 - Corrected Time object storage on subscriptions

Change-Id: I7cb4f53fd8dcdb2fc93ffd15c3a0c72e7eeb57d0

Former-commit-id: 03ef15d7b8 [formerly 5aabcd3001] [formerly a7f277c67b] [formerly 03ef15d7b8 [formerly 5aabcd3001] [formerly a7f277c67b] [formerly 0846f7c79a [formerly a7f277c67b [formerly 250fb3c4f8df45d396bc76734ad8b198dcf40a4e]]]]
Former-commit-id: 0846f7c79a
Former-commit-id: c1809b7e31 [formerly 1357c03113] [formerly 6a249650dbb1ffd6f61ae7e2b311375b44f5e9f4 [formerly ec08442f5d]]
Former-commit-id: e949f35dbaf830d281e453f8ca643b049840f8f2 [formerly 0912f5e85e]
Former-commit-id: ce60afe8db
This commit is contained in:
Mike Duff 2013-06-12 09:44:48 -05:00
parent 9b832a1eea
commit 5231dd989a
4 changed files with 35 additions and 17 deletions

View file

@ -603,18 +603,9 @@ public class GriddedSubsetManagerDlg
Time dataSetTime = dataSet.getTime();
if (sub instanceof AdhocSubscription) {
Time newTime = new Time();
newTime.setEnd(dataSetTime.getEnd());
newTime.setFormat(dataSetTime.getFormat());
newTime.setNumTimes(dataSetTime.getNumTimes());
newTime.setRequestEnd(dataSetTime.getRequestEnd());
newTime.setRequestStart(dataSetTime.getRequestStart());
newTime.setStart(dataSetTime.getStart());
newTime.setStep(dataSetTime.getStep());
newTime.setStepUnit(dataSetTime.getStepUnit());
newTime.setCycleTimes(dataSetTime.getCycleTimes());
Time newTime = new Time();
if (sub instanceof AdhocSubscription) {
newTime = setupDataSpecificTime(newTime, sub);
sub.setTime(newTime);
} else if (!create) {
@ -629,6 +620,16 @@ public class GriddedSubsetManagerDlg
time.setSelectedTimeIndices(fcstIndices);
subscription.setTime(time);
} else {
newTime.setEnd(dataSetTime.getEnd());
newTime.setFormat(dataSetTime.getFormat());
newTime.setNumTimes(dataSetTime.getNumTimes());
newTime.setRequestEnd(dataSetTime.getRequestEnd());
newTime.setRequestStart(dataSetTime.getRequestStart());
newTime.setStart(dataSetTime.getStart());
newTime.setStep(dataSetTime.getStep());
newTime.setStepUnit(dataSetTime.getStepUnit());
sub.setTime(newTime);
}
GriddedCoverage cov = (GriddedCoverage) dataSet.getCoverage();

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* ------------ ---------- ----------- --------------------------
* May 14, 2013 2000 djohnson Initial creation
* May 23, 2013 1650 djohnson Reword change bandwidth message.
* Jun 12, 2013 2064 mpduff Update label.
*
* </pre>
*
@ -91,8 +92,7 @@ public class BandwidthTab extends SystemApplyCancelTab {
protected void initializeTabComponents(Composite mainComp) {
GridLayout gl = new GridLayout(1, false);
GridData gd = new GridData(SWT.VERTICAL, SWT.DEFAULT, true, false);
Composite configurationComposite = new Composite(mainComp,
SWT.NONE);
Composite configurationComposite = new Composite(mainComp, SWT.NONE);
configurationComposite.setLayout(gl);
configurationComposite.setLayoutData(gd);
@ -114,7 +114,7 @@ public class BandwidthTab extends SystemApplyCancelTab {
gd = new GridData(165, SWT.DEFAULT);
Label availBandwith = new Label(outerComp, SWT.NONE);
availBandwith.setLayoutData(gd);
availBandwith.setText("OPSNET Bandwidth (KB):");
availBandwith.setText("OPSNET Bandwidth (kB/s):");
final Spinner availBandwidthSpinner = new Spinner(outerComp, SWT.BORDER);
availBandwidthSpinner.setMinimum(0);

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
@ -77,6 +78,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* May 20, 2013 2000 djohnson Add message to inform the user changes were applied.
* Jun 04, 2013 223 mpduff Add point data stuff.
* Jun 11, 2013 2064 mpduff Don't output Parameter header if none exist.
* Jun 12, 2013 2064 mpduff Use SizeUtil to format data size output.
* </pre>
*
* @author mpduff
@ -276,7 +278,7 @@ public class DataDeliveryUtils {
DATA_SIZE("Data Size", null) {
@Override
public String getDisplayData(SubscriptionManagerRowData rd) {
return String.valueOf(rd.getDataSetSize());
return SizeUtil.prettyKiloByteSize(rd.getDataSetSize());
}
},
/** Column Group Name */
@ -629,7 +631,8 @@ public class DataDeliveryUtils {
.append(newline);
fmtStr.append("Dataset Name: ").append(sub.getDataSetName())
.append(newline);
fmtStr.append("Dataset Size: ").append(sub.getDataSetSize())
fmtStr.append("Dataset Size: ")
.append(SizeUtil.prettyKiloByteSize(sub.getDataSetSize()))
.append(newline);
fmtStr.append("Provider: ").append(sub.getProvider()).append(newline);
fmtStr.append("Office IDs: ")

View file

@ -29,6 +29,7 @@ package com.raytheon.uf.common.util;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 24, 2012 njensen Initial creation
* Jun 12, 2013 2064 mpduff Add prettyKiloByteSize.
*
* </pre>
*
@ -53,7 +54,7 @@ public class SizeUtil {
* @return the pretty String representation of the byte size
*/
public static String prettyByteSize(long numberOfBytes) {
float n = (float) numberOfBytes;
float n = numberOfBytes;
int reps = 0;
while (n > BYTES_PER && reps < REP_PREFIX.length - 1) {
reps++;
@ -66,4 +67,17 @@ public class SizeUtil {
return sb.toString();
}
/**
* Transforms a number of kilobytes to a pretty string based on the total
* number of bytes, e.g. B, kB, MB, or GB as fitting. For example: 1000 ->
* 1000B, 10000 -> 9.7kB, 100000 -> 97.6kB, 1000000 -> 976.5kB, 10000000 ->
* 9.5MB
*
* @param numberOfKiloBytes
* * the number to transform to a pretty string
* @return the pretty String representation of the byte size
*/
public static String prettyKiloByteSize(long numberOfKiloBytes) {
return prettyByteSize(numberOfKiloBytes * BYTES_PER);
}
}