Omaha #3720 Remove dataURI from redbook plugin

Change-Id: Iaeef7a259a51840fa51e1256ed8dc1c5b3df3a49

Former-commit-id: 5d3c2eb58fce655b25bf4db2a2045e9007ca58f8
This commit is contained in:
Mark Peters 2014-10-14 17:13:23 -05:00
parent 0105b3bacf
commit 153cf12248
3 changed files with 43 additions and 20 deletions

View file

@ -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"

View file

@ -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.
*
* </pre>
*
@ -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";

View file

@ -18,22 +18,18 @@ of the Upper Air NDM menus.
<menuEntry type="submenu" text="CPC Charts">
<menuEntry type="productButton"
text="6-10 day mean 500 Hgt" id="ua610daymean500Hgt">
<menuEntry type="dataURI">/redbook/%/PHBV50/%</menuEntry>
<menuEntry type="substitute" key="wmo" value="PHBV50"/>
</menuEntry>
<menuEntry type="productButton"
text="8-14 day Mean 500 Hgt" id="ua814dayMean500Hgt">
<menuEntry type="dataURI">/redbook/%/PHTT50/%</menuEntry>
<menuEntry type="substitute" key="wmo" value="PHTT50"/>
</menuEntry>
<menuEntry type="productButton"
text="6-10 day 500 Hgt Anomaly" id="ua610day500HgtAnomaly">
<menuEntry type="dataURI">/redbook/%/PHNT50/%</menuEntry>
<menuEntry type="substitute" key="wmo" value="PHNT50"/>
</menuEntry>
<menuEntry type="productButton"
text="8-14 day 500 Anom" id="ua814day500Anom">
<menuEntry type="dataURI">/redbook/%/PHTT51/%</menuEntry>
<menuEntry type="substitute" key="wmo" value="PHTT51"/>
</menuEntry>
</menuEntry>