diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextDisplayModel.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextDisplayModel.java index 9daba6b99b..bdfe005144 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextDisplayModel.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextDisplayModel.java @@ -22,6 +22,7 @@ package com.raytheon.viz.texteditor; import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -62,6 +63,7 @@ import com.raytheon.viz.texteditor.msgs.ITextWorkstationCallback; * Apr 14, 2010 4734 mhuang Corrected StdTextProduct import * dependency * 05/28/2010 2187 cjeanbap Added StdTextProductFactory functionality. + * 03/18/2014 DR 17174 D. Friedman Return correct 3-letter site IDs in getNnnXxx. * * * @author grichard @@ -78,7 +80,7 @@ public final class TextDisplayModel { private static final Map vtecPpToNnn = new HashMap(); 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 .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 */ public static String[] getNnnXxx(String warning) { - String[] rval = { "nnn", "xxx" }; if (warning != null) { Matcher m = warningPattern.matcher(warning); - if (m.find()) { - if (m.group(1).equals("NEW") - && vtecPpToNnn.containsKey(m.group(3))) { - rval[0] = vtecPpToNnn.get(m.group(3)); - rval[1] = m.group(2); - } 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); + if (m.find() && m.group(1).equals("NEW")) { + String nnn = vtecPpToNnn.get(m.group(3)); + Set siteSet = SiteMap.getInstance().getSite3LetterIds(m.group(2)); + if (nnn != null && siteSet.size() == 1) { + return new String[] { nnn, siteSet.iterator().next() }; } } + m = nnnxxxPattern.matcher(warning); + if (m.find()) { + return new String[] { m.group(1), m.group(2) }; + } } - return rval; + return new String[] { "nnn", "xxx" }; } } diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWarningConstants.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWarningConstants.java index 21984552c1..1b6b5af59f 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWarningConstants.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWarningConstants.java @@ -31,6 +31,8 @@ import java.util.TimeZone; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Dec 8, 2008 1737 grichard Initial creation. + * Mar 14, 2014 DR 17175 D. Friedman Fixed Atlantic and Samoa time zones. + * Add short name map. * * * @author grichard @@ -71,6 +73,8 @@ public final class TextWarningConstants { public static HashMap timeZoneAbbreviationMap = null; + public static HashMap timeZoneShortNameMap = null; + static { // build the abbreviation map timeZoneAbbreviationMap = new HashMap(); @@ -82,8 +86,26 @@ public final class TextWarningConstants { timeZoneAbbreviationMap.put("M", TimeZone.getTimeZone("MST7MDT")); timeZoneAbbreviationMap.put("m", TimeZone.getTimeZone("MST")); timeZoneAbbreviationMap.put("P", TimeZone.getTimeZone("PST8PDT")); - timeZoneAbbreviationMap.put("S", TimeZone.getTimeZone("AST")); - timeZoneAbbreviationMap.put("V", TimeZone.getTimeZone("VST")); + timeZoneAbbreviationMap.put("S", TimeZone.getTimeZone("US/Samoa")); + timeZoneAbbreviationMap.put("V", TimeZone.getTimeZone("America/Puerto_Rico")); + + HashMap t = timeZoneAbbreviationMap; + timeZoneShortNameMap = new HashMap(); + 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")); } /** diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java index a3c8870531..2224f3104c 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java @@ -334,6 +334,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox; * 20Sep2013 #2394 lvenable Fixed color memory leaks. * 20Nov2013 DR 16777 D. Friedman Check if OUPRequest will work before setting ETN. * 10Dec2013 2601 mpduff Fix NullPointerException. + * 14Mar2014 DR 17175 D. Friedman Get correct time zone for MND header time sync. * * * @author lvenable @@ -5813,11 +5814,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, if (m.find()) { SimpleDateFormat headerFormat = new SimpleDateFormat( "hmm a z EEE MMM d yyyy"); - headerFormat - .setTimeZone(TextWarningConstants.timeZoneAbbreviationMap - .get(m.group(5).substring(0, 1))); - product = product.replace(m.group(1), headerFormat.format(now) - .toUpperCase()); + TimeZone tz = TextWarningConstants.timeZoneShortNameMap + .get(m.group(5)); + if (tz != null) { + headerFormat.setTimeZone(tz); + 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; } diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TimeConsistentCheck.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TimeConsistentCheck.java index 79e45035d8..a46997cb23 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TimeConsistentCheck.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TimeConsistentCheck.java @@ -41,6 +41,7 @@ import com.raytheon.viz.texteditor.util.VtecUtil; * ------------ ---------- ----------- -------------------------- * Initial creation * Aug 25, 2011 10719 rferrel ugcPtrn now local to file. + * Mar 14, 2014 DR 17175 D. Friedman Get correct time zone from times. * * * @version 1.0 @@ -90,8 +91,12 @@ public class TimeConsistentCheck implements IQCCheck { // Event ending time (second bullet) vs Expiration m = secondBulletPtrn.matcher(body); if (m.find()) { - TimeZone timeZone = TextWarningConstants.timeZoneAbbreviationMap - .get(m.group(4).substring(0, 1)); + TimeZone timeZone = TextWarningConstants.timeZoneShortNameMap + .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 minute = Integer.parseInt(m.group(2)); int hour = Integer.parseInt(m.group(1)) == 12 ? 0 : Integer @@ -134,8 +139,12 @@ public class TimeConsistentCheck implements IQCCheck { m = thirdBulletPtrn.matcher(body); if (m.find()) { - TimeZone timeZone = TextWarningConstants.timeZoneAbbreviationMap - .get(m.group(4).substring(0, 1)); + TimeZone timeZone = TextWarningConstants.timeZoneShortNameMap + .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 minute = Integer.parseInt(m.group(2)); int hour = Integer.parseInt(m.group(1)); diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ModeListener.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ModeListener.java index 34e6b1d109..fe17879249 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ModeListener.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ModeListener.java @@ -52,6 +52,7 @@ import com.raytheon.viz.core.mode.CAVEMode; * ---------- ---------- ----------- -------------------------- * 12/20/07 561 Dan Fitch Initial Creation. * 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. * * * @author Dan Fitch @@ -107,7 +108,7 @@ public class ModeListener implements PaintListener { .getStyle() & SWT.READ_ONLY) == 0)) && !(control instanceof Table) && !((control instanceof Button) && ((((Button) control) - .getStyle() & SWT.PUSH) != 0))) { + .getStyle() & (SWT.PUSH|SWT.TOGGLE|SWT.CHECK|SWT.RADIO)) != 0))) { Color back = control.getBackground(); Color fore = control.getForeground(); diff --git a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteMap.java b/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteMap.java index 52f1e4fcc5..63cfe9324e 100644 --- a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteMap.java +++ b/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/SiteMap.java @@ -27,6 +27,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; 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 * sites. * May 15, 2013 1040 mpduff Add awips_site_list.xml. + * Mar 18, 2014 DR 17173 D. Friedmna Re-implement DR 14765. * * * @@ -93,6 +95,8 @@ public class SiteMap { private final Map> siteTo3LetterSite = new HashMap>(); + private final Set site3to4LetterOverrides = new HashSet(); + private final Map siteMap = new TreeMap(); /** JAXB context */ @@ -163,6 +167,7 @@ public class SiteMap { nationalCategoryMap.clear(); siteTo4LetterSite.clear(); siteTo3LetterSite.clear(); + site3to4LetterOverrides.clear(); siteMap.clear(); // 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); // Add the entry to the reverse lookup map @@ -390,22 +400,17 @@ public class SiteMap { public String getSite4LetterId(String site3LetterId) { String site = siteTo4LetterSite.get(site3LetterId); - // if site not found default to K - if (site == null) { + /* If site not found default to K + 3-letter-ID. + * + * 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; - } 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; diff --git a/edexOsgi/com.raytheon.uf.common.site/utility/common_static/base/site3LetterTo4LetterOverride.dat b/edexOsgi/com.raytheon.uf.common.site/utility/common_static/base/site3LetterTo4LetterOverride.dat index 8b2f954ef6..d8b94e5aba 100644 --- a/edexOsgi/com.raytheon.uf.common.site/utility/common_static/base/site3LetterTo4LetterOverride.dat +++ b/edexOsgi/com.raytheon.uf.common.site/utility/common_static/base/site3LetterTo4LetterOverride.dat @@ -8,4 +8,4 @@ AFG PAFG AJK PAJK GUM PGUM HFO PHFO -SJU TSJU +SJU TJSJ diff --git a/nativeLib/files.native/awipsShare/hydroapps/whfs/local/data/log/nrldb/.gitignore b/nativeLib/files.native/awipsShare/hydroapps/whfs/local/data/log/nrldb/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/nativeLib/files.native/awipsShare/hydroapps/whfs/local/data/nrldb/.gitignore b/nativeLib/files.native/awipsShare/hydroapps/whfs/local/data/nrldb/.gitignore new file mode 100644 index 0000000000..e69de29bb2