diff --git a/deltaScripts/14.4.1/DR3720/dropRedbookDataURI.sh b/deltaScripts/14.4.1/DR3720/dropRedbookDataURI.sh new file mode 100644 index 0000000000..6b0b9d65e2 --- /dev/null +++ b/deltaScripts/14.4.1/DR3720/dropRedbookDataURI.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# DR #3720 - this update script will drop the dataURI column from redbook + +PSQL="/awips2/psql/bin/psql" + +# takes one arg: a table name +# drops the datauri constraint and column if they exist +function dropDatauri { + echo "INFO: Dropping DataURI column from $1" + ${PSQL} -U awips -d metadata -c "ALTER TABLE $1 DROP CONSTRAINT IF EXISTS ${1}_datauri_key;" + ${PSQL} -U awips -d metadata -c "ALTER TABLE $1 DROP COLUMN IF EXISTS datauri;" + if [ $? -ne 0 ]; then + echo "ERROR: Failed to drop dataURI column for $table" + echo "FATAL: The update has failed." + exit 1 + fi +} + +# takes three args: table, constraint name, unique columns +# will first drop the constraint if it exists and then adds it back, this is +# fairly inefficient if it does exist but operationally it won't exist and for +# testing this allows the script to be run easily as a noop. +function dropDatauriAndAddConstraint { + dropDatauri $1 + ${PSQL} -U awips -d metadata -c "ALTER TABLE $1 DROP CONSTRAINT IF EXISTS $2;" + ${PSQL} -U awips -d metadata -c "ALTER TABLE $1 ADD CONSTRAINT $2 UNIQUE $3;" + if [ $? -ne 0 ]; then + echo "ERROR: Failed to add new unique constraint for $table" + echo "FATAL: The update has failed." + exit 1 + fi +} + +echo "INFO: Dropping redbook dataURI columns." + +dropDatauriAndAddConstraint redbook redbook_reftime_forecasttime_wmottaaii_corindicator_fcsthours_productid_fileid_originatorid_key "(reftime, forecasttime, wmottaaii, corindicator, fcsthours, productid, fileid, originatorid)" +${PSQL} -U awips -d metadata -c "VACUUM FULL ANALYZE redbook" + +echo "INFO: redbook dataURI columns dropped successfully" diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/RedbookRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/RedbookRecord.java index 8918edc32b..3e9ce16673 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/RedbookRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/RedbookRecord.java @@ -23,8 +23,6 @@ import java.util.Arrays; import java.util.Calendar; import java.util.Date; -import javax.persistence.Access; -import javax.persistence.AccessType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.SequenceGenerator; @@ -70,6 +68,7 @@ import com.raytheon.uf.common.time.DataTime; * Nov 04, 2013 2361 njensen Remove XML annotations * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and * edex redbook plugins + * Oct 10, 2014 3720 mapeters Removed dataURI column. * * * @@ -78,7 +77,9 @@ import com.raytheon.uf.common.time.DataTime; */ @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "redbookseq") -@Table(name = "redbook", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) +@Table(name = "redbook", uniqueConstraints = { @UniqueConstraint(columnNames = { + "wmoTTAAii", "corIndicator", "fcstHours", "productId", "fileId", + "originatorId" }) }) /* * Both refTime and forecastTime are included in the refTimeIndex since * forecastTime is unlikely to be used. @@ -226,12 +227,6 @@ public class RedbookRecord extends PersistablePluginDataObject implements this.timeObs = timeObs; } - @Override - public void setDataURI(String dataURI) { - super.setDataURI(dataURI); - identifier = dataURI; - } - /** * @return the retentionHours */ @@ -464,13 +459,6 @@ public class RedbookRecord extends PersistablePluginDataObject implements return true; } - @Override - @Column - @Access(AccessType.PROPERTY) - public String getDataURI() { - return super.getDataURI(); - } - @Override public String getPluginName() { return "redbook"; diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.redbook/Documentation/SampleFiles/RedbookUAMenus.xml b/edexOsgi/com.raytheon.uf.edex.plugin.redbook/Documentation/SampleFiles/RedbookUAMenus.xml index abf31726be..32379c01fa 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.redbook/Documentation/SampleFiles/RedbookUAMenus.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.redbook/Documentation/SampleFiles/RedbookUAMenus.xml @@ -18,22 +18,18 @@ of the Upper Air NDM menus. - /redbook/%/PHBV50/% - /redbook/%/PHTT50/% - /redbook/%/PHNT50/% - /redbook/%/PHTT51/%