From b05424c90294a55ae0b44f30b832e13195943c4c Mon Sep 17 00:00:00 2001 From: Tom Gurney Date: Mon, 18 Jan 2016 13:42:27 -0600 Subject: [PATCH] Omaha #5253 Remove dataURI from SvrWx plugin Also update SvrWx regex to accept SvrWx hourly products (starting with "NWUS22") which were incorrectly being rejected. Change-Id: I58ece4293c0a011edccee5a065e7710557a3951b Former-commit-id: 183079715d857fd085653a90a21eaeb4c615da07 --- .../viz/pointdata/rsc/PlotResourceData.java | 4 +- .../16.2.2/DR5253/alter_svrwx_drop_datauri.sh | 17 +++++ .../common/dataplugin/svrwx/SvrWxRecord.java | 26 ++------ .../res/pointdata/svrwxdb.xml | 4 +- .../uf/edex/plugin/svrwx/SvrWxRecordDao.java | 64 +------------------ .../edex_static/base/distribution/svrwx.xml | 2 +- 6 files changed, 29 insertions(+), 88 deletions(-) create mode 100755 deltaScripts/16.2.2/DR5253/alter_svrwx_drop_datauri.sh diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java index de99448334..3e90883c0c 100644 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java +++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java @@ -62,6 +62,7 @@ import com.raytheon.viz.pointdata.rsc.retrieve.PointDataPlotInfoRetriever; * Oct 27, 2015 4798 bsteffen Move SVG localization url handler * registration. * Nov 16, 2015 5119 bsteffen Remove bufquikscat + * Jan 19, 2016 5253 tgurney Remove svrwx dependency on dataURI * * * @@ -146,7 +147,6 @@ public class PlotResourceData extends AbstractRequestableResourceData { */ pluginProps.put("radar", new PluginPlotProperties(false)); pluginProps.put("tcg", new PluginPlotProperties(false)); - pluginProps.put("svrwx", new PluginPlotProperties(false)); pluginProps.put("ldadhydro", new PluginPlotProperties(false)); pluginProps.put("textPoints", new PluginPlotProperties(false)); @@ -155,6 +155,8 @@ public class PlotResourceData extends AbstractRequestableResourceData { * default behavior, but for now they are included so we have a * comprehensive list of which plugins use certain behaviors. */ + + pluginProps.put("svrwx", new PluginPlotProperties()); pluginProps.put("obs", new PluginPlotProperties()); pluginProps.put("goessounding", new PluginPlotProperties()); pluginProps.put("poessounding", new PluginPlotProperties()); diff --git a/deltaScripts/16.2.2/DR5253/alter_svrwx_drop_datauri.sh b/deltaScripts/16.2.2/DR5253/alter_svrwx_drop_datauri.sh new file mode 100755 index 0000000000..ea435b1f9f --- /dev/null +++ b/deltaScripts/16.2.2/DR5253/alter_svrwx_drop_datauri.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# DR #5253 - This script drops dataURI column from svrwx table and adds a new +# multi-column unique constraint + +PSQL="/awips2/psql/bin/psql" + +echo "INFO: Altering table svrwx" + +${PSQL} -U awips -d metadata << EOF +begin transaction; +alter table svrwx + drop constraint if exists uk_svrwx_datauri_fields, + drop column if exists datauri, + add constraint uk_svrwx_datauri_fields unique ( + reftime, reporttype, stationid, latitude, longitude); +commit transaction; +EOF diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.svrwx/src/com/raytheon/uf/common/dataplugin/svrwx/SvrWxRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.svrwx/src/com/raytheon/uf/common/dataplugin/svrwx/SvrWxRecord.java index 8a2b0ada5f..4b03143503 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.svrwx/src/com/raytheon/uf/common/dataplugin/svrwx/SvrWxRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.svrwx/src/com/raytheon/uf/common/dataplugin/svrwx/SvrWxRecord.java @@ -21,8 +21,6 @@ package com.raytheon.uf.common.dataplugin.svrwx; import java.util.Calendar; -import javax.persistence.Access; -import javax.persistence.AccessType; import javax.persistence.Column; import javax.persistence.Embedded; import javax.persistence.Entity; @@ -61,7 +59,8 @@ import com.vividsolutions.jts.geom.Geometry; * PluginDataObject. * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Oct 14, 2013 2361 njensen Remove XML annotations - * Jul 28, 2015 4360 rferrel Named unique constraint. Made reportType non-nullable. + * Jul 28, 2015 4360 rferrel Named unique constraint. Made reportType non-nullable. + * Jan 14, 2016 5253 tgurney Dropped dataUri column and updated unique constraint. * * * @@ -70,7 +69,8 @@ import com.vividsolutions.jts.geom.Geometry; */ @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "svrwxseq") -@Table(name = "svrwx", uniqueConstraints = { @UniqueConstraint(name = "uk_svrwx_datauri_fields", columnNames = { "dataURI" }) }) +@Table(name = "svrwx", uniqueConstraints = { @UniqueConstraint(name = "uk_svrwx_datauri_fields", columnNames = { + "refTime", "reportType", "stationId", "latitude", "longitude" }) }) /* * Both refTime and forecastTime are included in the refTimeIndex since * forecastTime is unlikely to be used. @@ -145,17 +145,6 @@ public class SvrWxRecord extends PersistablePluginDataObject implements this.wmoHeader = wmoHeader; } - /** - * Set the data uri for this observation. - * - * @param dataURI - */ - @Override - public void setDataURI(String dataURI) { - super.setDataURI(dataURI); - identifier = dataURI; - } - @Override public SurfaceObsLocation getSpatialObject() { return location; @@ -279,13 +268,6 @@ public class SvrWxRecord extends PersistablePluginDataObject implements return sb.toString(); } - @Override - @Column - @Access(AccessType.PROPERTY) - public String getDataURI() { - return super.getDataURI(); - } - @Override public String getPluginName() { return "svrwx"; diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/res/pointdata/svrwxdb.xml b/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/res/pointdata/svrwxdb.xml index b1ac58a90b..9190ea2c48 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/res/pointdata/svrwxdb.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/res/pointdata/svrwxdb.xml @@ -2,5 +2,5 @@ - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/src/com/raytheon/uf/edex/plugin/svrwx/SvrWxRecordDao.java b/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/src/com/raytheon/uf/edex/plugin/svrwx/SvrWxRecordDao.java index f13f3613b6..f2ca4f4ddf 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/src/com/raytheon/uf/edex/plugin/svrwx/SvrWxRecordDao.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/src/com/raytheon/uf/edex/plugin/svrwx/SvrWxRecordDao.java @@ -19,11 +19,8 @@ **/ package com.raytheon.uf.edex.plugin.svrwx; -import java.util.List; - import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.svrwx.SvrWxRecord; -import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.pointdata.PointDataPluginDao; /** @@ -37,6 +34,7 @@ import com.raytheon.uf.edex.pointdata.PointDataPluginDao; * ------------ ---------- ----------- -------------------------- * Jan 4, 2010 jsanchez Initial creation * Apr 10, 2014 2971 skorolev Cleaned code. + * Jan 19, 2016 5253 tgurney Remove dead code * * * @@ -46,7 +44,7 @@ import com.raytheon.uf.edex.pointdata.PointDataPluginDao; public class SvrWxRecordDao extends PointDataPluginDao { /** - * Creates a new TropicalCycloneGuidance Dao + * Creates a new SvrWxRecord Dao * * @param pluginName * @throws PluginException @@ -55,74 +53,16 @@ public class SvrWxRecordDao extends PointDataPluginDao { super(pluginName); } - /** - * Retrieves an tcg report using the datauri . - * - * @param dataURI - * The dataURI to match against. - * @return The report record if it exists. - */ - public SvrWxRecord queryByDataURI(String dataURI) { - SvrWxRecord report = null; - List obs = null; - try { - obs = queryBySingleCriteria("dataURI", dataURI); - } catch (DataAccessLayerException e) { - e.printStackTrace(); - } - if ((obs != null) && (obs.size() > 0)) { - report = (SvrWxRecord) obs.get(0); - } - return report; - } - - /** - * Queries for to determine if a given data uri exists on the tcg table. - * - * @param dataUri - * The DataURI to find. - * @return An array of objects. If not null, there should only be a single - * element. - */ - public Object[] queryDataUriColumn(final String dataUri) { - - String sql = "select datauri from awips.svrwx where datauri='" - + dataUri + "';"; - - Object[] results = executeSQLQuery(sql); - - return results; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.pointdata.PointDataPluginDao#getKeysRequiredForFileName - * () - */ @Override public String[] getKeysRequiredForFileName() { return new String[] { "dataTime.refTime" }; } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.edex.pointdata.PointDataPluginDao#getPointDataFileName - * (com.raytheon.uf.common.dataplugin.PluginDataObject) - */ @Override public String getPointDataFileName(SvrWxRecord p) { return "svrwx.h5"; } - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.edex.pointdata.PointDataPluginDao#newObject() - */ @Override public SvrWxRecord newObject() { return new SvrWxRecord(); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/utility/edex_static/base/distribution/svrwx.xml b/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/utility/edex_static/base/distribution/svrwx.xml index 6c226bea9a..9fe42592ea 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/utility/edex_static/base/distribution/svrwx.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.svrwx/utility/edex_static/base/distribution/svrwx.xml @@ -19,5 +19,5 @@ further_licensing_information. --> - ^NWUS20.* + ^NWUS2[02].* \ No newline at end of file