Omaha #4027 More changes for Mixed Case

Change-Id: Id47f1c68877e8df0cbf84df09bdaa000a41a863e

Former-commit-id: 0e48bfe4de5c227ebf96b0b59f9c7a9c39415f2e
This commit is contained in:
Ron Anderson 2015-04-28 14:35:26 -05:00
parent 233bbf78a5
commit 551d1bee91
42 changed files with 502 additions and 881 deletions

View file

@ -95,7 +95,7 @@ def executeFromJava(databaseID, site, username, dataMgr, forecastList, logFile,
forecasts = runFormatter(databaseID=databaseID, site=site, forecastList=forecastList, testMode=testMode, forecasts = runFormatter(databaseID=databaseID, site=site, forecastList=forecastList, testMode=testMode,
cmdLineVarDict=cmdLineVarDict, vtecMode=vtecMode, username=username, cmdLineVarDict=cmdLineVarDict, vtecMode=vtecMode, username=username,
dataMgr=dataMgr, drtTime=drtTime) dataMgr=dataMgr, drtTime=drtTime, vtecActiveTable=vtecActiveTable)
elapsedTime = (time.time() - startTime)*1000 elapsedTime = (time.time() - startTime)*1000
logger.info("Text Formatter Finished, took: %d ms",elapsedTime) logger.info("Text Formatter Finished, took: %d ms",elapsedTime)

View file

@ -47,6 +47,7 @@ import VTECTableUtil, VTECTable
import TimeRange, AbsTime, ActiveTableVtec import TimeRange, AbsTime, ActiveTableVtec
import JUtil import JUtil
from java.util import ArrayList from java.util import ArrayList
from com.raytheon.uf.common.activetable import ActiveTableMode
from com.raytheon.uf.common.dataplugin.gfe.db.objects import DatabaseID as JavaDatabaseID from com.raytheon.uf.common.dataplugin.gfe.db.objects import DatabaseID as JavaDatabaseID
from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceID from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceID
from com.raytheon.uf.common.dataplugin.gfe.discrete import DiscreteKey from com.raytheon.uf.common.dataplugin.gfe.discrete import DiscreteKey
@ -82,9 +83,14 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
self.filterMethod = filterMethod self.filterMethod = filterMethod
self.__activeTable = None self.__activeTable = None
self.__allGEOActiveTable = None #not filtered by edit areas self.__allGEOActiveTable = None #not filtered by edit areas
self.__activeTableName = activeTableName
self.__vtecMode = vtecMode self.__vtecMode = vtecMode
self.__etnCache = {} self.__etnCache = {}
if activeTableName == "PRACTICE":
self.__activeTableMode = ActiveTableMode.PRACTICE
else:
self.__activeTableMode = ActiveTableMode.OPERATIONAL
if hazardEndTime is None: if hazardEndTime is None:
self.__hazardEndTime = None self.__hazardEndTime = None
else: else:
@ -721,7 +727,7 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
# Local WFOs do not assign these numbers, so they should have # Local WFOs do not assign these numbers, so they should have
# numbers < 1000 # numbers < 1000
if phensig not in self.__tpcKeys or self.__siteID4 in self.__sitesIgnoreNatlEtn: if phensig not in self.__tpcKeys or self.__siteID4 in self.__sitesIgnoreNatlEtn:
etn_base = GFEVtecUtil.getNextEtn(self.__siteID4, '.'.join(phensig), False).getNextEtn() - 1 etn_base = GFEVtecUtil.getNextEtn(self.__siteID4, '.'.join(phensig), False, self.__activeTableMode).getNextEtn() - 1
else: else:
presentyear = time.gmtime(self.__time)[0] presentyear = time.gmtime(self.__time)[0]
for active in activeTable: for active in activeTable:
@ -922,13 +928,9 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
def __getActiveTable(self): def __getActiveTable(self):
#Uses the IFPClient interface to get the VTEC active table from #Uses the IFPClient interface to get the VTEC active table from
#the server. Returns None on failure. #the server. Returns None on failure.
from com.raytheon.uf.common.activetable import ActiveTableMode
try: try:
if self.__activeTableName != "PRACTICE": table = self.__ifpClient.getVTECActiveTable(self.__dataMgr.getSiteID(), self.__activeTableMode)
table = self.__ifpClient.getVTECActiveTable(self.__dataMgr.getSiteID())
else:
table = self.__ifpClient.getVTECActiveTable(self.__dataMgr.getSiteID(), ActiveTableMode.PRACTICE)
table = ActiveTableVtec.transformActiveTableToPython(table) table = ActiveTableVtec.transformActiveTableToPython(table)
return table return table

View file

@ -27,6 +27,14 @@
# #
# Author: hansen # Author: hansen
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 04/28/2016 4027 randerso Changes for mixed case
#
##
import PhraseBuilder import PhraseBuilder
import ModuleAccessor import ModuleAccessor
@ -2059,7 +2067,7 @@ class DiscretePhrases(PhraseBuilder.PhraseBuilder):
# test mode # test mode
if argDict.get('testMode', 0): if argDict.get('testMode', 0):
phrase = 'TEST ' + name #test mode, prepend "TEST" phrase = 'Test ' + name #test mode, prepend "TEST"
else: else:
phrase = name phrase = name

View file

@ -25,13 +25,13 @@
# SRF_850, SRF_853, SRF_856 # SRF_850, SRF_853, SRF_856
# #
# surfAreas: # surfAreas:
# NorthCoast1 (listed with FLZ039), SouthCoast (along GMZ850) # NorthCoast1 (listed with FLZ139), SouthCoast (along GMZ850)
# NorthCoast2 (listed with FLZ042), SouthCoast (along GMZ850) # NorthCoast2 (listed with FLZ142), SouthCoast (along GMZ850)
# #
# TBW always runs with the same combinations: # TBW always runs with the same combinations:
# FLZ039-FLZ042-FLZ048-FLZ049 # FLZ139-FLZ142-FLZ148-FLZ149
# FLZ050-FLZ051-FLZ055-FLZ060 # FLZ050-FLZ151-FLZ155-FLZ160
# FLZ062-FLZ065 # FLZ162-FLZ165
# Thus, additional entries need only be listed for at least one zone # Thus, additional entries need only be listed for at least one zone
# in each combination. # in each combination.
# #
@ -39,6 +39,15 @@
# for each zone and the system will take care to combine them appropriately. # for each zone and the system will take care to combine them appropriately.
# For example, note that the "surfAreas" are listed for both FLZ039 and FLZ042. # For example, note that the "surfAreas" are listed for both FLZ039 and FLZ042.
# When they are combined, the surfAreas are reported just once, as desired. # When they are combined, the surfAreas are reported just once, as desired.
# ----------------------------------------------------------------------------
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 04/28/2016 4027 randerso Changes for mixed case
#
##
AreaDictionary = { AreaDictionary = {
@ -91,7 +100,7 @@ AreaDictionary = {
'FLZ050': {'fullStateName': 'Florida', 'FLZ050': {'fullStateName': 'Florida',
'partOfState': 'west central', 'partOfState': 'west central',
'stateAbbr': 'FL', 'stateAbbr': 'FL',
'ugcCityString': '...Bradenton Beach...Clearwater Beach...Siesta Key...Saint pete Beach...Venice Beach', 'ugcCityString': '...Bradenton Beach...Clearwater Beach...Siesta Key...Saint Pete Beach...Venice Beach',
'ugcCode': 'FLZ050', 'ugcCode': 'FLZ050',
'ugcName': 'Pinellas', 'ugcName': 'Pinellas',
'ugcTimeZone': 'EST5EDT', 'ugcTimeZone': 'EST5EDT',

View file

@ -71,30 +71,30 @@ class WeatherSubKey:
return self.__key.getVisibility() return self.__key.getVisibility()
def attributes(self): def attributes(self):
return JUtil.javaStringListToPylist(self.__key.getAttributes()) return JUtil.javaObjToPyVal(self.__key.getAttributes())
def wxDef(self): def wxDef(self):
return WxDefinition.WxDefinition(self.__key.wxDef()) return WxDefinition.WxDefinition(self.__key.wxDef())
def availableCoverages(dataMgr, wxType): def availableCoverages(dataMgr, wxType):
siteId = dataMgr.getSiteID() siteId = dataMgr.getSiteID()
return JUtil.javaStringListToPylist(JavaWeatherSubKey.availableCoverages(siteId, wxType)) return JUtil.javaObjToPyVal(JavaWeatherSubKey.availableCoverages(siteId, wxType))
def availableAttributes(dataMgr, wxType): def availableAttributes(dataMgr, wxType):
siteId = dataMgr.getSiteID() siteId = dataMgr.getSiteID()
return JUtil.javaStringListToPylist(JavaWeatherSubKey.availableAttributes(siteId, wxType)) return JUtil.javaObjToPyVal(JavaWeatherSubKey.availableAttributes(siteId, wxType))
def availableIntensities(dataMgr, wxType): def availableIntensities(dataMgr, wxType):
siteId = dataMgr.getSiteID() siteId = dataMgr.getSiteID()
return JUtil.javaStringListToPylist(JavaWeatherSubKey.availableIntensities(siteId, wxType)) return JUtil.javaObjToPyVal(JavaWeatherSubKey.availableIntensities(siteId, wxType))
def availableVisibilities(dataMgr): def availableVisibilities(dataMgr):
siteId = dataMgr.getSiteID() siteId = dataMgr.getSiteID()
return JUtil.javaStringListToPylist(JavaWeatherSubKey.availableVisibilities(siteId)) return JUtil.javaObjToPyVal(JavaWeatherSubKey.availableVisibilities(siteId))
def availableWxTypes(dataMgr): def availableWxTypes(dataMgr):
siteId = dataMgr.getSiteID() siteId = dataMgr.getSiteID()
return JUtil.javaStringListToPylist(JavaWeatherSubKey.availableWxTypes(siteId)) return JUtil.javaObjToPyVal(JavaWeatherSubKey.availableWxTypes(siteId))
def weatherSubKey(dataMgr, coverage, wxType, intensity, vis, attrList): def weatherSubKey(dataMgr, coverage, wxType, intensity, vis, attrList):
siteId = dataMgr.getSiteID() siteId = dataMgr.getSiteID()

View file

@ -24,7 +24,7 @@
# Edit Areas: solicited from user # Edit Areas: solicited from user
# Weather Elements: You must have these Weather elements defined in # Weather Elements: You must have these Weather elements defined in
# your server: Sky, LAL, RelHum, MaxT, MinT, FreeWind, # your server: Sky, LAL, RelHum, MaxT, MinT, FreeWind,
# Haines, TransWind, MixHgt(ft agl) # Haines, TransWind, MixHgt(ft AGL)
# To Run: # To Run:
# Set GFE Time Range # Set GFE Time Range
# Products-->Generate Products # Products-->Generate Products
@ -36,7 +36,7 @@
## Fire Period Table for Feb 29 00 17:00:00 GMT - Mar 01 00 11:00:00 GMT. ## Fire Period Table for Feb 29 00 17:00:00 GMT - Mar 01 00 11:00:00 GMT.
## Edit Area Sky (%) LAL RelHum (%) MaxT MinT FreeWind(mph) Haines TransWind(mph) MixHgt(ft agl) ## Edit Area Sky (%) LAL RelHum (%) MaxT MinT FreeWind(mph) Haines TransWind(mph) MixHgt(ft AGL)
## COAdams 36-23 46 26 ## COAdams 36-23 46 26
## COArapahoe 34-24 46 26 ## COArapahoe 34-24 46 26
@ -102,7 +102,7 @@ Definition = {
"vectorRange", "vectorRange",
"range2Value", "range2Value",
"Vector", 1, "ktToMph"), "Vector", 1, "ktToMph"),
("MixHgt", "MixHgt(ft agl)", ("MixHgt", "MixHgt(ft AGL)",
"minMax", "minMax",
"range2Value", "range2Value",
"Scalar",10,None), "Scalar",10,None),

View file

@ -297,7 +297,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if digit > 3 or digit <= 9: if digit > 3 or digit <= 9:
RH1 = ten + 5 RH1 = ten + 5
RH2 = RH1 + 10 RH2 = RH1 + 10
words = `RH1` + " TO " + `RH2` + " PERCENT" words = `RH1` + " to " + `RH2` + " percent"
return self.setWords(node, words) return self.setWords(node, words)
def _windChill_heatIndex_compoundPhrase(self): def _windChill_heatIndex_compoundPhrase(self):
@ -316,7 +316,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if words is None: if words is None:
return return
if words == "": if words == "":
words = "NOT A FACTOR" words = "not a factor"
node.set("descriptor", "") node.set("descriptor", "")
statsWC = tree.stats.get("WindChill", node.getTimeRange(), statsWC = tree.stats.get("WindChill", node.getTimeRange(),
node.getAreaLabel(), mergeMethod="Min") node.getAreaLabel(), mergeMethod="Min")
@ -364,11 +364,11 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
maxWind, dir = self.getValue(stats, "Max", self.VECTOR()) maxWind, dir = self.getValue(stats, "Max", self.VECTOR())
chopphrase = "" chopphrase = ""
if maxWind >= 26.1: if maxWind >= 26.1:
chopphrase = "HEAVY CHOP EXPECTED ON AREA RIVERS AND LAKES" chopphrase = "Heavy chop expected on area rivers and lakes"
elif maxWind >= 21.7: elif maxWind >= 21.7:
chopphrase = "MODERATE CHOP EXPECTED ON AREA RIVERS AND LAKES" chopphrase = "Moderate chop expected on area rivers and lakes"
elif maxWind >= 17.4: elif maxWind >= 17.4:
chopphrase = "LIGHT CHOP EXPECTED ON AREA RIVERS AND LAKES" chopphrase = "Light chop expected on area rivers and lakes"
if chopphrase != "": if chopphrase != "":
words = words + ". " + chopphrase words = words + ". " + chopphrase
return self.setWords(node, words) return self.setWords(node, words)
@ -408,10 +408,10 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
QPFwords = "\n" QPFwords = "\n"
words = WXwords words = WXwords
elif (QPFrange0 == "0.0"): elif (QPFrange0 == "0.0"):
QPFwords = "AMOUNTS UP TO " + QPFrange1 + " OF AN INCH" QPFwords = "Amounts up to " + QPFrange1 + " of an inch"
words = WXwords + ". " + QPFwords words = WXwords + ". " + QPFwords
else: else:
QPFwords = "AMOUNTS BETWEEN " + QPFrange0 + " AND " + QPFrange1 + " OF AN INCH" QPFwords = "Amounts between " + QPFrange0 + " and " + QPFrange1 + " of an inch"
words = WXwords + ". " + QPFwords words = WXwords + ". " + QPFwords
return self.setWords(node, words) return self.setWords(node, words)
@ -441,15 +441,15 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if wxType == "T": if wxType == "T":
cov = subkey.coverage() cov = subkey.coverage()
if cov in ["Num", "Wide", "Ocnl", "Brf", "Frq", "Pds", "Inter", "Lkly", "Def"]: if cov in ["Num", "Wide", "Ocnl", "Brf", "Frq", "Pds", "Inter", "Lkly", "Def"]:
words = "LIKELY" words = "likely"
elif cov in ["Sct", "Chc"] and words not in ["LIKELY"]: elif cov in ["Sct", "Chc"] and words not in ["likely"]:
words = "SCATTERED" words = "scattered"
elif cov in ["Iso", "SChc"] and words not in ["LIKELY", "SCATTERED"]: elif cov in ["Iso", "SChc"] and words not in ["likely", "scattered"]:
words = "ISOLATED" words = "isolated"
elif words not in ["LIKELY", "SCATTERED", "ISOLATED"]: elif words not in ["likely", "scattered", "isolated"]:
words = "POSSIBLE" words = "possible"
elif words not in ["LIKELY", "SCATTERED", "ISOLATED", "POSSIBLE"]: elif words not in ["likely", "scattered", "isolated", "possible"]:
words = "NONE" words = "none"
#print words #print words
return self.setWords(node, words) return self.setWords(node, words)

View file

@ -166,6 +166,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 01/28/2015 #4018 randerso Code cleanup. * 01/28/2015 #4018 randerso Code cleanup.
* 02/04/2014 17039 ryu Removed menu item related to the HighlighFramingCodes feature. * 02/04/2014 17039 ryu Removed menu item related to the HighlighFramingCodes feature.
* 04/20/2015 4027 randerso Renamed ProductStateEnum with an initial capital * 04/20/2015 4027 randerso Renamed ProductStateEnum with an initial capital
* Expunged Calendar from ActiveTableRecord
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -1388,7 +1389,7 @@ public class ProductEditorComp extends Composite implements
// check if the segment is still valid // check if the segment is still valid
int started = 0; int started = 0;
for (ActiveTableRecord atr : activeRecs) { for (ActiveTableRecord atr : activeRecs) {
if (atr.getStartTime().getTimeInMillis() <= transmissionTime if (atr.getStartTime().getTime() <= transmissionTime
.getTime()) { .getTime()) {
started++; started++;
} }
@ -1420,7 +1421,7 @@ public class ProductEditorComp extends Composite implements
for (ActiveTableRecord r : activeRecs) { for (ActiveTableRecord r : activeRecs) {
// need to change the action to CON if // need to change the action to CON if
// the end time did not change // the end time did not change
if (r.getEndTime().getTimeInMillis() == vtecEnd if (r.getEndTime().getTime() == vtecEnd
.getTime()) { .getTime()) {
if (!newActions.contains("CON")) { if (!newActions.contains("CON")) {
newActions.add("CON"); newActions.add("CON");

View file

@ -29,6 +29,7 @@ import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.raytheon.uf.common.activetable.ActiveTableMode;
import com.raytheon.uf.common.activetable.response.GetNextEtnResponse; import com.raytheon.uf.common.activetable.response.GetNextEtnResponse;
import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.util.StringUtil; import com.raytheon.uf.common.util.StringUtil;
@ -63,6 +64,7 @@ import com.raytheon.viz.texteditor.util.VtecUtil;
* Dec 18, 2013 #2641 dgilling Force ordering of items returned by * Dec 18, 2013 #2641 dgilling Force ordering of items returned by
* getVtecLinesThatNeedEtn(). * getVtecLinesThatNeedEtn().
* Feb 05, 2014 #2774 dgilling Additional correction to previous fix. * Feb 05, 2014 #2774 dgilling Additional correction to previous fix.
* Apr 28, 2015 #4027 randerso Added getNextEtn parameter to specify ActiveTableMode
* *
* </pre> * </pre>
* *
@ -134,6 +136,33 @@ public class GFEVtecUtil {
return getNextEtn(office, phensig, lockEtn, false, false, null); return getNextEtn(office, phensig, lockEtn, false, false, null);
} }
/**
* Gets the next available ETN for a specific product and office.
*
* @param office
* The 4-character site ID of the office.
* @param phensig
* The phenomenon and significance of the hazard concatenated
* with a '.' (e.g., TO.W or DU.Y)
* @param lockEtn
* Whether or not to request an exclusive ETN--if true, this will
* cause the server to increment its running ETN sequence to the
* next number after determining the next ETN for this request.
* If false, the next ETN will be returned, but it will not
* increment the server's running sequence, so the ETN return
* could be used by another client that makes a
* GetNextEtnRequest.
* @param mode
* Indicates which active table to query
* @return The next ETN in sequence, given the office and phensig.
* @throws VizException
* If an error occurred sending the request to the server.
*/
public static GetNextEtnResponse getNextEtn(String office, String phensig,
boolean lockEtn, ActiveTableMode mode) throws VizException {
return getNextEtn(office, phensig, lockEtn, false, false, null, mode);
}
/** /**
* Gets the next available ETN for a specific product and office. * Gets the next available ETN for a specific product and office.
* *
@ -206,6 +235,50 @@ public class GFEVtecUtil {
reportOnlyConflict, etnOverride); reportOnlyConflict, etnOverride);
} }
/**
* Gets the next available ETN for a specific product and office.
*
* @param office
* The 4-character site ID of the office.
* @param phensig
* The phenomenon and significance of the hazard concatenated
* with a '.' (e.g., TO.W or DU.Y)
* @param lockEtn
* Whether or not to request an exclusive ETN--if true, this will
* cause the server to increment its running ETN sequence to the
* next number after determining the next ETN for this request.
* If false, the next ETN will be returned, but it will not
* increment the server's running sequence, so the ETN return
* could be used by another client that makes a
* GetNextEtnRequest.
* @param performISC
* Whether or not to collaborate with neighboring sites to
* determine the next ETN. See {@link
* GetNextEtnUtil#getNextEtnFromPartners(String, ActiveTableMode,
* String, Calendar, List<IRequestRouter>)} for more information.
* @param reportOnlyConflict
* Affects which kinds of errors get reported back to the
* requestor. If true, only cases where the value of
* <code>etnOverride</code> is less than or equal to the last ETN
* used by this site or any of its partners will be reported.
* Else, all significant errors will be reported back.
* @param etnOverride
* Allows the user to influence the next ETN assigned by using
* this value unless it is less than or equal to the last ETN
* used by this site or one of its partners.
* @param mode
* Indicates which active table to query
* @return The next ETN in sequence, given the office and phensig.
* @throws VizException
* If an error occurred sending the request to the server.
*/
public static GetNextEtnResponse getNextEtn(String office, String phensig,
boolean lockEtn, boolean performISC, boolean reportOnlyConflict,
Integer etnOverride, ActiveTableMode mode) throws VizException {
return VtecUtil.getNextEtn(office, phensig, lockEtn, performISC,
reportOnlyConflict, etnOverride, mode);
}
/** /**
* Reads through a GFE VTEC product and returns VTEC lines with NEW action * Reads through a GFE VTEC product and returns VTEC lines with NEW action
* codes that need to be assigned an ETN. * codes that need to be assigned an ETN.

View file

@ -48,6 +48,7 @@ import com.raytheon.viz.ghg.monitor.data.GhgConfigData.SelectionEnum;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 25 MAR 2008 N/A lvenable Initial creation * 25 MAR 2008 N/A lvenable Initial creation
* 30 JUL 2010 6721 mpduff WFO now from officeid column. * 30 JUL 2010 6721 mpduff WFO now from officeid column.
* 28 APR 2015 4027 randerso Expunged Calendar from ActiveTableRecord
* *
* </pre> * </pre>
* *
@ -234,13 +235,13 @@ public class GhgData implements Comparable<GhgData> {
sig = warning.getSig(); sig = warning.getSig();
hazard = getHazardDescription(getPhenSig()); hazard = getHazardDescription(getPhenSig());
try { try {
startDate = warning.getStartTime().getTime(); startDate = warning.getStartTime();
} catch (Exception e) { } catch (Exception e) {
startDate = now; startDate = now;
} }
endDate = warning.getEndTime().getTime(); endDate = warning.getEndTime();
purgeDate = warning.getPurgeTime().getTime(); purgeDate = warning.getPurgeTime();
issueTime = warning.getIssueTime().getTime(); issueTime = warning.getIssueTime();
pil = warning.getPil(); pil = warning.getPil();
segNum = String.valueOf(warning.getSeg()); segNum = String.valueOf(warning.getSeg());
wfo = warning.getOfficeid(); wfo = warning.getOfficeid();
@ -933,7 +934,7 @@ public class GhgData implements Comparable<GhgData> {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 1; int hash = 1;
hash = hash * 31 + hazard.hashCode(); hash = (hash * 31) + hazard.hashCode();
return hash; return hash;
} }

View file

@ -33,6 +33,7 @@ import com.raytheon.uf.common.activetable.GetActiveTableResponse;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.core.mode.CAVEMode; import com.raytheon.viz.core.mode.CAVEMode;
@ -52,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* tables names. * tables names.
* Dec 20, 2010 7210 cjeanbap Added non-blocking dialog. * Dec 20, 2010 7210 cjeanbap Added non-blocking dialog.
* Apr 25, 2014 DR 16668 D. Friedman Handle partial cancellations * Apr 25, 2014 DR 16668 D. Friedman Handle partial cancellations
* Apr 28, 2015 4027 randerso Expunged Calendar from ActiveTableRecord
* </pre> * </pre>
* *
* @author jsanchez * @author jsanchez
@ -65,7 +67,7 @@ public class NotifyExpirationTask extends TimerTask {
/** /**
* Miliseconds in two days * Miliseconds in two days
*/ */
private static final long TWO_DAYS = 48 * 60 * 60 * 1000; private static final long TWO_DAYS = 2 * TimeUtil.MILLIS_PER_DAY;
private String office; private String office;
@ -90,9 +92,11 @@ public class NotifyExpirationTask extends TimerTask {
+ dateFormat.format(vtecObject.getEndTime().getTime()); + dateFormat.format(vtecObject.getEndTime().getTime());
} }
@Override
public void run() { public void run() {
if (!isCanceled()) { if (!isCanceled()) {
parentShell.getDisplay().asyncExec(new Runnable() { parentShell.getDisplay().asyncExec(new Runnable() {
@Override
public void run() { public void run() {
SWTMessageBox mb = new SWTMessageBox( SWTMessageBox mb = new SWTMessageBox(
NotifyExpirationTask.this.parentShell, NotifyExpirationTask.this.parentShell,
@ -126,8 +130,8 @@ public class NotifyExpirationTask extends TimerTask {
activeTable = resp.getActiveTable(); activeTable = resp.getActiveTable();
} catch (VizException e) { } catch (VizException e) {
statusHandler.handle(Priority.ERROR, statusHandler.handle(Priority.ERROR,
"Error querying active table for " + office + "." "Error querying active table for " + office + "." + phenSig
+ phenSig + "." + etn, e); + "." + etn, e);
} }
if (activeTable != null) { if (activeTable != null) {
@ -135,16 +139,17 @@ public class NotifyExpirationTask extends TimerTask {
for (ActiveTableRecord record : activeTable) { for (ActiveTableRecord record : activeTable) {
if (record != null) { if (record != null) {
/* /*
* textNotifyExpiration.tcl ln 106: If any of the found products are * textNotifyExpiration.tcl ln 106: If any of the found
* less than 48 hours old,return true. * products are less than 48 hours old,return true.
*/ */
if ("CAN".equals(record.getAct()) if ("CAN".equals(record.getAct())
&& (System.currentTimeMillis() && ((System.currentTimeMillis() - record
- record.getIssueTime().getTimeInMillis() < TWO_DAYS)) { .getIssueTime().getTime()) < TWO_DAYS)) {
haveCAN = true; haveCAN = true;
} else if ("CON".equals(record.getAct())) { } else if ("CON".equals(record.getAct())) {
/* If there CANs and the event is still active, there /*
* should be some CONs. Thus, it is not necessary to * If there CANs and the event is still active, there
* should be some CONs. Thus, it is not necessary to
* check for every other kind of non-terminal action. * check for every other kind of non-terminal action.
*/ */
return false; return false;
@ -160,7 +165,7 @@ public class NotifyExpirationTask extends TimerTask {
private String pad(int value) { private String pad(int value) {
String rval = ""; String rval = "";
String str = Integer.toString(value); String str = Integer.toString(value);
for (int i = 0; i < 4 - str.length(); i++) { for (int i = 0; i < (4 - str.length()); i++) {
rval += "0"; rval += "0";
} }

View file

@ -20,6 +20,7 @@
package com.raytheon.viz.texteditor.util; package com.raytheon.viz.texteditor.util;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -46,6 +47,9 @@ import com.raytheon.viz.core.mode.CAVEMode;
* May 08, 2013 #1842 dgilling Code cleanup. * May 08, 2013 #1842 dgilling Code cleanup.
* Aug 29, 2013 #1843 dgilling Use new GetNextEtnRequest constructor. * Aug 29, 2013 #1843 dgilling Use new GetNextEtnRequest constructor.
* Oct 21, 2013 #1843 dgilling Use new GetNextEtnResponse. * Oct 21, 2013 #1843 dgilling Use new GetNextEtnResponse.
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
* Added getNextEtn method with parameter to specify
* activeTableMode
* *
* </pre> * </pre>
* *
@ -103,7 +107,7 @@ public class VtecUtil {
return message; return message;
} }
VtecObject vtec = parseMessage(message); VtecObject vtec = parseMessage(message);
if (vtec == null || vtec.getAction() == null) { if ((vtec == null) || (vtec.getAction() == null)) {
return message; return message;
} }
@ -181,13 +185,57 @@ public class VtecUtil {
public static GetNextEtnResponse getNextEtn(String office, String phensig, public static GetNextEtnResponse getNextEtn(String office, String phensig,
boolean lockEtn, boolean performISC, boolean reportOnlyConflict, boolean lockEtn, boolean performISC, boolean reportOnlyConflict,
Integer etnOverride) throws VizException { Integer etnOverride) throws VizException {
Calendar currentTime = Calendar.getInstance(); ActiveTableMode mode = (CAVEMode.getMode().equals(CAVEMode.PRACTICE)) ? ActiveTableMode.PRACTICE
currentTime.setTime(SimulatedTime.getSystemTime().getTime());
ActiveTableMode activeTable = (CAVEMode.getMode()
.equals(CAVEMode.PRACTICE)) ? ActiveTableMode.PRACTICE
: ActiveTableMode.OPERATIONAL; : ActiveTableMode.OPERATIONAL;
GetNextEtnRequest req = new GetNextEtnRequest(office, activeTable,
phensig, currentTime, lockEtn, performISC, reportOnlyConflict, return getNextEtn(office, phensig, lockEtn, performISC,
reportOnlyConflict, etnOverride, mode);
}
/**
* Gets the next available ETN for a specific product and office.
*
* @param office
* The 4-character site ID of the office.
* @param phensig
* The phenomenon and significance of the hazard concatenated
* with a '.' (e.g., TO.W or DU.Y)
* @param lockEtn
* Whether or not to request an exclusive ETN--if true, this will
* cause the server to increment its running ETN sequence to the
* next number after determining the next ETN for this request.
* If false, the next ETN will be returned, but it will not
* increment the server's running sequence, so the ETN return
* could be used by another client that makes a
* GetNextEtnRequest.
* @param performISC
* Whether or not to collaborate with neighboring sites to
* determine the next ETN. See {@link
* GetNextEtnUtil#getNextEtnFromPartners(String, ActiveTableMode,
* String, Calendar, List<IRequestRouter>)} for more information.
* @param reportOnlyConflict
* Affects which kinds of errors get reported back to the
* requestor. If true, only cases where the value of
* <code>etnOverride</code> is less than or equal to the last ETN
* used by this site or any of its partners will be reported.
* Else, all significant errors will be reported back.
* @param etnOverride
* Allows the user to influence the next ETN assigned by using
* this value unless it is less than or equal to the last ETN
* used by this site or one of its partners.
* @param mode
* Indicates which active table to query
* @return The next ETN in sequence, given the office and phensig.
* @throws VizException
* If an error occurs while submitting or processing the remote
* request.
*/
public static GetNextEtnResponse getNextEtn(String office, String phensig,
boolean lockEtn, boolean performISC, boolean reportOnlyConflict,
Integer etnOverride, ActiveTableMode mode) throws VizException {
Date currentTime = SimulatedTime.getSystemTime().getTime();
GetNextEtnRequest req = new GetNextEtnRequest(office, mode, phensig,
currentTime, lockEtn, performISC, reportOnlyConflict,
etnOverride); etnOverride);
GetNextEtnResponse resp = (GetNextEtnResponse) ThriftClient GetNextEtnResponse resp = (GetNextEtnResponse) ThriftClient
@ -197,6 +245,13 @@ public class VtecUtil {
return rval; return rval;
} }
/**
* Parse a VTEC message
*
* @param message
* the message
* @return the parsed VtecObject
*/
public static VtecObject parseMessage(String message) { public static VtecObject parseMessage(String message) {
VtecObject rval = null; VtecObject rval = null;
Matcher m = VTEC_REGEX.matcher(message); Matcher m = VTEC_REGEX.matcher(message);
@ -215,7 +270,7 @@ public class VtecUtil {
* *
* @param message * @param message
* the message to modify * the message to modify
* @param obj * @param vtec
* new VTEC for the message * new VTEC for the message
* *
* @return the modified message * @return the modified message

View file

@ -85,6 +85,7 @@ import com.vividsolutions.jts.geom.Polygon;
* /missing (part of state, state abbreviation) which resulted from * /missing (part of state, state abbreviation) which resulted from
* extension of a watch to counties which are of same/different fe_area. * extension of a watch to counties which are of same/different fe_area.
* Sep 25, 2014 ASM #16783 D. Friedman Do not use VTEC action to determine Watch uniqueness. * Sep 25, 2014 ASM #16783 D. Friedman Do not use VTEC action to determine Watch uniqueness.
* Apr 28, 2015 RODO #4027 randerso Expunged Calendar from ActiveTableRecord
* </pre> * </pre>
* *
* @author jsanchez * @author jsanchez
@ -324,12 +325,12 @@ public class WatchUtil {
* fixed the underlying system. request.addConstraint("act", new * fixed the underlying system. request.addConstraint("act", new
* RequestConstraint("CAN", ConstraintType.NOT_EQUALS)); * RequestConstraint("CAN", ConstraintType.NOT_EQUALS));
*/ */
if (action != WarningAction.CAN && action != WarningAction.EXP) { if ((action != WarningAction.CAN) && (action != WarningAction.EXP)) {
ActiveTableRecord record = entityClass.newInstance(); ActiveTableRecord record = entityClass.newInstance();
record.setIssueTime((Calendar) result.get(ISSUE_TIME_FIELD)); record.setIssueTime((Date) result.get(ISSUE_TIME_FIELD));
record.setStartTime((Calendar) result.get(START_TIME_FIELD)); record.setStartTime((Date) result.get(START_TIME_FIELD));
record.setEndTime((Calendar) result.get(END_TIME_FIELD)); record.setEndTime((Date) result.get(END_TIME_FIELD));
record.setEndTime((Calendar) result.get(END_TIME_FIELD)); record.setEndTime((Date) result.get(END_TIME_FIELD));
record.setUgcZone(String.valueOf(result.get(UGC_ZONE_FIELD))); record.setUgcZone(String.valueOf(result.get(UGC_ZONE_FIELD)));
record.setPhensig(String.valueOf(result.get(PHEN_SIG_FIELD))); record.setPhensig(String.valueOf(result.get(PHEN_SIG_FIELD)));
record.setEtn(String.valueOf(result.get(ETN))); record.setEtn(String.valueOf(result.get(ETN)));
@ -348,10 +349,12 @@ public class WatchUtil {
} }
} }
// remove ActiveTableRecord from records whose etn, ugcZone, and phensig is same as /*
// canceled or expired. * remove ActiveTableRecord from records whose etn, ugcZone, and phensig
* is same as canceled or expired.
*/
String etn, ugczone, phensig; String etn, ugczone, phensig;
for (Pair<String, String> etnPhensig: removedUgczones.keySet()) { for (Pair<String, String> etnPhensig : removedUgczones.keySet()) {
ugczones = removedUgczones.get(etnPhensig); ugczones = removedUgczones.get(etnPhensig);
etn = etnPhensig.getFirst(); etn = etnPhensig.getFirst();
phensig = etnPhensig.getSecond(); phensig = etnPhensig.getSecond();
@ -361,8 +364,9 @@ public class WatchUtil {
Iterator<ActiveTableRecord> iterator = records.iterator(); Iterator<ActiveTableRecord> iterator = records.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ActiveTableRecord atr = iterator.next(); ActiveTableRecord atr = iterator.next();
if (atr.getEtn().equals(etn) && atr.getUgcZone().equals(ugczone) && if (atr.getEtn().equals(etn)
atr.getPhensig().equals(phensig)) { && atr.getUgcZone().equals(ugczone)
&& atr.getPhensig().equals(phensig)) {
iterator.remove(); iterator.remove();
} }
} }
@ -371,9 +375,12 @@ public class WatchUtil {
Collections.sort(records, PEUI); Collections.sort(records, PEUI);
// Filters out extra ActiveTableRecords that have same phenSig, etn, and ugcZone. /*
* Filters out extra ActiveTableRecords that have same phenSig, etn, and
* ugcZone.
*/
Map<String, ActiveTableRecord> atrMap = new LinkedHashMap<String, ActiveTableRecord>(); Map<String, ActiveTableRecord> atrMap = new LinkedHashMap<String, ActiveTableRecord>();
for (ActiveTableRecord atr: records) { for (ActiveTableRecord atr : records) {
String key = atr.getPhensig() + atr.getEtn() + atr.getUgcZone(); String key = atr.getPhensig() + atr.getEtn() + atr.getUgcZone();
atrMap.put(key, atr); atrMap.put(key, atr);
} }
@ -419,7 +426,7 @@ public class WatchUtil {
String ugcZone = ar.getUgcZone(); String ugcZone = ar.getUgcZone();
String state = null; String state = null;
if (marineUgcs != null && marineUgcs.contains(ugcZone)) { if ((marineUgcs != null) && marineUgcs.contains(ugcZone)) {
// Just leave state == null // Just leave state == null
} else { } else {
state = getStateName(ugcZone.substring(0, 2)); state = getStateName(ugcZone.substring(0, 2));
@ -430,12 +437,11 @@ public class WatchUtil {
String phenSig = ar.getPhensig(); String phenSig = ar.getPhensig();
String etn = ar.getEtn(); String etn = ar.getEtn();
Date startTime = ar.getStartTime().getTime(); Date startTime = ar.getStartTime();
Date endTime = ar.getEndTime().getTime(); Date endTime = ar.getEndTime();
if (validUgcZones.contains(ugcZone)) { if (validUgcZones.contains(ugcZone)) {
Watch watch = new Watch(state, phenSig, etn, startTime, Watch watch = new Watch(state, phenSig, etn, startTime, endTime);
endTime);
List<String> areas = map.get(watch); List<String> areas = map.get(watch);
if (areas == null) { if (areas == null) {
areas = new ArrayList<String>(); areas = new ArrayList<String>();
@ -460,9 +466,9 @@ public class WatchUtil {
} }
} }
/* Sorts the watches based on ETN, then state. Marine areas /*
* have a null state value so they appear at the end of each * Sorts the watches based on ETN, then state. Marine areas have a null
* watch. * state value so they appear at the end of each watch.
*/ */
Collections.sort(watches, new Comparator<Watch>() { Collections.sort(watches, new Comparator<Watch>() {
@ -471,37 +477,44 @@ public class WatchUtil {
String etn1 = watch1.getEtn(); String etn1 = watch1.getEtn();
String etn2 = watch2.getEtn(); String etn2 = watch2.getEtn();
int c; int c;
if (etn1 == etn2) if (etn1 == etn2) {
c = 0; c = 0;
else if (etn1 == null) } else if (etn1 == null) {
return 1; return 1;
else if (etn2 == null) } else if (etn2 == null) {
return -1; return -1;
else } else {
c = etn1.compareTo(etn2); c = etn1.compareTo(etn2);
if (c != 0) }
if (c != 0) {
return c; return c;
}
String state1 = watch1.getState(); String state1 = watch1.getState();
String state2 = watch2.getState(); String state2 = watch2.getState();
if (state1 == state2) if (state1 == state2) {
return 0; return 0;
else if (state1 == null) } else if (state1 == null) {
return 1; // null state is greater; put at end return 1; // null state is greater; put at end
else if (state2 == null) } else if (state2 == null) {
return -1; return -1;
else } else {
return state1.compareTo(state2); return state1.compareTo(state2);
}
} }
}); });
// Filters out extra Watches that have different startTime but same phenSig, etn, state, partOfState, endTime, and marineArea. /*
* Filters out extra Watches that have different startTime but same
* phenSig, etn, state, partOfState, endTime, and marineArea.
*/
Map<String, Watch> watchMap = new LinkedHashMap<String, Watch>(); Map<String, Watch> watchMap = new LinkedHashMap<String, Watch>();
for (Watch w: watches) { for (Watch w : watches) {
List<String> pos = w.getPartOfState() != null ? List<String> pos = w.getPartOfState() != null ? new ArrayList<String>(
new ArrayList<String>(w.getPartOfState()) : null; w.getPartOfState()) : null;
if (pos != null) if (pos != null) {
Collections.sort(pos); Collections.sort(pos);
}
String key = String.valueOf(w.getPhenSig()) String key = String.valueOf(w.getPhenSig())
+ String.valueOf(w.getEtn()) + String.valueOf(w.getState()) + String.valueOf(w.getEtn()) + String.valueOf(w.getState())
+ String.valueOf(pos) + String.valueOf(w.getEndTime()); + String.valueOf(pos) + String.valueOf(w.getEndTime());
@ -540,9 +553,10 @@ public class WatchUtil {
return affectedPortions; return affectedPortions;
} }
private List<Watch> generateMarineWatchItems(Watch template, List<String> areas) { private List<Watch> generateMarineWatchItems(Watch template,
List<String> areas) {
ArrayList<Watch> result = new ArrayList<Watch>(); ArrayList<Watch> result = new ArrayList<Watch>();
for (String area: areas) { for (String area : areas) {
Watch watch = new Watch(template.getState(), template.getPhenSig(), Watch watch = new Watch(template.getState(), template.getPhenSig(),
template.getEtn(), template.getStartTime(), template.getEtn(), template.getStartTime(),
template.getEndTime()); template.getEndTime());
@ -553,7 +567,7 @@ public class WatchUtil {
} }
private List<String> determineMarineAreas(List<String> areas) { private List<String> determineMarineAreas(List<String> areas) {
HashSet<Pair<Integer, String>> groupedAreas = new HashSet<Pair<Integer,String>>(); HashSet<Pair<Integer, String>> groupedAreas = new HashSet<Pair<Integer, String>>();
for (String area : areas) { for (String area : areas) {
int entryIndex = 0; int entryIndex = 0;
for (MarineWordingEntry entry : marineWordingConfig.getEntries()) { for (MarineWordingEntry entry : marineWordingConfig.getEntries()) {
@ -573,9 +587,12 @@ public class WatchUtil {
entryIndex++; entryIndex++;
} }
} }
ArrayList<Pair<Integer, String>> sorted = new ArrayList<Pair<Integer,String>>(groupedAreas); ArrayList<Pair<Integer, String>> sorted = new ArrayList<Pair<Integer, String>>(
groupedAreas);
Collections.sort(sorted, new Comparator<Pair<Integer, String>>() { Collections.sort(sorted, new Comparator<Pair<Integer, String>>() {
public int compare(Pair<Integer, String> o1, Pair<Integer, String> o2) { @Override
public int compare(Pair<Integer, String> o1,
Pair<Integer, String> o2) {
int r = o1.getFirst().compareTo(o2.getFirst()); int r = o1.getFirst().compareTo(o2.getFirst());
return r != 0 ? r : o1.getSecond().compareTo(o2.getSecond()); return r != 0 ? r : o1.getSecond().compareTo(o2.getSecond());
}; };
@ -702,7 +719,7 @@ public class WatchUtil {
if (((nn > 0) && (ss > 0)) || ((ee > 0) && (ww > 0))) { if (((nn > 0) && (ss > 0)) || ((ee > 0) && (ww > 0))) {
return abrev; return abrev;
} }
if (nnn + sss + eee + www == 3) { if ((nnn + sss + eee + www) == 3) {
if (www == 0) { if (www == 0) {
abrev = "e"; abrev = "e";
} else if (eee == 0) { } else if (eee == 0) {
@ -724,7 +741,7 @@ public class WatchUtil {
return abrev; return abrev;
} }
} }
if (m == 1 + cc) { if (m == (1 + cc)) {
abrev += partAbrev + " "; abrev += partAbrev + " ";
return abrev; return abrev;
} }

View file

@ -35,17 +35,16 @@ class TextProduct(MultipleElementTable.TextProduct):
Definition = copy.deepcopy(MultipleElementTable.TextProduct.Definition) Definition = copy.deepcopy(MultipleElementTable.TextProduct.Definition)
Definition["displayName"] = "MultipleElementTable" Definition["displayName"] = "MultipleElementTable"
Definition["database"] = "Official"
#Definition["outputFile"] = "/awips/GFESuite/products/TEXT/MultipleElementTable.txt" #Definition["outputFile"] = "/awips/GFESuite/products/TEXT/MultipleElementTable.txt"
#Definition["defaultEditAreas"] = [ #Definition["regionList"] = [
# ("area1","AREA 1"), # ("area1","AREA 1"),
# ("area2","AREA 2"), # ("area2","AREA 2"),
# ("area3","AREA 3"), # ("area3","AREA 3"),
# ] # ],
#Definition["regionList"] = [ #Definition["regionList"] = [
# ("/33",["AREA 1","AREA 2"]), # ("/33",["AREA 1","AREA 2"]),
# ("/19",["AREA 3"]) # ("/19",["AREA 3"])
# ] # ],
#Definition["elementList"] = ["Temp", "PoP"] # Default #Definition["elementList"] = ["Temp", "PoP"] # Default
#Definition["elementList"] = ["Temp", "Humidity"] #Definition["elementList"] = ["Temp", "Humidity"]

View file

@ -1,206 +0,0 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
########################################################################
# RDFcst
#
########################################################################
## EXAMPLE OUTPUT:
##
## 24 Hour Tabular Forecast for Boulder for 12 AM MST Mar 21 TO 12 PM MST Mar 21.
##
## Weather Element 12 AM 3 AM 6 AM 9 AM
##
## Temperature 30 28 29
## Dew Point 25 23 25
## Wind (mph) NW 4 NW 5 NW 6
## Sky Cover(%) MOSTLY MOSTLY MOSTLY
## CLOUDY CLOUDY CLOUDY
## Rainfall Amount(in.) 0.00 0.00 0.00 0.00
## Weather RAIN RAIN
## Snowfall(in.) 0 0 0 0
##
## This forecast was generated from a gridded database.
# Forecast Definition
RDFcst = {
## General Set-Up
"type": "table",
"displayName": "RDFcst", # for Product Generation Menu
"database": "Official",
# Output file for product results
"outputFile": "/home/ifp/release/products/TEXT/RDFcst.txt", # default output file
"runTimeOutputFile": "no", # If yes, ask user at run time
# Language
"language": "english", # default
"runTimeLanguage": "no", # If yes, ask user at run time
# Line Length for resulting Product
"lineLength": 79, # default
"runTimeLineLength": "no", # If yes, ask user at run time
# Text to preceed and follow the text product.
# Remember to add spacing lines backslash n.
# The variables: %TimePeriod, %EditArea, and %WeatherElement
# can be included to be filled in with constant variables.
# For phrase and combo, only %EditArea and %TimePeriod
# can be filled in.
"timePeriodMethod": "localTRLabel", ## localRangeLabel
"editAreaLoopBegText": "24 Hour Tabular Forecast for %EditArea for %TimePeriod. \n\n",
"editAreaLoopEndText": "\n",
"endingText": "\nThis forecast was generated from a gridded database.\n\n\n",
## Table Layout
# A table is a combination of three variables:
# edit areas, weather elements, and time periods
# One of these variables is held constant,
# one is assigned to rows and the other to columns.
"constantVariable": "EditArea", ## "TimePeriod",
"rowVariable": "WeatherElement", ## "EditArea",
"columnVariable": "TimePeriod", ## "WeatherElement",
"columnJustification":"Right",
## Edit Areas
# If the edit area is the constant variable, specify
# one area and whether to ask user at run time.
# runTimeEditArea can be a list of areas and/or edit area
# groups (groups will be expanded into areas) from which
# the user will be able to choose.
"defaultEditAreas": [
("area1", "Area1"),
("area2", "Area2"),
("area3", "Area3"),
("area4", "Area4")],
"runTimeEditAreas": "yes",
"areaType" : "Edit Area", # E.g. City, County, Basin, etc.
# Time Ranges
"defaultRanges": ["Today"],
"runTimeRanges" : "no", # if yes, ask user at run time
## Weather Elements
# elementList: List of Weather Element tuples:
# Weather Element Name
# Weather Element Label
# If you want the label to appear on multiple lines,
# use vertical bars as separators e.g. Maximum|Temperature
# Analysis method -- Method to produce statistics from the data
# ReportAs Method -- Method to format the analyzed value(s)
# DataType: Scalar or Vector or Weather
# Rounding increment e.g. 5 = round final value to
# nearest multiple of 5
# Conversion method
# e.g. "mphToKt" converts from mph to knots
#
# If the weather element is the constant variable, only one
# should be given.
# Name , Label , Analysis Method , ReportAs Method ,
# DataType , Rounding , Conversion
"elementList": [
("T","Temperature",
"avg",
"singleValue",
"Scalar", 1, None),
("Td","Dew Point",
"avg",
"singleValue",
"Scalar", 1, None),
("RH","Relative Humidity(%)",
"avg",
"singleValue",
"Scalar", 1, None),
("WindChill","Wind Chill(F)",
"avg",
"singleValue",
"Scalar", 1, None),
("Wind","Wind (mph)",
"vectorRange",
"avgValue",
"Vector", 1, "ktToMph"),
("Sky","Sky Cover(%)",
"avg",
"cloudCover",
"Scalar", 5, None),
("QPF","Rainfall Amount(in.)",
"avg",
"singleValue",
"Scalar", .01, None),
("Wx","Weather ",
"dominantWx",
"short_weather_phrase",
"Scalar", 1, None),
("SnowAmt","Snowfall(in.)",
"avg",
"singleValue",
"Scalar", 1, None),
("PoP", "Precip (%)",
"avg",
"singleValue",
"Scalar", 1, None),
],
## Time Period (If rows or columns vary with TimePeriod
# timePeriod: This is the interval in hours for sampling the data
# e.g. every 3 hours.
# (Can be floating point e.g. 1.5 hour TimePeriods)
"timePeriod": 3,
# timeSpan: This is the amount of data to sample at each
# interval.
# If you want the data analyzed (e.g averaged) over the
# entire period, the timeSpan should be set to "timePeriod".
# If you only want data for the beginning of each timePeriod,
# the timeSpan should be set to number of hours over which
# to analyze the data e.g. 1 hour
"timeSpan": 1,
"runTimePeriod": "no", # If yes, ask user at run time for period
# Method to label periods given a time range
# periodLabel -- GMT time hourZ/day e.g. 15Z/4
# localTimeLabel -- local time e.g. 6 AM
# localRangeLabel -- local time range e.g. 6AM-9AM
"periodLabelMethod": "localTimeLabel",
## User-supplied Methods
# loopMethod: Method to be called for each row.
# Such a method might keep ongoing statistics about table data.
# Arguments: (rowLabel, rowEntries, userDict, argDict)
# Returns: nothing
# "rowEntries" is a list of (colValue, value) tuples
# describing the entries in this row.
# "userDict" is a dictionary set up for user-defined
# callback methods so they can keep ongoing data as
# the table is being produced.
# It is not modified by the TextFormatter code.
"loopMethod": None,
# endMethod: Method to be called after table is complete.
# Arguments: (table, userDict, argDict)
# Returns: table (could be modified)
# The table can be modified to report summary statistics
# gathered in userDict.
#
"endMethod": None,
}

View file

@ -1,311 +0,0 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
#-------------------------------------------------------------------------
# Description: This product creates a Smart Element Table.
# The possible elements are Temperature (MaxT, MinT), Humidity (MinRH, MaxRH), and PoP
#-------------------------------------------------------------------------
# Copying:
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
#-------------------------------------------------------------------------
# Standard and Local file names and Locations:
# MultipleElementTableTable, MultipleElementTable_Local, MultipleElementTable_Aux_Local
#-------------------------------------------------------------------------
# User Configurable Variables:
#-------------------------------------------------------------------------
# Weather Elements Needed:
#-------------------------------------------------------------------------
# Edit Areas Needed:
#-------------------------------------------------------------------------
# Associated Utilities Files e.g. Combinations file:
#-------------------------------------------------------------------------
# Component Products:
#-------------------------------------------------------------------------
# Programmers and Support including product team leader's email:
#-------------------------------------------------------------------------
# Development tasks that are identified and in progress:
#-------------------------------------------------------------------------
# Additional Information:
#-------------------------------------------------------------------------
import TextRules
import SampleAnalysis
import string, time, types
class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
VariableList = [
("Forecast Product" , "Morning", "radio",
["Morning","Afternoon"]),
]
Definition = {
"type": "smart",
"displayName": "None",
"database": "Official",
"outputFile": "/awips/GFESuite/products/TEXT/SmartElementTable.txt",
"defaultEditAreas": [
("area1","AREA 1"),
("area2","AREA 2"),
("area3","AREA 3"),
],
# Product-specific variables
"regionList" : [
("/33",["AREA 1","AREA 2"]),
("/19",["AREA 3"])
],
# Possible elements are:
# "Temp" -- lists MaxT for daytime, MinT for nighttime
# "PoP"
# "Humidity" -- lists MinRH for daytime, MaxRH for nighttime
"elementList" : ["Temp", "PoP"],
# If set to 1, only one value for each element is listed
"includeTitle": 1,
"introLetters": ".<",
}
def __init__(self):
TextRules.TextRules.__init__(self)
SampleAnalysis.SampleAnalysis.__init__(self)
def generateForecast(self, argDict):
# Generate formatted product for a list of edit areas
# Get variables from varDict and Definition
self._getVariables(argDict)
# Get the areaList -- derived from defaultEditAreas and
# may be solicited at run-time from the user if desired
self._areaList = self.getAreaList(argDict)
# Determine time ranges for which the data will be sampled
self._determineTimeRanges(argDict)
# Sample the data
self._sampleData(argDict)
# Initialize the output string
fcst = ""
fcst = self._preProcessProduct(fcst, argDict)
# Generate the product for each edit area in the list
for editArea, areaLabel in self._areaList:
fcst = self._preProcessArea(fcst, editArea, areaLabel, argDict)
fcst = self._makeProduct(fcst, editArea, areaLabel, argDict)
fcst = self._postProcessArea(fcst, editArea, areaLabel, argDict)
fcst = self._postProcessProduct(fcst, argDict)
return fcst
def _getVariables(self, argDict):
# Determine whether Morning or Afternoon product type
varDict = argDict["varDict"]
self._productType = varDict["Forecast Product"]
# Make argDict accessible
self.__argDict = argDict
# Set up any other product-specific variables from the Definition
self._definition = argDict["forecastDef"]
for key in self._definition.keys():
exec "self._" + key + "= self._definition[key]"
self._currentRegion = None
# The analysisList tells which weather elements and statistics
# are desired for the product.
self._analysisList = self._getAnalysisList()
def _determineTimeRanges(self, argDict):
# Determine time ranges for product
# Sets up self._timeRangeList
if self._productType == "Morning":
timeRange = self.getTimeRange("Today", argDict)
numPeriods = 3
else:
timeRange = self.getTimeRange("Tonight", argDict)
numPeriods = 4
self._timeRangeList = self.getPeriods(timeRange, 12, 12, numPeriods)
return
def _sampleData(self, argDict):
# Sample the data
self._sampler = self.getSampler(argDict,
(self._analysisList, self._timeRangeList, self._areaList))
return
def _preProcessProduct(self, fcst, argDict):
# Set up format spacing and title line spacing
numElements = len(self._elementList)
if numElements > 2:
self._spaceStr = ""
else:
self._spaceStr = " "
if self._includeTitle == 0:
return fcst
self._titles = self._titleDict()
if numElements > 2:
if self._productType == "Morning":
self._headingLen = 15
else:
self._headingLen = 19
else:
if self._productType == "Morning":
self._headingLen = 21
else:
self._headingLen = 28
# Create title line
title = self._introLetters + " "
index = 0
for element in self._elementList:
title = title + string.center(
self._titles[element], self._headingLen)
if index < len(self._elementList)-1:
title = title + "/"
index += 1
return fcst + title + "\n"
def _preProcessArea(self, fcst, editArea, areaLabel, argDict):
# If we are in a new region, add region header
for region, areaList in self._regionList:
if areaLabel in areaList:
break
if region != self._currentRegion:
if self._currentRegion is not None:
# End the Region
fcst = fcst + "\n$$\n\n"
self._currentRegion = region
fcst = fcst + region
return fcst + "\n" + string.ljust(areaLabel, 10)
def _makeProduct(self, fcst, editArea, areaLabel, argDict):
# Get the Statistics
statList = self.getStatList(self._sampler, self._analysisList,
self._timeRangeList, editArea)
numElements = len(self._elementList)
index = 0
for element in self._elementList:
exec "fcst = fcst + self._get" + element + \
"Values(statList, argDict)"
if index < numElements-1:
fcst = fcst + " /"
index += 1
return fcst
def _postProcessArea(self, fcst, editArea, areaLabel, argDict):
return fcst
def _postProcessProduct(self, fcst, argDict):
fcst = fcst + "\n"
return fcst
########################################################################
# PRODUCT-SPECIFIC METHODS
########################################################################
def _getAnalysisList(self):
return [
("MinT", self.avg),
("MaxT", self.avg),
("MinRH", self.avg),
("MaxRH", self.avg),
("PoP", self.stdDevMaxAvg),
]
def _titleDict(self):
return {
"Temp": "TEMPERATURE",
"PoP": "PRECIPITATION",
"Humidity":"HUMIDITY",
}
def _getTempValues(self, statList, argDict):
# Return a string of Temperature values given statList
stats1 = statList[0]
if self._productType == "Morning":
stats2 = statList[1]
stats3 = statList[2]
t1 = self.getScalarVal(stats1["MaxT"])
t2 = self.getScalarVal(stats2["MinT"])
t3 = self.getScalarVal(stats3["MaxT"])
str = " " + t1+ self._spaceStr +t2+ self._spaceStr +t3
return str
else:
stats2 = statList[1]
stats3 = statList[2]
stats4 = statList[3]
t1 = self.getScalarVal(stats1["MinT"])
t2 = self.getScalarVal(stats2["MaxT"])
t3 = self.getScalarVal(stats3["MinT"])
t4 = self.getScalarVal(stats4["MaxT"])
str = " " +t1+ self._spaceStr +t2+ self._spaceStr +t3+ \
self._spaceStr+t4
return str
def _getHumidityValues(self, statList, argDict):
# Return a string of Humidity values given statList
stats1 = statList[0]
if self._productType == "Morning":
stats2 = statList[1]
stats3 = statList[2]
t1 = self.getScalarVal(stats1["MinRH"])
t2 = self.getScalarVal(stats2["MaxRH"])
t3 = self.getScalarVal(stats3["MinRH"])
return " " +t1+ self._spaceStr +t2+ self._spaceStr+t3
else:
stats2 = statList[1]
stats3 = statList[2]
stats4 = statList[3]
t1 = self.getScalarVal(stats1["MaxRH"])
t2 = self.getScalarVal(stats2["MinRH"])
t3 = self.getScalarVal(stats3["MaxRH"])
t4 = self.getScalarVal(stats4["MinRH"])
return " " +t1+ self._spaceStr +t2+ self._spaceStr +t3+ self._spaceStr +t4
def _getPoPValues(self, statList, argDict):
# Return a string of PoP values in the statList
pop = []
popStr = ""
index = 0
for stats in statList:
val = self._getPoPValue(stats)
if index < len(statList)-1:
popStr = popStr + val + self._spaceStr
else:
popStr = popStr + val
index += 1
popStr = popStr + " "
return popStr
def _getPoPValue(self, stats):
pop = self.getStats(stats,"PoP")
if pop is None:
val = " "
else:
max = self.round(pop, "Nearest", 10)
val = self.getScalarVal(max)
return val

View file

@ -1,59 +0,0 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
########################################################################
# SmartElementTable_Local
#
# Type: smart
# Local product:
# SmartElementTable_Local(type: smart)
# To customize this product for your site:
# Set up SmartElementTable_Local (see template below)
# to override variables, definitions, thresholds, and methods
##
##########################################################################
import SmartElementTable
import string, time, re, os, types, copy
class TextProduct(SmartElementTable.TextProduct):
Definition = copy.deepcopy(SmartElementTable.TextProduct.Definition)
Definition["displayName"] = "TEST_SmartElementTable"
#Definition["outputFile"] = "/awips/GFESuite/products/TEXT/SmartElementTable.txt"
#Definition["defaultEditAreas"] = [
# ("area1","AREA 1"),
# ("area2","AREA 2"),
# ("area3","AREA 3"),
# ]
#Definition["regionList"] = [
# ("/33",["AREA 1","AREA 2"]),
# ("/19",["AREA 3"])
# ]
#Definition["elementList"] = ["Temp", "PoP"] # Default
#Definition["elementList"] = ["Temp", "Humidity"]
#Definition["elementList"] = ["Temp", "Humidity", "PoP"]
#Definition["elementList"] = ["Temp", "PoP", "Humidity"]
#Definition["elementList"] = ["PoP", "Humidity", "Temp"]
#Definition["introLetters"] = ".<"
def __init__(self):
SmartElementTable.TextProduct.__init__(self)

View file

@ -833,7 +833,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
print "Generating Forecast for", areaLabel print "Generating Forecast for", areaLabel
areaHeader = self.makeAreaHeader( areaHeader = self.makeAreaHeader(
argDict, areaLabel, self._issueTime, self._expireTime, argDict, areaLabel, self._issueTime, self._expireTime,
self._areaDictionary, self._defaultEditAreas) self._areaDictionary, self._defaultEditAreas, upperCase=True)
fcst = fcst + areaHeader fcst = fcst + areaHeader
# get the hazards text # get the hazards text

View file

@ -1132,7 +1132,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
print "Generating Forecast for", areaLabel print "Generating Forecast for", areaLabel
areaHeader = self.makeAreaHeader( areaHeader = self.makeAreaHeader(
argDict, areaLabel, self._issueTime, self._expireTime, argDict, areaLabel, self._issueTime, self._expireTime,
self._areaDictionary, self._defaultEditAreas) self._areaDictionary, self._defaultEditAreas, upperCase=True)
fcst = fcst + areaHeader fcst = fcst + areaHeader
# get the hazards text # get the hazards text

View file

@ -504,6 +504,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
continue #no defined headline, skip phrase continue #no defined headline, skip phrase
endTimePhrase = self.hazardTimePhrases(eachHazard, argDict) endTimePhrase = self.hazardTimePhrases(eachHazard, argDict)
hazNameA = self.hazardName(eachHazard['hdln'], argDict, True) hazNameA = self.hazardName(eachHazard['hdln'], argDict, True)
hazNameACap = self.sentence(hazNameA, addPeriod=False)
hazName = self.hazardName(eachHazard['hdln'], argDict, False) hazName = self.hazardName(eachHazard['hdln'], argDict, False)
if hazName in ["Winter Weather Advisory", "Winter Storm Warning", "Beach Hazards Statement"]: if hazName in ["Winter Weather Advisory", "Winter Storm Warning", "Beach Hazards Statement"]:
@ -527,18 +528,18 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
phraseCount = 2 phraseCount = 2
if hdln != lastHdln: if hdln != lastHdln:
if eachHazard['phen'] in ['HU', 'TR', 'TY']: if eachHazard['phen'] in ['HU', 'TR', 'TY']:
hazardBodyPhrase = hazardBodyPhrase + hazNameA + \ hazardBodyPhrase = hazardBodyPhrase + hazNameACap + \
" has also been issued." " has also been issued."
else: else:
hazardBodyPhrase = hazardBodyPhrase + hazNameA + \ hazardBodyPhrase = hazardBodyPhrase + hazNameACap + \
" has also been issued. This " + hazName + forPhrase + \ " has also been issued. This " + hazName + forPhrase + \
" is in effect" + endTimePhrase + ". " " is in effect" + endTimePhrase + ". "
else: else:
if eachHazard['phen'] in ['HU', 'TR', 'TY']: if eachHazard['phen'] in ['HU', 'TR', 'TY']:
hazardBodyPhrase = hazardBodyPhrase + hazNameA + \ hazardBodyPhrase = hazardBodyPhrase + hazNameACap + \
" has also been issued." " has also been issued."
else: else:
hazardBodyPhrase = hazardBodyPhrase + hazNameA + forPhrase + \ hazardBodyPhrase = hazardBodyPhrase + hazNameACap + forPhrase + \
" has also been issued" + endTimePhrase + ". " " has also been issued" + endTimePhrase + ". "
else: else:
if eachHazard['phen'] in ['HU', 'TR', 'TY']: if eachHazard['phen'] in ['HU', 'TR', 'TY']:
@ -564,7 +565,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
hazardBodyPhrase = hazardBodyPhrase + \ hazardBodyPhrase = hazardBodyPhrase + \
" has cancelled the " + hazName + ". " " has cancelled the " + hazName + ". "
else: else:
hazardBodyPhrase = hazardBodyPhrase + "THE " + hazName + \ hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
" has been cancelled. " " has been cancelled. "
# #
@ -579,13 +580,13 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
continue # No attribution for this case if it is a bullet product continue # No attribution for this case if it is a bullet product
hazName = self.hazardName(eachHazard['hdln'], argDict, False) hazName = self.hazardName(eachHazard['hdln'], argDict, False)
if eachHazard['endTime'] <= argDict['creationTime']: if eachHazard['endTime'] <= argDict['creationTime']:
hazardBodyPhrase = hazardBodyPhrase + "THE " + hazName + \ hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
" is no longer in effect. " " is no longer in effect. "
else: else:
expTimeCurrent = argDict['creationTime'] expTimeCurrent = argDict['creationTime']
timeWords = self.getTimingPhrase(eachHazard, expTimeCurrent) timeWords = self.getTimingPhrase(eachHazard, expTimeCurrent)
hazardBodyPhrase = hazardBodyPhrase + "THE " + hazName + \ hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
" will expire " + timeWords + ". " " will expire " + timeWords + ". "
# #
@ -600,7 +601,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
endTimePhrase = self.hazardTimePhrases(eachHazard, argDict) endTimePhrase = self.hazardTimePhrases(eachHazard, argDict)
hazName = self.hazardName(eachHazard['hdln'], argDict, False) hazName = self.hazardName(eachHazard['hdln'], argDict, False)
hazardBodyPhrase = hazardBodyPhrase + "THE " + hazName + \ hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
" is now in effect" + endTimePhrase + ". " " is now in effect" + endTimePhrase + ". "
# #
@ -611,7 +612,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
if len(eachHazard['hdln']) == 0: if len(eachHazard['hdln']) == 0:
continue #no defined headline, skip phrase continue #no defined headline, skip phrase
hazName = self.hazardName(eachHazard['hdln'], argDict, False) hazName = self.hazardName(eachHazard['hdln'], argDict, False)
hazardBodyPhrase = hazardBodyPhrase + "THE " + hazName + \ hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
" is no longer in effect. " " is no longer in effect. "
# #

View file

@ -24,6 +24,7 @@
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# Oct 20, 2014 #3685 randerso Changed to support mixed case # Oct 20, 2014 #3685 randerso Changed to support mixed case
# Apr 28, 2015 #4027 randerso Additional changes for mixed case
# #
## ##
@ -90,14 +91,14 @@ class TextProduct(GenericHazards.TextProduct):
"name": "Forsyth County Environmental Affairs Department Winston-Salem NC", "name": "Forsyth County Environmental Affairs Department Winston-Salem NC",
"declaration": "The Forsyth County Environmental Affairs Department has issued an Air Quality Action Day...", "declaration": "The Forsyth County Environmental Affairs Department has issued an Air Quality Action Day...",
"zones": ["FLZ039"], "zones": ["FLZ039"],
"text": "A Code @ALERTCODE Air Quality Alert for Ozone has been issued. Ground level ozone concentrations within the region may approach or exceed unhealthy standards. @ALERTCTA For additional information...please visit the Forsyth County Environmental Affairs Department Web site at http://www.co.forsyth.nc.us/envaffairs.", "text": "A Code @ALERTCODE Air Quality Alert for Ozone has been issued. Ground level ozone concentrations within the region may approach or exceed unhealthy standards. @ALERTCTA For additional information...please visit the Forsyth County Environmental Affairs Department web site at http://www.co.forsyth.nc.us/envaffairs.",
}, },
"NC": { "NC": {
"name": "North Carolina Department of Environmental and Natural Resources Raleigh NC", "name": "North Carolina Department of Environmental and Natural Resources Raleigh NC",
"declaration": "The North Carolina Department of Environmental and Natural Resources has issued an Air Quality Action Day...", "declaration": "The North Carolina Department of Environmental and Natural Resources has issued an Air Quality Action Day...",
"zones" : ["FLZ042", "FLZ043","FLZ048"], "zones" : ["FLZ042", "FLZ043","FLZ048"],
"text": "A Code @ALERTCODE Air Quality Alert for Ozone has been issued. Ground level ozone concentrations within the region may approach or exceed unhealthy standards. @ALERTCTA For additional information...please visit the North Carolina Division of Air Quality Web site at http://daq.state.nc.us/airaware/forecast/.", "text": "A Code @ALERTCODE Air Quality Alert for Ozone has been issued. Ground level ozone concentrations within the region may approach or exceed unhealthy standards. @ALERTCTA For additional information...please visit the North Carolina Division of Air Quality web site at http://daq.state.nc.us/airaware/forecast/.",
}, },
} }

View file

@ -295,9 +295,9 @@ class TextProduct(GenericHazards.TextProduct):
#period. #period.
areaGroupLen = len(areaGroups) areaGroupLen = len(areaGroups)
if areaGroupLen == 1: if areaGroupLen == 1:
areaPhrase = "A portion of " areaPhrase = "a portion of "
else: else:
areaPhrase = "Portions of " areaPhrase = "portions of "
#parts of the states #parts of the states
areaGroupCount = 0 areaGroupCount = 0
@ -326,39 +326,39 @@ class TextProduct(GenericHazards.TextProduct):
countyCnt = 0 countyCnt = 0
for state, partOfState, names in areaGroups: for state, partOfState, names in areaGroups:
for name,nameType in names: for name,nameType in names:
if nameType == "Zone": if nameType == "zone":
zoneCnt = zoneCnt + 1 zoneCnt = zoneCnt + 1
elif nameType == "County": elif nameType == "county":
countyCnt = countyCnt + 1 countyCnt = countyCnt + 1
elif nameType == "Independent city": elif nameType == "independent city":
icCnt = icCnt + 1 icCnt = icCnt + 1
elif nameType == "Parish": elif nameType == "parish":
parishCnt = parishCnt + 1 parishCnt = parishCnt + 1
incPhrases = [] incPhrases = []
if zoneCnt == 1: if zoneCnt == 1:
incPhrases.append("Area") incPhrases.append("area")
elif zoneCnt > 1: elif zoneCnt > 1:
incPhrases.append("Areas") incPhrases.append("areas")
if countyCnt == 1: if countyCnt == 1:
incPhrases.append("County") incPhrases.append("county")
elif countyCnt > 1: elif countyCnt > 1:
incPhrases.append("Counties") incPhrases.append("counties")
if icCnt == 1: if icCnt == 1:
incPhrases.append("Independent city") incPhrases.append("independent city")
elif icCnt > 1: elif icCnt > 1:
incPhrases.append("Independent cities") incPhrases.append("independent cities")
if parishCnt == 1: if parishCnt == 1:
incPhrases.append("Parish") incPhrases.append("parish")
elif parishCnt > 1: elif parishCnt > 1:
incPhrases.append("Parishes") incPhrases.append("parishes")
incPhrase = " and ".join(incPhrases) incPhrase = " and ".join(incPhrases)
if generalOnly: if generalOnly:
return areaPhrase return areaPhrase
areaPhrase = areaPhrase + "...Including the following " + \ areaPhrase = areaPhrase + "...including the following " + \
incPhrase + "..." incPhrase + "..."
#list of the specific areas #list of the specific areas
@ -377,7 +377,10 @@ class TextProduct(GenericHazards.TextProduct):
phrase = "...".join(snames[0:-1]) phrase = "...".join(snames[0:-1])
# complex phrasing (state, partOfState, and names) # complex phrasing (state, partOfState, and names)
else: else:
phrase = "In " if i == 0:
phrase = "in "
else:
phrase = "In "
if partOfState != '' and partOfState != ' ': if partOfState != '' and partOfState != ' ':
phrase = phrase + partOfState + ' ' phrase = phrase + partOfState + ' '
phrase = phrase + state + "..." + "...".join(snames[0:-1]) phrase = phrase + state + "..." + "...".join(snames[0:-1])

View file

@ -3444,7 +3444,7 @@ class TextProduct(GenericHazards.TextProduct):
# t+="but will continue to be monitored until it no longer threatens the area. " # t+="but will continue to be monitored until it no longer threatens the area. "
# #
# else: # else:
t+="AT "+ self._stormTime + "...the center of " t+="At "+ self._stormTime + "...the center of "
# Fix the grammar if dealing with "remnants" # Fix the grammar if dealing with "remnants"
if re.search("(?i)remnants", self._stormTypeName) is not None: if re.search("(?i)remnants", self._stormTypeName) is not None:

View file

@ -595,7 +595,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
def _preProcessArea(self, fcst, editArea, areaLabel, argDict): def _preProcessArea(self, fcst, editArea, areaLabel, argDict):
areaHeader = self.makeAreaHeader( areaHeader = self.makeAreaHeader(
argDict, areaLabel, self._issueTime, self._expireTime, argDict, areaLabel, self._issueTime, self._expireTime,
self._areaDictionary, self._defaultEditAreas) self._areaDictionary, self._defaultEditAreas, upperCase=True)
fcst = fcst + areaHeader fcst = fcst + areaHeader
# get the hazards text # get the hazards text

View file

@ -355,7 +355,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
# If a method, it will be called with arguments: # If a method, it will be called with arguments:
# tree, node, key, element # tree, node, key, element
return { return {
"WaveHeight" : "surf................", "WaveHeight" : "SURF................",
"Swell": "swell", "Swell": "swell",
"Swell2": "swell", "Swell2": "swell",
"LabelSwell": "SWELL...............", "LabelSwell": "SWELL...............",
@ -377,8 +377,8 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
"MaxT":"highs", "MaxT":"highs",
"Wind": "winds", "Wind": "winds",
# Used for Headlines # Used for Headlines
"Expected" : "expected", "EXPECTED" : "expected",
"In effect" : "in effect", "IN EFFECT" : "in effect",
# Used for single values # Used for single values
"around": "around ", "around": "around ",
" VALLEYS/LWR SLOPES...": " INLAND...............", " VALLEYS/LWR SLOPES...": " INLAND...............",
@ -1229,7 +1229,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
return self.setWords(node, "") return self.setWords(node, "")
self.setWords(node, "") self.setWords(node, "")
node.set("descriptor", "") node.set("descriptor", "")
node.set("indentLabel", "20-foot winds.......") node.set("indentLabel", "20-FOOT WINDS.......")
return self.DONE() return self.DONE()
def fireRidgeValleyWind_setUp(self, tree, node): def fireRidgeValleyWind_setUp(self, tree, node):
@ -1539,7 +1539,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
tokens = line.split() tokens = line.split()
# Look for the city # Look for the city
for token in tokens: for token in tokens:
if token == uviCity: if token.upper() == uviCity.upper():
index = tokens.index(token) index = tokens.index(token)
state = tokens[index + 1] state = tokens[index + 1]
if state == uviState: if state == uviState:
@ -1598,7 +1598,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
# Add error message to fcst # Add error message to fcst
fcst = fcst + tideTable fcst = fcst + tideTable
continue continue
fcst = fcst + "\nAT " + label + "...\n\n" fcst = fcst + "\nAt " + label + "...\n\n"
for line in tideTable: for line in tideTable:
if line.find(currentDate) == 0: if line.find(currentDate) == 0:
# Get the tide info # Get the tide info

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.common.activetable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
@ -56,6 +57,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Jul 16, 2013 2181 bsteffen Convert geometry types to use hibernate- * Jul 16, 2013 2181 bsteffen Convert geometry types to use hibernate-
* spatial * spatial
* 10/16/2014 3454 bphillip Upgrading to Hibernate 4 * 10/16/2014 3454 bphillip Upgrading to Hibernate 4
* 04/28/2015 4027 randerso Expunged Calendar from ActiveTableRecord
* </pre> * </pre>
* *
* @author njensen * @author njensen
@ -126,19 +128,19 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
/** vtec start time */ /** vtec start time */
@DynamicSerializeElement @DynamicSerializeElement
protected Calendar startTime; protected Date startTime;
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
protected Calendar endTime; protected Date endTime;
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
protected Calendar issueTime; protected Date issueTime;
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
protected Calendar purgeTime; protected Date purgeTime;
@Column(length = 8) @Column(length = 8)
@DynamicSerializeElement @DynamicSerializeElement
@ -209,15 +211,15 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
protected Calendar floodBegin; protected Date floodBegin;
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
protected Calendar floodCrest; protected Date floodCrest;
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
protected Calendar floodEnd; protected Date floodEnd;
@Override @Override
public abstract Object clone(); public abstract Object clone();
@ -657,7 +659,7 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
/** /**
* @return the startTime * @return the startTime
*/ */
public Calendar getStartTime() { public Date getStartTime() {
return startTime; return startTime;
} }
@ -665,14 +667,14 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
* @param startTime * @param startTime
* the startTime to set * the startTime to set
*/ */
public void setStartTime(Calendar startTime) { public void setStartTime(Date startTime) {
this.startTime = startTime; this.startTime = startTime;
} }
/** /**
* @return the endTime * @return the endTime
*/ */
public Calendar getEndTime() { public Date getEndTime() {
return endTime; return endTime;
} }
@ -680,14 +682,14 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
* @param endTime * @param endTime
* the endTime to set * the endTime to set
*/ */
public void setEndTime(Calendar endTime) { public void setEndTime(Date endTime) {
this.endTime = endTime; this.endTime = endTime;
} }
/** /**
* @return the issueTime * @return the issueTime
*/ */
public Calendar getIssueTime() { public Date getIssueTime() {
return issueTime; return issueTime;
} }
@ -695,14 +697,14 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
* @param issueTime * @param issueTime
* the issueTime to set * the issueTime to set
*/ */
public void setIssueTime(Calendar issueTime) { public void setIssueTime(Date issueTime) {
this.issueTime = issueTime; this.issueTime = issueTime;
} }
/** /**
* @return the purgeTime * @return the purgeTime
*/ */
public Calendar getPurgeTime() { public Date getPurgeTime() {
return purgeTime; return purgeTime;
} }
@ -710,7 +712,7 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
* @param purgeTime * @param purgeTime
* the purgeTime to set * the purgeTime to set
*/ */
public void setPurgeTime(Calendar purgeTime) { public void setPurgeTime(Date purgeTime) {
this.purgeTime = purgeTime; this.purgeTime = purgeTime;
} }
@ -957,7 +959,7 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
/** /**
* @return the floodBegin * @return the floodBegin
*/ */
public Calendar getFloodBegin() { public Date getFloodBegin() {
return floodBegin; return floodBegin;
} }
@ -965,14 +967,14 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
* @param floodBegin * @param floodBegin
* the floodBegin to set * the floodBegin to set
*/ */
public void setFloodBegin(Calendar floodBegin) { public void setFloodBegin(Date floodBegin) {
this.floodBegin = floodBegin; this.floodBegin = floodBegin;
} }
/** /**
* @return the floodCrest * @return the floodCrest
*/ */
public Calendar getFloodCrest() { public Date getFloodCrest() {
return floodCrest; return floodCrest;
} }
@ -980,14 +982,14 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
* @param floodCrest * @param floodCrest
* the floodCrest to set * the floodCrest to set
*/ */
public void setFloodCrest(Calendar floodCrest) { public void setFloodCrest(Date floodCrest) {
this.floodCrest = floodCrest; this.floodCrest = floodCrest;
} }
/** /**
* @return the floodEnd * @return the floodEnd
*/ */
public Calendar getFloodEnd() { public Date getFloodEnd() {
return floodEnd; return floodEnd;
} }
@ -995,7 +997,7 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
* @param floodEnd * @param floodEnd
* the floodEnd to set * the floodEnd to set
*/ */
public void setFloodEnd(Calendar floodEnd) { public void setFloodEnd(Date floodEnd) {
this.floodEnd = floodEnd; this.floodEnd = floodEnd;
} }
@ -1050,17 +1052,17 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
} }
atr.setAct(wr.getAct()); atr.setAct(wr.getAct());
atr.setCountyheader(wr.getCountyheader()); atr.setCountyheader(wr.getCountyheader());
atr.setEndTime(wr.getEndTime()); atr.setEndTime(calendarToDate(wr.getEndTime()));
atr.setEtn(wr.getEtn()); atr.setEtn(wr.getEtn());
atr.setFloodBegin(wr.getFloodBegin()); atr.setFloodBegin(calendarToDate(wr.getFloodBegin()));
atr.setFloodCrest(wr.getFloodCrest()); atr.setFloodCrest(calendarToDate(wr.getFloodCrest()));
atr.setFloodEnd(wr.getFloodEnd()); atr.setFloodEnd(calendarToDate(wr.getFloodEnd()));
atr.setFloodRecordStatus(wr.getFloodRecordStatus()); atr.setFloodRecordStatus(wr.getFloodRecordStatus());
atr.setFloodSeverity(wr.getFloodSeverity()); atr.setFloodSeverity(wr.getFloodSeverity());
atr.setForecaster(wr.getForecaster()); atr.setForecaster(wr.getForecaster());
atr.setGeometry(wr.getGeometry()); atr.setGeometry(wr.getGeometry());
atr.setImmediateCause(wr.getImmediateCause()); atr.setImmediateCause(wr.getImmediateCause());
atr.setIssueTime(wr.getIssueTime()); atr.setIssueTime(calendarToDate(wr.getIssueTime()));
atr.setLoc(wr.getLoc()); atr.setLoc(wr.getLoc());
atr.setLocationID(wr.getLocationID()); atr.setLocationID(wr.getLocationID());
atr.setMotdir(wr.getMotdir()); atr.setMotdir(wr.getMotdir());
@ -1071,13 +1073,13 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
atr.setPhensig(wr.getPhensig()); atr.setPhensig(wr.getPhensig());
atr.setPil(wr.getPil()); atr.setPil(wr.getPil());
atr.setProductClass(wr.getProductClass()); atr.setProductClass(wr.getProductClass());
atr.setPurgeTime(wr.getPurgeTime()); atr.setPurgeTime(calendarToDate(wr.getPurgeTime()));
atr.setRawmessage(wr.getRawmessage()); atr.setRawmessage(wr.getRawmessage());
atr.setRegion(wr.getRegion()); atr.setRegion(wr.getRegion());
atr.setSeg(wr.getSeg()); atr.setSeg(wr.getSeg());
atr.setSegText(wr.getSegText()); atr.setSegText(wr.getSegText());
atr.setSig(wr.getSig()); atr.setSig(wr.getSig());
atr.setStartTime(wr.getStartTime()); atr.setStartTime(calendarToDate(wr.getStartTime()));
atr.setUfn(wr.isUfn()); atr.setUfn(wr.isUfn());
atr.setVtecstr(wr.getVtecstr()); atr.setVtecstr(wr.getVtecstr());
atr.setWmoid(wr.getWmoid()); atr.setWmoid(wr.getWmoid());
@ -1093,4 +1095,11 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
return list; return list;
} }
private static Date calendarToDate(Calendar calendar) {
Date date = null;
if (calendar != null) {
date = calendar.getTime();
}
return date;
}
} }

View file

@ -20,7 +20,7 @@
package com.raytheon.uf.common.activetable; package com.raytheon.uf.common.activetable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -37,7 +37,8 @@ import com.vividsolutions.jts.geom.Geometry;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 4, 2013 dgilling Initial creation * Mar 4, 2013 dgilling Initial creation
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
* *
* </pre> * </pre>
* *
@ -84,15 +85,12 @@ public class ActiveTableUtil {
template.put("phensig", atr.getPhensig()); template.put("phensig", atr.getPhensig());
template.put("act", atr.getAct()); template.put("act", atr.getAct());
template.put("seg", atr.getSeg()); template.put("seg", atr.getSeg());
template.put("startTime", template.put("startTime", atr.getStartTime().getTime() / 1000);
atr.getStartTime().getTimeInMillis() / 1000); template.put("endTime", atr.getEndTime().getTime() / 1000);
template.put("endTime", atr.getEndTime().getTimeInMillis() / 1000);
template.put("ufn", atr.isUfn()); template.put("ufn", atr.isUfn());
template.put("officeid", atr.getOfficeid()); template.put("officeid", atr.getOfficeid());
template.put("purgeTime", template.put("purgeTime", atr.getPurgeTime().getTime() / 1000);
atr.getPurgeTime().getTimeInMillis() / 1000); template.put("issueTime", atr.getIssueTime().getTime() / 1000);
template.put("issueTime",
atr.getIssueTime().getTimeInMillis() / 1000);
template.put("state", "Decoded"); template.put("state", "Decoded");
template.put("xxxid", atr.getXxxid()); template.put("xxxid", atr.getXxxid());
@ -104,9 +102,9 @@ public class ActiveTableUtil {
template.put("rawMessage", atr.getRawmessage()); template.put("rawMessage", atr.getRawmessage());
template.put("countyheader", atr.getCountyheader()); template.put("countyheader", atr.getCountyheader());
Calendar floodBegin = atr.getFloodBegin(); Date floodBegin = atr.getFloodBegin();
if (floodBegin != null) { if (floodBegin != null) {
long floodBeginMillis = floodBegin.getTimeInMillis(); long floodBeginMillis = floodBegin.getTime();
if (floodBeginMillis != 0) { if (floodBeginMillis != 0) {
template.put("floodBegin", floodBeginMillis / 1000); template.put("floodBegin", floodBeginMillis / 1000);
} }
@ -114,31 +112,31 @@ public class ActiveTableUtil {
template.put("wmoid", atr.getWmoid()); template.put("wmoid", atr.getWmoid());
// Warngen fields // Warngen fields
Calendar floodCrest = atr.getFloodCrest(); Date floodCrest = atr.getFloodCrest();
if (floodCrest != null) { if (floodCrest != null) {
long floodCrestMillis = floodCrest.getTimeInMillis(); long floodCrestMillis = floodCrest.getTime();
if (floodCrestMillis != 0) { if (floodCrestMillis != 0) {
template.put("floodCrest", floodCrestMillis / 1000); template.put("floodCrest", floodCrestMillis / 1000);
} }
} }
Calendar floodEnd = atr.getFloodEnd(); Date floodEnd = atr.getFloodEnd();
if (floodEnd != null) { if (floodEnd != null) {
long floodEndMillis = floodEnd.getTimeInMillis(); long floodEndMillis = floodEnd.getTime();
if (floodEndMillis != 0) { if (floodEndMillis != 0) {
template.put("floodBegin", floodEndMillis / 1000); template.put("floodBegin", floodEndMillis / 1000);
} }
} }
String floodStatus = atr.getFloodRecordStatus(); String floodStatus = atr.getFloodRecordStatus();
if (floodStatus != null && !"".equals(floodStatus.trim())) { if ((floodStatus != null) && !"".equals(floodStatus.trim())) {
template.put("floodrecordstatus", floodStatus); template.put("floodrecordstatus", floodStatus);
} }
String floodSeverity = atr.getFloodSeverity(); String floodSeverity = atr.getFloodSeverity();
if (floodSeverity != null && !"".equals(floodSeverity.trim())) { if ((floodSeverity != null) && !"".equals(floodSeverity.trim())) {
template.put("floodseverity", floodSeverity); template.put("floodseverity", floodSeverity);
} }
Geometry geometry = atr.getGeometry(); Geometry geometry = atr.getGeometry();
if (geometry != null && !geometry.isEmpty()) { if ((geometry != null) && !geometry.isEmpty()) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
String sep = ""; String sep = "";
long lat; long lat;
@ -154,17 +152,17 @@ public class ActiveTableUtil {
} }
String immediateCause = atr.getImmediateCause(); String immediateCause = atr.getImmediateCause();
if (immediateCause != null && !"".equals(immediateCause.trim())) { if ((immediateCause != null) && !"".equals(immediateCause.trim())) {
template.put("immediateCause", immediateCause); template.put("immediateCause", immediateCause);
} }
String loc = atr.getLoc(); String loc = atr.getLoc();
if (loc != null && !"".equals(loc.trim())) { if ((loc != null) && !"".equals(loc.trim())) {
template.put("loc", loc); template.put("loc", loc);
} }
String locationId = atr.getLocationID(); String locationId = atr.getLocationID();
if (locationId != null && !"".equals(locationId.trim())) { if ((locationId != null) && !"".equals(locationId.trim())) {
template.put("locationId", locationId); template.put("locationId", locationId);
} }

View file

@ -19,14 +19,14 @@
**/ **/
package com.raytheon.uf.common.activetable; package com.raytheon.uf.common.activetable;
import java.util.Calendar; import java.util.Date;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.comm.IServerRequest; import com.raytheon.uf.common.serialization.comm.IServerRequest;
/** /**
* TODO Add Description * Request for next ETN in the sequence
* *
* <pre> * <pre>
* *
@ -36,6 +36,7 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
* Feb 14, 2011 rjpeter Initial creation * Feb 14, 2011 rjpeter Initial creation
* Oct 21, 2013 #1843 dgilling Add performISC and reportConflictOnly * Oct 21, 2013 #1843 dgilling Add performISC and reportConflictOnly
* fields, proper constructors. * fields, proper constructors.
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
* *
* </pre> * </pre>
* *
@ -55,7 +56,7 @@ public class GetNextEtnRequest implements IServerRequest {
private String phensig; private String phensig;
@DynamicSerializeElement @DynamicSerializeElement
private Calendar currentTime; private Date currentTime;
@DynamicSerializeElement @DynamicSerializeElement
private boolean lockEtn; private boolean lockEtn;
@ -84,7 +85,7 @@ public class GetNextEtnRequest implements IServerRequest {
* The phenomenon and significance of the hazard concatenated * The phenomenon and significance of the hazard concatenated
* with a '.' (e.g., TO.W or DU.Y) * with a '.' (e.g., TO.W or DU.Y)
* @param currentTime * @param currentTime
* <code>Calendar</code> representing time (needed for DRT mode). * <code>Date</code> representing time (needed for DRT mode).
* @param lockEtn * @param lockEtn
* Whether or not to request an exclusive ETN--if true, this will * Whether or not to request an exclusive ETN--if true, this will
* cause the server to increment its running ETN sequence to the * cause the server to increment its running ETN sequence to the
@ -95,7 +96,7 @@ public class GetNextEtnRequest implements IServerRequest {
* GetNextEtnRequest. * GetNextEtnRequest.
*/ */
public GetNextEtnRequest(String siteID, ActiveTableMode mode, public GetNextEtnRequest(String siteID, ActiveTableMode mode,
String phensig, Calendar currentTime, boolean lockEtn) { String phensig, Date currentTime, boolean lockEtn) {
this(siteID, mode, phensig, currentTime, lockEtn, false, false, null); this(siteID, mode, phensig, currentTime, lockEtn, false, false, null);
} }
@ -110,7 +111,7 @@ public class GetNextEtnRequest implements IServerRequest {
* The phenomenon and significance of the hazard concatenated * The phenomenon and significance of the hazard concatenated
* with a '.' (e.g., TO.W or DU.Y) * with a '.' (e.g., TO.W or DU.Y)
* @param currentTime * @param currentTime
* <code>Calendar</code> representing time (needed for DRT mode). * <code>Date</code> representing time (needed for DRT mode).
* @param lockEtn * @param lockEtn
* Whether or not to request an exclusive ETN--if true, this will * Whether or not to request an exclusive ETN--if true, this will
* cause the server to increment its running ETN sequence to the * cause the server to increment its running ETN sequence to the
@ -123,7 +124,7 @@ public class GetNextEtnRequest implements IServerRequest {
* Whether or not to collaborate with neighboring sites to * Whether or not to collaborate with neighboring sites to
* determine the next ETN. See {@link * determine the next ETN. See {@link
* GetNextEtnUtil#getNextEtnFromPartners(String, ActiveTableMode, * GetNextEtnUtil#getNextEtnFromPartners(String, ActiveTableMode,
* String, Calendar, List<IRequestRouter>)} for more information. * String, Date, List<IRequestRouter>)} for more information.
* @param reportConflictOnly * @param reportConflictOnly
* Affects which kinds of errors get reported back to the * Affects which kinds of errors get reported back to the
* requestor. If true, only cases where the value of * requestor. If true, only cases where the value of
@ -136,7 +137,7 @@ public class GetNextEtnRequest implements IServerRequest {
* used by this site or one of its partners. * used by this site or one of its partners.
*/ */
public GetNextEtnRequest(String siteID, ActiveTableMode mode, public GetNextEtnRequest(String siteID, ActiveTableMode mode,
String phensig, Calendar currentTime, boolean lockEtn, String phensig, Date currentTime, boolean lockEtn,
boolean performISC, boolean reportConflictOnly, Integer etnOverride) { boolean performISC, boolean reportConflictOnly, Integer etnOverride) {
this.siteID = siteID; this.siteID = siteID;
this.mode = mode; this.mode = mode;
@ -180,11 +181,11 @@ public class GetNextEtnRequest implements IServerRequest {
this.lockEtn = lockEtn; this.lockEtn = lockEtn;
} }
public Calendar getCurrentTime() { public Date getCurrentTime() {
return currentTime; return currentTime;
} }
public void setCurrentTime(Calendar currentTime) { public void setCurrentTime(Date currentTime) {
this.currentTime = currentTime; this.currentTime = currentTime;
} }

View file

@ -19,7 +19,7 @@
**/ **/
package com.raytheon.uf.common.activetable.request; package com.raytheon.uf.common.activetable.request;
import java.util.Calendar; import java.util.Date;
import com.raytheon.uf.common.activetable.ActiveTableMode; import com.raytheon.uf.common.activetable.ActiveTableMode;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -37,6 +37,7 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 19, 2013 #1843 dgilling Initial creation * Aug 19, 2013 #1843 dgilling Initial creation
* Oct 21, 2013 #1843 dgilling Add ETN override field. * Oct 21, 2013 #1843 dgilling Add ETN override field.
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
* *
* </pre> * </pre>
* *
@ -60,7 +61,7 @@ public class LockAndGetNextEtnRequest implements IServerRequest {
private String phensig; private String phensig;
@DynamicSerializeElement @DynamicSerializeElement
private Calendar currentTime; private Date currentTime;
@DynamicSerializeElement @DynamicSerializeElement
private Integer etnOverride; private Integer etnOverride;
@ -70,12 +71,12 @@ public class LockAndGetNextEtnRequest implements IServerRequest {
} }
public LockAndGetNextEtnRequest(String siteID, String requestorSiteID, public LockAndGetNextEtnRequest(String siteID, String requestorSiteID,
ActiveTableMode mode, String phensig, Calendar currentTime) { ActiveTableMode mode, String phensig, Date currentTime) {
this(siteID, requestorSiteID, mode, phensig, currentTime, null); this(siteID, requestorSiteID, mode, phensig, currentTime, null);
} }
public LockAndGetNextEtnRequest(String siteID, String requestorSiteID, public LockAndGetNextEtnRequest(String siteID, String requestorSiteID,
ActiveTableMode mode, String phensig, Calendar currentTime, ActiveTableMode mode, String phensig, Date currentTime,
Integer etnOverride) { Integer etnOverride) {
this.siteID = siteID; this.siteID = siteID;
this.requestorSiteID = requestorSiteID; this.requestorSiteID = requestorSiteID;
@ -117,11 +118,11 @@ public class LockAndGetNextEtnRequest implements IServerRequest {
this.phensig = phensig; this.phensig = phensig;
} }
public Calendar getCurrentTime() { public Date getCurrentTime() {
return currentTime; return currentTime;
} }
public void setCurrentTime(Calendar currentTime) { public void setCurrentTime(Date currentTime) {
this.currentTime = currentTime; this.currentTime = currentTime;
} }

View file

@ -19,6 +19,8 @@
**/ **/
package com.raytheon.uf.common.activetable.request; package com.raytheon.uf.common.activetable.request;
import java.util.Date;
import com.raytheon.uf.common.activetable.ActiveTableMode; import com.raytheon.uf.common.activetable.ActiveTableMode;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -34,6 +36,7 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 19, 2013 #1843 dgilling Initial creation * Aug 19, 2013 #1843 dgilling Initial creation
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
* *
* </pre> * </pre>
* *
@ -54,7 +57,7 @@ public class UnlockAndSetNextEtnRequest implements IServerRequest {
private ActiveTableMode mode; private ActiveTableMode mode;
@DynamicSerializeElement @DynamicSerializeElement
private int year; private Date currentTime;
@DynamicSerializeElement @DynamicSerializeElement
private String phensig; private String phensig;
@ -67,11 +70,11 @@ public class UnlockAndSetNextEtnRequest implements IServerRequest {
} }
public UnlockAndSetNextEtnRequest(String siteID, String requestorSiteID, public UnlockAndSetNextEtnRequest(String siteID, String requestorSiteID,
ActiveTableMode mode, int year, String phensig, int newEtn) { ActiveTableMode mode, Date currentTime, String phensig, int newEtn) {
this.siteID = siteID; this.siteID = siteID;
this.requestorSiteID = requestorSiteID; this.requestorSiteID = requestorSiteID;
this.mode = mode; this.mode = mode;
this.year = year; this.currentTime = currentTime;
this.phensig = phensig; this.phensig = phensig;
this.newEtn = newEtn; this.newEtn = newEtn;
} }
@ -100,12 +103,12 @@ public class UnlockAndSetNextEtnRequest implements IServerRequest {
this.mode = mode; this.mode = mode;
} }
public int getYear() { public Date getCurrentTime() {
return year; return currentTime;
} }
public void setYear(int year) { public void setCurrentTime(Date currentTime) {
this.year = year; this.currentTime = currentTime;
} }
public String getPhensig() { public String getPhensig() {

View file

@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.TimeZone;
import jep.JepException; import jep.JepException;
@ -108,6 +109,8 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* Feb 23, 2015 4127 dgilling Use cluster locking to only allow 1 active * Feb 23, 2015 4127 dgilling Use cluster locking to only allow 1 active
* table write at a time. * table write at a time.
* Mar 04, 2015 4129 randerso Pass active table change logger to ingestAt and/or MergeVTEC * Mar 04, 2015 4129 randerso Pass active table change logger to ingestAt and/or MergeVTEC
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord,
* fixed next ETN query to query for >= Jan 1
* *
* </pre> * </pre>
* *
@ -447,7 +450,7 @@ public class ActiveTable {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static List<ActiveTableRecord> queryTable(String siteId, private static List<ActiveTableRecord> queryTable(String siteId,
ActiveTableMode mode, String phensigList, String action, ActiveTableMode mode, String phensigList, String action,
String etn, Calendar currentTime, boolean requestValidTimes, String etn, Date currentTime, boolean requestValidTimes,
boolean latestEtn) { boolean latestEtn) {
DatabaseQuery query = null; DatabaseQuery query = null;
CoreDao dao = null; CoreDao dao = null;
@ -472,27 +475,18 @@ public class ActiveTable {
query.addQueryParam("etn", etn, "in"); query.addQueryParam("etn", etn, "in");
} }
if (requestValidTimes && (currentTime != null)) { if (requestValidTimes && (currentTime != null)) {
// Current Time
query.addQueryParam("endTime", currentTime, "greater_than");
}
if (latestEtn && (currentTime != null)) {
Calendar yearStart = Calendar.getInstance();
yearStart.set(currentTime.get(Calendar.YEAR), Calendar.JANUARY,
0, 0, 0);
query.addQueryParam("startTime", yearStart, "greater_than");
query.addOrder("etn", false);
query.setMaxResults(1);
}
if (requestValidTimes && currentTime != null) {
// Current Time // Current Time
query.addQueryParam("endTime", currentTime, "greater_than"); query.addQueryParam("endTime", currentTime, ">");
} }
if (latestEtn && currentTime != null) { if (latestEtn && (currentTime != null)) {
Calendar yearStart = Calendar.getInstance(); Calendar yearStart = Calendar.getInstance(TimeZone
yearStart.set(currentTime.get(Calendar.YEAR), Calendar.JANUARY, 1, .getTimeZone("GMT"));
yearStart.setTime(currentTime);
yearStart.set(yearStart.get(Calendar.YEAR), Calendar.JANUARY, 1, 0,
0, 0); 0, 0);
query.addQueryParam("issueTime", yearStart, "greater_than"); yearStart.set(Calendar.MILLISECOND, 0);
query.addQueryParam("issueTime", yearStart.getTime(), ">=");
query.addOrder("etn", false); query.addOrder("etn", false);
query.setMaxResults(1); query.setMaxResults(1);
} }
@ -713,14 +707,14 @@ public class ActiveTable {
* @param phensig * @param phensig
* The phenomenon and significance combination to search for. * The phenomenon and significance combination to search for.
* @param currentTime * @param currentTime
* <code>Calendar</code> representing time to perform search from * <code>Date</code> representing time to perform search from
* (needed for DRT mode). * (needed for DRT mode).
* @return The last ETN assigned to the particular site and phensig * @return The last ETN assigned to the particular site and phensig
* combination, or <code>null</code> if no ETNs have been assigned * combination, or <code>null</code> if no ETNs have been assigned
* to this combination. * to this combination.
*/ */
public static Integer getLastUsedEtn(String siteId, ActiveTableMode mode, public static Integer getLastUsedEtn(String siteId, ActiveTableMode mode,
String phensig, Calendar currentTime) { String phensig, Date currentTime) {
Integer lastEtn = null; Integer lastEtn = null;
List<ActiveTableRecord> records = ActiveTable.queryTable(siteId, mode, List<ActiveTableRecord> records = ActiveTable.queryTable(siteId, mode,
phensig, null, null, currentTime, false, true); phensig, null, null, currentTime, false, true);

View file

@ -26,11 +26,12 @@ import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.text.SimpleDateFormat;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -38,6 +39,7 @@ import java.util.Map.Entry;
import java.util.Properties; import java.util.Properties;
import java.util.Queue; import java.util.Queue;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TimeZone;
import java.util.TreeMap; import java.util.TreeMap;
import com.raytheon.edex.site.SiteUtil; import com.raytheon.edex.site.SiteUtil;
@ -75,6 +77,7 @@ import com.raytheon.uf.edex.requestsrv.router.RemoteServerRequestRouter;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 29, 2013 #1843 dgilling Initial creation * Aug 29, 2013 #1843 dgilling Initial creation
* Dec 18, 2013 #2641 dgilling Fix ClusterTask locking. * Dec 18, 2013 #2641 dgilling Fix ClusterTask locking.
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
* *
* </pre> * </pre>
* *
@ -118,7 +121,7 @@ public final class GetNextEtnUtil {
* The phenomenon and significance combination (e.g., TO.W or * The phenomenon and significance combination (e.g., TO.W or
* DU.Y). * DU.Y).
* @param currentTime * @param currentTime
* <code>Calendar</code> representing time (needed for DRT mode). * <code>Date</code> representing time (needed for DRT mode).
* @param isLock * @param isLock
* Whether or not to return a unique ETN--one that has not and * Whether or not to return a unique ETN--one that has not and
* cannot be used by any other requestor. * cannot be used by any other requestor.
@ -142,7 +145,7 @@ public final class GetNextEtnUtil {
* and any hosts that couldn't be contacted during this process. * and any hosts that couldn't be contacted during this process.
*/ */
public static GetNextEtnResponse getNextEtn(String siteId, public static GetNextEtnResponse getNextEtn(String siteId,
ActiveTableMode mode, String phensig, Calendar currentTime, ActiveTableMode mode, String phensig, Date currentTime,
boolean isLock, boolean performISC, boolean reportConflictOnly, boolean isLock, boolean performISC, boolean reportConflictOnly,
Integer etnOverride) { Integer etnOverride) {
SortedMap<String, IRequestRouter> hostsToQuery = new TreeMap<String, IRequestRouter>(); SortedMap<String, IRequestRouter> hostsToQuery = new TreeMap<String, IRequestRouter>();
@ -271,7 +274,7 @@ public final class GetNextEtnUtil {
* The phenomenon and significance combination (e.g., TO.W or * The phenomenon and significance combination (e.g., TO.W or
* DU.Y). * DU.Y).
* @param currentTime * @param currentTime
* <code>Calendar</code> representing time (needed for DRT mode). * <code>Date</code> representing time (needed for DRT mode).
* @param isLock * @param isLock
* Whether or not to actually obtain the cluster task lock. Not * Whether or not to actually obtain the cluster task lock. Not
* needed if only determining a preliminary ETN. Required to be * needed if only determining a preliminary ETN. Required to be
@ -284,7 +287,7 @@ public final class GetNextEtnUtil {
* @return The next ETN to be used in sequence. * @return The next ETN to be used in sequence.
*/ */
public static int lockAndGetNextEtn(String siteId, ActiveTableMode mode, public static int lockAndGetNextEtn(String siteId, ActiveTableMode mode,
String phensig, Calendar currentTime, boolean isLock, String phensig, Date currentTime, boolean isLock,
Integer etnOverride) { Integer etnOverride) {
String lockName = getEtnClusterLockName(siteId, mode); String lockName = getEtnClusterLockName(siteId, mode);
ClusterTask ct = null; ClusterTask ct = null;
@ -306,7 +309,9 @@ public final class GetNextEtnUtil {
int sysNextEtn = -1; int sysNextEtn = -1;
if (etnOverride == null) { if (etnOverride == null) {
String year = Integer.toString(currentTime.get(Calendar.YEAR)); SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String year = sdf.format(currentTime);
String eInfo = ct.getExtraInfo(); String eInfo = ct.getExtraInfo();
statusHandler.info("ClusterTask Lock info: " + eInfo); statusHandler.info("ClusterTask Lock info: " + eInfo);
@ -342,16 +347,20 @@ public final class GetNextEtnUtil {
* @param phensig * @param phensig
* The phenomenon and significance combination (e.g., TO.W or * The phenomenon and significance combination (e.g., TO.W or
* DU.Y). * DU.Y).
* @param year * @param currentTime
* Year the next ETN is effective for. * <code>Date</code> used to determine year for ETN.
* @param nextEtn * @param nextEtn
* The ETN to persist. * The ETN to persist.
*/ */
public static void setNextEtnAndUnlock(String siteId, ActiveTableMode mode, public static void setNextEtnAndUnlock(String siteId, ActiveTableMode mode,
String phensig, int year, int nextEtn) { String phensig, Date currentTime, int nextEtn) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String year = sdf.format(currentTime);
String lockName = getEtnClusterLockName(siteId, mode); String lockName = getEtnClusterLockName(siteId, mode);
ClusterLockUtils.updateExtraInfo(lockName, phensig, ClusterLockUtils.updateExtraInfo(lockName, phensig, year + ":"
Integer.toString(year) + ":" + nextEtn); + nextEtn);
ClusterLockUtils.unlock(lockName, phensig); ClusterLockUtils.unlock(lockName, phensig);
statusHandler.info("Unlocking::[nextEtn = " + nextEtn + "]"); statusHandler.info("Unlocking::[nextEtn = " + nextEtn + "]");
} }
@ -369,20 +378,19 @@ public final class GetNextEtnUtil {
* The phenomenon and significance combination (e.g., TO.W or * The phenomenon and significance combination (e.g., TO.W or
* DU.Y). * DU.Y).
* @param currentTime * @param currentTime
* <code>Calendar</code> representing time (needed for DRT mode). * <code>Date</code> representing time (needed for DRT mode).
* @param isLock * @param isLock
* Whether or not to return a unique ETN--one that has not and * Whether or not to return a unique ETN--one that has not and
* cannot be used by any other requestor. * cannot be used by any other requestor.
* @return The next ETN to be used in sequence. * @return The next ETN to be used in sequence.
*/ */
public static Integer getNextEtnFromLocal(String siteId, public static Integer getNextEtnFromLocal(String siteId,
ActiveTableMode mode, String phensig, Calendar currentTime, ActiveTableMode mode, String phensig, Date currentTime,
boolean isLock) { boolean isLock) {
int nextEtn = lockAndGetNextEtn(siteId, mode, phensig, currentTime, int nextEtn = lockAndGetNextEtn(siteId, mode, phensig, currentTime,
isLock, null); isLock, null);
if (isLock) { if (isLock) {
setNextEtnAndUnlock(siteId, mode, phensig, setNextEtnAndUnlock(siteId, mode, phensig, currentTime, nextEtn);
currentTime.get(Calendar.YEAR), nextEtn);
} }
return nextEtn; return nextEtn;
} }
@ -405,7 +413,7 @@ public final class GetNextEtnUtil {
* The phenomenon and significance combination (e.g., TO.W or * The phenomenon and significance combination (e.g., TO.W or
* DU.Y). * DU.Y).
* @param currentTime * @param currentTime
* <code>Calendar</code> representing time (needed for DRT mode). * <code>Date</code> representing time (needed for DRT mode).
* @param hostsToQuery * @param hostsToQuery
* The remote hosts to query. This should also include the local * The remote hosts to query. This should also include the local
* EDEX instance initiating this operation. * EDEX instance initiating this operation.
@ -424,7 +432,7 @@ public final class GetNextEtnUtil {
* @throws UnknownHostException * @throws UnknownHostException
*/ */
public static GetNextEtnResponse getNextEtnFromPartners(String siteId, public static GetNextEtnResponse getNextEtnFromPartners(String siteId,
ActiveTableMode mode, String phensig, Calendar currentTime, ActiveTableMode mode, String phensig, Date currentTime,
SortedMap<String, IRequestRouter> hostsToQuery, SortedMap<String, IRequestRouter> hostsToQuery,
boolean reportConflictOnly, Integer etnOverride) { boolean reportConflictOnly, Integer etnOverride) {
Queue<Entry<String, IRequestRouter>> unlockQueue = Collections Queue<Entry<String, IRequestRouter>> unlockQueue = Collections
@ -474,8 +482,7 @@ public final class GetNextEtnUtil {
} }
IServerRequest unlockReq = new UnlockAndSetNextEtnRequest(siteId, IServerRequest unlockReq = new UnlockAndSetNextEtnRequest(siteId,
mySiteId, mode, currentTime.get(Calendar.YEAR), phensig, mySiteId, mode, currentTime, phensig, nextEtn);
nextEtn);
for (Entry<String, IRequestRouter> host : unlockQueue) { for (Entry<String, IRequestRouter> host : unlockQueue) {
IRequestRouter router = host.getValue(); IRequestRouter router = host.getValue();
try { try {

View file

@ -25,6 +25,8 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.activetable.ActiveTable; import com.raytheon.uf.edex.activetable.ActiveTable;
import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.plugin.PluginDao;
import com.raytheon.uf.edex.database.plugin.PluginFactory;
/** /**
* Request handler for clearing the practice VTEC active table. * Request handler for clearing the practice VTEC active table.
@ -38,6 +40,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* Apr 23, 2010 wkwock Initial creation * Apr 23, 2010 wkwock Initial creation
* Apr 09, 2014 #3004 dgilling Move to activetable plugin, remove GFE * Apr 09, 2014 #3004 dgilling Move to activetable plugin, remove GFE
* dependencies. * dependencies.
* Apr 28, 2015 #4027 randerso Added clearing of practice warning table
* *
* </pre> * </pre>
* *
@ -55,6 +58,10 @@ public class ClearPracticeVTECTableHandler implements
throws Exception { throws Exception {
try { try {
ActiveTable.clearPracticeTable(request.getSiteID()); ActiveTable.clearPracticeTable(request.getSiteID());
PluginDao dao = PluginFactory.getInstance().getPluginDao(
"practicewarning");
dao.purgeAllData();
} catch (DataAccessLayerException e) { } catch (DataAccessLayerException e) {
statusHandler.error("Error failed to clear practice VTEC table", e); statusHandler.error("Error failed to clear practice VTEC table", e);
throw new Exception("Unable to clear practice VTEC table.", e); throw new Exception("Unable to clear practice VTEC table.", e);

View file

@ -21,8 +21,7 @@ package com.raytheon.uf.edex.activetable.handler;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -60,6 +59,7 @@ import com.vividsolutions.jts.io.WKTReader;
* and use MergeVTEC.py to perform merge. * and use MergeVTEC.py to perform merge.
* Jul 23, 2013 #2212 dgilling Fix ClassCastExceptions on flood * Jul 23, 2013 #2212 dgilling Fix ClassCastExceptions on flood
* fields. * fields.
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
* *
* </pre> * </pre>
* *
@ -160,21 +160,17 @@ public class MergeActiveTableHandler implements
atr.setPhensig(template.get("phensig").toString()); atr.setPhensig(template.get("phensig").toString());
atr.setAct(template.get("act").toString()); atr.setAct(template.get("act").toString());
atr.setSeg((Integer) template.get("seg")); atr.setSeg((Integer) template.get("seg"));
Calendar start = GregorianCalendar.getInstance(); Date start = new Date(
start.setTimeInMillis(((Number) template.get("startTime")) ((Number) template.get("startTime")).longValue() * 1000L);
.longValue() * 1000L);
atr.setStartTime(start); atr.setStartTime(start);
Calendar end = GregorianCalendar.getInstance(); Date end = new Date(
end.setTimeInMillis(((Number) template.get("endTime")) ((Number) template.get("endTime")).longValue() * 1000L);
.longValue() * 1000L);
atr.setEndTime(end); atr.setEndTime(end);
Calendar purge = GregorianCalendar.getInstance(); Date purge = new Date(
purge.setTimeInMillis(((Number) template.get("purgeTime")) ((Number) template.get("purgeTime")).longValue() * 1000L);
.longValue() * 1000L);
atr.setPurgeTime(purge); atr.setPurgeTime(purge);
Calendar issue = GregorianCalendar.getInstance(); Date issue = new Date(
issue.setTimeInMillis(((Number) template.get("issueTime")) ((Number) template.get("issueTime")).longValue() * 1000L);
.longValue() * 1000L);
atr.setIssueTime(issue); atr.setIssueTime(issue);
atr.setUfn((Boolean) template.get("ufn")); atr.setUfn((Boolean) template.get("ufn"));
atr.setOfficeid(template.get("officeid").toString()); atr.setOfficeid(template.get("officeid").toString());
@ -187,22 +183,20 @@ public class MergeActiveTableHandler implements
Number floodBeginTime = (Number) template.get("floodBegin"); Number floodBeginTime = (Number) template.get("floodBegin");
if (floodBeginTime != null) { if (floodBeginTime != null) {
Calendar floodBegin = GregorianCalendar.getInstance(); Date floodBegin = new Date(
floodBegin floodBeginTime.longValue() * 1000L);
.setTimeInMillis(floodBeginTime.longValue() * 1000L);
atr.setFloodBegin(floodBegin); atr.setFloodBegin(floodBegin);
} }
Number floodCrestTime = (Number) template.get("floodCrest"); Number floodCrestTime = (Number) template.get("floodCrest");
if (floodCrestTime != null) { if (floodCrestTime != null) {
Calendar floodCrest = GregorianCalendar.getInstance(); Date floodCrest = new Date(
floodCrest floodCrestTime.longValue() * 1000L);
.setTimeInMillis(floodCrestTime.longValue() * 1000L);
atr.setFloodCrest(floodCrest); atr.setFloodCrest(floodCrest);
} }
Number floodEndTime = (Number) template.get("floodEnd"); Number floodEndTime = (Number) template.get("floodEnd");
if (floodEndTime != null) { if (floodEndTime != null) {
Calendar floodEnd = GregorianCalendar.getInstance(); Date floodEnd = new Date(
floodEnd.setTimeInMillis(floodEndTime.longValue() * 1000L); floodEndTime.longValue() * 1000L);
atr.setFloodEnd(floodEnd); atr.setFloodEnd(floodEnd);
} }
atr.setFloodRecordStatus((String) template atr.setFloodRecordStatus((String) template

View file

@ -37,6 +37,7 @@ import com.raytheon.uf.edex.activetable.GetNextEtnUtil;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 19, 2013 #1843 dgilling Initial creation * Aug 19, 2013 #1843 dgilling Initial creation
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
* *
* </pre> * </pre>
* *
@ -65,8 +66,8 @@ public class UnlockActiveTablePhenSigHandler implements
+ request.getSiteID() + "]: phensig= " + request.getPhensig() + request.getSiteID() + "]: phensig= " + request.getPhensig()
+ ", nextETN= " + request.getNewEtn()); + ", nextETN= " + request.getNewEtn());
GetNextEtnUtil.setNextEtnAndUnlock(request.getSiteID(), GetNextEtnUtil.setNextEtnAndUnlock(request.getSiteID(),
request.getMode(), request.getPhensig(), request.getYear(), request.getMode(), request.getPhensig(),
request.getNewEtn()); request.getCurrentTime(), request.getNewEtn());
return Boolean.TRUE; return Boolean.TRUE;
} }
} }

View file

@ -30,6 +30,7 @@
# 02/26/13 1447 dgilling Implement __eq__() and # 02/26/13 1447 dgilling Implement __eq__() and
# __ne__(). # __ne__().
# 07/23/13 2212 dgilling Fix typo in __eq__(). # 07/23/13 2212 dgilling Fix typo in __eq__().
# 04/28/2015 4027 randerso Expunged Calendar from ActiveTableRecord
# #
# #
@ -65,17 +66,17 @@ class ActiveTableRecord(object):
elif key == 'seg': elif key == 'seg':
return self.atr.getSeg() return self.atr.getSeg()
elif key == 'startTime': elif key == 'startTime':
return self.atr.getStartTime().getTimeInMillis() / 1000 return self.atr.getStartTime().getTime() / 1000
elif key == 'endTime': elif key == 'endTime':
return self.atr.getEndTime().getTimeInMillis() / 1000 return self.atr.getEndTime().getTime() / 1000
elif key == 'ufn': elif key == 'ufn':
return self.atr.isUfn() return self.atr.isUfn()
elif key == 'officeid': elif key == 'officeid':
return self.atr.getOfficeid() return self.atr.getOfficeid()
elif key == 'purgeTime': elif key == 'purgeTime':
return self.atr.getPurgeTime().getTimeInMillis() / 1000 return self.atr.getPurgeTime().getTime() / 1000
elif key == 'issueTime': elif key == 'issueTime':
return self.atr.getIssueTime().getTimeInMillis() / 1000 return self.atr.getIssueTime().getTime() / 1000
elif key == 'state': elif key == 'state':
return self.state return self.state
elif key == 'xxxid': elif key == 'xxxid':

View file

@ -29,7 +29,8 @@ import copy
# #
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 09/19/08 njensen Initial Creation. # 09/19/08 njensen Initial Creation.
# 04/28/2015 #4027 randerso Expunged Calendar from ActiveTableRecord
# #
# #
# #
@ -64,12 +65,12 @@ def transformActiveTableToPython(table):
template['phensig'] = atr.getPhensig() template['phensig'] = atr.getPhensig()
template['act'] = atr.getAct() template['act'] = atr.getAct()
template['seg'] = atr.getSeg() template['seg'] = atr.getSeg()
template['startTime'] = atr.getStartTime().getTimeInMillis() / 1000 template['startTime'] = atr.getStartTime().getTime() / 1000
template['endTime'] = atr.getEndTime().getTimeInMillis() / 1000 template['endTime'] = atr.getEndTime().getTime() / 1000
template['ufn'] = atr.isUfn() template['ufn'] = atr.isUfn()
template['officeid'] = atr.getOfficeid() template['officeid'] = atr.getOfficeid()
template['purgeTime'] = atr.getPurgeTime().getTimeInMillis() / 1000 template['purgeTime'] = atr.getPurgeTime().getTime() / 1000
template['issueTime'] = atr.getIssueTime().getTimeInMillis() / 1000 template['issueTime'] = atr.getIssueTime().getTime() / 1000
template['state'] = "Decoded" template['state'] = "Decoded"
template['xxxid'] = atr.getXxxid() template['xxxid'] = atr.getXxxid()
@ -98,7 +99,7 @@ def transfomActiveTableToThrift(table, mode='PRACTICE'):
from dynamicserialize.dstypes.com.raytheon.uf.common.activetable.OperationalActiveTableRecord \ from dynamicserialize.dstypes.com.raytheon.uf.common.activetable.OperationalActiveTableRecord \
import OperationalActiveTableRecord import OperationalActiveTableRecord
# TODO: Eliminate use of Calendar # TODO: Eliminate use of Calendar
from dynamicserialize.dstypes.java.util import GregorianCalendar from dynamicserialize.dstypes.java.util import Date
tableList = [] tableList = []
if mode.upper()=='PRACTICE': if mode.upper()=='PRACTICE':
@ -120,17 +121,13 @@ def transfomActiveTableToThrift(table, mode='PRACTICE'):
atr.setAct(template['act']) atr.setAct(template['act'])
atr.setSeg(template['seg']) atr.setSeg(template['seg'])
start = GregorianCalendar.getInstance() start = Date(template['startTime'] * 1000)
start.setTimeInMillis(template['startTime'] * 1000)
atr.setStartTime(start) atr.setStartTime(start)
end = GregorianCalendar.getInstance() end = Date(template['endTime'] * 1000)
end.setTimeInMillis(template['endTime'] * 1000)
atr.setEndTime(end) atr.setEndTime(end)
purge = GregorianCalendar.getInstance() purge = Date(template['purgeTime'] * 1000)
purge.setTimeInMillis(template['purgeTime'] * 1000)
atr.setPurgeTime(purge) atr.setPurgeTime(purge)
issue = GregorianCalendar.getInstance() issue = Date(template['issueTime'] * 1000)
issue.setTimeInMillis(template['issueTime'] * 1000)
atr.setIssueTime(issue) atr.setIssueTime(issue)
atr.setUfn(template['ufn']) atr.setUfn(template['ufn'])

View file

@ -30,6 +30,7 @@
# 01/24/14 2504 randerso change to use iscUtil.getLogger for consistency # 01/24/14 2504 randerso change to use iscUtil.getLogger for consistency
# 05/15/14 #3157 dgilling Support multiple TPC and SPC sites. # 05/15/14 #3157 dgilling Support multiple TPC and SPC sites.
# 03/10/2015 #4129 randerso Refactored server selection code into a reusable method # 03/10/2015 #4129 randerso Refactored server selection code into a reusable method
# 04/28/2015 #4027 randerso Expunged Calendar from ActiveTableRecord
# #
# #
@ -100,7 +101,7 @@ def execute_request_at(serverHost, serverPort, serverProtocol, mhsid, siteID, an
rec.getOfficeid() not in otherSites: rec.getOfficeid() not in otherSites:
continue continue
recIssueTime = float(rec.getIssueTime().getTimeInMillis() / TimeUtil.MILLIS_PER_SECOND) recIssueTime = float(rec.getIssueTime().getTime() / TimeUtil.MILLIS_PER_SECOND)
#track latest #track latest
issueTime = max(recIssueTime, issueTime) issueTime = max(recIssueTime, issueTime)

View file

@ -1,3 +1,3 @@
#Sun Mar 20 15:17:07 CDT 2011
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//werkzeug/examples/plnt/__init__.py=utf-8 encoding//werkzeug/examples/plnt/__init__.py=utf-8
encoding//werkzeug/werkzeug/http.py=utf-8

View file

@ -17,12 +17,20 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
# ----------------------------------------------------------------------------
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 04/28/2016 4027 randerso Added optional construction parameter to set the time
#
##
# File auto-generated against equivalent DynamicSerialize Java class
class Date(object): class Date(object):
def __init__(self): def __init__(self, timeInMillis=None):
self.time = None self.time = None
def getTime(self): def getTime(self):