Merge branch 'master_14.2.2' into omaha_14.2.2

Former-commit-id: b0b18895aa445ee9b29674443529558b2141c042
This commit is contained in:
Steve Harris 2014-03-26 16:13:59 -05:00
commit e5910b6c60
9 changed files with 83 additions and 48 deletions

View file

@ -22,6 +22,7 @@ package com.raytheon.viz.texteditor;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -62,6 +63,7 @@ import com.raytheon.viz.texteditor.msgs.ITextWorkstationCallback;
* Apr 14, 2010 4734 mhuang Corrected StdTextProduct import * Apr 14, 2010 4734 mhuang Corrected StdTextProduct import
* dependency * dependency
* 05/28/2010 2187 cjeanbap Added StdTextProductFactory functionality. * 05/28/2010 2187 cjeanbap Added StdTextProductFactory functionality.
* 03/18/2014 DR 17174 D. Friedman Return correct 3-letter site IDs in getNnnXxx.
* </pre> * </pre>
* *
* @author grichard * @author grichard
@ -78,7 +80,7 @@ public final class TextDisplayModel {
private static final Map<String, String> vtecPpToNnn = new HashMap<String, String>(); private static final Map<String, String> vtecPpToNnn = new HashMap<String, String>();
private static final Pattern warningPattern = Pattern private static final Pattern warningPattern = Pattern
.compile("/[A-Z]\\.([A-Z]{3})\\.\\p{Alnum}{1}(\\p{Alnum}{3})\\.([A-Z]{2}\\.[A-Z]{1})"); .compile("/[A-Z]\\.([A-Z]{3})\\.(\\p{Alnum}{4})\\.([A-Z]{2}\\.[A-Z]{1})");
private static final Pattern nnnxxxPattern = Pattern private static final Pattern nnnxxxPattern = Pattern
.compile("[\\r\\n]+([A-Z]{3})([A-Z]{3})(| WRKWG[0-9])[\\r\\n]+"); .compile("[\\r\\n]+([A-Z]{3})([A-Z]{3})(| WRKWG[0-9])[\\r\\n]+");
@ -514,29 +516,20 @@ public final class TextDisplayModel {
* @return the product category and product designator strings * @return the product category and product designator strings
*/ */
public static String[] getNnnXxx(String warning) { public static String[] getNnnXxx(String warning) {
String[] rval = { "nnn", "xxx" };
if (warning != null) { if (warning != null) {
Matcher m = warningPattern.matcher(warning); Matcher m = warningPattern.matcher(warning);
if (m.find()) { if (m.find() && m.group(1).equals("NEW")) {
if (m.group(1).equals("NEW") String nnn = vtecPpToNnn.get(m.group(3));
&& vtecPpToNnn.containsKey(m.group(3))) { Set<String> siteSet = SiteMap.getInstance().getSite3LetterIds(m.group(2));
rval[0] = vtecPpToNnn.get(m.group(3)); if (nnn != null && siteSet.size() == 1) {
rval[1] = m.group(2); return new String[] { nnn, siteSet.iterator().next() };
} else {
m = nnnxxxPattern.matcher(warning);
if (m.find()) {
rval[0] = m.group(1);
rval[1] = m.group(2);
}
}
} else {
m = nnnxxxPattern.matcher(warning);
if (m.find()) {
rval[0] = m.group(1);
rval[1] = m.group(2);
} }
} }
m = nnnxxxPattern.matcher(warning);
if (m.find()) {
return new String[] { m.group(1), m.group(2) };
}
} }
return rval; return new String[] { "nnn", "xxx" };
} }
} }

View file

