Merge "Omaha #5253 Remove dataURI from SvrWx plugin" into omaha_16.2.2

Former-commit-id: b0a29d586176e28d93bc8c284b6483c8e87d915d
This commit is contained in:
Richard Peter 2016-01-19 12:34:26 -06:00 committed by Gerrit Code Review
commit 8b797e4518
6 changed files with 29 additions and 88 deletions

View file

@ -62,6 +62,7 @@ import com.raytheon.viz.pointdata.rsc.retrieve.PointDataPlotInfoRetriever;
* Oct 27, 2015 4798 bsteffen Move SVG localization url handler
* registration.
* Nov 16, 2015 5119 bsteffen Remove bufquikscat
* Jan 19, 2016 5253 tgurney Remove svrwx dependency on dataURI
*
* </pre>
*
@ -146,7 +147,6 @@ public class PlotResourceData extends AbstractRequestableResourceData {
*/
pluginProps.put("radar", new PluginPlotProperties(false));
pluginProps.put("tcg", new PluginPlotProperties(false));
pluginProps.put("svrwx", new PluginPlotProperties(false));
pluginProps.put("ldadhydro", new PluginPlotProperties(false));
pluginProps.put("textPoints", new PluginPlotProperties(false));
@ -155,6 +155,8 @@ public class PlotResourceData extends AbstractRequestableResourceData {
* default behavior, but for now they are included so we have a
* comprehensive list of which plugins use certain behaviors.
*/
pluginProps.put("svrwx", new PluginPlotProperties());
pluginProps.put("obs", new PluginPlotProperties());
pluginProps.put("goessounding", new PluginPlotProperties());
pluginProps.put("poessounding", new PluginPlotProperties());

View file

@ -0,0 +1,17 @@
#!/bin/bash
# DR #5253 - This script drops dataURI column from svrwx table and adds a new
# multi-column unique constraint
PSQL="/awips2/psql/bin/psql"
echo "INFO: Altering table svrwx"
${PSQL} -U awips -d metadata << EOF
begin transaction;
alter table svrwx
drop constraint if exists uk_svrwx_datauri_fields,
drop column if exists datauri,
add constraint uk_svrwx_datauri_fields unique (
reftime, reporttype, stationid, latitude, longitude);
commit transaction;
EOF

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.common.dataplugin.svrwx;
import java.util.Calendar;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
@ -61,7 +59,8 @@ import com.vividsolutions.jts.geom.Geometry;
* PluginDataObject.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Oct 14, 2013 2361 njensen Remove XML annotations
* Jul 28, 2015 4360 rferrel Named unique constraint. Made reportType non-nullable.
* Jul 28, 2015 4360 rferrel Named unique constraint. Made reportType non-nullable.
* Jan 14, 2016 5253 tgurney Dropped dataUri column and updated unique constraint.
*
* </pre>
*
@ -70,7 +69,8 @@ import com.vividsolutions.jts.geom.Geometry;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "svrwxseq")
@Table(name = "svrwx", uniqueConstraints = { @UniqueConstraint(name = "uk_svrwx_datauri_fields", columnNames = { "dataURI" }) })
@Table(name = "svrwx", uniqueConstraints = { @UniqueConstraint(name = "uk_svrwx_datauri_fields", columnNames = {
"refTime", "reportType", "stationId", "latitude", "longitude" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
@ -145,17 +145,6 @@ public class SvrWxRecord extends PersistablePluginDataObject implements
this.wmoHeader = wmoHeader;
}
/**
* Set the data uri for this observation.
*
* @param dataURI
*/
@Override
public void setDataURI(String dataURI) {
super.setDataURI(dataURI);
identifier = dataURI;
}
@Override
public SurfaceObsLocation getSpatialObject() {
return location;
@ -279,13 +268,6 @@ public class SvrWxRecord extends PersistablePluginDataObject implements
return sb.toString();
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
@Override
public String getPluginName() {
return "svrwx";

View file

@ -2,5 +2,5 @@
<pointDataDbDescription>
<parameter name="latitude" queryName="location.latitude" type="FLOAT" unit="°" />
<parameter name="longitude" queryName="location.longitude" type="FLOAT" unit="°" />
<parameter name="dataURI" queryName="dataURI" type="STRING" />
</pointDataDbDescription>
<parameter name="stationId" queryName="location.stationId" type="STRING" />
</pointDataDbDescription>

View file

@ -19,11 +19,8 @@
**/
package com.raytheon.uf.edex.plugin.svrwx;
import java.util.List;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.svrwx.SvrWxRecord;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
/**
@ -37,6 +34,7 @@ import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
* ------------ ---------- ----------- --------------------------
* Jan 4, 2010 jsanchez Initial creation
* Apr 10, 2014 2971 skorolev Cleaned code.
* Jan 19, 2016 5253 tgurney Remove dead code
*
* </pre>
*
@ -46,7 +44,7 @@ import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
public class SvrWxRecordDao extends PointDataPluginDao<SvrWxRecord> {
/**
* Creates a new TropicalCycloneGuidance Dao
* Creates a new SvrWxRecord Dao
*
* @param pluginName
* @throws PluginException
@ -55,74 +53,16 @@ public class SvrWxRecordDao extends PointDataPluginDao<SvrWxRecord> {
super(pluginName);
}
/**
* Retrieves an tcg report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public SvrWxRecord queryByDataURI(String dataURI) {
SvrWxRecord report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if ((obs != null) && (obs.size() > 0)) {
report = (SvrWxRecord) obs.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the tcg table.
*
* @param dataUri
* The DataURI to find.
* @return An array of objects. If not null, there should only be a single
* element.
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.svrwx where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
return results;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.edex.pointdata.PointDataPluginDao#getKeysRequiredForFileName
* ()
*/
@Override
public String[] getKeysRequiredForFileName() {
return new String[] { "dataTime.refTime" };
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.edex.pointdata.PointDataPluginDao#getPointDataFileName
* (com.raytheon.uf.common.dataplugin.PluginDataObject)
*/
@Override
public String getPointDataFileName(SvrWxRecord p) {
return "svrwx.h5";
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.edex.pointdata.PointDataPluginDao#newObject()
*/
@Override
public SvrWxRecord newObject() {
return new SvrWxRecord();

View file

@ -19,5 +19,5 @@
further_licensing_information.
-->
<requestPatterns xmlns:ns2="group">
<regex>^NWUS20.*</regex>
<regex>^NWUS2[02].*</regex>
</requestPatterns>