Omaha #3722 Remove dataURI from taf plugin

Change-Id: I214772ee74989ab9f91423c2bad4ee7d58b3eba4

Former-commit-id: 3a0cc08b25395cb168c8344c00fb17fb016aae36
This commit is contained in:
Mark Peters 2014-10-14 11:13:03 -05:00
parent 3a12ab9bdf
commit e7388847d6
2 changed files with 46 additions and 15 deletions

View file

@ -0,0 +1,41 @@
#!/bin/bash
# DR #3722 - this update script will drop the dataURI column from taf
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 taf dataURI columns."
dropDatauriAndAddConstraint taf taf_reftime_stationid_corindicator_amdindicator_issuetimestring_key "(reftime, stationid, corindicator, amdindicator, issue_timestring)"
${PSQL} -U awips -d metadata -c "DROP INDEX taf_reftimeindex;"
${PSQL} -U awips -d metadata -c "CREATE INDEX taf_reftimeindex ON taf USING btree (reftime);"
${PSQL} -U awips -d metadata -c "VACUUM FULL ANALYZE taf"
echo "INFO: taf dataURI columns dropped successfully"

View file

@ -24,8 +24,6 @@ import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -68,6 +66,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Feb 10, 2014 2777 rferrel Assign parent id when setting ChangeGroup.
* Feb 11, 2014 2784 rferrel Remove override of setIdentifier.
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
* Oct 10, 2014 3722 mapeters Removed dataURI column.
* </pre>
*
* @author bphillip
@ -75,13 +74,11 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "tafseq")
@Table(name = TafRecord.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
*/
@Table(name = TafRecord.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = {
"stationId", "corIndicator", "amdIndicator", "issue_timeString" }) })
@org.hibernate.annotations.Table(appliesTo = TafRecord.PLUGIN_NAME, indexes = { @Index(name = "taf_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
"refTime" }) })
@DynamicSerialize
public class TafRecord extends PluginDataObject implements ISpatialEnabled {
@ -388,13 +385,6 @@ public class TafRecord extends PluginDataObject implements ISpatialEnabled {
return true;
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
@Override
public String getPluginName() {
return PLUGIN_NAME;