From c18e66cc452d322de48a9af5837995db5d01e50c Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Thu, 30 Jan 2014 11:56:16 -0600 Subject: [PATCH] Issue #2581 add dataURI back to LocalStormReport for 14.2.1, fix RAIN events while in there Change-Id: I678035f35aef0153fdc92b935bad4372d77d3619 Former-commit-id: 906c679b4e24f73cfc1e7c410ae899ab2d4fb679 [formerly 68de7dd0f4e5728cb077dad541ef9369627fced4] Former-commit-id: 327c588c9e444b9d56293ef01fadb51c711686da --- deltaScripts/14.2.1/undoDropLSRdataURI.sh | 29 +++++++++++++++++++ .../common/dataplugin/lsr/LSREventType.java | 4 ++- .../dataplugin/lsr/LocalStormReport.java | 14 +++++++-- 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 deltaScripts/14.2.1/undoDropLSRdataURI.sh diff --git a/deltaScripts/14.2.1/undoDropLSRdataURI.sh b/deltaScripts/14.2.1/undoDropLSRdataURI.sh new file mode 100644 index 0000000000..df564c24f6 --- /dev/null +++ b/deltaScripts/14.2.1/undoDropLSRdataURI.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# DR #2581 - This update script will add the dataURI column to the lsr table +# The column needs to be there for 14.2.1. +# Only run this if you have already run dropLSRdataURI.sh, otherwise +# don't run this script or that one. + + +PSQL="/awips2/psql/bin/psql" + +# adds the datauri constraint and column +function addDataUriLSR { + echo "INFO: Adding DataURI column to lsr" + ${PSQL} -U awips -d metadata -c "ALTER TABLE lsr DROP CONSTRAINT IF EXISTS lsr_latitude_longitude_stationId_reftime_forecasttime_eventtype;" + ${PSQL} -U awips -d metadata -c "ALTER TABLE lsr ADD COLUMN datauri varchar(255);" + ${PSQL} -U awips -d metadata -c "ALTER TABLE lsr ADD CONSTRAINT lsr_datauri_key UNIQUE (datauri);" + if [ $? -ne 0 ]; then + echo "ERROR: Failed to repair dataURI for lsr" + echo "FATAL: The update has failed." + exit 1 + fi +} + + + +echo "INFO: Adding LSR dataURI column back in." + +addDataUriLSR + +echo "INFO: LSR dataURI column added successfully" diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.lsr/src/com/raytheon/uf/common/dataplugin/lsr/LSREventType.java b/edexOsgi/com.raytheon.uf.common.dataplugin.lsr/src/com/raytheon/uf/common/dataplugin/lsr/LSREventType.java index bb38201db2..885f7c2be0 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.lsr/src/com/raytheon/uf/common/dataplugin/lsr/LSREventType.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.lsr/src/com/raytheon/uf/common/dataplugin/lsr/LSREventType.java @@ -37,6 +37,7 @@ import java.util.Map; * Jan 03, 2014 2581 njensen Added coastal flood * Jan 13, 2014 2581 njensen Added debris flow * Jan 17, 2014 2581 njensen Added blowing snow + * Jan 30, 2014 2581 njensen Added rain * * * @@ -89,7 +90,8 @@ public enum LSREventType { FREEZINGDRIZZLE("FREEZING DRIZZLE", 40, LSRUnits.NOUNITS), COASTALFLOOD("COASTAL FLOOD", 41, LSRUnits.NOUNITS), DEBRISFLOW("DEBRIS FLOW", 42, LSRUnits.NOUNITS), - BLOWINGSNOW("BLOWING SNOW", 43, LSRUnits.NOUNITS); + BLOWINGSNOW("BLOWING SNOW", 43, LSRUnits.NOUNITS), + RAIN("RAIN", 44, LSRUnits.NOUNITS); // TODO contemplate storing the event type as a string in the database instead of an enum/integer diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.lsr/src/com/raytheon/uf/common/dataplugin/lsr/LocalStormReport.java b/edexOsgi/com.raytheon.uf.common.dataplugin.lsr/src/com/raytheon/uf/common/dataplugin/lsr/LocalStormReport.java index a952eafe65..39d08765ef 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.lsr/src/com/raytheon/uf/common/dataplugin/lsr/LocalStormReport.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.lsr/src/com/raytheon/uf/common/dataplugin/lsr/LocalStormReport.java @@ -30,6 +30,8 @@ import javax.measure.quantity.Velocity; import javax.measure.unit.NonSI; import javax.measure.unit.SI; import javax.measure.unit.Unit; +import javax.persistence.Access; +import javax.persistence.AccessType; import javax.persistence.Column; import javax.persistence.Embedded; import javax.persistence.Entity; @@ -70,6 +72,7 @@ import com.vividsolutions.jts.geom.Geometry; * Oct 14, 2013 2361 njensen Removed XML annotations and IDecoderGettable * Dec 10, 2013 2581 njensen Removed dataURI column * Jan 15, 2014 2581 njensen Changed constraint to use officeId instead of stationId + * Jan 30, 2014 2581 njensen Added dataURI column back in * * * @@ -79,8 +82,8 @@ import com.vividsolutions.jts.geom.Geometry; @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "lsrseq") @Table(name = "lsr", uniqueConstraints = { @UniqueConstraint(columnNames = { - "latitude", "longitude", "officeId", "refTime", "forecastTime", - "eventType" }) }) +// "latitude", "longitude", "officeId", "refTime", "forecastTime", "eventType" +"dataURI" }) }) /* * Both refTime and forecastTime are included in the refTimeIndex since * forecastTime is unlikely to be used. @@ -509,4 +512,11 @@ public class LocalStormReport extends PersistablePluginDataObject implements public String getPluginName() { return "lsr"; } + + @Override + @Column + @Access(AccessType.PROPERTY) + public String getDataURI() { + return super.getDataURI(); + } }