Issue #1869 Remove DataURI column from bufrmos.

Change-Id: Ic1a25588a45c2dc8a1a089332a4d6a33c41e205e

Former-commit-id: 5b740e5d614d9cac2476335a0754ccd0e1185c84
This commit is contained in:
Ben Steffensmeier 2013-05-14 18:13:44 -05:00
parent 44cfe00b5e
commit fabbc29fe8
11 changed files with 89 additions and 166 deletions

View file

@ -4,16 +4,43 @@
PSQL="/awips2/psql/bin/psql"
echo "INFO: Dropping dataURI columns."
# TODO this script will need to be extended for unique constraint.
for table in gfe;
do
echo "INFO: Dropping DataURI column from $table"
${PSQL} -U awips -d metadata -c "ALTER TABLE $table DROP COLUMN IF EXISTS datauri;"
# 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 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
done
}
# 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 dataURI columns."
dropDatauri gfe
dropDatauriAndAddConstraint bufrmosavn bufrmosavn_location_id_reftime_forecasttime_key "(location_id, reftime, forecasttime)"
dropDatauriAndAddConstraint bufrmoseta bufrmoseta_location_id_reftime_forecasttime_key "(location_id, reftime, forecasttime)"
dropDatauriAndAddConstraint bufrmosgfs bufrmosgfs_location_id_reftime_forecasttime_key "(location_id, reftime, forecasttime)"
dropDatauriAndAddConstraint bufrmoshpc bufrmoshpc_location_id_reftime_forecasttime_key "(location_id, reftime, forecasttime)"
dropDatauriAndAddConstraint bufrmoslamp bufrmoslamp_location_id_reftime_forecasttime_key "(location_id, reftime, forecasttime)"
dropDatauriAndAddConstraint bufrmosmrf bufrmosmrf_location_id_reftime_forecasttime_key "(location_id, reftime, forecasttime)"
dropDatauriAndAddConstraint bufrmosngm bufrmosngm_location_id_reftime_forecasttime_key "(location_id, reftime, forecasttime)"
echo "INFO: dataURI columns dropped successfully"

View file

