Issue #3026 Fixed null metaData lookups in resource.

Change-Id: I29d17ea990ac5516b67ac18fadf4267663a23efb

Former-commit-id: 02cba88d1a [formerly 019739d738] [formerly 3052a38081] [formerly 02cba88d1a [formerly 019739d738] [formerly 3052a38081] [formerly 39db26fb1d [formerly 3052a38081 [formerly 3f6bba1fda61fe283be47af1a4245d196f94f998]]]]
Former-commit-id: 39db26fb1d
Former-commit-id: cf99f70020 [formerly d58e10f006] [formerly 9caf66e7d3bf0e1f08a3d26da73cf675814cd89e [formerly 99e46fdc2c]]
Former-commit-id: 650e9621a3a41dccf35bb4303f1192441e964d40 [formerly 1e663936c6]
Former-commit-id: 1fd60a4db7
This commit is contained in:
Dave Hladky 2014-11-10 17:21:30 -06:00
parent 346b21fb94
commit 7c8d6fc6dd
2 changed files with 87 additions and 3 deletions

View file

@ -100,6 +100,7 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
* Jul 09, 2013 2152 njensen Synchronize uri requests to avoid duplicating effort
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
* Jul 16, 2013 2197 njensen Use FFMPBasinData.hasAnyBasins() for efficiency
* Nov 10, 2014 3026 dhladky HPE BIAS displays.
*
* </pre>
*
@ -2203,5 +2204,62 @@ public class FFMPMonitor extends ResourceMonitor {
}
}
}
/**
*
* Set and lookup metaData ID used by HPE for text bias string on D2D.
*
* @param date
* @param wfo
* @param siteKey
* @param dataKey
* @param sourceName
* @return
*/
public String getProductID(Date date, String wfo, String siteKey, String dataKey, String sourceName) {
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(FFMPRecord.class);
request.addRequestField("metaData");
request.addConstraint("dataTime.refTime", new RequestConstraint(
datePattern.get().format(date),
ConstraintType.EQUALS));
request.addConstraint("wfo", new RequestConstraint(wfo));
request.addConstraint("siteKey", new RequestConstraint(siteKey));
request.addConstraint("dataKey", new RequestConstraint(dataKey));
request.addConstraint("sourceName", new RequestConstraint(sourceName));
DbQueryResponse dbResponse = null;
try {
dbResponse = (DbQueryResponse) ThriftClient.sendRequest(request);
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
"Couldn't lookup FFMP HPE metaData! date: " + date
+ ", wfo: " + wfo + ", siteKey: " + siteKey
+ " , dataKey: " + dataKey + ", sourceName: "
+ sourceName, e);
}
if (dbResponse.getFieldObjects("metaData", String.class).length > 1) {
statusHandler
.warn("There SHOULD only be one unique response for this query! date: "
+ date
+ ", wfo: "
+ wfo
+ ", siteKey: "
+ siteKey
+ " , dataKey: "
+ dataKey
+ ", sourceName: "
+ sourceName);
}
for (String metadata : dbResponse.getFieldObjects("metaData",
String.class)) {
return metadata;
}
return null;
}
}

View file

@ -184,6 +184,7 @@ import com.vividsolutions.jts.geom.Point;
* Apr 30, 2014 DR 16148 gzhang Filter Basin Dates for Trend and Table Gap.
* May 05, 2014 3026 mpduff Display Hpe bias source.
* May 19, 2014 DR 16096 gzhang Make getBasin() protected for FFMPDataGenerator.
* Nov 10, 2014 3026 dhladky HPE BIAS displays.
* </pre>
*
* @author dhladky
@ -1474,8 +1475,7 @@ public class FFMPResource extends
// Paint the HPE bias source text if HPE
if (isHpe && qpeRecord != null) {
String text = getText(paintTime.getRefTime(),
qpeRecord.getMetaData());
String text = getText(paintTime.getRefTime());
if (text != null) {
sb.append(StringUtil.NEWLINE);
sb.append(text);
@ -4140,15 +4140,41 @@ public class FFMPResource extends
return dataTimes;
}
private String getText(Date date, String productId) {
/**
* This method creates the upper left legend text for HPE derived QPE sources.
* It is only used for HPE QPE sources.
* @param date
* @return
*/
private String getText(Date date) {
String text = hpeLegendMap.get(date);
if (text == null) {
FFMPRecord hpeQpeRecord = getQpeRecord();
String productId = monitor.getProductID(paintTime.getRefTime(),
hpeQpeRecord.getWfo(), hpeQpeRecord.getSiteKey(),
hpeQpeRecord.getDataKey(), hpeQpeRecord.getSourceName());
dataJob.scheduleRetrieval(date, productId);
}
return text;
}
/**
* HPE source lookup job
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 11, 2014 3026 dhladky Initial creation
*
* </pre>
*
* @author dhladky
* @version 1.0
*/
private class HpeSourceDataJob extends Job {
private volatile String productId;