diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/guidance/GuidanceUtil.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/guidance/GuidanceUtil.java index 05a27b97bc..bd3fa12435 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/guidance/GuidanceUtil.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/guidance/GuidanceUtil.java @@ -22,6 +22,8 @@ package com.raytheon.viz.aviation.guidance; import com.raytheon.uf.common.dataplugin.gfe.point.GFEPointDataContainers; import com.raytheon.uf.common.dataplugin.gfe.request.GetPointDataRequest; import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; @@ -37,6 +39,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient; * Jul 29, 2009 njensen Initial creation * Mar 11, 2013 1735 rferrel Get a list of GFE Point Data Containers * Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references + * Apr 23, 2014 3006 randerso Added error logging * * * @@ -45,6 +48,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient; */ public class GuidanceUtil { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(GuidanceUtil.class); /** * Get a list of GFE Point Data information for the task request. @@ -59,6 +64,10 @@ public class GuidanceUtil { task.setWorkstationID(VizApp.getWsId()); ServerResponse sr = (ServerResponse) ThriftClient .sendRequest(task); + if (!sr.isOkay()) { + // some kind of error occurred on the server side + statusHandler.error(sr.message()); + } return sr.getPayload(); } diff --git a/cave/com.raytheon.viz.avnconfig/.project b/cave/com.raytheon.viz.avnconfig/.project index 3bf0c421ac..854ed8d30c 100644 --- a/cave/com.raytheon.viz.avnconfig/.project +++ b/cave/com.raytheon.viz.avnconfig/.project @@ -5,6 +5,11 @@ + + org.python.pydev.PyDevBuilder + + + org.eclipse.jdt.core.javabuilder @@ -24,5 +29,6 @@ org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature + org.python.pydev.pythonNature diff --git a/cave/com.raytheon.viz.avnconfig/.pydevproject b/cave/com.raytheon.viz.avnconfig/.pydevproject new file mode 100644 index 0000000000..40e9f40a0a --- /dev/null +++ b/cave/com.raytheon.viz.avnconfig/.pydevproject @@ -0,0 +1,5 @@ + + +Default +python 2.7 + diff --git a/cave/com.raytheon.viz.avnconfig/localization/aviation/python/GfeValues.py b/cave/com.raytheon.viz.avnconfig/localization/aviation/python/GfeValues.py index 1debdf7bf1..e086c7423d 100644 --- a/cave/com.raytheon.viz.avnconfig/localization/aviation/python/GfeValues.py +++ b/cave/com.raytheon.viz.avnconfig/localization/aviation/python/GfeValues.py @@ -28,8 +28,8 @@ # # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- -# 08/12/09 njensen Initial Creation. -# +# 08/12/09 njensen Initial Creation. +# 04/23/2-14 #3006 randerso Fix Wx parsing # # @@ -99,7 +99,7 @@ def wxVal(value, index): return value skip = index - count = 0 + count = 1 for subkey in wxStats: if subkey.wxType() not in ['','T'] + _vsbyCodes: if count == skip: @@ -120,7 +120,7 @@ def wxValInst(value, index): return value skip = index - count = 0 + count = 1 for subkey in wxStats: if subkey.wxType() not in ['','T'] + _vsbyCodes: if count == skip: @@ -141,7 +141,7 @@ def wxValCov(value, index): return value skip = index - count = 0 + count = 1 for subkey in wxStats: if subkey.wxType() not in ['','T'] + _vsbyCodes: if count == skip: @@ -149,7 +149,6 @@ def wxValCov(value, index): break else: count = count + 1 - return value def wxTstm(value): @@ -179,7 +178,7 @@ def wxTstmInt(value): for subkey in wxStats: if subkey.wxType() == 'T': - value = self._translateCode.get(subkey.intensity(), 'm' ) + value = _translateCode.get(subkey.intensity(), 'm' ) break return value @@ -188,10 +187,13 @@ def wxTstmInt(value): class FakeWxKey: def __init__(self, value): - split = value.split(',') + split = value.split('^') self.subkeys = [] for s in split: - self.subkeys.append(FakeWxSubkey(s)) + self.subkeys.append(FakeWxSubkey(s)) + + def __str__(self): + return "^".join([str(subkey) for subkey in self.subkeys]) def __getitem__(self, key): return self.subkeys[key] @@ -207,10 +209,13 @@ class FakeWxSubkey: def __init__(self, value): split = value.split(':') - self.cov = value[0] - self.type = value[1] - self.inten = value[2] - self.vis = value[3] + self.cov = split[0] + self.type = split[1] + self.inten = split[2] + self.vis = split[3] + + def __str__(self): + return ":".join([self.cov, self.type, self.inten, self.vis]) def wxType(self): return self.type diff --git a/cave/com.raytheon.viz.avnconfig/localization/aviation/python/GridData.py b/cave/com.raytheon.viz.avnconfig/localization/aviation/python/GridData.py index 0480d8dded..2a0516faba 100644 --- a/cave/com.raytheon.viz.avnconfig/localization/aviation/python/GridData.py +++ b/cave/com.raytheon.viz.avnconfig/localization/aviation/python/GridData.py @@ -141,15 +141,14 @@ # Status: TEST # Title: AvnFPS: Lack of customization in QC check # -#** -#* -#* -#*
-#* SOFTWARE HISTORY
-#* Date         Ticket#     Engineer    Description
-#* ------------ ----------  ----------- --------------------------
-#*                                      Initial creation.
-#* Mar 07, 2013 1735        rferrel     Changes to obtain grid data for a list of sites.
+# 
+# SOFTWARE HISTORY
+# Date         Ticket#     Engineer    Description
+# ------------ ----------  ----------- --------------------------
+#                                      Initial creation.
+# Mar 07, 2013 1735        rferrel     Changes to obtain grid data for a list of sites.
+# Apr 23, 2014 3006        randerso    Fix Wx parsing, handling of missing pdcs
+#
 ##  
 #
 import logging, os, time, ConfigParser
@@ -313,7 +312,7 @@ def _getData(pdc, firstTime):
             organizedData[fcstHr] = pdv
         for n in range(_NumHours):
             dd = {'time': 3600.0*n+(firstTime / 1000)}
-            dd = _createRecord(dd, organizedData[n])        
+            dd = _createRecord(dd, organizedData[n])
             data.append(dd)
     else :
     	return None
@@ -344,11 +343,11 @@ def _createRecord(dd, pdv):
         elif k == 'Tint':
             v = _stripmsng(GfeValues.wxTstmInt(arg))
         elif k[:4] == 'Prob':
-            v = _stripmsng(GfeValues.wxValCov(arg, k[4]))                                                     
+            v = _stripmsng(GfeValues.wxValCov(arg, int(k[4])))
         elif k[:4] == 'PTyp':
-            v = _wxcode(GfeValues.wxVal(arg, k[4]))
+            v = _wxcode(GfeValues.wxVal(arg, int(k[4])))
         elif k[:4] == 'Ints':
-            v = _intcode(GfeValues.wxValInst(arg, k[4]))
+            v = _intcode(GfeValues.wxValInst(arg, int(k[4])))
         else:
             v = _stripmsng(arg)
         dd[k] = v
@@ -545,12 +544,12 @@ def _retrieveMapData(siteIDs, timeSeconds, parameters=Parameters):
             results[siteID] = None
         return results
     
-    i = 0
-    for siteID in siteIDs:
-        pdc = pdcs.getContainer(i)
+    for i, siteID in enumerate(siteIDs):
+        data = None
         if i < pdcs.getSize() :
-            ++i
-        data = _getData(pdc, timeSeconds * 1000)
+            pdc = pdcs.getContainer(i)
+            data = _getData(pdc, timeSeconds * 1000)
+            
         if data is None:
             _Logger.info('Data not available for %s', siteID)
         results[siteID] = data
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetPointDataHandler.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetPointDataHandler.java
index 96e2c1653f..149fda355f 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetPointDataHandler.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/GetPointDataHandler.java
@@ -21,22 +21,21 @@ package com.raytheon.edex.plugin.gfe.server.handler;
 
 import java.awt.Point;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 
 import javax.measure.unit.NonSI;
 import javax.measure.unit.SI;
 import javax.measure.unit.Unit;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.geotools.coverage.grid.GridGeometry2D;
-
-import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager;
-import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
+import com.raytheon.edex.plugin.gfe.server.IFPServer;
+import com.raytheon.edex.plugin.gfe.server.database.GridDatabase;
 import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
-import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord;
+import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
 import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
 import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
 import com.raytheon.uf.common.dataplugin.gfe.point.GFEPointDataContainer;
@@ -44,15 +43,15 @@ import com.raytheon.uf.common.dataplugin.gfe.point.GFEPointDataContainers;
 import com.raytheon.uf.common.dataplugin.gfe.point.GFEPointDataView;
 import com.raytheon.uf.common.dataplugin.gfe.request.GetPointDataRequest;
 import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
-import com.raytheon.uf.common.dataplugin.gfe.server.request.GetGridRequest;
 import com.raytheon.uf.common.dataplugin.gfe.slice.DiscreteGridSlice;
 import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice;
 import com.raytheon.uf.common.dataplugin.gfe.slice.ScalarGridSlice;
 import com.raytheon.uf.common.dataplugin.gfe.slice.VectorGridSlice;
-import com.raytheon.uf.common.geospatial.MapUtil;
-import com.raytheon.uf.common.geospatial.PointUtil;
+import com.raytheon.uf.common.dataplugin.gfe.slice.WeatherGridSlice;
 import com.raytheon.uf.common.pointdata.PointDataDescription.Type;
 import com.raytheon.uf.common.serialization.comm.IRequestHandler;
+import com.raytheon.uf.common.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
 import com.raytheon.uf.common.time.TimeRange;
 import com.raytheon.uf.common.time.util.TimeUtil;
 import com.vividsolutions.jts.geom.Coordinate;
@@ -70,6 +69,7 @@ import com.vividsolutions.jts.geom.Coordinate;
  *                                      in a single grid request.
  * Jun 13, 2013     #2044  randerso    Refactored to use IFPServer
  * Oct 31, 2013     #2508  randerso    Change to use DiscreteGridSlice.getKeys()
+ * Apr 23, 2014     #3006  randerso    Restructured code to work with multi-hour grids
  * 
  * 
* @@ -79,8 +79,8 @@ import com.vividsolutions.jts.geom.Coordinate; public class GetPointDataHandler extends BaseGfeRequestHandler implements IRequestHandler { - - protected final transient Log logger = LogFactory.getLog(getClass()); + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(GetPointDataHandler.class); /* * (non-Javadoc) @@ -89,143 +89,156 @@ public class GetPointDataHandler extends BaseGfeRequestHandler implements * com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest * (com.raytheon.uf.common.serialization.comm.IServerRequest) */ - @SuppressWarnings("unchecked") @Override - public ServerResponse handleRequest(GetPointDataRequest request) - throws Exception { + public ServerResponse handleRequest( + GetPointDataRequest request) throws Exception { + ServerResponse resp = new ServerResponse(); + + IFPServer ifpServer = getIfpServer(request); + DatabaseID dbID = new DatabaseID(request.getDatabaseID()); + GridDatabase db = ifpServer.getGridParmMgr().getDatabase(dbID); + GridLocation loc = ifpServer.getConfig().dbDomain(); + List parameters = request.getParameters(); - - DatabaseID db = new DatabaseID(request.getDatabaseID()); List parmIds = new ArrayList(parameters.size()); - GridLocation loc = null; - - try { - loc = IFPServerConfigManager.getServerConfig(db.getSiteId()) - .dbDomain(); - } catch (GfeConfigurationException e) { - String msg = "Error getting grid location for site " - + db.getSiteId(); - logger.error(msg, e); - ServerResponse error = new ServerResponse(); - error.addMessage(msg); - return error; - } - - GridGeometry2D geom = MapUtil.getGridGeometry(loc); - for (String p : parameters) { - parmIds.add(new ParmID(p, db)); + parmIds.add(new ParmID(p, dbID)); } - List times = new ArrayList(); - for (int i = 0; i < request.getNumberHours(); i++) { - long iStartTime = request.getStartTime() - + (i * TimeUtil.MILLIS_PER_HOUR); - long iEndTime = iStartTime + TimeUtil.MILLIS_PER_HOUR; - TimeRange tr = new TimeRange(iStartTime, iEndTime); - times.add(tr); - } + int numHours = request.getNumberHours(); + long startTime = request.getStartTime(); + TimeRange overallTr = new TimeRange(new Date(startTime), numHours + * TimeUtil.MILLIS_PER_HOUR); List coordinates = request.getCoordinates(); - ServerResponse resp = null; - resp = new ServerResponse(); Map infoMap = new HashMap(); - boolean getSlices = false; - // See if any of the coordinates need the grid slices and set up info // map. for (Coordinate coordinate : coordinates) { - CoordinateInfo info = new CoordinateInfo(); + CoordinateInfo info = new CoordinateInfo(numHours, coordinate, loc); infoMap.put(coordinate, info); - info.container = new GFEPointDataContainer(); - Point index = PointUtil.determineIndex(coordinate, loc.getCrs(), - geom); - info.x = index.x; - info.y = index.y; - info.containsCoord = !((info.x < 0) || (info.x >= loc.getNx()) - || (info.y < 0) || (info.y >= loc.getNy())); - - if (!getSlices) { - getSlices = info.containsCoord; + if (!info.containsCoord) { + // coordinate is outside this GFE domain + resp.addMessage(coordinate + " is outside the " + + request.getSiteID() + + " GFE domain, no data will be returned."); } } - - for (TimeRange tr : times) { - List reqList = new ArrayList(); - for (ParmID p : parmIds) { - GetGridRequest req = new GetGridRequest(); - req.setParmId(p); - List reqRecList = new ArrayList( - times.size()); - GFERecord rec = new GFERecord(p, tr); - reqRecList.add(rec); - req.setRecords(reqRecList); - reqList.add(req); + for (ParmID parmId : parmIds) { + ServerResponse> invSr = db.getGridInventory(parmId, + overallTr); + if (!invSr.isOkay()) { + String msg = "Error retrieving inventory for " + parmId + "\n" + + invSr.message(); + statusHandler.error(msg); + resp.addMessage(msg); + continue; } - try { - ServerResponse> sr = null; - if (getSlices) { - sr = getIfpServer(request).getGridParmMgr().getGridData( - reqList); - } + String param = parmId.getParmName(); - for (Coordinate coordinate : coordinates) { - CoordinateInfo info = infoMap.get(coordinate); - boolean containsCoord = info.containsCoord; - GFEPointDataContainer container = info.container; - GFEPointDataView view = new GFEPointDataView(); - int x = info.x; - int y = info.y; + List inv = invSr.getPayload(); + ServerResponse> slicesSR = db.getGridData(parmId, + inv); + if (!slicesSR.isOkay()) { + String msg = "Error retrieving data for " + parmId + "\n" + + slicesSR.message(); + statusHandler.error(msg); + resp.addMessage(msg); + continue; + } + List slices = slicesSR.getPayload(); + Iterator sliceIter = slices.iterator(); + IGridSlice slice = null; + for (int i = 0; i < numHours; i++) { + Date time = new Date(startTime + (i * TimeUtil.MILLIS_PER_HOUR)); + try { + for (Coordinate coordinate : coordinates) { + CoordinateInfo info = infoMap.get(coordinate); + boolean containsCoord = info.containsCoord; + GFEPointDataView view = info.getView(time); + int x = info.x; + int y = info.y; - view.setData("time", Type.LONG, SI.MILLI(SI.SECOND), tr - .getStart().getTime()); - view.setData("lat", Type.FLOAT, null, coordinate.y); - view.setData("lon", Type.FLOAT, null, coordinate.x); + // initially set all requested params to missing + view.setData(parmId.getParmName(), Type.FLOAT, + Unit.ONE, 999.0f); - // initially set all requested params to missing - for (String param : parameters) { - view.setData(param, Type.FLOAT, Unit.ONE, 999.0f); - } + if (containsCoord) { - if (containsCoord) { + // find the slice that contains the current time + if ((slice == null) && sliceIter.hasNext()) { + slice = sliceIter.next(); + } + if ((slice != null) + && (time.getTime() >= slice.getValidTime() + .getEnd().getTime()) + && sliceIter.hasNext()) { + slice = sliceIter.next(); + } + if ((slice != null) + && slice.getValidTime().contains(time)) { + Unit unit = slice.getGridInfo() + .getUnitObject(); - // set the retrieved data - for (IGridSlice slice : sr.getPayload()) { - String param = slice.getGridInfo().getParmID() - .getParmName(); - Unit unit = slice.getGridInfo().getUnitObject(); - if (slice instanceof VectorGridSlice) { - VectorGridSlice gs = (VectorGridSlice) slice; - Type type = Type.FLOAT; - view.setData(param + "Dir", type, - NonSI.DEGREE_ANGLE, gs.getDirGrid() - .get(x, y)); - view.setData(param + "Spd", type, unit, gs - .getMagGrid().get(x, y)); - } else if (slice instanceof ScalarGridSlice) { - ScalarGridSlice gs = (ScalarGridSlice) slice; - float val = gs.getScalarGrid().get(x, y); - Type type = Type.FLOAT; - view.setData(param, type, unit, val); - } else if (slice instanceof DiscreteGridSlice) { - DiscreteGridSlice gs = (DiscreteGridSlice) slice; - byte value = gs.getDiscreteGrid().get(x, y); - String key = gs.getKeys()[value].toString(); - Type type = Type.STRING; - view.setData(param, type, unit, key); + Type type; + GridType gridType = slice.getGridInfo() + .getGridType(); + switch (gridType) { + case VECTOR: + VectorGridSlice vectorSlice = (VectorGridSlice) slice; + type = Type.FLOAT; + view.setData(param + "Dir", type, + NonSI.DEGREE_ANGLE, vectorSlice + .getDirGrid().get(x, y)); + view.setData(param + "Spd", type, unit, + vectorSlice.getMagGrid().get(x, y)); + break; + case SCALAR: + ScalarGridSlice scalarSlice = (ScalarGridSlice) slice; + float val = scalarSlice.getScalarGrid() + .get(x, y); + type = Type.FLOAT; + view.setData(param, type, unit, val); + break; + case DISCRETE: + DiscreteGridSlice discreteSlice = (DiscreteGridSlice) slice; + byte discreteValue = discreteSlice + .getDiscreteGrid().get(x, y); + String discreteKey = discreteSlice + .getKeys()[discreteValue] + .toString(); + type = Type.STRING; + view.setData(param, type, unit, discreteKey); + break; + case WEATHER: + WeatherGridSlice weatherSlice = (WeatherGridSlice) slice; + byte wxValue = weatherSlice + .getWeatherGrid().get(x, y); + String wxKey = weatherSlice.getKeys()[wxValue] + .toString(); + type = Type.STRING; + view.setData(param, type, unit, wxKey); + break; + + default: + String msg = "Unknown gridType: " + + gridType + " for " + parmId + + ", data will be ignored."; + statusHandler.error(msg); + resp.addMessage(msg); + break; + } } } } - container.append(view); + } catch (Exception e) { + resp.addMessage(e.getMessage()); } - } catch (Exception e) { - resp.addMessage(e.getMessage()); } - } GFEPointDataContainers gfeContainers = new GFEPointDataContainers(); @@ -235,11 +248,17 @@ public class GetPointDataHandler extends BaseGfeRequestHandler implements // Keep the results list in the same order as the request's // coordinate list. for (Coordinate coordinate : coordinates) { - containers.add(infoMap.get(coordinate).container); + CoordinateInfo info = infoMap.get(coordinate); + + List views = new ArrayList( + info.viewMap.values()); + + GFEPointDataContainer container = new GFEPointDataContainer(); + container.setViews(views); + containers.add(container); } gfeContainers.setContainers(containers); - ((ServerResponse) resp) - .setPayload(gfeContainers); + resp.setPayload(gfeContainers); return resp; } @@ -247,12 +266,41 @@ public class GetPointDataHandler extends BaseGfeRequestHandler implements * Information for a coordinate. */ private class CoordinateInfo { - GFEPointDataContainer container; + Map viewMap; boolean containsCoord; int x; int y; + + Coordinate coordinate; + + public CoordinateInfo(int numHours, Coordinate coordinate, + GridLocation gloc) { + viewMap = new TreeMap(); + this.coordinate = coordinate; + + Point gridCell = gloc.gridCoordinate(coordinate); + x = gridCell.x; + y = gridCell.y; + + containsCoord = !((x < 0) || (x >= gloc.getNx()) || (y < 0) || (y >= gloc + .getNy())); + } + + public GFEPointDataView getView(Date fcstHour) { + GFEPointDataView view = viewMap.get(fcstHour); + if (view == null) { + view = new GFEPointDataView(); + view.setData("time", Type.LONG, SI.MILLI(SI.SECOND), + fcstHour.getTime()); + view.setData("lat", Type.FLOAT, null, coordinate.y); + view.setData("lon", Type.FLOAT, null, coordinate.x); + viewMap.put(fcstHour, view); + } + + return view; + } } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataContainer.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataContainer.java index a356a6e69c..cc410956a3 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataContainer.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataContainer.java @@ -26,19 +26,19 @@ import java.util.Set; import com.raytheon.uf.common.pointdata.IPointDataContainerReader; import com.raytheon.uf.common.pointdata.IPointDataViewReader; -import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; /** - * TODO Add Description + * GFE Point Data Container * *
  * 
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Aug 4, 2009            njensen     Initial creation
+ * Aug  4, 2009            njensen     Initial creation
+ * Apr 23, 2014  #3006     randerso    Added toString to aid in debugging
  * 
  * 
* @@ -47,8 +47,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; */ @DynamicSerialize -public class GFEPointDataContainer implements IPointDataContainerReader, - ISerializableObject { +public class GFEPointDataContainer implements IPointDataContainerReader { @DynamicSerializeElement private List views = new ArrayList(); @@ -104,4 +103,14 @@ public class GFEPointDataContainer implements IPointDataContainerReader, this.views = views; } + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return views.toString(); + } + } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataContainers.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataContainers.java index 16344e4793..a53cd180fc 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataContainers.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataContainers.java @@ -33,7 +33,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Mar 6, 2013 1735 rferrel Initial creation + * Mar 6, 2013 1735 rferrel Initial creation + * Apr 23, 2014 #3006 randerso Added toString to aid in debugging * * * @@ -86,4 +87,15 @@ public class GFEPointDataContainers { public GFEPointDataContainer getContainer(int index) { return containers.get(index); } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return containers.toString(); + } + } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataView.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataView.java index 95091655fd..4124d0154d 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataView.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/point/GFEPointDataView.java @@ -31,12 +31,11 @@ import javax.persistence.Transient; import com.raytheon.uf.common.pointdata.IPointDataContainerReader; import com.raytheon.uf.common.pointdata.IPointDataViewReader; import com.raytheon.uf.common.pointdata.PointDataDescription.Type; -import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; /** - * TODO Add Description + * GFE Point Data View * *
  * 
@@ -44,6 +43,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Aug 4, 2009            njensen     Initial creation
+ * Apr 23, 2014  #3006    randerso    Added toString to aid in debugging
+ *                                    Fixed conversion of Double to float
  * 
  * 
* @@ -52,8 +53,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; */ @DynamicSerialize -public class GFEPointDataView implements IPointDataViewReader, - ISerializableObject { +public class GFEPointDataView implements IPointDataViewReader { @DynamicSerializeElement private Map valueMap = new HashMap(); @@ -99,7 +99,7 @@ public class GFEPointDataView implements IPointDataViewReader, Type type = pd.getType(); Object obj = pd.getValue(); if (type == Type.FLOAT) { - return (Float) obj; + return ((Number) obj).floatValue(); } else if (type == Type.STRING) { return Float.valueOf((String) obj); } else { @@ -264,4 +264,14 @@ public class GFEPointDataView implements IPointDataViewReader, parent = container; } + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return valueMap.toString(); + } + }