diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/IFPWE.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/IFPWE.java index 645b6f8101..6369592a7e 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/IFPWE.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/IFPWE.java @@ -26,6 +26,7 @@ import java.util.Collections; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.TimeZone; @@ -81,6 +82,7 @@ import com.raytheon.uf.common.time.TimeRange; * Apr 23, 2013 #1941 dgilling Implement put(), add methods to build * Scalar/VectorGridSlices, refactor * Discrete/WeatherGridSlices builders. + * Jun 05, 2013 #2063 dgilling Port history() from A1. * * * @@ -308,6 +310,39 @@ public class IFPWE { } } + /** + * Returns the grid history for a specified time range. + * + * @param tr + * The time for which the history is being requested. + * @return The grid history entries for the specified time range in coded + * string format. + */ + public List history(final TimeRange tr) { + ServerResponse>> sr = GridParmManager + .getGridHistory(parmId, Arrays.asList(tr)); + + if (!sr.isOkay()) { + statusHandler.error("Error retrieving grid history for parm [" + + parmId + "] at time range " + tr + ": " + sr.message()); + return Collections.emptyList(); + } + + Map> payload = sr.getPayload(); + if ((payload == null) || (payload.isEmpty())) { + statusHandler.error("No grid history returned for parm [" + parmId + + "] at time range " + tr); + return Collections.emptyList(); + } + + List hist = payload.get(tr); + List retVal = new ArrayList(hist.size()); + for (GridDataHistory entry : hist) { + retVal.add(entry.getCodedString()); + } + return retVal; + } + private void setItem(TimeRange time, IGridSlice gridSlice, List gdh) throws GfeException { GFERecord rec = new GFERecord(parmId, time); diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py index 5ac2bcf270..6ff58e0757 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py @@ -80,6 +80,8 @@ from com.raytheon.uf.edex.database.cluster import ClusterTask # 05/08/13 1988 dgilling Fix history handling bug in # __getDbGrid(). # 05/23/13 1759 dgilling Remove unnecessary imports. +# 06/05/13 2063 dgilling Change __siteInDbGrid() to +# call IFPWE.history() like A1. # # @@ -1289,13 +1291,14 @@ class IscMosaic: def __siteInDbGrid(self, tr): if tr is None: return None - history = self.__dbwe.getItem(iscUtil.toJavaTimeRange(tr)).getHistory() + history = self.__dbwe.history(iscUtil.toJavaTimeRange(tr)) - for i in range(0, len(history)): - index = string.find(history[i].getCodedString(), self.__siteID + "_GRID") - if index != -1: - return 1 - return 0 + itr = history.iterator() + while itr.hasNext(): + h = str(itr.next()) + if self.__siteID + "_GRID" in h: + return True + return False #--------------------------------------------------------------------- # validateAdjustDiscreteKeys()