Merge "Omaha #4360 DataURI changes for table madis." into omaha_16.2.1

Former-commit-id: 0a3eda442c9e6ed3566651d86b6b7e8f4cf8ba52
This commit is contained in:
Richard Peter 2015-07-21 12:56:31 -05:00 committed by Gerrit Code Review
commit f9be09fa46
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,10 +124,10 @@ public class MadisRecord extends PersistablePluginDataObject implements
/** An integer denoting the restriction level */
@DynamicSerializeElement
@Column
@Column(nullable = false)
@DataURI(position = 4)
private int restriction;
/** A string denoting the time of observation */
@DynamicSerializeElement
@Transient
@ -351,7 +355,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
@DynamicSerializeElement
@Embedded
private PointDataView pointDataView;
public static final String PLUGIN_NAME = "madis";
public static final String STATION_ID = "stationId";
@ -455,18 +459,19 @@ public class MadisRecord extends PersistablePluginDataObject implements
public static final String RESTRICTION = "RESTRICTION";
}
/**
* URI constructor
*
* @param string
*/
public MadisRecord(String string) {
super();
}
//empty constructor
// empty constructor
public MadisRecord() {
}
/**
@ -1101,11 +1106,12 @@ public class MadisRecord extends PersistablePluginDataObject implements
public String getPluginName() {
return PLUGIN_NAME;
}
/**
* 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() {