From 00c44b3a08e63c0bbe6ad81982bc8ec93028afb5 Mon Sep 17 00:00:00 2001 From: Richard Peter Date: Tue, 3 Dec 2013 12:52:29 -0600 Subject: [PATCH] Issue #2551: Update NCEP objects to extend PersistablePluginDataObject. Amend: Remove IDecoderGettable. Change-Id: Ic01ebe373da1946a992e10150c1da34119e10d6b Former-commit-id: 796293c036ca3d423e619fa2ec38b403e74c680d [formerly 98117b4093d0130b6bb5db3a39862e582d35942d] [formerly f8f3ebc6e9ca1b7400c27e57a2d95d2ae77ac59e [formerly 0778a7f0123dd150894458fef6958fcdd9da39b6]] Former-commit-id: f8f3ebc6e9ca1b7400c27e57a2d95d2ae77ac59e Former-commit-id: 1a554d963203dd3527c6edd0c2d8089373def1ad --- .../dataplugin/npp/viirs/VIIRSDataRecord.java | 49 +--- .../common/dataplugin/airep/AirepRecord.java | 122 +--------- .../common/dataplugin/ncscd/NcScdRecord.java | 19 +- .../common/dataplugin/nctaf/NcTafRecord.java | 74 +----- .../dataplugin/ncuair/NcUairRecord.java | 15 +- .../common/dataplugin/pirep/PirepRecord.java | 221 +----------------- .../common/dataplugin/sgwh/SgwhRecord.java | 78 +------ .../common/dataplugin/sgwhv/SgwhvRecord.java | 83 +------ .../common/dataplugin/ssha/SshaRecord.java | 72 +----- .../ncep/edex/plugin/pirep/PirepDecoder.java | 32 +-- 10 files changed, 39 insertions(+), 726 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/VIIRSDataRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/VIIRSDataRecord.java index dee486f783..f1c5bbde60 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/VIIRSDataRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/VIIRSDataRecord.java @@ -19,10 +19,6 @@ **/ package com.raytheon.uf.common.dataplugin.npp.viirs; -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; - import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.Column; @@ -36,7 +32,6 @@ import javax.persistence.UniqueConstraint; import org.geotools.coverage.grid.GridGeometry2D; import org.hibernate.annotations.Index; -import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; @@ -60,7 +55,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * May 07, 2013 1869 bsteffen Remove dataURI column from * PluginDataObject. * Aug 30, 2013 2298 rjpeter Make getPluginName abstract - * + * Dec 03, 2013 2551 rjpeter Removed get/setPersistenceTime override * * * @author mschenke @@ -244,37 +239,6 @@ public class VIIRSDataRecord extends PersistablePluginDataObject implements this.channelType = channelType; } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.common.dataplugin.persist.IPersistable#getPersistenceTime - * () - */ - @Override - public Date getPersistenceTime() { - Calendar c = getInsertTime(); - if (c == null) { - return null; - } - - return c.getTime(); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.common.dataplugin.persist.IPersistable#setPersistenceTime - * (java.util.Date) - */ - @Override - public void setPersistenceTime(Date persistTime) { - Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT")); - c.setTime(persistTime); - setInsertTime(c); - } - /** * Get the name of the dataset for the level * @@ -285,17 +249,6 @@ public class VIIRSDataRecord extends PersistablePluginDataObject implements return "Data-" + level; } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.common.dataplugin.PluginDataObject#getDecoderGettable() - */ - @Override - public IDecoderGettable getDecoderGettable() { - return null; - } - @Override @Column @Access(AccessType.PROPERTY) diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.airep/src/gov/noaa/nws/ncep/common/dataplugin/airep/AirepRecord.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.airep/src/gov/noaa/nws/ncep/common/dataplugin/airep/AirepRecord.java index 918d5bb082..f09569e5e0 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.airep/src/gov/noaa/nws/ncep/common/dataplugin/airep/AirepRecord.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.airep/src/gov/noaa/nws/ncep/common/dataplugin/airep/AirepRecord.java @@ -10,9 +10,6 @@ import java.text.DateFormat; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; import javax.measure.converter.UnitConverter; import javax.measure.quantity.Angle; @@ -39,10 +36,9 @@ import javax.xml.bind.annotation.XmlRootElement; import org.hibernate.annotations.Index; -import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.dataplugin.persist.IPersistable; +import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; import com.raytheon.uf.common.geospatial.ISpatialEnabled; import com.raytheon.uf.common.pointdata.IPointData; import com.raytheon.uf.common.pointdata.PointDataView; @@ -78,7 +74,7 @@ import com.vividsolutions.jts.geom.Geometry; * PluginDataObject. * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Sep 05, 2013 2316 bsteffen Unify airep and ncairep. - * + * Dec 03, 2013 2551 rjpeter Extend PersistablePluginDataObject * * * @author jkorman @@ -97,8 +93,8 @@ import com.vividsolutions.jts.geom.Geometry; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize -public class AirepRecord extends PluginDataObject implements ISpatialEnabled, - IDecoderGettable, IPointData, IPersistable { +public class AirepRecord extends PersistablePluginDataObject implements + ISpatialEnabled, IPointData { private static final long serialVersionUID = 1L; @@ -115,31 +111,9 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled, private static UnitConverter ftToHft = NonSI.FOOT.getConverterTo(SI .HECTO(NonSI.FOOT)); - private static final HashMap PARM_MAP = new HashMap(); - // private static final HashMap WX_MAP = new // HashMap(); - static { - PARM_MAP.put("T", SFC_TEMP); - PARM_MAP.put("WS", SFC_WNDSPD); - PARM_MAP.put("WD", SFC_WNDDIR); - PARM_MAP.put("NLAT", STA_LAT); - PARM_MAP.put("NLON", STA_LON); - PARM_MAP.put("FLT_LVL", UA_FLTLVL); - - // WX_MAP.put(0, "CLR"); - // WX_MAP.put(1, "SCT"); - // WX_MAP.put(2, "BKN"); - // WX_MAP.put(3, "CONT"); - // WX_MAP.put(4, "LIGHTNING"); - // WX_MAP.put(5, "DZRA"); - // WX_MAP.put(6, "CONT RA"); - // WX_MAP.put(7, "CONT SN"); - // WX_MAP.put(8, "SH"); - // WX_MAP.put(9, "TSRA"); - } - @Transient @DynamicSerializeElement @XmlAttribute @@ -647,85 +621,6 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled, identifier = dataURI; } - /** - * Get the IDecoderGettable reference for this record. - * - * @return The IDecoderGettable reference for this record. - */ - @Override - public IDecoderGettable getDecoderGettable() { - return this; - } - - /** - * Get the value of a parameter that is represented as a String. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return The String value of the parameter. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public String getString(String paramName) { - if ("STA".matches(paramName)) { - return this.getStationId(); - } - return null; - } - - /** - * Get the value and units of a named parameter within this observation. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return An Amount with value and units. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public Amount getValue(String paramName) { - Amount a = null; - - String pName = PARM_MAP.get(paramName); - - if (SFC_TEMP.equals(pName) && (temp != null)) { - a = new Amount(temp, TEMPERATURE_UNIT); - } else if (SFC_WNDSPD.equals(pName) && (windSpeed != null)) { - a = new Amount(windSpeed, WIND_SPEED_UNIT); - } else if (SFC_WNDDIR.equals(pName) && (windDirection != null)) { - a = new Amount(windDirection, WIND_DIR_UNIT); - } else if (STA_LAT.equals(pName)) { - a = new Amount(this.getLatitude(), LOCATION_UNIT); - } else if (STA_LON.equals(pName)) { - a = new Amount(this.getLongitude(), LOCATION_UNIT); - } else if (UA_FLTLVL.equals(pName) && (getFlightLevel() != null)) { - a = new Amount(this.getFlightLevel().intValue(), ALTITUDE_UNIT); - - } - return a; - } - - /** - * Get the value of a parameter that is represented as a String. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return The String value of the parameter. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public Collection getValues(String paramName) { - return null; - } - - @Override - public String[] getStrings(String paramName) { - if ("FLT_HZD".matches(paramName) && (flightHazard != null)) { - String[] flightHazards = { flightHazard.toString() }; - return flightHazards; - } - return null; - } - @Override public AircraftObsLocation getSpatialObject() { return location; @@ -860,15 +755,6 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled, return true; } - @Override - public Date getPersistenceTime() { - return this.dataTime.getRefTime(); - } - - @Override - public void setPersistenceTime(Date persistTime) { - } - /* * (non-Javadoc) * diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncscd/src/gov/noaa/nws/ncep/common/dataplugin/ncscd/NcScdRecord.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncscd/src/gov/noaa/nws/ncep/common/dataplugin/ncscd/NcScdRecord.java index 8b7473c804..496a5ac266 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncscd/src/gov/noaa/nws/ncep/common/dataplugin/ncscd/NcScdRecord.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncscd/src/gov/noaa/nws/ncep/common/dataplugin/ncscd/NcScdRecord.java @@ -4,7 +4,6 @@ import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN; import java.util.Calendar; import java.util.Collection; -import java.util.Date; import javax.measure.quantity.Length; import javax.measure.quantity.Temperature; @@ -31,7 +30,7 @@ import org.hibernate.annotations.Index; import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.dataplugin.persist.IPersistable; +import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; import com.raytheon.uf.common.geospatial.ISpatialEnabled; import com.raytheon.uf.common.pointdata.IPointData; import com.raytheon.uf.common.pointdata.PointDataView; @@ -62,7 +61,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * Apr 04, 2013 1293 bkowal Removed references to hdffileid. * Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation. * May 07, 2013 1869 bsteffen Remove dataURI column from PluginDataObject. - * Aug 30, 2013 2298 rjpeter Make getPluginName abstract + * Aug 30, 2013 2298 rjpeter Make getPluginName abstract. + * Dec 03, 2013 2551 rjpeter Extend PersistablePluginDataObject. * * * @author T.Lee @@ -81,8 +81,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize -public class NcScdRecord extends PluginDataObject implements ISpatialEnabled, - IDecoderGettable, IPointData, IPersistable { +public class NcScdRecord extends PersistablePluginDataObject implements + ISpatialEnabled, IDecoderGettable, IPointData { private static final long serialVersionUID = 1L; @@ -495,15 +495,6 @@ public class NcScdRecord extends PluginDataObject implements ISpatialEnabled, * null reference is returned. */ - @Override - public Date getPersistenceTime() { - return this.dataTime.getRefTime(); - } - - @Override - public void setPersistenceTime(Date persistTime) { - } - /* * (non-Javadoc) * diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.nctaf/src/gov/noaa/nws/ncep/common/dataplugin/nctaf/NcTafRecord.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.nctaf/src/gov/noaa/nws/ncep/common/dataplugin/nctaf/NcTafRecord.java index b26e3018a8..eba70056ec 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.nctaf/src/gov/noaa/nws/ncep/common/dataplugin/nctaf/NcTafRecord.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.nctaf/src/gov/noaa/nws/ncep/common/dataplugin/nctaf/NcTafRecord.java @@ -10,7 +10,6 @@ import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN; import java.util.ArrayList; import java.util.Calendar; -import java.util.Collection; import java.util.Date; import java.util.HashSet; import java.util.Iterator; @@ -36,10 +35,9 @@ import javax.xml.bind.annotation.XmlRootElement; import org.apache.commons.lang.time.DateUtils; import org.hibernate.annotations.Index; -import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.dataplugin.persist.IPersistable; +import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; import com.raytheon.uf.common.geospatial.ISpatialEnabled; import com.raytheon.uf.common.pointdata.IPointData; import com.raytheon.uf.common.pointdata.PointDataView; @@ -77,8 +75,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation. * May 07, 2013 1869 bsteffen Remove dataURI column from * PluginDataObject. - * Aug 30, 2013 2298 rjpeter Make getPluginName abstract - * + * Aug 30, 2013 2298 rjpeter Make getPluginName abstract. + * Dec 03, 2013 2551 rjpeter Extend PersistablePluginDataObject. * * * @author sgurung @@ -96,8 +94,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; @DynamicSerialize @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement -public class NcTafRecord extends PluginDataObject implements ISpatialEnabled, - IDecoderGettable, IPointData, IPersistable { +public class NcTafRecord extends PersistablePluginDataObject implements + ISpatialEnabled, IPointData { private static final long serialVersionUID = 1L; @@ -621,17 +619,6 @@ public class NcTafRecord extends PluginDataObject implements ISpatialEnabled, } - /** - * Get the IDecoderGettable reference for this record. - * - * @return The IDecoderGettable reference for this record. Null for this - * class. - */ - @Override - public IDecoderGettable getDecoderGettable() { - return null; - } - @Override public SurfaceObsLocation getSpatialObject() { return location; @@ -723,57 +710,6 @@ public class NcTafRecord extends PluginDataObject implements ISpatialEnabled, this.pointDataView = pointDataView; } - /** - * Get the time to use for persisting this data. - * - * @return The persistence time for this data. - */ - @Override - public Date getPersistenceTime() { - if (getInsertTime() == null) { - return null; - } else { - return getInsertTime().getTime(); - } - } - - /** - * Set the time to be used for the persistence time for this object. - * - * @param persistTime - * The persistence time to be used. - */ - @Override - public void setPersistenceTime(Date persistTime) { - Calendar insertTime = Calendar.getInstance(); - insertTime.setTime(persistTime); - setInsertTime(insertTime); - } - - @Override - public Amount getValue(String paramName) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Collection getValues(String paramName) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getString(String paramName) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String[] getStrings(String paramName) { - // TODO Auto-generated method stub - return null; - } - /** * * @return The string containing the change group text diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncuair/src/gov/noaa/nws/ncep/common/dataplugin/ncuair/NcUairRecord.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncuair/src/gov/noaa/nws/ncep/common/dataplugin/ncuair/NcUairRecord.java index 6a023c45eb..3faefa1d77 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncuair/src/gov/noaa/nws/ncep/common/dataplugin/ncuair/NcUairRecord.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncuair/src/gov/noaa/nws/ncep/common/dataplugin/ncuair/NcUairRecord.java @@ -18,7 +18,7 @@ * Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation. * May 07, 2013 1869 bsteffen Remove dataURI column from * PluginDataObject. - * + * Dec 03, 2013 2551 rjpeter Remove get/setPersistenceTime * * * This code has been developed by the SIB for use in the AWIPS2 system. @@ -30,7 +30,6 @@ package gov.noaa.nws.ncep.common.dataplugin.ncuair; import java.util.Calendar; import java.util.Collection; -import java.util.Date; import java.util.HashSet; import java.util.Set; @@ -527,18 +526,6 @@ public class NcUairRecord extends PersistablePluginDataObject implements this.pointDataView = pointDataView; } - @Override - public Date getPersistenceTime() { - // return this.dataTime.getRefTime(); - return null; - } - - @Override - public void setPersistenceTime(Date persistTime) { - // TODO Auto-generated method stub - - } - @Override public Amount getValue(String paramName) { // TODO Auto-generated method stub diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepRecord.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepRecord.java index c70c21b112..cde4508c04 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepRecord.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.pirep/src/gov/noaa/nws/ncep/common/dataplugin/pirep/PirepRecord.java @@ -6,9 +6,6 @@ package gov.noaa.nws.ncep.common.dataplugin.pirep; **/ import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; import java.util.HashSet; import java.util.Set; @@ -37,10 +34,9 @@ import javax.xml.bind.annotation.XmlRootElement; import org.hibernate.annotations.Index; -import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.dataplugin.persist.IPersistable; +import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; import com.raytheon.uf.common.geospatial.ISpatialEnabled; import com.raytheon.uf.common.pointdata.IPointData; import com.raytheon.uf.common.pointdata.PointDataView; @@ -76,7 +72,7 @@ import com.vividsolutions.jts.geom.Geometry; * PluginDataObject. * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep. - * + * Dec 03, 2013 2551 rjpeter Extend PersistablePluginDataObject. * * * @author jkorman @@ -94,8 +90,8 @@ import com.vividsolutions.jts.geom.Geometry; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize -public class PirepRecord extends PluginDataObject implements ISpatialEnabled, - IDecoderGettable, IPointData, IPersistable { +public class PirepRecord extends PersistablePluginDataObject implements + ISpatialEnabled, IPointData { private static final long serialVersionUID = 1L; @@ -111,51 +107,11 @@ public class PirepRecord extends PluginDataObject implements ISpatialEnabled, public static final Unit LOCATION_UNIT = NonSI.DEGREE_ANGLE; - private static final HashMap PARM_MAP = new HashMap(); - - private static final HashMap ICING_MAP = new HashMap(); - - private static final HashMap TURB_MAP = new HashMap(); - static { - PARM_MAP.put("T", SFC_TEMP); - PARM_MAP.put("WS", SFC_WNDSPD); - PARM_MAP.put("WD", SFC_WNDDIR); - PARM_MAP.put("NLAT", STA_LAT); - PARM_MAP.put("NLON", STA_LON); - PARM_MAP.put("FLT_LVL", UA_FLTLVL); - PARM_MAP.put("ICT", UA_ICETYPE); - PARM_MAP.put("ICI", UA_ICEINTENSE); - PARM_MAP.put("TBF", UA_TURBFREQ); - PARM_MAP.put("TBI", UA_TURBINTENSE); - PARM_MAP.put("TOP_HGT", UA_TOPHGT); - PARM_MAP.put("BOT_HGT", UA_BOTHGT); - - ICING_MAP.put("", new Integer(0)); - ICING_MAP.put("NEG", new Integer(1)); - ICING_MAP.put("TRACE", new Integer(2)); - ICING_MAP.put("TRACELGT", new Integer(3)); - ICING_MAP.put("LGT", new Integer(4)); - ICING_MAP.put("LGTMOD", new Integer(5)); - ICING_MAP.put("MOD", new Integer(6)); - ICING_MAP.put("MODSEV", new Integer(7)); - ICING_MAP.put("SEV", new Integer(8)); - - TURB_MAP.put("", new Integer(0)); - TURB_MAP.put("NEG", new Integer(1)); - TURB_MAP.put("SMOOTHLGT", new Integer(2)); - TURB_MAP.put("LGT", new Integer(3)); - TURB_MAP.put("LGTMOD", new Integer(4)); - TURB_MAP.put("MOD", new Integer(5)); - TURB_MAP.put("MODSEV", new Integer(6)); - TURB_MAP.put("SEV", new Integer(7)); - TURB_MAP.put("EXTRM", new Integer(8)); - } + @Transient + private final PirepLayerData maxPirepLayerData = null; @Transient - private PirepLayerData maxPirepLayerData = null; - - @Transient - private boolean display = true; + private final boolean display = true; @Transient @XmlAttribute @@ -601,160 +557,6 @@ public class PirepRecord extends PluginDataObject implements ISpatialEnabled, identifier = dataURI; } - /** - * Get the IDecoderGettable reference for this record. - * - * @return The IDecoderGettable reference for this record. - */ - @Override - public IDecoderGettable getDecoderGettable() { - return this; - } - - /** - * Get the value of a parameter that is represented as a String. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return The String value of the parameter. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public String getString(String paramName) { - String retData = null; - if ("STA".matches(paramName)) { - retData = getStationId(); - } else if ("TEXT".equals(paramName)) { - retData = obsText; - } - return retData; - } - - /** - * Get the value and units of a named parameter within this observation. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return An Amount with value and units. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public Amount getValue(String paramName) { - Amount a = null; - - String pName = PARM_MAP.get(paramName); - if (display) { - if (SFC_TEMP.equals(pName) && (temp != null)) { - a = new Amount(temp, TEMPERATURE_UNIT); - } else if (SFC_WNDSPD.equals(pName) && (windSpeed != null)) { - a = new Amount(windSpeed, WIND_SPEED_UNIT); - } else if (SFC_WNDDIR.equals(pName) && (windDirection != null)) { - a = new Amount(windDirection, WIND_DIR_UNIT); - } else if (STA_LAT.equals(pName)) { - a = new Amount(this.getLatitude(), LOCATION_UNIT); - } else if (STA_LON.equals(pName)) { - a = new Amount(this.getLongitude(), LOCATION_UNIT); - } else if (UA_FLTLVL.equals(pName) && (getFlightLevel() != null)) { - a = new Amount(this.getFlightLevel().intValue(), ALTITUDE_UNIT); - // if used, need to modify raytheon code - // } else if (UA_TOPHGT.equals(pName) && maxPirepLayerData != - // null - // && maxPirepLayerData.getTopLayerHeight() != null) { - // a = new - // Amount(maxPirepLayerData.getTopLayerHeight().intValue(), - // ALTITUDE_UNIT); - // } else if (UA_BOTHGT.equals(pName) && maxPirepLayerData != - // null - // && maxPirepLayerData.getBaseLayerHeight() != null) { - // a = new - // Amount(maxPirepLayerData.getBaseLayerHeight().intValue(), - // ALTITUDE_UNIT); - } - } - return a; - } - - /** - * Get the value of a parameter that is represented as a String. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return The String value of the parameter. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public Collection getValues(String paramName) { - return null; - } - - @Override - public String[] getStrings(String paramName) { - if ("ICI".matches(paramName)) { - int rank = -1; - String iceIntensity = null; - for (PirepLayerData layer : this.ancPirepData) { - String intensity = ""; - if (layer.getLayerType().equals( - PirepLayerData.LAYER_TYP_ICING)) { - if (layer.getIceInten() != null) { - intensity = layer.getIceInten(); - } - // if (layer.getSecondValue() != null) { - // intensity += layer.getSecondValue(); - // } - - if (ICING_MAP.get(intensity).intValue() > rank) { - rank = ICING_MAP.get(intensity).intValue(); - iceIntensity = intensity; - maxPirepLayerData = layer; - } - } - } - if (iceIntensity != null) { - String[] maxIntensity = { iceIntensity }; - return maxIntensity; - } else { - display = false; - } - } else if ("ICT".matches(paramName) && (maxPirepLayerData != null)) { - String[] maxType = { maxPirepLayerData.getIceType() }; - return maxType; - } else if ("TBI".matches(paramName)) { - int rank = -1; - String turbIntensity = null; - for (PirepLayerData layer : this.ancPirepData) { - String intensity = ""; - if (layer.getLayerType().equals( - PirepLayerData.LAYER_TYP_TURBC)) { - if (layer.getTurbInten() != null) { - intensity = layer.getTurbInten(); - } - // if (layer.getSecondValue() != null) { - // intensity += layer.getSecondValue(); - // } - - if (TURB_MAP.get(intensity).intValue() > rank) { - rank = TURB_MAP.get(intensity).intValue(); - turbIntensity = intensity; - maxPirepLayerData = layer; - } - } - } - if (turbIntensity != null) { - String[] maxIntensity = { turbIntensity }; - return maxIntensity; - } else { - display = false; - } - } else if ("TBT".matches(paramName) && (maxPirepLayerData != null)) { - String[] maxType = { maxPirepLayerData.getTurbType() }; - return maxType; - } else if ("TBF".matches(paramName) && (maxPirepLayerData != null)) { - // Turbulence Frequency Types do not get stored. - } - return null; - } - @Override public AircraftObsLocation getSpatialObject() { return location; @@ -817,15 +619,6 @@ public class PirepRecord extends PluginDataObject implements ISpatialEnabled, return true; } - @Override - public Date getPersistenceTime() { - return this.dataTime.getRefTime(); - } - - @Override - public void setPersistenceTime(Date persistTime) { - } - /* * (non-Javadoc) * diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.sgwh/src/gov/noaa/nws/ncep/common/dataplugin/sgwh/SgwhRecord.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.sgwh/src/gov/noaa/nws/ncep/common/dataplugin/sgwh/SgwhRecord.java index 90bf018bd1..6e7b5acac9 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.sgwh/src/gov/noaa/nws/ncep/common/dataplugin/sgwh/SgwhRecord.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.sgwh/src/gov/noaa/nws/ncep/common/dataplugin/sgwh/SgwhRecord.java @@ -3,8 +3,6 @@ package gov.noaa.nws.ncep.common.dataplugin.sgwh; import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN; import java.util.Calendar; -import java.util.Collection; -import java.util.Date; import javax.persistence.Access; import javax.persistence.AccessType; @@ -18,10 +16,9 @@ import javax.persistence.UniqueConstraint; import org.hibernate.annotations.Index; -import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.dataplugin.persist.IPersistable; +import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; import com.raytheon.uf.common.pointdata.IPointData; import com.raytheon.uf.common.pointdata.PointDataView; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; @@ -45,7 +42,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation. * May 07, 2013 1869 bsteffen Remove dataURI column from * PluginDataObject. - * Aug 30, 2013 2298 rjpeter Make getPluginName abstract + * Aug 30, 2013 2298 rjpeter Make getPluginName abstract. + * Dec 03, 2013 2551 rjpeter Extend PersistablePluginDataObject. * * * @author chin chen @@ -61,8 +59,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @org.hibernate.annotations.Table(appliesTo = "sgwh", indexes = { @Index(name = "sgwh_refTimeIndex", columnNames = { "refTime", "forecastTime" }) }) @DynamicSerialize -public class SgwhRecord extends PluginDataObject implements IDecoderGettable, - IPointData, IPersistable { +public class SgwhRecord extends PersistablePluginDataObject implements + IPointData { private static final long serialVersionUID = 1L; /** Satellite Identification */ @@ -1584,77 +1582,11 @@ public class SgwhRecord extends PluginDataObject implements IDecoderGettable, this.obsTime = obsTime; } - /** - * Get the value and units of a named parameter within this observation. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return An Amount with value and units. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public Amount getValue(String paramName) { - return null; - } - - /** - * Get the value of a parameter that is represented as a String. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return The String value of the parameter. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public String getString(String paramName) { - return null; - } - - /** - * Get the value of a parameter that is represented as a String. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return The String value of the parameter. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public Collection getValues(String paramName) { - return null; - } - - /** - * Get the IDecoderGettable reference for this record. - * - * @return The IDecoderGettable reference for this record. - */ - @Override - public IDecoderGettable getDecoderGettable() { - return this; - } - @Override public void setDataURI(String dataURI) { identifier = dataURI; } - @Override - public String[] getStrings(String paramName) { - return null; - } - - @Override - public Date getPersistenceTime() { - return this.dataTime.getRefTime(); - - } - - @Override - public void setPersistenceTime(Date persistTime) { - // TODO Auto-generated method stub - - } - @Override public PointDataView getPointDataView() { return this.pointDataView; diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.sgwhv/src/gov/noaa/nws/ncep/common/dataplugin/sgwhv/SgwhvRecord.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.sgwhv/src/gov/noaa/nws/ncep/common/dataplugin/sgwhv/SgwhvRecord.java index 9ff61d069f..1efbae3614 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.sgwhv/src/gov/noaa/nws/ncep/common/dataplugin/sgwhv/SgwhvRecord.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.sgwhv/src/gov/noaa/nws/ncep/common/dataplugin/sgwhv/SgwhvRecord.java @@ -3,8 +3,6 @@ package gov.noaa.nws.ncep.common.dataplugin.sgwhv; import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN; import java.util.Calendar; -import java.util.Collection; -import java.util.Date; import javax.persistence.Access; import javax.persistence.AccessType; @@ -18,19 +16,18 @@ import javax.persistence.UniqueConstraint; import org.hibernate.annotations.Index; -import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.dataplugin.persist.IPersistable; +import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; import com.raytheon.uf.common.pointdata.IPointData; import com.raytheon.uf.common.pointdata.PointDataView; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; /** - * SgwhvRecord - * This java class performs the mapping to the database for BUFR Sgwhv. - * + * SgwhvRecord This java class performs the mapping to the database for BUFR + * Sgwhv. + * *
  * 
  * SOFTWARE HISTORY
