Merge "Issue #1869 Get plots working without dataURI" into development

Former-commit-id: 661482f1dd [formerly 6c42b5af64 [formerly 3d4bbfa57651c97bc94d88ea83583a366a09200b]]
Former-commit-id: 6c42b5af64
Former-commit-id: 521420916e
This commit is contained in:
Nate Jensen 2013-05-14 16:23:00 -05:00 committed by Gerrit Code Review
commit 45c3d17eb7
6 changed files with 221 additions and 81 deletions

View file

@ -37,6 +37,8 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller; import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -75,11 +77,13 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 10, 2009 chammack Initial creation * Feb 10, 2009 chammack Initial creation
* Feb 26, 2009 2032 jsanchez Added loadWithNoData condition. * Feb 26, 2009 2032 jsanchez Added loadWithNoData condition.
* April 6, 2011 njensen Moved binning times to edex * Apr 06, 2011 njensen Moved binning times to edex
* April 13, 2011 njensen Caching available times * Apr 13, 2011 njensen Caching available times
* Mar 29, 2013 1638 mschenke Switched to create PDO from dataURI mapping instead of dataURI string * Mar 29, 2013 1638 mschenke Switched to create PDO from dataURI
* mapping instead of dataURI string
* May 14, 2013 1869 bsteffen Get dataURI map directly from PDO.
* *
* </pre> * </pre>
* *
@ -240,10 +244,8 @@ public abstract class AbstractRequestableResourceData extends
public static void checkMetadataMap(Map<String, RequestConstraint> map, public static void checkMetadataMap(Map<String, RequestConstraint> map,
PluginDataObject pdo) { PluginDataObject pdo) {
String dataURI = pdo.getDataURI();
RecordFactory factory = RecordFactory.getInstance();
try { try {
Map<String, Object> dataURIMap = factory.loadMapFromUri(dataURI); Map<String, Object> dataURIMap = DataURIUtil.createDataURIMap(pdo);
for (String key : map.keySet()) { for (String key : map.keySet()) {
if (dataURIMap.containsKey(key) == false) { if (dataURIMap.containsKey(key) == false) {
statusHandler statusHandler
@ -257,7 +259,7 @@ public abstract class AbstractRequestableResourceData extends
+ " is not in datauri, updates may not properly work for resource"); + " is not in datauri, updates may not properly work for resource");
} }
} }
} catch (VizException e) { } catch (PluginException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error parsing datauri into map", e); "Error parsing datauri into map", e);
} }
@ -289,9 +291,8 @@ public abstract class AbstractRequestableResourceData extends
} }
} }
} }
this.fireChangeListeners(ChangeType.DATA_UPDATE, updateData);
} }
this.fireChangeListeners(ChangeType.DATA_UPDATE, updateData);
} }
protected void update(AlertMessage... messages) { protected void update(AlertMessage... messages) {

View file

@ -37,12 +37,14 @@ import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.IMapDescriptor; import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.viz.pointdata.PlotModelFactory2.PlotModelElement; import com.raytheon.viz.pointdata.PlotModelFactory2.PlotModelElement;
import com.raytheon.viz.pointdata.rsc.PlotResourceData;
import com.raytheon.viz.pointdata.thread.GetDataTask; import com.raytheon.viz.pointdata.thread.GetDataTask;
import com.raytheon.viz.pointdata.thread.PlotSampleGeneratorJob; import com.raytheon.viz.pointdata.thread.PlotSampleGeneratorJob;
@ -57,6 +59,7 @@ import com.raytheon.viz.pointdata.thread.PlotSampleGeneratorJob;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 22, 2011 njensen Initial creation * Apr 22, 2011 njensen Initial creation
* May 14, 2013 1869 bsteffen Get plots working without dataURI
* *
* </pre> * </pre>
* *
@ -193,22 +196,62 @@ public class PlotModelDataRequestJob extends Job {
} }
} }
if (!params.contains("dataURI")) { boolean hasDistinctStationId = PlotResourceData
params.add("dataURI"); .getPluginProperties(plugin).hasDistinctStationId;
} String uniquePointDataKey = "stationId";
String uniqueQueryKey = "location.stationId";
if(!hasDistinctStationId){
uniquePointDataKey = "dataURI";
uniqueQueryKey = uniquePointDataKey;
}
if (!params.contains(uniquePointDataKey)) {
params.add(uniquePointDataKey);
}
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>(); Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
map.putAll(this.constraintMap); map.putAll(this.constraintMap);
RequestConstraint rc = new RequestConstraint(); RequestConstraint rc = new RequestConstraint();
rc.setConstraintType(ConstraintType.IN); rc.setConstraintType(ConstraintType.IN);
List<String> str = new ArrayList<String>(stationQuery.size()); List<String> str = new ArrayList<String>(stationQuery.size());
DataTime start = null;
DataTime end = null;
for (PlotInfo[] infos : stationQuery) { for (PlotInfo[] infos : stationQuery) {
for (PlotInfo info : infos) { for (PlotInfo info : infos) {
str.add(info.dataURI); String key = null;
plotMap.put(info.dataURI, info); if (hasDistinctStationId) {
key = info.stationId;
}else{
key = info.dataURI;
}
str.add(key);
if (!plotMap.containsKey(key)) {
plotMap.put(key, info);
}
if (start == null
|| start.getValidTime().after(
info.dataTime.getValidTime())) {
start = info.dataTime;
}
if (end == null
|| end.getValidTime().before(
info.dataTime.getValidTime())) {
end = info.dataTime;
}
} }
} }
if (start.equals(end)) {
map.put("dataTime", new RequestConstraint(start.toString()));
} else {
RequestConstraint r = new RequestConstraint(null,
ConstraintType.BETWEEN);
r.setBetweenValueList(new String[] { start.toString(),
end.toString() });
map.put("dataTime.refTime", r);
}
int index = 0; int index = 0;
int j = 0; int j = 0;
int numOfValues = 500; int numOfValues = 500;
@ -219,7 +262,7 @@ public class PlotModelDataRequestJob extends Job {
index++; index++;
j++; j++;
} }
map.put("dataURI", rc); map.put(uniqueQueryKey, rc);
try { try {
// Try and get data from datacube // Try and get data from datacube
long t0 = System.currentTimeMillis(); long t0 = System.currentTimeMillis();
@ -243,8 +286,8 @@ public class PlotModelDataRequestJob extends Job {
for (int uriCounter = 0; uriCounter < pdc.getAllocatedSz(); uriCounter++) { for (int uriCounter = 0; uriCounter < pdc.getAllocatedSz(); uriCounter++) {
PointDataView pdv = pdc.readRandom(uriCounter); PointDataView pdv = pdc.readRandom(uriCounter);
if (pdv != null) { if (pdv != null) {
String dataURI = pdv.getString("dataURI"); String unique = pdv.getString(uniquePointDataKey);
PlotInfo info = plotMap.get(dataURI); PlotInfo info = plotMap.get(unique);
// If the id doesn't match, try to match by // If the id doesn't match, try to match by
// location // location
if (info == null) { if (info == null) {

View file

@ -82,15 +82,16 @@ import com.vividsolutions.jts.geom.Coordinate;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 11/20/2006 brockwoo Initial creation. * Nov 20, 2006 brockwoo Initial creation.
* 02/17/2009 njensen Refactored to new rsc architecture. * Feb 17, 2009 njensen Refactored to new rsc architecture.
* 03/17/2009 2105 jsanchez Plot goessounding/poessounding availability. * Mar 17, 2009 2105 jsanchez Plot goessounding/poessounding
* 03/30/2009 2169 jsanchez Updated initNewFrame. * availability.
* 04/09/2009 952 jsanchez Plot acars. * Mar 30, 2009 2169 jsanchez Updated initNewFrame.
* 04/13/2009 2251 jsanchez Plot profilers. * Apr 09, 2009 952 jsanchez Plot acars.
* 04/21/2009 chammack Refactor to common pointData model * Apr 13, 2009 2251 jsanchez Plot profilers.
* 02/01/2013 1567 njensen Refactor handling of updates * Apr 21, 2009 chammack Refactor to common pointData model
* * Feb 01, 2013 1567 njensen Refactor handling of updates
* May 14, 2013 1869 bsteffen Get plots working without dataURI
* *
* </pre> * </pre>
* *
@ -378,7 +379,9 @@ public class PlotResource2 extends
} }
boolean dup = false; boolean dup = false;
for (int i = 0; i < existingStation.info.length; i++) { for (int i = 0; i < existingStation.info.length; i++) {
if (existingStation.info[i].dataURI.equals(plot.dataURI)) { String curUri = existingStation.info[i].dataURI;
String newUri = plot.dataURI;
if (curUri == null || curUri.equals(newUri)) {
dup = true; dup = true;
break; break;
} }

View file

@ -21,9 +21,7 @@ package com.raytheon.viz.pointdata.rsc;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
@ -35,6 +33,7 @@ import org.apache.batik.util.ParsedURL;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller; import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller;
import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
@ -55,7 +54,8 @@ import com.raytheon.viz.pointdata.rsc.retrieve.PointDataPlotInfoRetriever;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 17, 2009 njensen Initial creation * Feb 17, 2009 njensen Initial creation
* Jun 29, 2009 2538 jsanchez Implemented Metars. * Jun 29, 2009 2538 jsanchez Implemented Metars.
* May 14, 2013 1869 bsteffen Get plots working without dataURI
* *
* </pre> * </pre>
* *
@ -68,6 +68,39 @@ public class PlotResourceData extends AbstractRequestableResourceData {
public static final String PLOT_DIR = "plotModels" + File.separator; public static final String PLOT_DIR = "plotModels" + File.separator;
public static class PluginPlotProperties {
/**
* Plugins that use the point data api will be instantiated using
* PlotResource2, otherwise PlotResource will be used which requires
* that the PDO of the plugin implement IDecoderGettable
*/
public final boolean usesPointDataApi;
/**
* When this is true all plots will be correlated based on the
* stationId, otherwise each dataURI is mapped to a specific set of
* data.
*/
public final boolean hasDistinctStationId;
public PluginPlotProperties(boolean usesPointDataApi,
boolean hasDistinctStationId) {
this.usesPointDataApi = usesPointDataApi;
this.hasDistinctStationId = hasDistinctStationId;
}
/**
* This is the goal for all plugins, they should use the new api and
* they should have distinct stationIds.
*/
public PluginPlotProperties() {
this.usesPointDataApi = true;
this.hasDistinctStationId = true;
}
}
@XmlAttribute @XmlAttribute
int pixelSampleDistance = 32; int pixelSampleDistance = 32;
@ -107,40 +140,56 @@ public class PlotResourceData extends AbstractRequestableResourceData {
@XmlJavaTypeAdapter(value = RequestableMetadataMarshaller.class) @XmlJavaTypeAdapter(value = RequestableMetadataMarshaller.class)
protected HashMap<String, RequestConstraint> timeQueryMetadataMap; protected HashMap<String, RequestConstraint> timeQueryMetadataMap;
private static Set<String> pluginNames = new HashSet<String>(); private static final Map<String, PluginPlotProperties> pluginProps = new HashMap<String, PluginPlotProperties>();
static { static {
pluginNames.add("goessounding"); /*
pluginNames.add("poessounding"); * These use the original PlotResource, whoever can convert these gets
pluginNames.add("obs"); * to delete thousands of lines of code, it will be amazing.
pluginNames.add("bufrssmi"); */
pluginNames.add("bufrquikscat"); pluginProps.put("pirep", new PluginPlotProperties(false, false));
pluginNames.add("bufrascat"); pluginProps.put("airep", new PluginPlotProperties(false, false));
pluginNames.add("radar");
pluginNames.add("bufrhdw"); /*
pluginNames.add("bufrmthdw"); * These have a dependency on dataURI because they don't set stationId,
pluginNames.add("bufrua"); * In the future if stationId can be set to anything that is even a
pluginNames.add("lsr"); * little unique we can get rid of this
pluginNames.add("sfcobs"); */
pluginNames.add("tcg"); pluginProps.put("bufrssmi", new PluginPlotProperties(true, false));
pluginNames.add("svrwx"); pluginProps.put("bufrquikscat", new PluginPlotProperties(true, false));
pluginNames.add("ldadmesonet"); pluginProps.put("bufrascat", new PluginPlotProperties(true, false));
pluginNames.add("ldadhydro"); pluginProps.put("radar", new PluginPlotProperties(true, false));
pluginNames.add("qc"); pluginProps.put("bufrhdw", new PluginPlotProperties(true, false));
pluginNames.add("profiler"); pluginProps.put("bufrmthdw", new PluginPlotProperties(true, false));
pluginNames.add("fssobs"); pluginProps.put("lsr", new PluginPlotProperties(true, false));
pluginNames.add("modelsounding"); pluginProps.put("tcg", new PluginPlotProperties(true, false));
pluginNames.add("textPoints"); pluginProps.put("svrwx", new PluginPlotProperties(true, false));
pluginNames.add("bufrmosAVN"); pluginProps.put("ldadmesonet", new PluginPlotProperties(true, false));
pluginNames.add("bufrmosETA"); pluginProps.put("ldadhydro", new PluginPlotProperties(true, false));
pluginNames.add("bufrmosGFS"); pluginProps.put("qc", new PluginPlotProperties(true, false));
pluginNames.add("bufrmosHPC"); pluginProps.put("textPoints", new PluginPlotProperties(true, false));
pluginNames.add("bufrmosLAMP"); /*
pluginNames.add("bufrmosMRF"); * The good ones, these don't even need to be here because this is the
pluginNames.add("bufrmosNGM"); * default behavior, but for now they are included so we have a
} * comprehensive list of which plugins use certain behaviors.
*/
pluginProps.put("obs", new PluginPlotProperties());
pluginProps.put("goessounding", new PluginPlotProperties());
pluginProps.put("poessounding", new PluginPlotProperties());
pluginProps.put("bufrua", new PluginPlotProperties());
pluginProps.put("sfcobs", new PluginPlotProperties());
pluginProps.put("profiler", new PluginPlotProperties());
pluginProps.put("fssobs", new PluginPlotProperties());
pluginProps.put("modelsounding", new PluginPlotProperties());
pluginProps.put("bufrmosAVN", new PluginPlotProperties());
pluginProps.put("bufrmosETA", new PluginPlotProperties());
pluginProps.put("bufrmosGFS", new PluginPlotProperties());
pluginProps.put("bufrmosHPC", new PluginPlotProperties());
pluginProps.put("bufrmosLAMP", new PluginPlotProperties());
pluginProps.put("bufrmosMRF", new PluginPlotProperties());
pluginProps.put("bufrmosNGM", new PluginPlotProperties());
static {
ParsedURL.registerHandler(new LocalizationParsedURLHandler()); ParsedURL.registerHandler(new LocalizationParsedURLHandler());
} }
@ -161,8 +210,8 @@ public class PlotResourceData extends AbstractRequestableResourceData {
@Override @Override
protected AbstractVizResource<?, ?> constructResource( protected AbstractVizResource<?, ?> constructResource(
LoadProperties loadProperties, PluginDataObject[] objects) { LoadProperties loadProperties, PluginDataObject[] objects) {
if (pluginNames.contains(this.metadataMap.get("pluginName")
.getConstraintValue())) { if (getPluginProperties().usesPointDataApi) {
return new PlotResource2(this, loadProperties); return new PlotResource2(this, loadProperties);
} }
@ -418,4 +467,24 @@ public class PlotResourceData extends AbstractRequestableResourceData {
return false; return false;
} }
public PluginPlotProperties getPluginProperties() {
return getPluginProperties(this.metadataMap);
}
public static PluginPlotProperties getPluginProperties(String pluginName) {
PluginPlotProperties result = pluginProps.get(pluginName);
if (result == null) {
result = new PluginPlotProperties();
}
return result;
}
public static PluginPlotProperties getPluginProperties(Map<String,RequestConstraint> metadataMap){
RequestConstraint rc = metadataMap.get("pluginName");
if (rc == null || rc.getConstraintType() != ConstraintType.EQUALS) {
throw new IllegalArgumentException("Cannot find plugin properties because metadataMap does not specify a plugin.");
}
return getPluginProperties(rc.getConstraintValue());
}
} }

View file

@ -37,6 +37,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType;
import com.raytheon.viz.pointdata.PlotInfo; import com.raytheon.viz.pointdata.PlotInfo;
import com.raytheon.viz.pointdata.rsc.PlotResourceData;
/** /**
* *
@ -47,7 +48,8 @@ import com.raytheon.viz.pointdata.PlotInfo;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 9, 2009 bsteffen Initial creation * Oct 09, 2009 bsteffen Initial creation
* May 14, 2013 1869 bsteffen Get plots working without dataURI
* *
* </pre> * </pre>
* *
@ -64,9 +66,10 @@ public class PointDataPlotInfoRetriever extends AbstractDbPlotInfoRetriever {
protected boolean onlyRefTime = false; protected boolean onlyRefTime = false;
protected boolean needsDataUri = true;
@Override @Override
protected void addColumns(DbQuery dq) { protected void addColumns(DbQuery dq) {
dq.addColumn("dataURI");
dq.addColumn("location.latitude"); dq.addColumn("location.latitude");
dq.addColumn("location.longitude"); dq.addColumn("location.longitude");
dq.addColumn("location.stationId"); dq.addColumn("location.stationId");
@ -76,23 +79,26 @@ public class PointDataPlotInfoRetriever extends AbstractDbPlotInfoRetriever {
} else { } else {
dq.addColumn("dataTime"); dq.addColumn("dataTime");
} }
if (needsDataUri) {
dq.addColumn("dataURI");
}
} }
@Override @Override
protected PlotInfo getPlotInfo(Object[] data) { protected PlotInfo getPlotInfo(Object[] data) {
PlotInfo stationInfo = new PlotInfo(); PlotInfo stationInfo = new PlotInfo();
stationInfo.dataURI = (String) data[0]; stationInfo.latitude = (Double) data[0];
stationInfo.latitude = (Double) data[1]; stationInfo.longitude = (Double) data[1];
stationInfo.longitude = (Double) data[2]; stationInfo.stationId = (String) data[2];
stationInfo.stationId = (String) data[3];
if (stationInfo.stationId == null) { if (stationInfo.stationId == null) {
stationInfo.stationId = "" + data[1] + "#" + data[2]; stationInfo.stationId = "" + stationInfo.latitude + "#"
+ stationInfo.longitude;
} }
if (data[4] instanceof DataTime) { if (data[3] instanceof DataTime) {
stationInfo.dataTime = (DataTime) data[4]; stationInfo.dataTime = (DataTime) data[3];
} else if (data[4] instanceof Timestamp) { } else if (data[3] instanceof Timestamp) {
stationInfo.dataTime = new DataTime((Timestamp) data[4]); stationInfo.dataTime = new DataTime((Timestamp) data[3]);
} else { } else {
String message = "Incorrect dataTime class type from database, expected " String message = "Incorrect dataTime class type from database, expected "
+ DataTime.class.getName() + DataTime.class.getName()
@ -103,7 +109,9 @@ public class PointDataPlotInfoRetriever extends AbstractDbPlotInfoRetriever {
statusHandler.handle(Priority.CRITICAL, message, new Exception( statusHandler.handle(Priority.CRITICAL, message, new Exception(
message)); message));
} }
if (data.length == 5) {
stationInfo.dataURI = (String) data[4];
}
return stationInfo; return stationInfo;
} }
@ -113,6 +121,7 @@ public class PointDataPlotInfoRetriever extends AbstractDbPlotInfoRetriever {
DbQuery dq = null; DbQuery dq = null;
synchronized (onlyRefTimeFlagLock) { synchronized (onlyRefTimeFlagLock) {
onlyRefTime = !time.getUtilityFlags().contains(FLAG.FCST_USED); onlyRefTime = !time.getUtilityFlags().contains(FLAG.FCST_USED);
needsDataUri = !PlotResourceData.getPluginProperties(metadataMap).hasDistinctStationId;
dq = getQueryObject(metadataMap); dq = getQueryObject(metadataMap);
} }
List<PlotInfo> info = runStationQuery(dq); List<PlotInfo> info = runStationQuery(dq);

View file

@ -28,6 +28,7 @@ import java.util.Set;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.pointdata.PointDataConstants;
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData; import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
@ -46,7 +47,8 @@ import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableNode;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 13, 2012 bsteffen Initial creation * Apr 13, 2012 bsteffen Initial creation
* May 14, 2013 1869 bsteffen Get plots working without dataURI
* *
* </pre> * </pre>
* *
@ -56,6 +58,15 @@ import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableNode;
public class PointMetadataContainer extends MetadataContainer { public class PointMetadataContainer extends MetadataContainer {
/**
* Parameters which should be requested for all levels.
*/
private static final List<String> constantParameters = Arrays.asList("id",
"latitude", "longitude", "dataURI",
PointDataConstants.DATASET_STATIONID,
PointDataConstants.DATASET_REFTIME,
PointDataConstants.DATASET_FORECASTHR);
private final PointDataCubeAdapter pdca; private final PointDataCubeAdapter pdca;
private final List<String> requestedParameters; private final List<String> requestedParameters;
@ -97,9 +108,13 @@ public class PointMetadataContainer extends MetadataContainer {
if (baseParams.isEmpty()) { if (baseParams.isEmpty()) {
return; return;
} }
if (requestedParameters.contains("dataURI")) { for (String parameter : requestedParameters) {
baseParams.add("dataURI"); if (constantParameters.contains(parameter)
&& !baseParams.contains(parameter)) {
baseParams.add(parameter);
}
} }
pdc = pdca.getBaseRecords(baseParams, originalConstraints); pdc = pdca.getBaseRecords(baseParams, originalConstraints);
for (PointDataLevelNode node : nodes) { for (PointDataLevelNode node : nodes) {
Set<AbstractRequestableData> cacheSet = new HashSet<AbstractRequestableData>(); Set<AbstractRequestableData> cacheSet = new HashSet<AbstractRequestableData>();
@ -107,7 +122,7 @@ public class PointMetadataContainer extends MetadataContainer {
IDataRecord rec = pdc.getParameterRecord(node.getParameter()); IDataRecord rec = pdc.getParameterRecord(node.getParameter());
cacheSet.add(new PointRequestableData(rec, pdc.getDescription( cacheSet.add(new PointRequestableData(rec, pdc.getDescription(
node.getParameter()).getUnitObject())); node.getParameter()).getUnitObject()));
if (!Arrays.asList("id", "latitude", "longitude", "dataURI") if (!constantParameters
.contains(rec.getName())) { .contains(rec.getName())) {
pdc.remove(rec.getName()); pdc.remove(rec.getName());
} }