Omaha #4360 DataURI changes for ccfp and script cleanup.

Change-Id: I192d1f09d91c7bb41386d70bd2ddc080e000d849

Former-commit-id: cf041ee683b38aa9611e98caf79772c8006b2423
This commit is contained in:
Roger Ferrel 2015-07-17 13:06:42 -05:00
parent 31b96edb14
commit 9fe8a715de
6 changed files with 58 additions and 21 deletions

View file

@ -14,12 +14,14 @@ renameConstraint ${table} uk_${table}_datauri_fields
col=windSpd
echo "INFO: Update ${table}'s ${col}"
${PSQL} -U awips -d metadata -c "UPDATE ${table} SET ${col}=-9999 where ${col} is NULL ; "
# Default value from BUFRPointDataAdapter.
${PSQL} -U awips -d metadata -c "UPDATE ${table} SET ${col}=-9999.0 where ${col} is NULL ; "
updateNotNullCol ${table} ${col}
col=satId
echo "Info Update ${table}'s ${col}"
${PSQL} -U awips -d metadata -c "UPDATE ${table} SET ${col}=0 where ${col} is NULL ; "
${PSQL} -U awips -d metadata -c "DELETE from ${table} where ${col} is NULL ; "
updateNotNullCol ${table} ${col}
echo "INFO: ${table} dataURI columns updated successfully"

View file

@ -14,12 +14,12 @@ renameConstraint ${table} uk_${table}_datauri_fields
col=pressure
echo "INFO: Update ${table}'s ${col}"
${PSQL} -U awips -d metadata -c "UPDATE ${table} SET ${col}=-9999 where ${col} is NULL ; "
${PSQL} -U awips -d metadata -c "DELETE from ${table} where ${col} is NULL ; "
updateNotNullCol ${table} ${col}
col=satType
echo "Info Update ${table}'s ${col}"
${PSQL} -U awips -d metadata -c "UPDATE ${table} SET ${col}='Null' where ${col} is NULL ; "
${PSQL} -U awips -d metadata -c "DELETE from ${table} where ${col} is NULL ; "
updateNotNullCol ${table} ${col}
echo "INFO: ${table} dataURI columns updated successfully"

View file

@ -0,0 +1,25 @@
#!/bin/bash
# DR #4360 - this update script will alter tables with the embedded dataURI columns from CcfpLocation
PSQL="/awips2/psql/bin/psql"
cmdDir=`dirname $0`
source ${cmdDir}/commonFunctions.sh
tables=("ccfp")
embedded=CcfpLocation
# DataURI cols from CcfpRecord.
cols=("boxlat" "boxlong")
echo "INFO: Start update of tables with embedded CcfpLocation"
for table in ${tables[@]} ; do
echo "INFO: update ${embedded} columns ${cols[@]} for table ${table}"
for col in ${cols[@]} ; do
${PSQL} -U awips -d metadata -c "DELETE from ${table} where ${col} is NULL ; "
updateNotNullCol ${table} ${col}
done
done
echo "INFO: Tables with embedded CcfpLocation updated successfully"

View file

@ -0,0 +1,20 @@
#!/bin/bash
# DR #4360 - this update script will alter the dataURI columns from ccfp
PSQL="/awips2/psql/bin/psql"
cmdDir=`dirname $0`
source ${cmdDir}/commonFunctions.sh
table=ccfp
# table and constraint names from CcfpRecord.
echo "INFO: Start update of ${table} dataURI columns."
renameConstraint ${table} uk_${table}_datauri_fields
col=producttype
echo "INFO: Update ${table}'s ${col}"
${PSQL} -U awips -d metadata -c "DELETE from ${table} where ${col} is NULL ; "
updateNotNullCol ${table} ${col}
echo "INFO: ${table} dataURI columns updated successfully"

View file

@ -49,6 +49,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Apr 15, 2014 3001 bgonzale Refactored to common package,
* com.raytheon.uf.common.dataplugin.ccfp.
* 10/16/2014 3454 bphillip Upgrading to Hibernate 4
* Jul 20, 2015 4360 rferrel DataURI's boxLat and boxLong no longer nullable.
*
*
* </pre>
@ -68,12 +69,12 @@ public class CcfpLocation implements ISpatialObject {
private Geometry geometry;
@DataURI(position = 0)
@Column
@Column(nullable = false)
@DynamicSerializeElement
private double boxLat;
@DataURI(position = 1)
@Column
@Column(nullable = false)
@DynamicSerializeElement
private double boxLong;

View file

@ -57,6 +57,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Apr 15, 2014 3001 bgonzale Refactored to common package,
* com.raytheon.uf.common.dataplugin.ccfp.
* Oct 03, 2014 3644 mapeters Removed dataURI column.
* Jul 17, 2015 4360 rferrel Named unique constraint, producttype no longer nullable.
*
*
* </pre>
@ -66,18 +67,16 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "ccfpseq")
@Table(name = "ccfp", uniqueConstraints = { @UniqueConstraint(columnNames = {
@Table(name = "ccfp", uniqueConstraints = { @UniqueConstraint(name = "uk_ccfp_datauri_fields", columnNames = {
"refTime", "producttype", "boxLat", "boxLong" }) })
@org.hibernate.annotations.Table(appliesTo = "ccfp", indexes = { @Index(name = "ccfp_refTimeIndex", columnNames = {
"refTime" }) })
@org.hibernate.annotations.Table(appliesTo = "ccfp", indexes = { @Index(name = "ccfp_refTimeIndex", columnNames = { "refTime" }) })
@DynamicSerialize
public class CcfpRecord extends PluginDataObject implements ISpatialEnabled {
private static final long serialVersionUID = 1L;
@DataURI(position = 1)
@Column(length = 8)
@Column(length = 8, nullable = false)
@DynamicSerializeElement
private String producttype;
@ -120,16 +119,6 @@ public class CcfpRecord extends PluginDataObject implements ISpatialEnabled {
public CcfpRecord() {
}
// /**
// * Constructor.
// *
// * @param message
// * The text of the message
// */
// public CcfpRecord(String message) {
// super(message);
// }
/**
* Constructs a ccfp record from a dataURI
*