Merge "Omaha #5310 Drop dataURI column from bufrncwf" into omaha_16.2.2
Former-commit-id: 5c1ea7af653b3133cd37a72db6a505b74c939769
This commit is contained in:
commit
d60d986d8b
5 changed files with 48 additions and 92 deletions
|
@ -29,8 +29,6 @@ import org.eclipse.swt.graphics.RGB;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.bufrncwf.BUFRncwf;
|
||||
import com.raytheon.uf.common.dataplugin.bufrncwf.NCWFFeature;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.pointdata.PointDataView;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
|
@ -54,8 +52,9 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 16, 2009 bsteffen Initial creation
|
||||
* Jul 24, 2014 3429 mapeters Updated deprecated drawLine() calls.
|
||||
* Sep 16, 2009 bsteffen Initial creation
|
||||
* Jul 24, 2014 3429 mapeters Updated deprecated drawLine() calls.
|
||||
* Feb 04, 2016 5310 tgurney Remove dependency on dataURI
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -168,7 +167,8 @@ public class NcwfMovementResource extends
|
|||
// Draw the body of the arrow
|
||||
DrawableLine line = new DrawableLine();
|
||||
line.setCoordinates(centerPixel[0], centerPixel[1], centerPixel[2]);
|
||||
line.addPoint(or_centerPixel[0], or_centerPixel[1], or_centerPixel[2]);
|
||||
line.addPoint(or_centerPixel[0], or_centerPixel[1],
|
||||
or_centerPixel[2]);
|
||||
line.basics.color = color;
|
||||
line.width = 1.5f;
|
||||
lines.add(line);
|
||||
|
@ -181,8 +181,8 @@ public class NcwfMovementResource extends
|
|||
}
|
||||
|
||||
private DrawableLine createArrowHead(IGraphicsTarget target,
|
||||
double[] center,
|
||||
Double length, Double dir, RGB color) throws VizException {
|
||||
double[] center, Double length, Double dir, RGB color)
|
||||
throws VizException {
|
||||
double[] pointPixel = target.getPointOnCircle(center[0], center[1],
|
||||
center[2], length, dir + 210);
|
||||
|
||||
|
@ -191,8 +191,7 @@ public class NcwfMovementResource extends
|
|||
line.setCoordinates(pointPixel[0], pointPixel[1], pointPixel[2]);
|
||||
line.addPoint(center[0], center[1], center[2]);
|
||||
double[] pointPixel2 = target.getPointOnCircle(center[0], center[1],
|
||||
center[2],
|
||||
length, dir + 150);
|
||||
center[2], length, dir + 150);
|
||||
line.addPoint(pointPixel2[0], pointPixel2[1], pointPixel2[2]);
|
||||
line.basics.color = color;
|
||||
line.width = 1.5f;
|
||||
|
@ -209,21 +208,13 @@ public class NcwfMovementResource extends
|
|||
if (!recordsMap.containsKey(displayedDataTime)) {
|
||||
recordsMap.put(displayedDataTime, new ArrayList<BUFRncwf>());
|
||||
}
|
||||
RequestConstraint constraint = new RequestConstraint();
|
||||
|
||||
constraint.setConstraintType(ConstraintType.IN);
|
||||
|
||||
for (BUFRncwf r : records) {
|
||||
|
||||
constraint.addToConstraintValueList(r.getDataURI());
|
||||
}
|
||||
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>();
|
||||
constraints.put("dataURI", constraint);
|
||||
// Request the point data
|
||||
PointDataContainer pdc = PointDataRequest.requestPointDataAllLevels(
|
||||
displayedDataTime,
|
||||
resourceData.getMetadataMap().get("pluginName")
|
||||
.getConstraintValue(), parameters, null, constraints);
|
||||
.getConstraintValue(), parameters, null,
|
||||
resourceData.getMetadataMap());
|
||||
|
||||
for (int uriCounter = 0; uriCounter < pdc.getAllocatedSz(); uriCounter++) {
|
||||
PointDataView pdv = pdc.readRandom(uriCounter);
|
||||
|
@ -253,6 +244,7 @@ public class NcwfMovementResource extends
|
|||
this.recordsToParse.get(displayedDataTime).clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addRecord(BUFRncwf obj) {
|
||||
if (!recordsToParse.containsKey(obj.getDataTime())) {
|
||||
recordsToParse.put(obj.getDataTime(), new ArrayList<BUFRncwf>());
|
||||
|
|
|
@ -53,7 +53,8 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 16, 2009 bsteffen Initial creation
|
||||
* Sep 16, 2009 bsteffen Initial creation
|
||||
* Feb 04, 2016 5310 tgurney Remove dependency on dataURI
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -175,14 +176,12 @@ public class NcwfPolygonResource extends
|
|||
DataTime dataTime = null;
|
||||
|
||||
for (BUFRncwf r : records) {
|
||||
constraint.addToConstraintValueList(r.getDataURI());
|
||||
dataTime = r.getDataTime();
|
||||
}
|
||||
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>();
|
||||
constraints.put("dataURI", constraint);
|
||||
PointDataContainer pdc = PointDataRequest.requestPointDataAllLevels(
|
||||
dataTime, resourceData.getMetadataMap().get("pluginName")
|
||||
.getConstraintValue(), parameters, null, constraints);
|
||||
.getConstraintValue(), parameters, null,
|
||||
resourceData.getMetadataMap());
|
||||
|
||||
for (int uriCounter = 0; uriCounter < pdc.getAllocatedSz(); uriCounter++) {
|
||||
PointDataView pdv = pdc.readRandom(uriCounter);
|
||||
|
@ -206,6 +205,7 @@ public class NcwfPolygonResource extends
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addRecord(BUFRncwf obj) {
|
||||
|
||||
DataTime time = calculateBinTime(obj.getDataTime());
|
||||
|
|
19
deltaScripts/16.2.2/DR5310/alter_bufrncwf_drop_datauri.sh
Executable file
19
deltaScripts/16.2.2/DR5310/alter_bufrncwf_drop_datauri.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
# DR #5310 - This script drops dataURI column from bufrncwf table and adds a
|
||||
# new multi-column unique constraint
|
||||
|
||||
TABLE=bufrncwf
|
||||
|
||||
PSQL="/awips2/psql/bin/psql"
|
||||
|
||||
echo "INFO: Altering table ${TABLE}"
|
||||
|
||||
${PSQL} -U awips -d metadata << EOF
|
||||
begin transaction;
|
||||
alter table ${TABLE}
|
||||
drop constraint if exists uk_${TABLE}_datauri_fields,
|
||||
drop column if exists datauri,
|
||||
add constraint uk_${TABLE}_datauri_fields unique
|
||||
(reftime, latitude, longitude, stationid);
|
||||
commit transaction;
|
||||
EOF
|
|
@ -19,9 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.dataplugin.bufrncwf;
|
||||
|
||||
import javax.persistence.Access;
|
||||
import javax.persistence.AccessType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
|
@ -60,6 +57,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* Oct 15, 2013 2361 njensen Remove XML annotations and IDecoderGettable
|
||||
* Jul 23, 2015 4360 rferrel Add name to unique constraint.
|
||||
* Feb 04, 2016 5310 tgurney Drop dataURI column and update unique constraint.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -68,7 +66,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
*/
|
||||
@Entity
|
||||
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "bufrncwfseq")
|
||||
@Table(name = "bufrncwf", uniqueConstraints = { @UniqueConstraint(name = "uk_bufrncwf_datauri_fields", columnNames = { "dataURI" }) })
|
||||
@Table(name = "bufrncwf", uniqueConstraints = { @UniqueConstraint(name = "uk_bufrncwf_datauri_fields", columnNames = {
|
||||
"refTime", "latitude", "longitude", "stationId" }) })
|
||||
/*
|
||||
* Both refTime and forecastTime are included in the refTimeIndex since
|
||||
* forecastTime is unlikely to be used.
|
||||
|
@ -224,29 +223,16 @@ public class BUFRncwf extends PersistablePluginDataObject implements
|
|||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public PointDataView getPointDataView() {
|
||||
return pointDataView;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void setPointDataView(PointDataView pointDataView) {
|
||||
this.pointDataView = pointDataView;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Column
|
||||
@Access(AccessType.PROPERTY)
|
||||
public String getDataURI() {
|
||||
return super.getDataURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "bufrncwf";
|
||||
|
|
|
@ -19,80 +19,39 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.plugin.bufrncwf;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.bufrncwf.BUFRncwf;
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* DAO for BUFRncwf
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 17, 2009 jkorman Initial creation
|
||||
*
|
||||
* Feb 04, 2016 5310 tgurney Remove dead code
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class BUFRncwfDao extends PointDataPluginDao<BUFRncwf> {
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new ReccoDao
|
||||
* @throws PluginException
|
||||
* Creates a new BUFRncwfDao
|
||||
*
|
||||
* @throws PluginException
|
||||
*/
|
||||
public BUFRncwfDao(String pluginName) throws PluginException {
|
||||
super(pluginName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an bufrua report using the datauri .
|
||||
*
|
||||
* @param dataURI
|
||||
* The dataURI to match against.
|
||||
* @return The report record if it exists.
|
||||
*/
|
||||
public BUFRncwf queryByDataURI(String dataURI) {
|
||||
BUFRncwf report = null;
|
||||
List<?> obs = null;
|
||||
try {
|
||||
obs = queryBySingleCriteria("dataURI", dataURI);
|
||||
} catch (DataAccessLayerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if((obs != null)&&(obs.size() > 0)) {
|
||||
report = (BUFRncwf) obs.get(0);
|
||||
}
|
||||
return report;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries for to determine if a given data uri exists on the bufrua 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.bufrncwfua where datauri='"
|
||||
+ dataUri + "';";
|
||||
|
||||
Object[] results = executeSQLQuery(sql);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getKeysRequiredForFileName() {
|
||||
return new String[] { "dataTime.refTime" };
|
||||
|
|
Loading…
Add table
Reference in a new issue