Issue #3321 - Fix ingest switch checks

Change-Id: I7de7ee482ab57789874a179499e6c51079e68e12

Former-commit-id: 5df0ac7f96d1280c1c50f39982693f9503b56f14
This commit is contained in:
Mike Duff 2014-06-26 15:45:33 -05:00
parent ead09dd683
commit f17c93bb19
2 changed files with 30 additions and 10 deletions

View file

@ -25,6 +25,7 @@ import java.util.regex.Pattern;
import com.raytheon.edex.plugin.shef.util.SHEFDate;
import com.raytheon.edex.plugin.shef.util.ShefParm;
import com.raytheon.uf.common.dataplugin.shef.tables.IngestfilterId;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.Duration;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.Extremum;
@ -47,6 +48,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* 03/19/08 387 M. Duff Initial creation.
* 10/16/2008 1548 jelkins Integrated ParameterCode Types
* 04/29/2014 3088 mpduff cleanup.
* 06/26/2014 3321 mpduff Added ingestfilter primary key getter.
*
* </pre>
*/
@ -805,14 +807,30 @@ public class ShefData implements ISerializableObject {
*
* @return
*/
public String getPeTsE() {
public String getPeDTsE() {
StringBuilder sb = new StringBuilder();
sb.append(this.getPhysicalElement().getCode());
sb.append(this.getTypeSource().getCode());
sb.append(this.getExtremum().getCode());
sb.append(this.getDurationCodeVariable());
return sb.toString();
}
/**
* Get the ingest filter table primary key value for this data object.
*
* @return The primary key object
*/
public IngestfilterId getIngestFilterKey() {
IngestfilterId id = new IngestfilterId();
id.setLid(this.getLocationId());
id.setDur(this.getDurationValue());
id.setExtremum(this.getExtremum().getCode());
id.setPe(this.getPhysicalElement().getCode());
id.setTs(this.getTypeSource().getCode());
return id;
}
/**
*
* @param element
@ -885,5 +903,4 @@ public class ShefData implements ISerializableObject {
}
}
}

View file

@ -122,7 +122,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* Updated with more performance fixes.
* 05/28/2014 3222 mpduff Fix posting time to be processed time so db doesn't show all post times the same
* 06/02/2014 mpduff Fix for caching of range checks.
*
* 06/26/2014 3321 mpduff Fix ingestSwitchMap checks
* </pre>
*
* @author mduff
@ -228,7 +228,7 @@ public class PostShef {
private Map<String, ShefAdjustFactor> adjustmentMap = new HashMap<String, ShefAdjustFactor>();
/** Map of location identifier to IngestSwitch */
private Map<String, IngestSwitch> ingestSwitchMap = new HashMap<String, IngestSwitch>();
private Map<IngestfilterId, IngestSwitch> ingestSwitchMap = new HashMap<IngestfilterId, IngestSwitch>();
// AppsDefaults tokens
private String undefStation;
@ -529,7 +529,7 @@ public class PostShef {
if (dataLog) {
log.info(LOG_SEP);
log.info("Posting process started for LID [" + locId
+ "] PEDTSEP [" + data.getPeTsE() + "] value ["
+ "] PEDTSEP [" + data.getPeDTsE() + "] value ["
+ dataValue + "]");
}
@ -650,7 +650,7 @@ public class PostShef {
if (Location.LOC_LOCATION.equals(postLocData)
|| (Location.LOC_GEOAREA.equals(postLocData))) {
if (!DataType.CONTINGENCY.equals(dataType)) {
ingestSwitch = checkIngest(locId, data, ingestSwitch);
ingestSwitch = checkIngest(locId, data);
}
if (ShefConstants.IngestSwitch.POST_PE_OFF
.equals(ingestSwitch)) {
@ -2123,8 +2123,7 @@ public class PostShef {
* ingest switch setting
* @return
*/
private IngestSwitch checkIngest(String locId, ShefData data,
ShefConstants.IngestSwitch ingestSwitch) {
private IngestSwitch checkIngest(String locId, ShefData data) {
StringBuilder errorMsg = new StringBuilder();
boolean matchFound = false;
int hNum = 0;
@ -2150,7 +2149,12 @@ public class PostShef {
String telem = null;
String sql = null;
Object[] oa = null;
String key = locId + data.getPeTsE();
IngestfilterId key = data.getIngestFilterKey();// .getPeDTsE();
// Default to off
ShefConstants.IngestSwitch ingestSwitch = IngestSwitch.POST_PE_OFF;
try {
if (!ingestSwitchMap.containsKey(key)) {
errorMsg.append("Error getting connection to IHFS Database");
@ -2192,7 +2196,6 @@ public class PostShef {
ingestSwitchMap.put(key, ingestSwitch);
}
matchFound = ingestSwitchMap.containsKey(key);
ingestSwitch = ingestSwitchMap.get(key);
/*