Omaha #4360 DataURI changes for table madis.

Former-commit-id: eeb5cc61ec80cc3685507ed952a6ce069ad0f189
This commit is contained in:
Roger Ferrel 2015-07-21 08:07:42 -05:00
parent 31b96edb14
commit f8a23c43df
2 changed files with 51 additions and 16 deletions

View file

@ -0,0 +1,29 @@
#!/bin/bash
# DR #4360 - this update script will alter the dataURI columns from madis
PSQL="/awips2/psql/bin/psql"
cmdDir=`dirname $0`
source ${cmdDir}/commonFunctions.sh
table=madis
# table and constraint names from MadisRecord.
echo "INFO: Start update of ${table} dataURI columns."
renameConstraint ${table} uk_${table}_datauri_fields
col=provider
echo "Info Update ${table}'s ${col}"
${PSQL} -U awips -d metadata -c "DELETE from ${table} where ${col} is NULL ; "
updateNotNullCol ${table} ${col}
col=subProvider
echo "Info Update ${table}'s ${col}"
# When subProvider missing MadisDecoder already enters the string "null"; therefore should never have a NULL entry.
${PSQL} -U awips -d metadata -c "DELETE from ${table} where ${col} is NULL ; "
updateNotNullCol ${table} ${col}
col=restriction
${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

@ -77,6 +77,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* jan 22, 2014 2713 dhladky Calendar conversion.
* Mar 21, 2014 2939 dhladky Fixed mismatches in HDF5, DB records.
* Jan 08, 2014 3141 dhladky Bad index for WFS requests.
* Jul 21, 2015 4360 rferrel Named unique constraint.
* Made provider, subProvider and restriction not nullable.
*
* </pre>
*
@ -86,8 +88,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "madisseq")
@Table(name = "madis", uniqueConstraints = { @UniqueConstraint(columnNames = {
"latitude", "longitude", "stationId", "refTime", "provider", "subProvider", "restriction" }) })
@Table(name = "madis", uniqueConstraints = { @UniqueConstraint(name = "uk_madis_datauri_fields", columnNames = {
"latitude", "longitude", "stationId", "refTime", "provider",
"subProvider", "restriction" }) })
@org.hibernate.annotations.Table(appliesTo = "madis", indexes = { @Index(name = "madis_wfsQueryIndex", columnNames = {
"insertTime", "location" }), })
@DynamicSerialize
@ -98,16 +101,17 @@ public class MadisRecord extends PersistablePluginDataObject implements
/** A string denoting the provider network */
@DynamicSerializeElement
@Column
@Column(nullable = false)
@DataURI(position = 1)
protected String provider;
private String provider;
/** A string denoting the sub provider */
@DynamicSerializeElement
@Column
@Column(nullable = false)
@DataURI(position = 2)
private String subProvider;
// TODO Update once SurfaceObsLocation DataURI's are corrected.
@Embedded
@DataURI(position = 3, embedded = true)
@DynamicSerializeElement
@ -120,7 +124,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
/** An integer denoting the restriction level */
@DynamicSerializeElement
@Column
@Column(nullable = false)
@DataURI(position = 4)
private int restriction;
@ -458,6 +462,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
/**
* URI constructor
*
* @param string
*/
public MadisRecord(String string) {
@ -1103,9 +1108,10 @@ public class MadisRecord extends PersistablePluginDataObject implements
}
/**
* Allow overwrite of MADIS records
* MADIS records are frequently updated for even the same temporal
* record. QC value changes will cause record re-submissions.
* Allow overwrite of MADIS records MADIS records are frequently updated for
* even the same temporal record. QC value changes will cause record
* re-submissions.
*
* @return
*/
public boolean getAllowOverWrite() {