From bdf527d5f2723fe2e377267c797c9eeb18b2396a Mon Sep 17 00:00:00 2001 From: "Qinglu.Lin" Date: Wed, 14 May 2014 10:00:46 -0400 Subject: [PATCH] ASM #556 - WarnGen: use noon/midnight instead of 1200 PM/1200 AM Change-Id: I31cc6fe46fff0f9246585ddbf84b2f94b3d8c22c Former-commit-id: c9e359f9478fe62a7b77171afd36fb634e6ab505 [formerly b7d276d00f8201dca008c49e28d25fe9c357bc07] [formerly 75c4b15e8e7e4b06d31859ecc8bce76bb12aa59d] [formerly c5097660c2d9ce3974fe37fe8af51342e30986f5 [formerly 75c4b15e8e7e4b06d31859ecc8bce76bb12aa59d [formerly 763641d787f7f8c79bf28456314dcc16786702ed]]] Former-commit-id: c5097660c2d9ce3974fe37fe8af51342e30986f5 Former-commit-id: cba5eacd009b07ca51d595c26e8a4b851d4605b4 [formerly 89fa05128e9349ae58675e31aed022b568fd2764] Former-commit-id: bdae3cdfdf3e2b70e48ae724f69e271f3f8b5455 --- .../viz/texteditor/qc/TextSegmentCheck.java | 3 ++- .../viz/texteditor/qc/TimeConsistentCheck.java | 5 ++++- .../warngen/text/AbstractLockingBehavior.java | 17 +++++++++-------- .../base/warngen/VM_global_library.vm | 8 ++++++-- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TextSegmentCheck.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TextSegmentCheck.java index b74a529c39..bf979971a7 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TextSegmentCheck.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TextSegmentCheck.java @@ -58,6 +58,7 @@ import com.raytheon.viz.texteditor.util.VtecUtil; * 07 NOV 2012 15003 mgamazaychikov Do not perform QC check on standalone MWS headline. * 21 MAY 2013 16200 Qinglu Lin Prevent countyOrZoneCounter from being increased for a line * that has no word County/Parish/Municipality in it. + * 13 MAY 2014 17177 Qinglu Lin Updated runQC(). * * * @@ -305,7 +306,7 @@ public class TextSegmentCheck implements IQCCheck { // second bullet if (line.startsWith("*") && nb == 2) { m = secondBulletPtrn.matcher(line); - if (m.find()) { + if (m.find() || line.contains("* UNTIL NOON") || line.contains("* UNTIL MIDNIGHT")) { secondBulletFound = true; insideFirstBullet = false; continue; 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 a46997cb23..937e3e74ad 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 @@ -42,6 +42,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. + * May 13, 2014 DR 17177 Qinglu Lin Updated runQC(). * * * @version 1.0 @@ -89,7 +90,9 @@ public class TimeConsistentCheck implements IQCCheck { } // Event ending time (second bullet) vs Expiration - m = secondBulletPtrn.matcher(body); + String newBody = body.replaceAll("UNTIL NOON", "UNTIL 1200 PM"); + newBody = newBody.replaceAll("UNTIL MIDNIGHT", "UNTIL 1200 AM"); + m = secondBulletPtrn.matcher(newBody); if (m.find()) { TimeZone timeZone = TextWarningConstants.timeZoneShortNameMap .get(m.group(4)); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/AbstractLockingBehavior.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/AbstractLockingBehavior.java index b9149a023e..0bd8950b80 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/AbstractLockingBehavior.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/AbstractLockingBehavior.java @@ -54,6 +54,7 @@ import com.raytheon.viz.warngen.gis.AffectedAreas; * bulletIndices(), header(), firstBullet(), secondBullet(), getImmediateCausesPtrn(); * updated body(), header(), and secondBullet(); * Mar 13, 2013 DR 15892 D. Friedman Fix bullet parsing. + * May 13, 2014 DR 17177 Qinglu Lin Updated secondBullet(). * * * @@ -255,14 +256,14 @@ abstract public class AbstractLockingBehavior implements ICommonPatterns { * Locks the second bullet. */ private void secondBullet() { - // LOCK_END should not be found at the beginning since the previous line - // should be blank. - String secondBullet = - "\\* UNTIL \\d{3,4} (AM|PM) \\w{3,4}( \\w{6,9}){0,1}(\\/\\d{3,4} (AM|PM) \\w{3,4}( \\w{6,9}){0,1}\\/){0,1}" - + newline; - Pattern secondBulletPtrn = Pattern.compile(secondBullet, - Pattern.MULTILINE); - find(secondBulletPtrn.matcher(text)); + // LOCK_END should not be found at the beginning since the previous line + // should be blank. + String secondBullet = + "\\* UNTIL (\\d{3,4} (AM|PM)|NOON|MIDNIGHT) \\w{3,4}( \\w{6,9}){0,1}(\\/(\\d{3,4} (AM|PM)|NOON|MIDNIGHT) \\w{3,4}( \\w{6,9}){0,1}\\/){0,1}" + + newline; + Pattern secondBulletPtrn = Pattern.compile(secondBullet, + Pattern.MULTILINE); + find(secondBulletPtrn.matcher(text)); } /** diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm index 2e1c9bd44e..c3a004c8f4 100755 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm @@ -11,6 +11,7 @@ ##### Evan Bookbinder 05-05-2013 handleClosesPoints and 3rd bullet changes (OVER & now) ##### Evan Bookbinder 09-20-2013 Fixed rural area otherPoints in pathcast section, added rural phrase ##### Qinglu Lin 03-17-2014 DR 16309. Updated inserttorwatches and insertsvrwatches. +##### Qinglu Lin 05-13-2014 DR 17177. Updated secondBullet. #################################################################################################### #* Mile Marker Test Code @@ -1142,10 +1143,13 @@ ${partOfArea}${area.name}... ######### MACRO TO GENERATE SECOND BULLET (UNTIL XXXX AMPM TZ (DAY) IN WARNINGS ########## #macro(secondBullet $dateUtil $expire $timeFormat $localtimezone $secondtimezone $duration) #if(${duration} >= 360) -UNTIL ${dateUtil.format(${expire}, ${timeFormat.plain}, 15, ${localtimezone})}## +#set($text = "UNTIL ${dateUtil.format(${expire}, ${timeFormat.plain}, 15, ${localtimezone})}") #else -UNTIL ${dateUtil.format(${expire}, ${timeFormat.clock}, 15, ${localtimezone})}## +#set($text = "UNTIL ${dateUtil.format(${expire}, ${timeFormat.clock}, 15, ${localtimezone})}") #end +#set($text = $text.replace("1200 PM", "NOON")) +#set($text = $text.replace("1200 AM", "MIDNIGHT")) +${text}## #if(${secondtimezone}) #if(${duration} >= 360) /${dateUtil.format(${expire}, ${timeFormat.plain}, 15, ${secondtimezone})}/##