@ -52,9 +52,10 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080221 862 jkorman Initial Coding.
* 20080408 1039 jkorman Added traceId for tracing data.
* 12/08/08 chammack Camel Refactor
* Feb 21, 2008 862 jkorman Initial Coding.
* Apr 08, 2008 1039 jkorman Added traceId for tracing data.
* Dec 08, 2008 chammack Camel Refactor
* May 14, 2013 1869 bsteffen Remove DataURI column from bufrmos.
* </pre>
*
* @author jkorman
@ -109,7 +110,6 @@ public class BufrMosDecoder extends AbstractDecoder {
if (fcstData != null) {
fcstData.setTraceId(traceId);
fcstData.setPersistenceTime(new Date());
fcstData.constructDataURI();
pdoList.add(fcstData);
}
} catch (Exception e) {

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.edex.plugin.bufrmos.common;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@ -45,10 +42,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 25, 2011 rjpeter Initial creation
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* Apr 04, 2013 1846 bkowal Added an index on refTime and
* forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* May 14, 2013 1869 bsteffen Remove DataURI column from bufrmos.
*
* </pre>
*
@ -57,7 +56,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "bufrmosAvnseq")
@Table(name = "bufrmosAvn", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Table(name = "bufrmosAvn", uniqueConstraints = { @UniqueConstraint(columnNames = {
"location_id", "refTime", "forecastTime" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
@ -77,11 +77,4 @@ public class BufrMosAvnData extends BufrMosData {
return MOSType.AVN;
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
}

View file

@ -19,8 +19,6 @@
**/
package com.raytheon.edex.plugin.bufrmos.common;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Embedded;
import javax.persistence.Inheritance;
@ -36,7 +34,6 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.annotations.DataURIConfig;
@ -56,11 +53,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080221 862 jkorman Initial Coding.
* 02/06/09 1990 bphillip removed populateDataStore method
* Feb 21, 2008 862 jkorman Initial Coding.
* Feb 06, 2009 1990 bphillip removed populateDataStore method
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* May 02, 2013 1970 bgonzale Removed Table annotation, changed from Entity
* annotation to MappedSuperClass.
* May 02, 2013 1970 bgonzale Removed Table annotation, changed from
* Entity annotation to MappedSuperClass.
* May 14, 2013 1869 bsteffen Remove DataURI column from bufrmos.
*
* </pre>
*
@ -75,7 +73,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize
@DataURIConfig(persistentIndex = 2)
public abstract class BufrMosData extends PersistablePluginDataObject implements
IDecoderGettable, IPersistable, IPointData {
IPersistable, IPointData {
public static enum MOSType {
ETA, GFS, AVN, LAMP, HPC, MRF, NGM
@ -178,62 +176,6 @@ public abstract class BufrMosData extends PersistablePluginDataObject implements
identifier = dataURI;
}
/**
* @see com.raytheon.uf.common.dataplugin.PluginDataObject#getDecoderGettable()
*/
@Override
public IDecoderGettable getDecoderGettable() {
return null;
}
/**
* @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getString(java.lang.String)
*/
@Override
public String getString(String paramName) {
return null;
}
/**
* @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getStrings(java.lang.String)
*/
@Override
public String[] getStrings(String paramName) {
return null;
}
/**
* @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getValue(java.lang.String)
*/
@Override
public Amount getValue(String paramName) {
Amount retValue = null;
// Object element = elementMap.get(paramName);
// TODO:
// if (element != null) {
// Unit<?> units = BUFRTableB.mapUnits(element.getUnits());
// if (units != null) {
// if ("FLOAT".equals(element.getElementType())) {
// retValue = new Amount(element.getDoubleVal(), units);
// } else if ("INTEGER".equals(element.getElementType())) {
// retValue = new Amount(element.getIntegerVal(), units);
// }
// }
// }
return retValue;
}
/**
* @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getValues(java.lang.String)
*/
@Override
public Collection<Amount> getValues(String paramName) {
return null;
}
public BufrMosDataLocation getLocation() {
return location;
}

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.edex.plugin.bufrmos.common;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@ -45,10 +42,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 25, 2011 rjpeter Initial creation
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
* Apr 04, 2013 1846 bkowal Added an index on refTime and
* forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* May 14, 2013 1869 bsteffen Remove DataURI column from bufrmos.
*
* </pre>
*
@ -57,7 +56,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "bufrmosEtaseq")
@Table(name = "bufrmosEta", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Table(name = "bufrmosEta", uniqueConstraints = { @UniqueConstraint(columnNames = {
"location_id", "refTime", "forecastTime" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
@ -77,11 +77,4 @@ public class BufrMosEtaData extends BufrMosData {
return MOSType.ETA;
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
}

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.edex.plugin.bufrmos.common;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@ -45,10 +42,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 25, 2011 rjpeter Initial creation
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
* Apr 04, 2013 1846 bkowal Added an index on refTime and
* forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* May 14, 2013 1869 bsteffen Remove DataURI column from bufrmos.
*
* </pre>
*
@ -57,7 +56,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "bufrmosGfsseq")
@Table(name = "bufrmosGfs", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Table(name = "bufrmosGfs", uniqueConstraints = { @UniqueConstraint(columnNames = {
"location_id", "refTime", "forecastTime" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
@ -77,10 +77,4 @@ public class BufrMosGfsData extends BufrMosData {
return MOSType.GFS;
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
}

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.edex.plugin.bufrmos.common;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@ -45,10 +42,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 25, 2011 rjpeter Initial creation
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* Apr 04, 2013 1846 bkowal Added an index on refTime and
* forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* May 14, 2013 1869 bsteffen Remove DataURI column from bufrmos.
*
* </pre>
*
@ -57,7 +56,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "bufrmosHpcseq")
@Table(name = "bufrmosHpc", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Table(name = "bufrmosHpc", uniqueConstraints = { @UniqueConstraint(columnNames = {
"location_id", "refTime", "forecastTime" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
@ -76,10 +76,5 @@ public class BufrMosHpcData extends BufrMosData {
public MOSType getType() {
return MOSType.HPC;
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
}

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.edex.plugin.bufrmos.common;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@ -45,10 +42,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 25, 2011 rjpeter Initial creation
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* Apr 04, 2013 1846 bkowal Added an index on refTime and
* forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* May 14, 2013 1869 bsteffen Remove DataURI column from bufrmos.
*
* </pre>
*
@ -57,7 +56,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "bufrmosLampseq")
@Table(name = "bufrmosLamp", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Table(name = "bufrmosLamp", uniqueConstraints = { @UniqueConstraint(columnNames = {
"location_id", "refTime", "forecastTime" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
@ -76,10 +76,5 @@ public class BufrMosLampData extends BufrMosData {
public MOSType getType() {
return MOSType.LAMP;
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
}

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.edex.plugin.bufrmos.common;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@ -45,10 +42,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 25, 2011 rjpeter Initial creation
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* Apr 04, 2013 1846 bkowal Added an index on refTime and
* forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* May 14, 2013 1869 bsteffen Remove DataURI column from bufrmos.
*
* </pre>
*
@ -57,7 +56,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "bufrmosMrfseq")
@Table(name = "bufrmosMrf", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Table(name = "bufrmosMrf", uniqueConstraints = { @UniqueConstraint(columnNames = {
"location_id", "refTime", "forecastTime" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
@ -76,10 +76,5 @@ public class BufrMosMrfData extends BufrMosData {
public MOSType getType() {
return MOSType.MRF;
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
}

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.edex.plugin.bufrmos.common;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@ -45,10 +42,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 25, 2011 rjpeter Initial creation
* Apr 4, 2013 1846 bkowal Added an index on refTime and forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* Apr 04, 2013 1846 bkowal Added an index on refTime and
* forecastTime
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* May 14, 2013 1869 bsteffen Remove DataURI column from bufrmos.
*
* </pre>
*
@ -57,7 +56,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "bufrmosNgmseq")
@Table(name = "bufrmosNgm", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Table(name = "bufrmosNgm", uniqueConstraints = { @UniqueConstraint(columnNames = {
"location_id", "refTime", "forecastTime" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
@ -76,10 +76,5 @@ public class BufrMosNgmData extends BufrMosData {
public MOSType getType() {
return MOSType.NGM;
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
}

View file

@ -44,7 +44,6 @@ import org.hibernate.annotations.Index;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
@ -193,11 +192,6 @@ public class GFERecord extends PluginDataObject {
super(uri);
}
@Override
public IDecoderGettable getDecoderGettable() {
return null;
}
public void setGridHistory(GridDataHistory[] history) {
setGridHistory(Arrays.asList(history));
}