@ -31,6 +31,8 @@ import java.util.TimeZone;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 8, 2008 1737 grichard Initial creation. * Dec 8, 2008 1737 grichard Initial creation.
* Mar 14, 2014 DR 17175 D. Friedman Fixed Atlantic and Samoa time zones.
* Add short name map.
* </pre> * </pre>
* *
* @author grichard * @author grichard
@ -71,6 +73,8 @@ public final class TextWarningConstants {
public static HashMap<String, TimeZone> timeZoneAbbreviationMap = null; public static HashMap<String, TimeZone> timeZoneAbbreviationMap = null;
public static HashMap<String, TimeZone> timeZoneShortNameMap = null;
static { static {
// build the abbreviation map // build the abbreviation map
timeZoneAbbreviationMap = new HashMap<String, TimeZone>(); timeZoneAbbreviationMap = new HashMap<String, TimeZone>();
@ -82,8 +86,26 @@ public final class TextWarningConstants {
timeZoneAbbreviationMap.put("M", TimeZone.getTimeZone("MST7MDT")); timeZoneAbbreviationMap.put("M", TimeZone.getTimeZone("MST7MDT"));
timeZoneAbbreviationMap.put("m", TimeZone.getTimeZone("MST")); timeZoneAbbreviationMap.put("m", TimeZone.getTimeZone("MST"));
timeZoneAbbreviationMap.put("P", TimeZone.getTimeZone("PST8PDT")); timeZoneAbbreviationMap.put("P", TimeZone.getTimeZone("PST8PDT"));
timeZoneAbbreviationMap.put("S", TimeZone.getTimeZone("AST")); timeZoneAbbreviationMap.put("S", TimeZone.getTimeZone("US/Samoa"));
timeZoneAbbreviationMap.put("V", TimeZone.getTimeZone("VST")); timeZoneAbbreviationMap.put("V", TimeZone.getTimeZone("America/Puerto_Rico"));
HashMap<String, TimeZone> t = timeZoneAbbreviationMap;
timeZoneShortNameMap = new HashMap<String, TimeZone>();
timeZoneShortNameMap.put("AKST", t.get("A"));
timeZoneShortNameMap.put("AKDT", t.get("A"));
timeZoneShortNameMap.put("CST", t.get("C"));
timeZoneShortNameMap.put("CDT", t.get("C"));
timeZoneShortNameMap.put("EST", t.get("E"));
timeZoneShortNameMap.put("EDT", t.get("E"));
timeZoneShortNameMap.put("CHST", t.get("G"));
timeZoneShortNameMap.put("ChST", t.get("G"));
timeZoneShortNameMap.put("HST", t.get("H"));
timeZoneShortNameMap.put("MST", t.get("m"));
timeZoneShortNameMap.put("MDT", t.get("M"));
timeZoneShortNameMap.put("PST", t.get("P"));
timeZoneShortNameMap.put("PDT", t.get("P"));
timeZoneShortNameMap.put("SST", t.get("S"));
timeZoneShortNameMap.put("AST", t.get("V"));
} }
/** /**

View file

@ -334,6 +334,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* 20Sep2013 #2394 lvenable Fixed color memory leaks. * 20Sep2013 #2394 lvenable Fixed color memory leaks.
* 20Nov2013 DR 16777 D. Friedman Check if OUPRequest will work before setting ETN. * 20Nov2013 DR 16777 D. Friedman Check if OUPRequest will work before setting ETN.
* 10Dec2013 2601 mpduff Fix NullPointerException. * 10Dec2013 2601 mpduff Fix NullPointerException.
* 14Mar2014 DR 17175 D. Friedman Get correct time zone for MND header time sync.
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -5813,11 +5814,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
if (m.find()) { if (m.find()) {
SimpleDateFormat headerFormat = new SimpleDateFormat( SimpleDateFormat headerFormat = new SimpleDateFormat(
"hmm a z EEE MMM d yyyy"); "hmm a z EEE MMM d yyyy");
headerFormat TimeZone tz = TextWarningConstants.timeZoneShortNameMap
.setTimeZone(TextWarningConstants.timeZoneAbbreviationMap .get(m.group(5));
.get(m.group(5).substring(0, 1))); if (tz != null) {
product = product.replace(m.group(1), headerFormat.format(now) headerFormat.setTimeZone(tz);
.toUpperCase()); product = product.replace(m.group(1), headerFormat.format(now)
.toUpperCase());
} else {
statusHandler.warn("Could not sync MND header time because the time zone could not be determined. Will proceed with save/send.");
}
} }
return product; return product;
} }

View file

@ -41,6 +41,7 @@ import com.raytheon.viz.texteditor.util.VtecUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Initial creation * Initial creation
* Aug 25, 2011 10719 rferrel ugcPtrn now local to file. * Aug 25, 2011 10719 rferrel ugcPtrn now local to file.
* Mar 14, 2014 DR 17175 D. Friedman Get correct time zone from times.
* </pre> * </pre>
* *
* @version 1.0 * @version 1.0
@ -90,8 +91,12 @@ public class TimeConsistentCheck implements IQCCheck {
// Event ending time (second bullet) vs Expiration // Event ending time (second bullet) vs Expiration
m = secondBulletPtrn.matcher(body); m = secondBulletPtrn.matcher(body);
if (m.find()) { if (m.find()) {
TimeZone timeZone = TextWarningConstants.timeZoneAbbreviationMap TimeZone timeZone = TextWarningConstants.timeZoneShortNameMap
.get(m.group(4).substring(0, 1)); .get(m.group(4));
if (timeZone == null) {
errorMsg += "Could not determine time zone in second bullet";
return errorMsg;
}
int am_pm = m.group(3).equals("AM") ? Calendar.AM : Calendar.PM; int am_pm = m.group(3).equals("AM") ? Calendar.AM : Calendar.PM;
int minute = Integer.parseInt(m.group(2)); int minute = Integer.parseInt(m.group(2));
int hour = Integer.parseInt(m.group(1)) == 12 ? 0 : Integer int hour = Integer.parseInt(m.group(1)) == 12 ? 0 : Integer
@ -134,8 +139,12 @@ public class TimeConsistentCheck implements IQCCheck {
m = thirdBulletPtrn.matcher(body); m = thirdBulletPtrn.matcher(body);
if (m.find()) { if (m.find()) {
TimeZone timeZone = TextWarningConstants.timeZoneAbbreviationMap TimeZone timeZone = TextWarningConstants.timeZoneShortNameMap
.get(m.group(4).substring(0, 1)); .get(m.group(4));
if (timeZone == null) {
errorMsg += "Could not determine time zone in third bullet";
return errorMsg;
}
int am_pm = m.group(3).equals("AM") ? Calendar.AM : Calendar.PM; int am_pm = m.group(3).equals("AM") ? Calendar.AM : Calendar.PM;
int minute = Integer.parseInt(m.group(2)); int minute = Integer.parseInt(m.group(2));
int hour = Integer.parseInt(m.group(1)); int hour = Integer.parseInt(m.group(1));

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.core.mode.CAVEMode;
* ---------- ---------- ----------- -------------------------- * ---------- ---------- ----------- --------------------------
* 12/20/07 561 Dan Fitch Initial Creation. * 12/20/07 561 Dan Fitch Initial Creation.
* 6/7/2013 mnash Implementation for Chris Golden to allow instances to be garbage collected. * 6/7/2013 mnash Implementation for Chris Golden to allow instances to be garbage collected.
* 03/24/14 DR 17186 D. Friedman Do not change colors of most buttons.
* </pre> * </pre>
* *
* @author Dan Fitch * @author Dan Fitch
@ -107,7 +108,7 @@ public class ModeListener implements PaintListener {
.getStyle() & SWT.READ_ONLY) == 0)) .getStyle() & SWT.READ_ONLY) == 0))
&& !(control instanceof Table) && !(control instanceof Table)
&& !((control instanceof Button) && ((((Button) control) && !((control instanceof Button) && ((((Button) control)
.getStyle() & SWT.PUSH) != 0))) { .getStyle() & (SWT.PUSH|SWT.TOGGLE|SWT.CHECK|SWT.RADIO)) != 0))) {
Color back = control.getBackground(); Color back = control.getBackground();
Color fore = control.getForeground(); Color fore = control.getForeground();

View file

@ -27,6 +27,7 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -60,6 +61,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Apr 09, 2012 DR14765 mhuang Map out correct CCCC site ID for backup * Apr 09, 2012 DR14765 mhuang Map out correct CCCC site ID for backup
* sites. * sites.
* May 15, 2013 1040 mpduff Add awips_site_list.xml. * May 15, 2013 1040 mpduff Add awips_site_list.xml.
* Mar 18, 2014 DR 17173 D. Friedmna Re-implement DR 14765.
* *
* </pre> * </pre>
* *
@ -93,6 +95,8 @@ public class SiteMap {
private final Map<String, Set<String>> siteTo3LetterSite = new HashMap<String, Set<String>>(); private final Map<String, Set<String>> siteTo3LetterSite = new HashMap<String, Set<String>>();
private final Set<String> site3to4LetterOverrides = new HashSet<String>();
private final Map<String, SiteData> siteMap = new TreeMap<String, SiteData>(); private final Map<String, SiteData> siteMap = new TreeMap<String, SiteData>();
/** JAXB context */ /** JAXB context */
@ -163,6 +167,7 @@ public class SiteMap {
nationalCategoryMap.clear(); nationalCategoryMap.clear();
siteTo4LetterSite.clear(); siteTo4LetterSite.clear();
siteTo3LetterSite.clear(); siteTo3LetterSite.clear();
site3to4LetterOverrides.clear();
siteMap.clear(); siteMap.clear();
// load base afos lookup // load base afos lookup
@ -311,6 +316,11 @@ public class SiteMap {
} }
} }
// Currently, only the 3-letter IDs are used (in
// getSite4LetterId(), but it should be possible
// to also add the 4-letter IDs to this set.
site3to4LetterOverrides.add(site3);
site3To4LetterMap.put(site3, site4); site3To4LetterMap.put(site3, site4);
// Add the entry to the reverse lookup map // Add the entry to the reverse lookup map
@ -390,22 +400,17 @@ public class SiteMap {
public String getSite4LetterId(String site3LetterId) { public String getSite4LetterId(String site3LetterId) {
String site = siteTo4LetterSite.get(site3LetterId); String site = siteTo4LetterSite.get(site3LetterId);
// if site not found default to K /* If site not found default to K + 3-letter-ID.
if (site == null) { *
* Or, if the 4-letter site ID that was looked up does not
* start with a 'K' and did not come from
* site3LetterTo4LetterOverride.dat, also return
* K + 3-letter-ID.
*/
if (site == null
|| (site.length() > 0 && site.charAt(0) != 'K' &&
!site3to4LetterOverrides.contains(site3LetterId))) {
site = "K" + site3LetterId; site = "K" + site3LetterId;
} else {
// DR_14765, in case the site hashed out from combined mapping
// table from both national_category_table and afo_lookup_table
// does not start with K but not from
// site3LetterTo4LetterOerride.dat
// which are starting with P or T
char[] siteChar = site.toCharArray();
if (siteChar[0] != 'K') {
if (!((siteChar[0] == 'P' && (siteChar[1] == 'A'
|| siteChar[1] == 'G' || siteChar[1] == 'H')) || (siteChar[0] == 'T' && siteChar[1] == 'S'))) {
site = "K" + site3LetterId;
}
}
} }
return site; return site;

View file

@ -8,4 +8,4 @@ AFG PAFG
AJK PAJK AJK PAJK
GUM PGUM GUM PGUM
HFO PHFO HFO PHFO
SJU TSJU SJU TJSJ