ASM #18905 - D2D: SPS plots in D2D are not updating for new products
Change-Id: If94fab039179851f52d26f9156e057af7580c70e Former-commit-id: ccb20847a90e75db9920a3124b321ff8e9dea23c
This commit is contained in:
parent
c76fb2ff2d
commit
0151cca2dd
1 changed files with 58 additions and 0 deletions
|
@ -1,19 +1,39 @@
|
|||
package com.raytheon.viz.warnings.rsc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
|
||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||
import com.raytheon.uf.viz.core.RecordFactory;
|
||||
import com.raytheon.uf.viz.core.alerts.AbstractAlertMessageParser;
|
||||
import com.raytheon.uf.viz.core.alerts.AlertMessage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
|
||||
/**
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Apr 21, 2016 DR 18905 Qinglu Lin Added code to handle no SPS auto-update issue.
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class CWASPSResourceData extends WWAResourceData {
|
||||
|
||||
private static AlertMessageToPDOParserSPS alertParser = new AlertMessageToPDOParserSPS();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -34,4 +54,42 @@ public class CWASPSResourceData extends WWAResourceData {
|
|||
|
||||
return new CWASPSResource(this, loadProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractAlertMessageParser getAlertParser() {
|
||||
return alertParser;
|
||||
}
|
||||
|
||||
private static class AlertMessageToPDOParserSPS extends AbstractAlertMessageParser {
|
||||
|
||||
@Override
|
||||
public Object parseAlertMessage(AlertMessage message,
|
||||
AbstractRequestableResourceData reqResourceData) throws VizException {
|
||||
Object objectToSend = null;
|
||||
Map<String, Object> attribs = new HashMap<>(message.decodedAlert);
|
||||
|
||||
if (reqResourceData.isUpdatingOnMetadataOnly()) {
|
||||
PluginDataObject record = RecordFactory.getInstance()
|
||||
.loadRecordFromMap(attribs);
|
||||
objectToSend = record;
|
||||
} else {
|
||||
/*
|
||||
* TODO avoid requesting data that will not be used, for example
|
||||
* when time matching won't allow the frame to be displayed.
|
||||
*/
|
||||
attribs.remove(PluginDataObject.DATAURI_ID);
|
||||
DbQueryRequest request = new DbQueryRequest(
|
||||
RequestConstraint.toConstraintMappingExcludeNull(attribs));
|
||||
request.setLimit(1);
|
||||
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||
.sendRequest(request);
|
||||
PluginDataObject[] pdos = response
|
||||
.getEntityObjects(PluginDataObject.class);
|
||||
if (pdos.length > 0) {
|
||||
objectToSend = pdos[0];
|
||||
}
|
||||
}
|
||||
return objectToSend;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue