ASM #15465 - No variable for failed site's MND Header location available for WarnGen to use

Change-Id: I8bc59786379680f635e85917eebf4c9d6b4ea683

Former-commit-id: f79ed1b1867b5516a390a8f70b2141052be3eb38
This commit is contained in:
Qinglu.Lin 2014-09-18 11:21:18 -04:00
parent 9b7823084f
commit 10da99d3f7
3 changed files with 54 additions and 16 deletions

View file

@ -1,25 +1,24 @@
package com.raytheon.viz.warngen.gui;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/18/2014 ASM #15465 Qinglu Lin Ignore the info after "/" if any.
*
* </pre>
*/
public class BackupData {
public String site;
public String office;
private static final Pattern cwaBackUp = Pattern
.compile("([A-Z]{3})/([A-Z\\s/-]{1,})");
public BackupData(String cwa) {
cwa = cwa.trim();
String[] parts = cwa.split("/");
site = parts[0];
office = parts[1];
Matcher m = cwaBackUp.matcher(cwa);
if (m.find()) {
site = m.group(1);
office = m.group(2);
if (cwa.contains("/")) {
String[] parts = cwa.split("/");
site = parts[0];
} else {
site = cwa;
}
}
}

View file

@ -219,6 +219,8 @@ import com.vividsolutions.jts.io.WKTReader;
* 08/20/2014 ASM #16703 D. Friedman Make geo feature types for watches explicit
* 09/14/2014 ASM #641 dhuffman To facilitate Area.java need to filter the differences between Areas and Zones,
* refactored filterCheck and added a new siginature version of filterArea.
* 09/17/2014 ASM #15465 Qinglu Lin get backupOfficeShort and backupOfficeLoc from backup WFO config.xml, and pop up AlertViz if
* any of them is missing.
* </pre>
*
* @author mschenke
@ -230,6 +232,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
.getHandler(WarngenLayer.class);
String uniqueFip = null;
String backupOfficeShort = null;
String backupOfficeLoc = null;
Map<String, Double> geomArea = new HashMap<String, Double>();
Map<String, Point> geomCentroid = new HashMap<String, Point>();
@ -1447,6 +1451,32 @@ public class WarngenLayer extends AbstractStormTrackResource {
dialogConfig.setDefaultTemplate(dc.getDefaultTemplate());
dialogConfig.setMainWarngenProducts(dc.getMainWarngenProducts());
dialogConfig.setOtherWarngenProducts(dc.getOtherWarngenProducts());
backupOfficeShort = dc.getWarngenOfficeShort();
backupOfficeLoc = dc.getWarngenOfficeLoc();
if (backupSite != null) {
boolean shortTag = false;
boolean locTag = false;
String infoType = null;
if (backupOfficeShort == null || backupOfficeShort.trim().length() == 0) {
shortTag = true;
}
if (backupOfficeLoc == null || backupOfficeLoc.trim().length() == 0) {
locTag = true;
}
if (shortTag && locTag) {
infoType = "warngenOfficeShort and warngenOfficeLoc";
} else {
if (shortTag) {
infoType = "warngenOfficeShort";
} else if (locTag) {
infoType = "warngenOfficeLoc";
}
}
if (infoType != null) {
statusHandler.handle(Priority.CRITICAL, "Info for " + infoType + " in " + backupSite +
"'s config.xml is missing.");
}
}
}
}
@ -3678,4 +3708,12 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
}
public String getBackupOfficeShort() {
return backupOfficeShort;
}
public String getBackupOfficeLoc() {
return backupOfficeLoc;
}
}

View file

@ -144,6 +144,7 @@ import com.vividsolutions.jts.io.WKTReader;
* Aug 15, 2014 DR15701 mgamazaychikov Removed static field watchUtil.
* Aug 28, 2014 ASM #15551 Qinglu Lin Replaced 1200 PM/1200 AM by NOON/MIDNIGHT, removed days in
* included tornado/severe thunderstorm watch message.
* Sep 18, 2014 ASM #15465 Qinglu Lin For backup, get officeShort and officeLoc from backup WFO's config.xml.
* </pre>
*
* @author njensen
@ -261,8 +262,8 @@ public class TemplateRunner {
if (backupData != null) {
context.remove("officeLoc");
context.remove("officeShort");
context.put("officeLoc", backupData.office);
context.put("officeShort", backupData.office);
context.put("officeLoc", warngenLayer.getBackupOfficeLoc());
context.put("officeShort", warngenLayer.getBackupOfficeShort());
context.put("backupSite", warngenLayer.getDialogConfig()
.getWarngenOfficeShort());
}