@@ -46,7 +43,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
  * Apr 12, 2013 1857        bgonzale    Added SequenceGenerator annotation.
  * May 07, 2013 1869        bsteffen    Remove dataURI column from
  *                                      PluginDataObject.
- * Aug 30, 2013 2298        rjpeter     Make getPluginName abstract
+ * Aug 30, 2013 2298        rjpeter     Make getPluginName abstract.
+ * Dec 03, 2013 2551        rjpeter     Extend PersistablePluginDataObject.
  * 
* * @author chin chen @@ -62,8 +60,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @org.hibernate.annotations.Table(appliesTo = "sgwhv", indexes = { @Index(name = "sgwhv_refTimeIndex", columnNames = { "refTime", "forecastTime" }) }) @DynamicSerialize -public class SgwhvRecord extends PluginDataObject implements IDecoderGettable, - IPointData, IPersistable { +public class SgwhvRecord extends PersistablePluginDataObject implements + IPointData { private static final long serialVersionUID = 1L; private static final float RMISSD = IDecoderConstantsN.FLOAT_MISSING; @@ -458,76 +456,11 @@ public class SgwhvRecord extends PluginDataObject implements IDecoderGettable, this.obsTime = obsTime; } - /** - * Get the value and units of a named parameter within this observation. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return An Amount with value and units. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public Amount getValue(String paramName) { - return null; - } - - /** - * Get the value of a parameter that is represented as a String. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return The String value of the parameter. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public String getString(String paramName) { - return null; - } - - /** - * Get the value of a parameter that is represented as a String. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return The String value of the parameter. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public Collection getValues(String paramName) { - return null; - } - - /** - * Get the IDecoderGettable reference for this record. - * - * @return The IDecoderGettable reference for this record. - */ - @Override - public IDecoderGettable getDecoderGettable() { - return this; - } - @Override public void setDataURI(String dataURI) { identifier = dataURI; } - @Override - public String[] getStrings(String paramName) { - return null; - } - - @Override - public Date getPersistenceTime() { - return this.dataTime.getRefTime(); - } - - @Override - public void setPersistenceTime(Date persistTime) { - // TODO Auto-generated method stub - - } - @Override public PointDataView getPointDataView() { return this.pointDataView; diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ssha/src/gov/noaa/nws/ncep/common/dataplugin/ssha/SshaRecord.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.ssha/src/gov/noaa/nws/ncep/common/dataplugin/ssha/SshaRecord.java index c659918d9a..4da2eb6d11 100644 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ssha/src/gov/noaa/nws/ncep/common/dataplugin/ssha/SshaRecord.java +++ b/ncep/gov.noaa.nws.ncep.common.dataplugin.ssha/src/gov/noaa/nws/ncep/common/dataplugin/ssha/SshaRecord.java @@ -3,8 +3,6 @@ package gov.noaa.nws.ncep.common.dataplugin.ssha; import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN; import java.util.Calendar; -import java.util.Collection; -import java.util.Date; import javax.persistence.Access; import javax.persistence.AccessType; @@ -18,7 +16,6 @@ import javax.persistence.UniqueConstraint; import org.hibernate.annotations.Index; -import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.persist.IPersistable; @@ -46,6 +43,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * May 07, 2013 1869 bsteffen Remove dataURI column from * PluginDataObject. * Aug 30, 2013 2298 rjpeter Make getPluginName abstract + * Dec 03, 2013 2551 rjpeter Removed get/setPersistenceTime override. * * * @author Chin Chen @@ -63,7 +61,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; "refTime", "forecastTime" }) }) @DynamicSerialize public class SshaRecord extends PersistablePluginDataObject implements - IDecoderGettable, IPointData, IPersistable { + IPointData, IPersistable { private static final long serialVersionUID = 1L; private static final float RMISSD = IDecoderConstantsN.FLOAT_MISSING; @@ -2481,77 +2479,11 @@ public class SshaRecord extends PersistablePluginDataObject implements this.obsTime = obsTime; } - /** - * Get the value and units of a named parameter within this observation. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return An Amount with value and units. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public Amount getValue(String paramName) { - return null; - } - - /** - * Get the value of a parameter that is represented as a String. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return The String value of the parameter. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public String getString(String paramName) { - return null; - } - - /** - * Get the value of a parameter that is represented as a String. - * - * @param paramName - * The name of the parameter value to retrieve. - * @return The String value of the parameter. If the parameter is unknown, a - * null reference is returned. - */ - @Override - public Collection getValues(String paramName) { - return null; - } - - /** - * Get the IDecoderGettable reference for this record. - * - * @return The IDecoderGettable reference for this record. - */ - @Override - public IDecoderGettable getDecoderGettable() { - return this; - } - @Override public void setDataURI(String dataURI) { identifier = dataURI; } - @Override - public String[] getStrings(String paramName) { - return null; - } - - @Override - public Date getPersistenceTime() { - return this.dataTime.getRefTime(); - - } - - @Override - public void setPersistenceTime(Date persistTime) { - // TODO Auto-generated method stub - - } - @Override public PointDataView getPointDataView() { return this.pointDataView; diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepDecoder.java b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepDecoder.java index 4791410108..c0a4e21822 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepDecoder.java +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.pirep/src/gov/noaa/nws/ncep/edex/plugin/pirep/PirepDecoder.java @@ -127,8 +127,7 @@ public class PirepDecoder extends AbstractDecoder { * @return The populated record. This method returns a null reference if * either the observation time or location data is unavailable. */ - private PirepRecord populateRecord(PirepParser parser, - WMOHeader wmoHeader) { + private PirepRecord populateRecord(PirepParser parser, WMOHeader wmoHeader) { PirepRecord record = null; AircraftObsLocation location = null; @@ -270,33 +269,4 @@ public class PirepDecoder extends AbstractDecoder { } return e; } - - public static final void main(String[] args) { - - PirepRecord rec = new PirepRecord(); - - PirepLayerData layer = new PirepLayerData(rec); - layer.setLayerType(PirepLayerData.LAYER_TYP_TURBC); - layer.setTurbFreq("OCN"); - layer.setTurbInten("LGT"); - layer.setTurbBaseHeight(15000); - layer.setTurbTopHeight(20000); - rec.addLayer(layer); - - layer = new PirepLayerData(rec); - layer.setLayerType(PirepLayerData.LAYER_TYP_TURBC); - layer.setTurbInten("MOD"); - layer.setTurbBaseHeight(20000); - layer.setTurbTopHeight(22000); - rec.addLayer(layer); - - String[] data = rec.getStrings("TBF"); - if ((data != null) && (data.length > 0)) { - System.out.println(data[0]); - } - data = rec.getStrings("TBI"); - if ((data != null) && (data.length > 0)) { - System.out.println(data[0]); - } - } }