Issue #2830 sort TAF dataTimes so latest are retrieved

Former-commit-id: a201d43d63 [formerly 230b8bf117] [formerly 8a00a419a1] [formerly a201d43d63 [formerly 230b8bf117] [formerly 8a00a419a1] [formerly f353c44cc0 [formerly 8a00a419a1 [formerly 04db02beec9d77e568c76541448bce0cd2f6c2d0]]]]
Former-commit-id: f353c44cc0
Former-commit-id: 4d460d3a26 [formerly a97f5b5ff7] [formerly 67f46ed66aeefd71f35b8ac193010ae9e960ed0b [formerly 74329bcb89]]
Former-commit-id: 31bbfe66d1d6c2a45d0680feb24acf664d2ade63 [formerly 02d2f0c713]
Former-commit-id: 78c8f1a62c
This commit is contained in:
Nate Jensen 2014-02-24 15:04:11 -06:00
parent 0d8cd5360a
commit 012037c1e6

View file

@ -45,12 +45,14 @@ import com.raytheon.uf.viz.core.exception.VizException;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 4, 2009 njensen Initial creation
* Jul 6, 2010 5792 rferrel getLatestTafs now returns tafs
* sorted by issue date newest at
* the start of the array.
* 08AUG2012 15613 zhao Modified safeFormatTaf()
* Sep 4, 2009 njensen Initial creation
* Jul 6, 2010 5792 rferrel getLatestTafs now returns tafs
* sorted by issue date newest at
* the start of the array.
* 08AUG2012 15613 zhao Modified safeFormatTaf()
* Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references
* Feb 24, 2014 2830 njensen Sort dataTimes in getLatestTafs()
* so it works correctly
*
* </pre>
*
@ -97,6 +99,11 @@ public class TafUtil {
TafRecord.PLUGIN_NAME));
map.put("stationId", new RequestConstraint(siteID));
/*
* even if only requesting one, cannot pass in true because that
* will return a DataTime with only refTime set and tafs need to
* have fcstTime, validPeriod, etc set
*/
DataTime[] dt = DataCubeContainer.performTimeQuery(map, false);
if (dt.length == 0) {
return null;
@ -105,6 +112,7 @@ public class TafUtil {
if (size > dt.length) {
size = dt.length;
}
Arrays.sort(dt);
DataTime[] requestedTimes = new DataTime[size];
int k = 0;
for (int i = dt.length - 1; i > -1; i--) {