Merge branch 'omaha_15.1.1' of ssh://awips2omaha.com:29418/AWIPS2_baseline into int_15.1.1
Former-commit-id: fb0b41ff7b119e80d81e028bd8a768d6df335cf3
This commit is contained in:
commit
8cce7a082c
50 changed files with 634 additions and 935 deletions
|
@ -22,7 +22,8 @@
|
|||
<list>
|
||||
<value>com.raytheon.uf.common.dataplugin.text</value>
|
||||
<value>com.raytheon.uf.common.dataplugin.shef</value>
|
||||
<value>com.raytheon.edex.plugin.shef</value>
|
||||
<value>com.raytheon.edex.plugin.shef</value>
|
||||
<value>com.raytheon.uf.common.bmh</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
|
|
@ -54,6 +54,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
|
|||
* May 23, 2012 mpduff Initial creation
|
||||
* Aug 08, 2012 863 jpiatt Added new interface method.
|
||||
* Jul 28, 2013 2236 mpduff Made resizable.
|
||||
* May 04, 2015 4419 rferrel Sort {@link #roleDualList}.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -208,6 +209,7 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
roleConfig.setSelectedList(selectedList);
|
||||
roleConfig.setFullList(fullList);
|
||||
roleConfig.setMenuData(menuData);
|
||||
roleConfig.setSortList(true);
|
||||
|
||||
roleDualList = new DualList(stackComp, SWT.NONE, roleConfig, this);
|
||||
|
||||
|
@ -240,6 +242,7 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
|
|||
permConfig.setSelectedList(selectedPermList);
|
||||
permConfig.setFullList(fullPermList);
|
||||
permConfig.setMenuData(menuData2);
|
||||
permConfig.setSortList(true);
|
||||
|
||||
permDualList = new DualList(stackComp, SWT.NONE, permConfig, this);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.uf.viz.useradmin.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
|
@ -54,11 +55,11 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
|
||||
/**
|
||||
* Main User Administration Dialog.
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 23, 2012 mpduff Initial creation.
|
||||
|
@ -70,9 +71,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* is selected. Better enable/disable edit
|
||||
* and delete buttons. Give delete dialogs
|
||||
* a title.
|
||||
*
|
||||
* May 04, 2015 4419 rferrel Sort {@link #userPermList}.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
@ -109,7 +111,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param parent
|
||||
* The parent shell
|
||||
*/
|
||||
|
@ -232,7 +234,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
|
||||
*/
|
||||
@Override
|
||||
|
@ -544,7 +546,10 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
|
|||
rp.add(perm);
|
||||
}
|
||||
|
||||
userPermList.setItems(rp.toArray(new String[rp.size()]));
|
||||
String[] rpArray = rp.toArray(new String[rp.size()]);
|
||||
Arrays.sort(rpArray);
|
||||
|
||||
userPermList.setItems(rpArray);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ def executeFromJava(databaseID, site, username, dataMgr, forecastList, logFile,
|
|||
|
||||
forecasts = runFormatter(databaseID=databaseID, site=site, forecastList=forecastList, testMode=testMode,
|
||||
cmdLineVarDict=cmdLineVarDict, vtecMode=vtecMode, username=username,
|
||||
dataMgr=dataMgr, drtTime=drtTime)
|
||||
dataMgr=dataMgr, drtTime=drtTime, vtecActiveTable=vtecActiveTable)
|
||||
|
||||
elapsedTime = (time.time() - startTime)*1000
|
||||
logger.info("Text Formatter Finished, took: %d ms",elapsedTime)
|
||||
|
|
|
@ -47,6 +47,7 @@ import VTECTableUtil, VTECTable
|
|||
import TimeRange, AbsTime, ActiveTableVtec
|
||||
import JUtil
|
||||
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.reference import ReferenceID
|
||||
from com.raytheon.uf.common.dataplugin.gfe.discrete import DiscreteKey
|
||||
|
@ -82,9 +83,14 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
|
|||
self.filterMethod = filterMethod
|
||||
self.__activeTable = None
|
||||
self.__allGEOActiveTable = None #not filtered by edit areas
|
||||
self.__activeTableName = activeTableName
|
||||
self.__vtecMode = vtecMode
|
||||
self.__etnCache = {}
|
||||
|
||||
if activeTableName == "PRACTICE":
|
||||
self.__activeTableMode = ActiveTableMode.PRACTICE
|
||||
else:
|
||||
self.__activeTableMode = ActiveTableMode.OPERATIONAL
|
||||
|
||||
if hazardEndTime is None:
|
||||
self.__hazardEndTime = None
|
||||
else:
|
||||
|
@ -721,7 +727,7 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
|
|||
# Local WFOs do not assign these numbers, so they should have
|
||||
# numbers < 1000
|
||||
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:
|
||||
presentyear = time.gmtime(self.__time)[0]
|
||||
for active in activeTable:
|
||||
|
@ -922,13 +928,9 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
|
|||
def __getActiveTable(self):
|
||||
#Uses the IFPClient interface to get the VTEC active table from
|
||||
#the server. Returns None on failure.
|
||||
from com.raytheon.uf.common.activetable import ActiveTableMode
|
||||
|
||||
try:
|
||||
if self.__activeTableName != "PRACTICE":
|
||||
table = self.__ifpClient.getVTECActiveTable(self.__dataMgr.getSiteID())
|
||||
else:
|
||||
table = self.__ifpClient.getVTECActiveTable(self.__dataMgr.getSiteID(), ActiveTableMode.PRACTICE)
|
||||
table = self.__ifpClient.getVTECActiveTable(self.__dataMgr.getSiteID(), self.__activeTableMode)
|
||||
table = ActiveTableVtec.transformActiveTableToPython(table)
|
||||
return table
|
||||
|
||||
|
|
|
@ -27,6 +27,14 @@
|
|||
#
|
||||
# Author: hansen
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 04/28/2016 4027 randerso Changes for mixed case
|
||||
#
|
||||
##
|
||||
|
||||
import PhraseBuilder
|
||||
import ModuleAccessor
|
||||
|
@ -2059,7 +2067,7 @@ class DiscretePhrases(PhraseBuilder.PhraseBuilder):
|
|||
|
||||
# test mode
|
||||
if argDict.get('testMode', 0):
|
||||
phrase = 'TEST ' + name #test mode, prepend "TEST"
|
||||
phrase = 'Test ' + name #test mode, prepend "TEST"
|
||||
else:
|
||||
phrase = name
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
# SRF_850, SRF_853, SRF_856
|
||||
#
|
||||
# surfAreas:
|
||||
# NorthCoast1 (listed with FLZ039), SouthCoast (along GMZ850)
|
||||
# NorthCoast2 (listed with FLZ042), SouthCoast (along GMZ850)
|
||||
# NorthCoast1 (listed with FLZ139), SouthCoast (along GMZ850)
|
||||
# NorthCoast2 (listed with FLZ142), SouthCoast (along GMZ850)
|
||||
#
|
||||
# TBW always runs with the same combinations:
|
||||
# FLZ039-FLZ042-FLZ048-FLZ049
|
||||
# FLZ050-FLZ051-FLZ055-FLZ060
|
||||
# FLZ062-FLZ065
|
||||
# FLZ139-FLZ142-FLZ148-FLZ149
|
||||
# FLZ050-FLZ151-FLZ155-FLZ160
|
||||
# FLZ162-FLZ165
|
||||
# Thus, additional entries need only be listed for at least one zone
|
||||
# in each combination.
|
||||
#
|
||||
|
@ -39,6 +39,15 @@
|
|||
# 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.
|
||||
# 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 = {
|
||||
|
@ -91,7 +100,7 @@ AreaDictionary = {
|
|||
'FLZ050': {'fullStateName': 'Florida',
|
||||
'partOfState': 'west central',
|
||||
'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',
|
||||
'ugcName': 'Pinellas',
|
||||
'ugcTimeZone': 'EST5EDT',
|
||||
|
|
|
@ -71,30 +71,30 @@ class WeatherSubKey:
|
|||
return self.__key.getVisibility()
|
||||
|
||||
def attributes(self):
|
||||
return JUtil.javaStringListToPylist(self.__key.getAttributes())
|
||||
return JUtil.javaObjToPyVal(self.__key.getAttributes())
|
||||
|
||||
def wxDef(self):
|
||||
return WxDefinition.WxDefinition(self.__key.wxDef())
|
||||
|
||||
def availableCoverages(dataMgr, wxType):
|
||||
siteId = dataMgr.getSiteID()
|
||||
return JUtil.javaStringListToPylist(JavaWeatherSubKey.availableCoverages(siteId, wxType))
|
||||
return JUtil.javaObjToPyVal(JavaWeatherSubKey.availableCoverages(siteId, wxType))
|
||||
|
||||
def availableAttributes(dataMgr, wxType):
|
||||
siteId = dataMgr.getSiteID()
|
||||
return JUtil.javaStringListToPylist(JavaWeatherSubKey.availableAttributes(siteId, wxType))
|
||||
return JUtil.javaObjToPyVal(JavaWeatherSubKey.availableAttributes(siteId, wxType))
|
||||
|
||||
def availableIntensities(dataMgr, wxType):
|
||||
siteId = dataMgr.getSiteID()
|
||||
return JUtil.javaStringListToPylist(JavaWeatherSubKey.availableIntensities(siteId, wxType))
|
||||
return JUtil.javaObjToPyVal(JavaWeatherSubKey.availableIntensities(siteId, wxType))
|
||||
|
||||
def availableVisibilities(dataMgr):
|
||||
siteId = dataMgr.getSiteID()
|
||||
return JUtil.javaStringListToPylist(JavaWeatherSubKey.availableVisibilities(siteId))
|
||||
return JUtil.javaObjToPyVal(JavaWeatherSubKey.availableVisibilities(siteId))
|
||||
|
||||
def availableWxTypes(dataMgr):
|
||||
siteId = dataMgr.getSiteID()
|
||||
return JUtil.javaStringListToPylist(JavaWeatherSubKey.availableWxTypes(siteId))
|
||||
return JUtil.javaObjToPyVal(JavaWeatherSubKey.availableWxTypes(siteId))
|
||||
|
||||
def weatherSubKey(dataMgr, coverage, wxType, intensity, vis, attrList):
|
||||
siteId = dataMgr.getSiteID()
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
# Edit Areas: solicited from user
|
||||
# Weather Elements: You must have these Weather elements defined in
|
||||
# your server: Sky, LAL, RelHum, MaxT, MinT, FreeWind,
|
||||
# Haines, TransWind, MixHgt(ft agl)
|
||||
# Haines, TransWind, MixHgt(ft AGL)
|
||||
# To Run:
|
||||
# Set GFE Time Range
|
||||
# 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.
|
||||
|
||||
## 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
|
||||
## COArapahoe 34-24 46 26
|
||||
|
@ -102,7 +102,7 @@ Definition = {
|
|||
"vectorRange",
|
||||
"range2Value",
|
||||
"Vector", 1, "ktToMph"),
|
||||
("MixHgt", "MixHgt(ft agl)",
|
||||
("MixHgt", "MixHgt(ft AGL)",
|
||||
"minMax",
|
||||
"range2Value",
|
||||
"Scalar",10,None),
|
||||
|
|
|
@ -297,7 +297,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
if digit > 3 or digit <= 9:
|
||||
RH1 = ten + 5
|
||||
RH2 = RH1 + 10
|
||||
words = `RH1` + " TO " + `RH2` + " PERCENT"
|
||||
words = `RH1` + " to " + `RH2` + " percent"
|
||||
return self.setWords(node, words)
|
||||
|
||||
def _windChill_heatIndex_compoundPhrase(self):
|
||||
|
@ -316,7 +316,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
if words is None:
|
||||
return
|
||||
if words == "":
|
||||
words = "NOT A FACTOR"
|
||||
words = "not a factor"
|
||||
node.set("descriptor", "")
|
||||
statsWC = tree.stats.get("WindChill", node.getTimeRange(),
|
||||
node.getAreaLabel(), mergeMethod="Min")
|
||||
|
@ -364,11 +364,11 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
maxWind, dir = self.getValue(stats, "Max", self.VECTOR())
|
||||
chopphrase = ""
|
||||
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:
|
||||
chopphrase = "MODERATE CHOP EXPECTED ON AREA RIVERS AND LAKES"
|
||||
chopphrase = "Moderate chop expected on area rivers and lakes"
|
||||
elif maxWind >= 17.4:
|
||||
chopphrase = "LIGHT CHOP EXPECTED ON AREA RIVERS AND LAKES"
|
||||
chopphrase = "Light chop expected on area rivers and lakes"
|
||||
if chopphrase != "":
|
||||
words = words + ". " + chopphrase
|
||||
return self.setWords(node, words)
|
||||
|
@ -408,10 +408,10 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
QPFwords = "\n"
|
||||
words = WXwords
|
||||
elif (QPFrange0 == "0.0"):
|
||||
QPFwords = "AMOUNTS UP TO " + QPFrange1 + " OF AN INCH"
|
||||
QPFwords = "Amounts up to " + QPFrange1 + " of an inch"
|
||||
words = WXwords + ". " + QPFwords
|
||||
else:
|
||||
QPFwords = "AMOUNTS BETWEEN " + QPFrange0 + " AND " + QPFrange1 + " OF AN INCH"
|
||||
QPFwords = "Amounts between " + QPFrange0 + " and " + QPFrange1 + " of an inch"
|
||||
words = WXwords + ". " + QPFwords
|
||||
return self.setWords(node, words)
|
||||
|
||||
|
@ -441,15 +441,15 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
if wxType == "T":
|
||||
cov = subkey.coverage()
|
||||
if cov in ["Num", "Wide", "Ocnl", "Brf", "Frq", "Pds", "Inter", "Lkly", "Def"]:
|
||||
words = "LIKELY"
|
||||
elif cov in ["Sct", "Chc"] and words not in ["LIKELY"]:
|
||||
words = "SCATTERED"
|
||||
elif cov in ["Iso", "SChc"] and words not in ["LIKELY", "SCATTERED"]:
|
||||
words = "ISOLATED"
|
||||
elif words not in ["LIKELY", "SCATTERED", "ISOLATED"]:
|
||||
words = "POSSIBLE"
|
||||
elif words not in ["LIKELY", "SCATTERED", "ISOLATED", "POSSIBLE"]:
|
||||
words = "NONE"
|
||||
words = "likely"
|
||||
elif cov in ["Sct", "Chc"] and words not in ["likely"]:
|
||||
words = "scattered"
|
||||
elif cov in ["Iso", "SChc"] and words not in ["likely", "scattered"]:
|
||||
words = "isolated"
|
||||
elif words not in ["likely", "scattered", "isolated"]:
|
||||
words = "possible"
|
||||
elif words not in ["likely", "scattered", "isolated", "possible"]:
|
||||
words = "none"
|
||||
#print words
|
||||
return self.setWords(node, words)
|
||||
|
||||
|
|
|
@ -166,6 +166,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* 01/28/2015 #4018 randerso Code cleanup.
|
||||
* 02/04/2014 17039 ryu Removed menu item related to the HighlighFramingCodes feature.
|
||||
* 04/20/2015 4027 randerso Renamed ProductStateEnum with an initial capital
|
||||
* Expunged Calendar from ActiveTableRecord
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -1388,7 +1389,7 @@ public class ProductEditorComp extends Composite implements
|
|||
// check if the segment is still valid
|
||||
int started = 0;
|
||||
for (ActiveTableRecord atr : activeRecs) {
|
||||
if (atr.getStartTime().getTimeInMillis() <= transmissionTime
|
||||
if (atr.getStartTime().getTime() <= transmissionTime
|
||||
.getTime()) {
|
||||
started++;
|
||||
}
|
||||
|
@ -1420,7 +1421,7 @@ public class ProductEditorComp extends Composite implements
|
|||
for (ActiveTableRecord r : activeRecs) {
|
||||
// need to change the action to CON if
|
||||
// the end time did not change
|
||||
if (r.getEndTime().getTimeInMillis() == vtecEnd
|
||||
if (r.getEndTime().getTime() == vtecEnd
|
||||
.getTime()) {
|
||||
if (!newActions.contains("CON")) {
|
||||
newActions.add("CON");
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.viz.gfe.textformatter;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import com.raytheon.uf.common.activetable.ActiveTableMode;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
|
@ -44,6 +45,7 @@ import com.raytheon.viz.gfe.tasks.TaskManager;
|
|||
* Feb 12, 2014 2591 randerso Passed dataMgr instance to FormatterUtil.runFormatterScript
|
||||
* Removed call to TextProductManager.reloadModule
|
||||
* Apr 20, 2015 4027 randerso Renamed ProductStateEnum with an initial capital
|
||||
* Fixed hard coded active table mode in runFormatterScript
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -80,8 +82,12 @@ public class FormatterUtil {
|
|||
String vtecMode, TextProductFinishListener finish) {
|
||||
|
||||
int testMode = 0;
|
||||
if (dataMgr.getOpMode().equals(CAVEMode.TEST)) {
|
||||
ActiveTableMode atMode = ActiveTableMode.OPERATIONAL;
|
||||
CAVEMode caveMode = dataMgr.getOpMode();
|
||||
if (caveMode.equals(CAVEMode.TEST)) {
|
||||
testMode = 1;
|
||||
} else if (caveMode.equals(CAVEMode.PRACTICE)) {
|
||||
atMode = ActiveTableMode.PRACTICE;
|
||||
}
|
||||
|
||||
String shortVtec = null;
|
||||
|
@ -104,7 +110,6 @@ public class FormatterUtil {
|
|||
String varDict = productMgr.getVarDict(productName, dataMgr, dbId);
|
||||
|
||||
if (varDict != null) {
|
||||
// run the formatter with the normal active table
|
||||
String time = null;
|
||||
if (!SimulatedTime.getSystemTime().isRealTime()) {
|
||||
SimpleDateFormat gmtFormatter = new SimpleDateFormat(
|
||||
|
@ -114,7 +119,7 @@ public class FormatterUtil {
|
|||
time = gmtFormatter.format(SimulatedTime.getSystemTime()
|
||||
.getTime());
|
||||
}
|
||||
runFormatterScript(name, shortVtec, dbId, varDict, "Operational",
|
||||
runFormatterScript(name, shortVtec, dbId, varDict, atMode.name(),
|
||||
time, testMode, finish);
|
||||
} else {
|
||||
finish.textProductFinished("Formatter canceled",
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Map;
|
|||
import java.util.regex.Matcher;
|
||||
|
||||
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.time.TimeRange;
|
||||
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
|
||||
* getVtecLinesThatNeedEtn().
|
||||
* Feb 05, 2014 #2774 dgilling Additional correction to previous fix.
|
||||
* Apr 28, 2015 #4027 randerso Added getNextEtn parameter to specify ActiveTableMode
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -134,6 +136,33 @@ public class GFEVtecUtil {
|
|||
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.
|
||||
*
|
||||
|
@ -206,6 +235,50 @@ public class GFEVtecUtil {
|
|||
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
|
||||
* codes that need to be assigned an ETN.
|
||||
|
|
|
@ -48,6 +48,7 @@ import com.raytheon.viz.ghg.monitor.data.GhgConfigData.SelectionEnum;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 25 MAR 2008 N/A lvenable Initial creation
|
||||
* 30 JUL 2010 6721 mpduff WFO now from officeid column.
|
||||
* 28 APR 2015 4027 randerso Expunged Calendar from ActiveTableRecord
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -234,13 +235,13 @@ public class GhgData implements Comparable<GhgData> {
|
|||
sig = warning.getSig();
|
||||
hazard = getHazardDescription(getPhenSig());
|
||||
try {
|
||||
startDate = warning.getStartTime().getTime();
|
||||
startDate = warning.getStartTime();
|
||||
} catch (Exception e) {
|
||||
startDate = now;
|
||||
}
|
||||
endDate = warning.getEndTime().getTime();
|
||||
purgeDate = warning.getPurgeTime().getTime();
|
||||
issueTime = warning.getIssueTime().getTime();
|
||||
endDate = warning.getEndTime();
|
||||
purgeDate = warning.getPurgeTime();
|
||||
issueTime = warning.getIssueTime();
|
||||
pil = warning.getPil();
|
||||
segNum = String.valueOf(warning.getSeg());
|
||||
wfo = warning.getOfficeid();
|
||||
|
@ -933,7 +934,7 @@ public class GhgData implements Comparable<GhgData> {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 1;
|
||||
hash = hash * 31 + hazard.hashCode();
|
||||
hash = (hash * 31) + hazard.hashCode();
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,14 @@ import org.opengis.coverage.grid.GridEnvelope;
|
|||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.colormap.image.ColorMapData;
|
||||
import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType;
|
||||
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
|
||||
import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord;
|
||||
import com.raytheon.uf.common.geospatial.data.GeographicDataSource;
|
||||
import com.raytheon.uf.common.numeric.buffer.BufferWrapper;
|
||||
import com.raytheon.uf.common.numeric.buffer.ByteBufferWrapper;
|
||||
import com.raytheon.uf.common.numeric.buffer.ShortBufferWrapper;
|
||||
import com.raytheon.uf.common.numeric.filter.UnsignedFilter;
|
||||
import com.raytheon.uf.common.numeric.source.DataSource;
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
|
@ -60,12 +64,13 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 19, 2013 mschenke Initial creation
|
||||
* Jun 19, 2014 3238 bsteffen Add method to create a DataSource for
|
||||
* a tile level.
|
||||
* Oct 15, 2014 3681 bsteffen Allow asynchronous interrogation.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jun 19, 2013 mschenke Initial creation
|
||||
* Jun 19, 2014 3238 bsteffen Add method to create a DataSource for
|
||||
* a tile level.
|
||||
* Oct 15, 2014 3681 bsteffen Allow asynchronous interrogation.
|
||||
* May 04, 2015 4426 bsteffen Fix unsigned interrogation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -248,6 +253,11 @@ public class SatTileSetRenderable extends RecordTileSetRenderable {
|
|||
Rectangle rect = tile.getRectangle();
|
||||
DataSource source = BufferWrapper.wrap(data.getBuffer(),
|
||||
rect.width, rect.height);
|
||||
if (data.getDataType() == ColorMapDataType.BYTE) {
|
||||
source = UnsignedFilter.apply((ByteBufferWrapper) source);
|
||||
} else if (data.getDataType() == ColorMapDataType.UNSIGNED_SHORT) {
|
||||
source = UnsignedFilter.apply((ShortBufferWrapper) source);
|
||||
}
|
||||
dataValue = source.getDataValue(tilex, tiley);
|
||||
dataUnit = data.getDataUnit();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.raytheon.uf.common.activetable.GetActiveTableResponse;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
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.requests.ThriftClient;
|
||||
import com.raytheon.viz.core.mode.CAVEMode;
|
||||
|
@ -52,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
|||
* tables names.
|
||||
* Dec 20, 2010 7210 cjeanbap Added non-blocking dialog.
|
||||
* Apr 25, 2014 DR 16668 D. Friedman Handle partial cancellations
|
||||
* Apr 28, 2015 4027 randerso Expunged Calendar from ActiveTableRecord
|
||||
* </pre>
|
||||
*
|
||||
* @author jsanchez
|
||||
|
@ -65,7 +67,7 @@ public class NotifyExpirationTask extends TimerTask {
|
|||
/**
|
||||
* 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;
|
||||
|
||||
|
@ -90,9 +92,11 @@ public class NotifyExpirationTask extends TimerTask {
|
|||
+ dateFormat.format(vtecObject.getEndTime().getTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!isCanceled()) {
|
||||
parentShell.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SWTMessageBox mb = new SWTMessageBox(
|
||||
NotifyExpirationTask.this.parentShell,
|
||||
|
@ -126,8 +130,8 @@ public class NotifyExpirationTask extends TimerTask {
|
|||
activeTable = resp.getActiveTable();
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Error querying active table for " + office + "."
|
||||
+ phenSig + "." + etn, e);
|
||||
"Error querying active table for " + office + "." + phenSig
|
||||
+ "." + etn, e);
|
||||
}
|
||||
|
||||
if (activeTable != null) {
|
||||
|
@ -135,16 +139,17 @@ public class NotifyExpirationTask extends TimerTask {
|
|||
for (ActiveTableRecord record : activeTable) {
|
||||
if (record != null) {
|
||||
/*
|
||||
* textNotifyExpiration.tcl ln 106: If any of the found products are
|
||||
* less than 48 hours old,return true.
|
||||
* textNotifyExpiration.tcl ln 106: If any of the found
|
||||
* products are less than 48 hours old,return true.
|
||||
*/
|
||||
if ("CAN".equals(record.getAct())
|
||||
&& (System.currentTimeMillis()
|
||||
- record.getIssueTime().getTimeInMillis() < TWO_DAYS)) {
|
||||
&& ((System.currentTimeMillis() - record
|
||||
.getIssueTime().getTime()) < TWO_DAYS)) {
|
||||
haveCAN = true;
|
||||
} 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.
|
||||
*/
|
||||
return false;
|
||||
|
@ -160,7 +165,7 @@ public class NotifyExpirationTask extends TimerTask {
|
|||
private String pad(int value) {
|
||||
String rval = "";
|
||||
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";
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.viz.texteditor.util;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -46,6 +47,9 @@ import com.raytheon.viz.core.mode.CAVEMode;
|
|||
* May 08, 2013 #1842 dgilling Code cleanup.
|
||||
* Aug 29, 2013 #1843 dgilling Use new GetNextEtnRequest constructor.
|
||||
* 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>
|
||||
*
|
||||
|
@ -103,7 +107,7 @@ public class VtecUtil {
|
|||
return message;
|
||||
}
|
||||
VtecObject vtec = parseMessage(message);
|
||||
if (vtec == null || vtec.getAction() == null) {
|
||||
if ((vtec == null) || (vtec.getAction() == null)) {
|
||||
return message;
|
||||
}
|
||||
|
||||
|
@ -181,13 +185,57 @@ public class VtecUtil {
|
|||
public static GetNextEtnResponse getNextEtn(String office, String phensig,
|
||||
boolean lockEtn, boolean performISC, boolean reportOnlyConflict,
|
||||
Integer etnOverride) throws VizException {
|
||||
Calendar currentTime = Calendar.getInstance();
|
||||
currentTime.setTime(SimulatedTime.getSystemTime().getTime());
|
||||
ActiveTableMode activeTable = (CAVEMode.getMode()
|
||||
.equals(CAVEMode.PRACTICE)) ? ActiveTableMode.PRACTICE
|
||||
ActiveTableMode mode = (CAVEMode.getMode().equals(CAVEMode.PRACTICE)) ? ActiveTableMode.PRACTICE
|
||||
: 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);
|
||||
|
||||
GetNextEtnResponse resp = (GetNextEtnResponse) ThriftClient
|
||||
|
@ -197,6 +245,13 @@ public class VtecUtil {
|
|||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a VTEC message
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
* @return the parsed VtecObject
|
||||
*/
|
||||
public static VtecObject parseMessage(String message) {
|
||||
VtecObject rval = null;
|
||||
Matcher m = VTEC_REGEX.matcher(message);
|
||||
|
@ -215,7 +270,7 @@ public class VtecUtil {
|
|||
*
|
||||
* @param message
|
||||
* the message to modify
|
||||
* @param obj
|
||||
* @param vtec
|
||||
* new VTEC for the message
|
||||
*
|
||||
* @return the modified message
|
||||
|
|
|
@ -85,6 +85,7 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* /missing (part of state, state abbreviation) which resulted from
|
||||
* 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.
|
||||
* Apr 28, 2015 RODO #4027 randerso Expunged Calendar from ActiveTableRecord
|
||||
* </pre>
|
||||
*
|
||||
* @author jsanchez
|
||||
|
@ -324,12 +325,12 @@ public class WatchUtil {
|
|||
* fixed the underlying system. request.addConstraint("act", new
|
||||
* RequestConstraint("CAN", ConstraintType.NOT_EQUALS));
|
||||
*/
|
||||
if (action != WarningAction.CAN && action != WarningAction.EXP) {
|
||||
if ((action != WarningAction.CAN) && (action != WarningAction.EXP)) {
|
||||
ActiveTableRecord record = entityClass.newInstance();
|
||||
record.setIssueTime((Calendar) result.get(ISSUE_TIME_FIELD));
|
||||
record.setStartTime((Calendar) result.get(START_TIME_FIELD));
|
||||
record.setEndTime((Calendar) result.get(END_TIME_FIELD));
|
||||
record.setEndTime((Calendar) result.get(END_TIME_FIELD));
|
||||
record.setIssueTime((Date) result.get(ISSUE_TIME_FIELD));
|
||||
record.setStartTime((Date) result.get(START_TIME_FIELD));
|
||||
record.setEndTime((Date) result.get(END_TIME_FIELD));
|
||||
record.setEndTime((Date) result.get(END_TIME_FIELD));
|
||||
record.setUgcZone(String.valueOf(result.get(UGC_ZONE_FIELD)));
|
||||
record.setPhensig(String.valueOf(result.get(PHEN_SIG_FIELD)));
|
||||
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;
|
||||
for (Pair<String, String> etnPhensig: removedUgczones.keySet()) {
|
||||
for (Pair<String, String> etnPhensig : removedUgczones.keySet()) {
|
||||
ugczones = removedUgczones.get(etnPhensig);
|
||||
etn = etnPhensig.getFirst();
|
||||
phensig = etnPhensig.getSecond();
|
||||
|
@ -361,8 +364,9 @@ public class WatchUtil {
|
|||
Iterator<ActiveTableRecord> iterator = records.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ActiveTableRecord atr = iterator.next();
|
||||
if (atr.getEtn().equals(etn) && atr.getUgcZone().equals(ugczone) &&
|
||||
atr.getPhensig().equals(phensig)) {
|
||||
if (atr.getEtn().equals(etn)
|
||||
&& atr.getUgcZone().equals(ugczone)
|
||||
&& atr.getPhensig().equals(phensig)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
@ -371,9 +375,12 @@ public class WatchUtil {
|
|||
|
||||
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>();
|
||||
for (ActiveTableRecord atr: records) {
|
||||
for (ActiveTableRecord atr : records) {
|
||||
String key = atr.getPhensig() + atr.getEtn() + atr.getUgcZone();
|
||||
atrMap.put(key, atr);
|
||||
}
|
||||
|
@ -419,7 +426,7 @@ public class WatchUtil {
|
|||
String ugcZone = ar.getUgcZone();
|
||||
String state = null;
|
||||
|
||||
if (marineUgcs != null && marineUgcs.contains(ugcZone)) {
|
||||
if ((marineUgcs != null) && marineUgcs.contains(ugcZone)) {
|
||||
// Just leave state == null
|
||||
} else {
|
||||
state = getStateName(ugcZone.substring(0, 2));
|
||||
|
@ -430,12 +437,11 @@ public class WatchUtil {
|
|||
|
||||
String phenSig = ar.getPhensig();
|
||||
String etn = ar.getEtn();
|
||||
Date startTime = ar.getStartTime().getTime();
|
||||
Date endTime = ar.getEndTime().getTime();
|
||||
Date startTime = ar.getStartTime();
|
||||
Date endTime = ar.getEndTime();
|
||||
|
||||
if (validUgcZones.contains(ugcZone)) {
|
||||
Watch watch = new Watch(state, phenSig, etn, startTime,
|
||||
endTime);
|
||||
Watch watch = new Watch(state, phenSig, etn, startTime, endTime);
|
||||
List<String> areas = map.get(watch);
|
||||
if (areas == null) {
|
||||
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
|
||||
* watch.
|
||||
/*
|
||||
* Sorts the watches based on ETN, then state. Marine areas have a null
|
||||
* state value so they appear at the end of each watch.
|
||||
*/
|
||||
Collections.sort(watches, new Comparator<Watch>() {
|
||||
|
||||
|
@ -471,37 +477,44 @@ public class WatchUtil {
|
|||
String etn1 = watch1.getEtn();
|
||||
String etn2 = watch2.getEtn();
|
||||
int c;
|
||||
if (etn1 == etn2)
|
||||
if (etn1 == etn2) {
|
||||
c = 0;
|
||||
else if (etn1 == null)
|
||||
} else if (etn1 == null) {
|
||||
return 1;
|
||||
else if (etn2 == null)
|
||||
} else if (etn2 == null) {
|
||||
return -1;
|
||||
else
|
||||
} else {
|
||||
c = etn1.compareTo(etn2);
|
||||
if (c != 0)
|
||||
}
|
||||
if (c != 0) {
|
||||
return c;
|
||||
}
|
||||
|
||||
String state1 = watch1.getState();
|
||||
String state2 = watch2.getState();
|
||||
if (state1 == state2)
|
||||
if (state1 == state2) {
|
||||
return 0;
|
||||
else if (state1 == null)
|
||||
} else if (state1 == null) {
|
||||
return 1; // null state is greater; put at end
|
||||
else if (state2 == null)
|
||||
} else if (state2 == null) {
|
||||
return -1;
|
||||
else
|
||||
} else {
|
||||
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>();
|
||||
for (Watch w: watches) {
|
||||
List<String> pos = w.getPartOfState() != null ?
|
||||
new ArrayList<String>(w.getPartOfState()) : null;
|
||||
if (pos != null)
|
||||
for (Watch w : watches) {
|
||||
List<String> pos = w.getPartOfState() != null ? new ArrayList<String>(
|
||||
w.getPartOfState()) : null;
|
||||
if (pos != null) {
|
||||
Collections.sort(pos);
|
||||
}
|
||||
String key = String.valueOf(w.getPhenSig())
|
||||
+ String.valueOf(w.getEtn()) + String.valueOf(w.getState())
|
||||
+ String.valueOf(pos) + String.valueOf(w.getEndTime());
|
||||
|
@ -540,9 +553,10 @@ public class WatchUtil {
|
|||
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>();
|
||||
for (String area: areas) {
|
||||
for (String area : areas) {
|
||||
Watch watch = new Watch(template.getState(), template.getPhenSig(),
|
||||
template.getEtn(), template.getStartTime(),
|
||||
template.getEndTime());
|
||||
|
@ -553,7 +567,7 @@ public class WatchUtil {
|
|||
}
|
||||
|
||||
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) {
|
||||
int entryIndex = 0;
|
||||
for (MarineWordingEntry entry : marineWordingConfig.getEntries()) {
|
||||
|
@ -573,9 +587,12 @@ public class WatchUtil {
|
|||
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>>() {
|
||||
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());
|
||||
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))) {
|
||||
return abrev;
|
||||
}
|
||||
if (nnn + sss + eee + www == 3) {
|
||||
if ((nnn + sss + eee + www) == 3) {
|
||||
if (www == 0) {
|
||||
abrev = "e";
|
||||
} else if (eee == 0) {
|
||||
|
@ -724,7 +741,7 @@ public class WatchUtil {
|
|||
return abrev;
|
||||
}
|
||||
}
|
||||
if (m == 1 + cc) {
|
||||
if (m == (1 + cc)) {
|
||||
abrev += partAbrev + " ";
|
||||
return abrev;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ package com.raytheon.edex.plugin.gfe.isc;
|
|||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -31,11 +31,20 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager;
|
||||
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
|
||||
import com.raytheon.edex.plugin.gfe.server.IFPServer;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.IscDataRecRequest;
|
||||
import com.raytheon.uf.common.python.concurrent.IPythonJobListener;
|
||||
import com.raytheon.uf.common.python.concurrent.PythonJobCoordinator;
|
||||
|
@ -44,7 +53,6 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.common.util.file.FilenameFilters;
|
||||
import com.raytheon.uf.edex.site.SiteAwareRegistry;
|
||||
|
||||
/**
|
||||
* ISC data receive service. Takes incoming request and executes iscDataRec
|
||||
|
@ -60,6 +68,7 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry;
|
|||
* Mar 12, 2013 #1759 dgilling Re-implement using IscScript.
|
||||
* Mar 14, 2013 #1794 djohnson Consolidate common FilenameFilter implementations.
|
||||
* Dec 10, 2014 #4953 randerso Properly handle single file reception
|
||||
* May 06, 2015 #4383 dgilling Properly XML parse incoming XML file.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -68,9 +77,12 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry;
|
|||
*/
|
||||
|
||||
public class IscReceiveSrv {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(IscReceiveSrv.class);
|
||||
|
||||
private static final String ISC_REQUEST = "iscrequest";
|
||||
|
||||
private static final String METHOD_NAME = "main";
|
||||
|
||||
private static final FilenameFilter docFileFilter = FilenameFilters
|
||||
|
@ -113,6 +125,9 @@ public class IscReceiveSrv {
|
|||
} catch (GfeConfigurationException e) {
|
||||
statusHandler.error("Error getting GFE configuration", e);
|
||||
return;
|
||||
} catch (SAXException | ParserConfigurationException e) {
|
||||
statusHandler.error("Error parsing received XML file.", e);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entry<String, String[]> siteArgs : siteArgMap.entrySet()) {
|
||||
|
@ -132,7 +147,9 @@ public class IscReceiveSrv {
|
|||
}
|
||||
|
||||
private Map<String, String[]> prepareIscDataRec(String[] args)
|
||||
throws IOException, InterruptedException, GfeConfigurationException {
|
||||
throws IOException, InterruptedException,
|
||||
GfeConfigurationException, SAXException,
|
||||
ParserConfigurationException {
|
||||
Map<String, String[]> siteMap = new HashMap<String, String[]>();
|
||||
|
||||
String[] incomingFiles = args[2].split(",");
|
||||
|
@ -145,26 +162,21 @@ public class IscReceiveSrv {
|
|||
xmlFileName = incomingFiles[1];
|
||||
}
|
||||
|
||||
// TODO properly decode the xml
|
||||
final File incomingXMLFile = new File(xmlFileName);
|
||||
String fileContents = FileUtil.file2String(incomingXMLFile);
|
||||
Pattern siteTagRegEx = Pattern.compile("<site>(.*?)</site>");
|
||||
Matcher matcher = siteTagRegEx.matcher(fileContents);
|
||||
List<String> siteList = new ArrayList<String>();
|
||||
while (matcher.find()) {
|
||||
siteList.add(matcher.group(1));
|
||||
}
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
Document doc = db.parse(incomingXMLFile);
|
||||
doc.getDocumentElement().normalize();
|
||||
|
||||
List<String> activeSites = Arrays.asList(SiteAwareRegistry
|
||||
.getInstance().getActiveSites());
|
||||
if (fileContents.contains("<iscrequest>")) {
|
||||
// Need to copy the request file if more than 1 site is active
|
||||
// on this EDEX server. Otherwise, the file will be deleted
|
||||
// after the first site has processed the request file
|
||||
siteList.remove(siteList.size() - 1);
|
||||
Collection<String> siteList = getXMLDestinations(doc);
|
||||
Set<String> activeSites = IFPServer.getActiveSites();
|
||||
|
||||
for (int i = 0; i < siteList.size(); i++) {
|
||||
final String siteId = siteList.get(i);
|
||||
if (ISC_REQUEST.equals(doc.getDocumentElement().getNodeName())) {
|
||||
/*
|
||||
* This case is for processing an ISC Request/Reply message
|
||||
* requesting our site's grids.
|
||||
*/
|
||||
for (String siteId : siteList) {
|
||||
if (activeSites.contains(siteId)) {
|
||||
if (IFPServerConfigManager.getServerConfig(siteId)
|
||||
.requestISC()) {
|
||||
|
@ -180,11 +192,8 @@ public class IscReceiveSrv {
|
|||
}
|
||||
incomingXMLFile.delete();
|
||||
} else {
|
||||
// Remove the source site
|
||||
siteList.remove(0);
|
||||
Set<String> siteSet = new HashSet<String>(siteList);
|
||||
try {
|
||||
for (String site : siteSet) {
|
||||
for (String site : siteList) {
|
||||
if (activeSites.contains(site)
|
||||
&& IFPServerConfigManager.getServerConfig(site)
|
||||
.requestISC()) {
|
||||
|
@ -272,4 +281,46 @@ public class IscReceiveSrv {
|
|||
|
||||
return siteMap;
|
||||
}
|
||||
|
||||
private Collection<String> getXMLDestinations(final Document doc)
|
||||
throws SAXException, IOException, ParserConfigurationException {
|
||||
Collection<String> destinations = new HashSet<>();
|
||||
|
||||
// Expected XML format:
|
||||
// <isc>
|
||||
// <source></source>
|
||||
// <destinations>
|
||||
// <address>
|
||||
// <site>SITE_ID</site>
|
||||
// </address>
|
||||
// </destinations>
|
||||
// </isc>
|
||||
NodeList destNodes = doc.getElementsByTagName("destinations");
|
||||
if (destNodes.getLength() > 0) {
|
||||
Node destNode = destNodes.item(0);
|
||||
|
||||
if (destNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element destElement = (Element) destNode;
|
||||
|
||||
NodeList addrNodes = destElement
|
||||
.getElementsByTagName("address");
|
||||
for (int i = 0; i < addrNodes.getLength(); i++) {
|
||||
Node addrNode = addrNodes.item(i);
|
||||
if (addrNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element addrElement = (Element) addrNode;
|
||||
|
||||
NodeList siteIdNodes = addrElement
|
||||
.getElementsByTagName("site");
|
||||
if (siteIdNodes.getLength() > 0) {
|
||||
Node siteIDNode = siteIdNodes.item(0);
|
||||
String siteID = siteIDNode.getTextContent();
|
||||
destinations.add(siteID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return destinations;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,17 +35,16 @@ class TextProduct(MultipleElementTable.TextProduct):
|
|||
Definition = copy.deepcopy(MultipleElementTable.TextProduct.Definition)
|
||||
|
||||
Definition["displayName"] = "MultipleElementTable"
|
||||
Definition["database"] = "Official"
|
||||
#Definition["outputFile"] = "/awips/GFESuite/products/TEXT/MultipleElementTable.txt"
|
||||
#Definition["defaultEditAreas"] = [
|
||||
#Definition["regionList"] = [
|
||||
# ("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"]
|
||||
|
|
|
@ -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,
|
||||
}
|
|
@ -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
|
|
@ -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)
|
||||
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
##
|
||||
|
||||
import iscMosaic,iscUtil
|
||||
import os, stat, sys, re, string, traceback, types
|
||||
import os, stat, sys, re, string, types
|
||||
import time, xml, LogStream, IrtAccess
|
||||
import IrtServer
|
||||
from xml.etree import ElementTree
|
||||
|
@ -46,6 +46,7 @@ from java.util import ArrayList
|
|||
# 12/08/2014 4953 randerso Added support for sending/receiving TCV files
|
||||
# Additional code cleanup
|
||||
# 04/08/2015 4383 dgilling Support FireWx ISC.
|
||||
# 04/23/2015 4383 randerso Fixed exception logging
|
||||
#
|
||||
##
|
||||
|
||||
|
@ -78,7 +79,7 @@ def purgeFiles(msgid, files):
|
|||
try:
|
||||
os.remove(file)
|
||||
except:
|
||||
logEvent("iscDataRec Failed to remove: ",file)
|
||||
logException("iscDataRec Failed to remove file %s: ", str(file))
|
||||
|
||||
|
||||
def execIscDataRec(MSGID,SUBJECT,FILES):
|
||||
|
@ -109,7 +110,7 @@ def execIscDataRec(MSGID,SUBJECT,FILES):
|
|||
destTree = ElementTree.ElementTree(ElementTree.XML(xmlFileBuf))
|
||||
iscE = destTree.getroot()
|
||||
except:
|
||||
logProblem("Malformed XML received")
|
||||
logException("Malformed XML received")
|
||||
return
|
||||
|
||||
#no XML destination information. Default to dx4f,px3 98000000, 98000001
|
||||
|
@ -199,11 +200,11 @@ def execIscDataRec(MSGID,SUBJECT,FILES):
|
|||
elif SUBJECT == 'GET_ACTIVE_TABLE2':
|
||||
IrtServer.getVTECActiveTable(dataFile, xmlFileBuf)
|
||||
elif SUBJECT in ['ISCGRIDS', 'ISCGRIDS2']:
|
||||
import localConfig
|
||||
import serverConfig
|
||||
|
||||
additionalISCRouting = []
|
||||
if localConfig.AdditionalISCRouting:
|
||||
additionalISCRouting = localConfig.AdditionalISCRouting
|
||||
if serverConfig.AdditionalISCRouting:
|
||||
additionalISCRouting = serverConfig.AdditionalISCRouting
|
||||
putISCGrids(dataFile, siteConfig.GFESUITE_SITEID, srcServer.get('site'), additionalISCRouting)
|
||||
elif SUBJECT == 'ISCREQUEST':
|
||||
IrtServer.serviceISCRequest(dataFile)
|
||||
|
@ -220,7 +221,8 @@ def execIscDataRec(MSGID,SUBJECT,FILES):
|
|||
logEvent('Sent to:',
|
||||
irt.printServerInfo(destServer), "connectT=", delta1, "xmtT=", delta2)
|
||||
except:
|
||||
logProblem("iscDataRec failed!",traceback.format_exc())
|
||||
logException("iscDataRec failed!")
|
||||
|
||||
finally:
|
||||
# cleanup
|
||||
purgeFiles(MSGID, FILES)
|
||||
|
@ -303,8 +305,8 @@ def main(argv):
|
|||
execIscDataRec(MSGID,SUBJECT,FILES)
|
||||
|
||||
except:
|
||||
logProblem('Failure:', traceback.format_exc())
|
||||
logException('Failure:')
|
||||
|
||||
except:
|
||||
logProblem("FAIL: ", traceback.format_exc())
|
||||
logException("FAIL: ")
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
# ------------ ---------- ----------- --------------------------
|
||||
# 02/17/2015 4139 randerso Replaced call to iscTime.timeFromComponents
|
||||
# with call to calendar.timegm
|
||||
# 04/23/2015 4383 randerso Changed to log arguments to aid in troubleshooting
|
||||
##
|
||||
|
||||
|
||||
|
@ -521,9 +522,9 @@ class IscMosaic:
|
|||
self.__processTimePeriod = (startTime, endTime)
|
||||
|
||||
initLogger(self.__logFile)
|
||||
logger.info("iscMosaic Starting args: %s", str(args))
|
||||
|
||||
def execute(self):
|
||||
logger.info("iscMosaic Starting")
|
||||
|
||||
# get the WxDefinition and DiscreteDefinition
|
||||
config = IFPServerConfigManager.getServerConfig(self.__mysite)
|
||||
|
|
|
@ -833,7 +833,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
print "Generating Forecast for", areaLabel
|
||||
areaHeader = self.makeAreaHeader(
|
||||
argDict, areaLabel, self._issueTime, self._expireTime,
|
||||
self._areaDictionary, self._defaultEditAreas)
|
||||
self._areaDictionary, self._defaultEditAreas, upperCase=True)
|
||||
fcst = fcst + areaHeader
|
||||
|
||||
# get the hazards text
|
||||
|
|
|
@ -1132,7 +1132,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
print "Generating Forecast for", areaLabel
|
||||
areaHeader = self.makeAreaHeader(
|
||||
argDict, areaLabel, self._issueTime, self._expireTime,
|
||||
self._areaDictionary, self._defaultEditAreas)
|
||||
self._areaDictionary, self._defaultEditAreas, upperCase=True)
|
||||
fcst = fcst + areaHeader
|
||||
|
||||
# get the hazards text
|
||||
|
|
|
@ -504,6 +504,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
|
|||
continue #no defined headline, skip phrase
|
||||
endTimePhrase = self.hazardTimePhrases(eachHazard, argDict)
|
||||
hazNameA = self.hazardName(eachHazard['hdln'], argDict, True)
|
||||
hazNameACap = self.sentence(hazNameA, addPeriod=False)
|
||||
hazName = self.hazardName(eachHazard['hdln'], argDict, False)
|
||||
|
||||
if hazName in ["Winter Weather Advisory", "Winter Storm Warning", "Beach Hazards Statement"]:
|
||||
|
@ -527,18 +528,18 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
|
|||
phraseCount = 2
|
||||
if hdln != lastHdln:
|
||||
if eachHazard['phen'] in ['HU', 'TR', 'TY']:
|
||||
hazardBodyPhrase = hazardBodyPhrase + hazNameA + \
|
||||
hazardBodyPhrase = hazardBodyPhrase + hazNameACap + \
|
||||
" has also been issued."
|
||||
else:
|
||||
hazardBodyPhrase = hazardBodyPhrase + hazNameA + \
|
||||
hazardBodyPhrase = hazardBodyPhrase + hazNameACap + \
|
||||
" has also been issued. This " + hazName + forPhrase + \
|
||||
" is in effect" + endTimePhrase + ". "
|
||||
else:
|
||||
if eachHazard['phen'] in ['HU', 'TR', 'TY']:
|
||||
hazardBodyPhrase = hazardBodyPhrase + hazNameA + \
|
||||
hazardBodyPhrase = hazardBodyPhrase + hazNameACap + \
|
||||
" has also been issued."
|
||||
else:
|
||||
hazardBodyPhrase = hazardBodyPhrase + hazNameA + forPhrase + \
|
||||
hazardBodyPhrase = hazardBodyPhrase + hazNameACap + forPhrase + \
|
||||
" has also been issued" + endTimePhrase + ". "
|
||||
else:
|
||||
if eachHazard['phen'] in ['HU', 'TR', 'TY']:
|
||||
|
@ -564,7 +565,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
|
|||
hazardBodyPhrase = hazardBodyPhrase + \
|
||||
" has cancelled the " + hazName + ". "
|
||||
else:
|
||||
hazardBodyPhrase = hazardBodyPhrase + "THE " + hazName + \
|
||||
hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
|
||||
" 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
|
||||
hazName = self.hazardName(eachHazard['hdln'], argDict, False)
|
||||
if eachHazard['endTime'] <= argDict['creationTime']:
|
||||
hazardBodyPhrase = hazardBodyPhrase + "THE " + hazName + \
|
||||
hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
|
||||
" is no longer in effect. "
|
||||
else:
|
||||
expTimeCurrent = argDict['creationTime']
|
||||
timeWords = self.getTimingPhrase(eachHazard, expTimeCurrent)
|
||||
|
||||
hazardBodyPhrase = hazardBodyPhrase + "THE " + hazName + \
|
||||
hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
|
||||
" will expire " + timeWords + ". "
|
||||
|
||||
#
|
||||
|
@ -600,7 +601,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
|
|||
endTimePhrase = self.hazardTimePhrases(eachHazard, argDict)
|
||||
hazName = self.hazardName(eachHazard['hdln'], argDict, False)
|
||||
|
||||
hazardBodyPhrase = hazardBodyPhrase + "THE " + hazName + \
|
||||
hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
|
||||
" is now in effect" + endTimePhrase + ". "
|
||||
|
||||
#
|
||||
|
@ -611,7 +612,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
|
|||
if len(eachHazard['hdln']) == 0:
|
||||
continue #no defined headline, skip phrase
|
||||
hazName = self.hazardName(eachHazard['hdln'], argDict, False)
|
||||
hazardBodyPhrase = hazardBodyPhrase + "THE " + hazName + \
|
||||
hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
|
||||
" is no longer in effect. "
|
||||
|
||||
#
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 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",
|
||||
"declaration": "The Forsyth County Environmental Affairs Department has issued an Air Quality Action Day...",
|
||||
"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": {
|
||||
"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...",
|
||||
"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/.",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -295,9 +295,9 @@ class TextProduct(GenericHazards.TextProduct):
|
|||
#period.
|
||||
areaGroupLen = len(areaGroups)
|
||||
if areaGroupLen == 1:
|
||||
areaPhrase = "A portion of "
|
||||
areaPhrase = "a portion of "
|
||||
else:
|
||||
areaPhrase = "Portions of "
|
||||
areaPhrase = "portions of "
|
||||
|
||||
#parts of the states
|
||||
areaGroupCount = 0
|
||||
|
@ -326,39 +326,39 @@ class TextProduct(GenericHazards.TextProduct):
|
|||
countyCnt = 0
|
||||
for state, partOfState, names in areaGroups:
|
||||
for name,nameType in names:
|
||||
if nameType == "Zone":
|
||||
if nameType == "zone":
|
||||
zoneCnt = zoneCnt + 1
|
||||
elif nameType == "County":
|
||||
elif nameType == "county":
|
||||
countyCnt = countyCnt + 1
|
||||
elif nameType == "Independent city":
|
||||
elif nameType == "independent city":
|
||||
icCnt = icCnt + 1
|
||||
elif nameType == "Parish":
|
||||
elif nameType == "parish":
|
||||
parishCnt = parishCnt + 1
|
||||
|
||||
incPhrases = []
|
||||
if zoneCnt == 1:
|
||||
incPhrases.append("Area")
|
||||
incPhrases.append("area")
|
||||
elif zoneCnt > 1:
|
||||
incPhrases.append("Areas")
|
||||
incPhrases.append("areas")
|
||||
if countyCnt == 1:
|
||||
incPhrases.append("County")
|
||||
incPhrases.append("county")
|
||||
elif countyCnt > 1:
|
||||
incPhrases.append("Counties")
|
||||
incPhrases.append("counties")
|
||||
if icCnt == 1:
|
||||
incPhrases.append("Independent city")
|
||||
incPhrases.append("independent city")
|
||||
elif icCnt > 1:
|
||||
incPhrases.append("Independent cities")
|
||||
incPhrases.append("independent cities")
|
||||
if parishCnt == 1:
|
||||
incPhrases.append("Parish")
|
||||
incPhrases.append("parish")
|
||||
elif parishCnt > 1:
|
||||
incPhrases.append("Parishes")
|
||||
incPhrases.append("parishes")
|
||||
incPhrase = " and ".join(incPhrases)
|
||||
|
||||
if generalOnly:
|
||||
return areaPhrase
|
||||
|
||||
|
||||
areaPhrase = areaPhrase + "...Including the following " + \
|
||||
areaPhrase = areaPhrase + "...including the following " + \
|
||||
incPhrase + "..."
|
||||
|
||||
#list of the specific areas
|
||||
|
@ -377,7 +377,10 @@ class TextProduct(GenericHazards.TextProduct):
|
|||
phrase = "...".join(snames[0:-1])
|
||||
# complex phrasing (state, partOfState, and names)
|
||||
else:
|
||||
phrase = "In "
|
||||
if i == 0:
|
||||
phrase = "in "
|
||||
else:
|
||||
phrase = "In "
|
||||
if partOfState != '' and partOfState != ' ':
|
||||
phrase = phrase + partOfState + ' '
|
||||
phrase = phrase + state + "..." + "...".join(snames[0:-1])
|
||||
|
|
|
@ -3444,7 +3444,7 @@ class TextProduct(GenericHazards.TextProduct):
|
|||
# t+="but will continue to be monitored until it no longer threatens the area. "
|
||||
#
|
||||
# else:
|
||||
t+="AT "+ self._stormTime + "...the center of "
|
||||
t+="At "+ self._stormTime + "...the center of "
|
||||
|
||||
# Fix the grammar if dealing with "remnants"
|
||||
if re.search("(?i)remnants", self._stormTypeName) is not None:
|
||||
|
|
|
@ -595,7 +595,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
def _preProcessArea(self, fcst, editArea, areaLabel, argDict):
|
||||
areaHeader = self.makeAreaHeader(
|
||||
argDict, areaLabel, self._issueTime, self._expireTime,
|
||||
self._areaDictionary, self._defaultEditAreas)
|
||||
self._areaDictionary, self._defaultEditAreas, upperCase=True)
|
||||
fcst = fcst + areaHeader
|
||||
|
||||
# get the hazards text
|
||||
|
|
|
@ -355,7 +355,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
# If a method, it will be called with arguments:
|
||||
# tree, node, key, element
|
||||
return {
|
||||
"WaveHeight" : "surf................",
|
||||
"WaveHeight" : "SURF................",
|
||||
"Swell": "swell",
|
||||
"Swell2": "swell",
|
||||
"LabelSwell": "SWELL...............",
|
||||
|
@ -377,8 +377,8 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
"MaxT":"highs",
|
||||
"Wind": "winds",
|
||||
# Used for Headlines
|
||||
"Expected" : "expected",
|
||||
"In effect" : "in effect",
|
||||
"EXPECTED" : "expected",
|
||||
"IN EFFECT" : "in effect",
|
||||
# Used for single values
|
||||
"around": "around ",
|
||||
" VALLEYS/LWR SLOPES...": " INLAND...............",
|
||||
|
@ -1229,7 +1229,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
return self.setWords(node, "")
|
||||
self.setWords(node, "")
|
||||
node.set("descriptor", "")
|
||||
node.set("indentLabel", "20-foot winds.......")
|
||||
node.set("indentLabel", "20-FOOT WINDS.......")
|
||||
return self.DONE()
|
||||
|
||||
def fireRidgeValleyWind_setUp(self, tree, node):
|
||||
|
@ -1539,7 +1539,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
tokens = line.split()
|
||||
# Look for the city
|
||||
for token in tokens:
|
||||
if token == uviCity:
|
||||
if token.upper() == uviCity.upper():
|
||||
index = tokens.index(token)
|
||||
state = tokens[index + 1]
|
||||
if state == uviState:
|
||||
|
@ -1598,7 +1598,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
# Add error message to fcst
|
||||
fcst = fcst + tideTable
|
||||
continue
|
||||
fcst = fcst + "\nAT " + label + "...\n\n"
|
||||
fcst = fcst + "\nAt " + label + "...\n\n"
|
||||
for line in tideTable:
|
||||
if line.find(currentDate) == 0:
|
||||
# Get the tide info
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.common.activetable;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
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-
|
||||
* spatial
|
||||
* 10/16/2014 3454 bphillip Upgrading to Hibernate 4
|
||||
* 04/28/2015 4027 randerso Expunged Calendar from ActiveTableRecord
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
|
@ -126,19 +128,19 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
|
||||
/** vtec start time */
|
||||
@DynamicSerializeElement
|
||||
protected Calendar startTime;
|
||||
protected Date startTime;
|
||||
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
protected Calendar endTime;
|
||||
protected Date endTime;
|
||||
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
protected Calendar issueTime;
|
||||
protected Date issueTime;
|
||||
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
protected Calendar purgeTime;
|
||||
protected Date purgeTime;
|
||||
|
||||
@Column(length = 8)
|
||||
@DynamicSerializeElement
|
||||
|
@ -209,15 +211,15 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
protected Calendar floodBegin;
|
||||
protected Date floodBegin;
|
||||
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
protected Calendar floodCrest;
|
||||
protected Date floodCrest;
|
||||
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
protected Calendar floodEnd;
|
||||
protected Date floodEnd;
|
||||
|
||||
@Override
|
||||
public abstract Object clone();
|
||||
|
@ -657,7 +659,7 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
/**
|
||||
* @return the startTime
|
||||
*/
|
||||
public Calendar getStartTime() {
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
|
@ -665,14 +667,14 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
* @param startTime
|
||||
* the startTime to set
|
||||
*/
|
||||
public void setStartTime(Calendar startTime) {
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the endTime
|
||||
*/
|
||||
public Calendar getEndTime() {
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
|
@ -680,14 +682,14 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
* @param endTime
|
||||
* the endTime to set
|
||||
*/
|
||||
public void setEndTime(Calendar endTime) {
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the issueTime
|
||||
*/
|
||||
public Calendar getIssueTime() {
|
||||
public Date getIssueTime() {
|
||||
return issueTime;
|
||||
}
|
||||
|
||||
|
@ -695,14 +697,14 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
* @param issueTime
|
||||
* the issueTime to set
|
||||
*/
|
||||
public void setIssueTime(Calendar issueTime) {
|
||||
public void setIssueTime(Date issueTime) {
|
||||
this.issueTime = issueTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the purgeTime
|
||||
*/
|
||||
public Calendar getPurgeTime() {
|
||||
public Date getPurgeTime() {
|
||||
return purgeTime;
|
||||
}
|
||||
|
||||
|
@ -710,7 +712,7 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
* @param purgeTime
|
||||
* the purgeTime to set
|
||||
*/
|
||||
public void setPurgeTime(Calendar purgeTime) {
|
||||
public void setPurgeTime(Date purgeTime) {
|
||||
this.purgeTime = purgeTime;
|
||||
}
|
||||
|
||||
|
@ -957,7 +959,7 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
/**
|
||||
* @return the floodBegin
|
||||
*/
|
||||
public Calendar getFloodBegin() {
|
||||
public Date getFloodBegin() {
|
||||
return floodBegin;
|
||||
}
|
||||
|
||||
|
@ -965,14 +967,14 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
* @param floodBegin
|
||||
* the floodBegin to set
|
||||
*/
|
||||
public void setFloodBegin(Calendar floodBegin) {
|
||||
public void setFloodBegin(Date floodBegin) {
|
||||
this.floodBegin = floodBegin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the floodCrest
|
||||
*/
|
||||
public Calendar getFloodCrest() {
|
||||
public Date getFloodCrest() {
|
||||
return floodCrest;
|
||||
}
|
||||
|
||||
|
@ -980,14 +982,14 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
* @param floodCrest
|
||||
* the floodCrest to set
|
||||
*/
|
||||
public void setFloodCrest(Calendar floodCrest) {
|
||||
public void setFloodCrest(Date floodCrest) {
|
||||
this.floodCrest = floodCrest;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the floodEnd
|
||||
*/
|
||||
public Calendar getFloodEnd() {
|
||||
public Date getFloodEnd() {
|
||||
return floodEnd;
|
||||
}
|
||||
|
||||
|
@ -995,7 +997,7 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
* @param floodEnd
|
||||
* the floodEnd to set
|
||||
*/
|
||||
public void setFloodEnd(Calendar floodEnd) {
|
||||
public void setFloodEnd(Date floodEnd) {
|
||||
this.floodEnd = floodEnd;
|
||||
}
|
||||
|
||||
|
@ -1050,17 +1052,17 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
}
|
||||
atr.setAct(wr.getAct());
|
||||
atr.setCountyheader(wr.getCountyheader());
|
||||
atr.setEndTime(wr.getEndTime());
|
||||
atr.setEndTime(calendarToDate(wr.getEndTime()));
|
||||
atr.setEtn(wr.getEtn());
|
||||
atr.setFloodBegin(wr.getFloodBegin());
|
||||
atr.setFloodCrest(wr.getFloodCrest());
|
||||
atr.setFloodEnd(wr.getFloodEnd());
|
||||
atr.setFloodBegin(calendarToDate(wr.getFloodBegin()));
|
||||
atr.setFloodCrest(calendarToDate(wr.getFloodCrest()));
|
||||
atr.setFloodEnd(calendarToDate(wr.getFloodEnd()));
|
||||
atr.setFloodRecordStatus(wr.getFloodRecordStatus());
|
||||
atr.setFloodSeverity(wr.getFloodSeverity());
|
||||
atr.setForecaster(wr.getForecaster());
|
||||
atr.setGeometry(wr.getGeometry());
|
||||
atr.setImmediateCause(wr.getImmediateCause());
|
||||
atr.setIssueTime(wr.getIssueTime());
|
||||
atr.setIssueTime(calendarToDate(wr.getIssueTime()));
|
||||
atr.setLoc(wr.getLoc());
|
||||
atr.setLocationID(wr.getLocationID());
|
||||
atr.setMotdir(wr.getMotdir());
|
||||
|
@ -1071,13 +1073,13 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
atr.setPhensig(wr.getPhensig());
|
||||
atr.setPil(wr.getPil());
|
||||
atr.setProductClass(wr.getProductClass());
|
||||
atr.setPurgeTime(wr.getPurgeTime());
|
||||
atr.setPurgeTime(calendarToDate(wr.getPurgeTime()));
|
||||
atr.setRawmessage(wr.getRawmessage());
|
||||
atr.setRegion(wr.getRegion());
|
||||
atr.setSeg(wr.getSeg());
|
||||
atr.setSegText(wr.getSegText());
|
||||
atr.setSig(wr.getSig());
|
||||
atr.setStartTime(wr.getStartTime());
|
||||
atr.setStartTime(calendarToDate(wr.getStartTime()));
|
||||
atr.setUfn(wr.isUfn());
|
||||
atr.setVtecstr(wr.getVtecstr());
|
||||
atr.setWmoid(wr.getWmoid());
|
||||
|
@ -1093,4 +1095,11 @@ public abstract class ActiveTableRecord extends PersistableDataObject {
|
|||
return list;
|
||||
}
|
||||
|
||||
private static Date calendarToDate(Calendar calendar) {
|
||||
Date date = null;
|
||||
if (calendar != null) {
|
||||
date = calendar.getTime();
|
||||
}
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package com.raytheon.uf.common.activetable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -37,7 +37,8 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
*
|
||||
* 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>
|
||||
*
|
||||
|
@ -84,15 +85,12 @@ public class ActiveTableUtil {
|
|||
template.put("phensig", atr.getPhensig());
|
||||
template.put("act", atr.getAct());
|
||||
template.put("seg", atr.getSeg());
|
||||
template.put("startTime",
|
||||
atr.getStartTime().getTimeInMillis() / 1000);
|
||||
template.put("endTime", atr.getEndTime().getTimeInMillis() / 1000);
|
||||
template.put("startTime", atr.getStartTime().getTime() / 1000);
|
||||
template.put("endTime", atr.getEndTime().getTime() / 1000);
|
||||
template.put("ufn", atr.isUfn());
|
||||
template.put("officeid", atr.getOfficeid());
|
||||
template.put("purgeTime",
|
||||
atr.getPurgeTime().getTimeInMillis() / 1000);
|
||||
template.put("issueTime",
|
||||
atr.getIssueTime().getTimeInMillis() / 1000);
|
||||
template.put("purgeTime", atr.getPurgeTime().getTime() / 1000);
|
||||
template.put("issueTime", atr.getIssueTime().getTime() / 1000);
|
||||
template.put("state", "Decoded");
|
||||
template.put("xxxid", atr.getXxxid());
|
||||
|
||||
|
@ -104,9 +102,9 @@ public class ActiveTableUtil {
|
|||
|
||||
template.put("rawMessage", atr.getRawmessage());
|
||||
template.put("countyheader", atr.getCountyheader());
|
||||
Calendar floodBegin = atr.getFloodBegin();
|
||||
Date floodBegin = atr.getFloodBegin();
|
||||
if (floodBegin != null) {
|
||||
long floodBeginMillis = floodBegin.getTimeInMillis();
|
||||
long floodBeginMillis = floodBegin.getTime();
|
||||
if (floodBeginMillis != 0) {
|
||||
template.put("floodBegin", floodBeginMillis / 1000);
|
||||
}
|
||||
|
@ -114,31 +112,31 @@ public class ActiveTableUtil {
|
|||
template.put("wmoid", atr.getWmoid());
|
||||
|
||||
// Warngen fields
|
||||
Calendar floodCrest = atr.getFloodCrest();
|
||||
Date floodCrest = atr.getFloodCrest();
|
||||
if (floodCrest != null) {
|
||||
long floodCrestMillis = floodCrest.getTimeInMillis();
|
||||
long floodCrestMillis = floodCrest.getTime();
|
||||
if (floodCrestMillis != 0) {
|
||||
template.put("floodCrest", floodCrestMillis / 1000);
|
||||
}
|
||||
}
|
||||
Calendar floodEnd = atr.getFloodEnd();
|
||||
Date floodEnd = atr.getFloodEnd();
|
||||
if (floodEnd != null) {
|
||||
long floodEndMillis = floodEnd.getTimeInMillis();
|
||||
long floodEndMillis = floodEnd.getTime();
|
||||
if (floodEndMillis != 0) {
|
||||
template.put("floodBegin", floodEndMillis / 1000);
|
||||
}
|
||||
}
|
||||
String floodStatus = atr.getFloodRecordStatus();
|
||||
if (floodStatus != null && !"".equals(floodStatus.trim())) {
|
||||
if ((floodStatus != null) && !"".equals(floodStatus.trim())) {
|
||||
template.put("floodrecordstatus", floodStatus);
|
||||
}
|
||||
String floodSeverity = atr.getFloodSeverity();
|
||||
if (floodSeverity != null && !"".equals(floodSeverity.trim())) {
|
||||
if ((floodSeverity != null) && !"".equals(floodSeverity.trim())) {
|
||||
template.put("floodseverity", floodSeverity);
|
||||
}
|
||||
|
||||
Geometry geometry = atr.getGeometry();
|
||||
if (geometry != null && !geometry.isEmpty()) {
|
||||
if ((geometry != null) && !geometry.isEmpty()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String sep = "";
|
||||
long lat;
|
||||
|
@ -154,17 +152,17 @@ public class ActiveTableUtil {
|
|||
}
|
||||
|
||||
String immediateCause = atr.getImmediateCause();
|
||||
if (immediateCause != null && !"".equals(immediateCause.trim())) {
|
||||
if ((immediateCause != null) && !"".equals(immediateCause.trim())) {
|
||||
template.put("immediateCause", immediateCause);
|
||||
}
|
||||
|
||||
String loc = atr.getLoc();
|
||||
if (loc != null && !"".equals(loc.trim())) {
|
||||
if ((loc != null) && !"".equals(loc.trim())) {
|
||||
template.put("loc", loc);
|
||||
}
|
||||
|
||||
String locationId = atr.getLocationID();
|
||||
if (locationId != null && !"".equals(locationId.trim())) {
|
||||
if ((locationId != null) && !"".equals(locationId.trim())) {
|
||||
template.put("locationId", locationId);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
**/
|
||||
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.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Request for next ETN in the sequence
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -36,6 +36,7 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
|||
* Feb 14, 2011 rjpeter Initial creation
|
||||
* Oct 21, 2013 #1843 dgilling Add performISC and reportConflictOnly
|
||||
* fields, proper constructors.
|
||||
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -55,7 +56,7 @@ public class GetNextEtnRequest implements IServerRequest {
|
|||
private String phensig;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Calendar currentTime;
|
||||
private Date currentTime;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private boolean lockEtn;
|
||||
|
@ -84,7 +85,7 @@ public class GetNextEtnRequest implements IServerRequest {
|
|||
* The phenomenon and significance of the hazard concatenated
|
||||
* with a '.' (e.g., TO.W or DU.Y)
|
||||
* @param currentTime
|
||||
* <code>Calendar</code> representing time (needed for DRT mode).
|
||||
* <code>Date</code> representing time (needed for DRT mode).
|
||||
* @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
|
||||
|
@ -95,7 +96,7 @@ public class GetNextEtnRequest implements IServerRequest {
|
|||
* GetNextEtnRequest.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -110,7 +111,7 @@ public class GetNextEtnRequest implements IServerRequest {
|
|||
* The phenomenon and significance of the hazard concatenated
|
||||
* with a '.' (e.g., TO.W or DU.Y)
|
||||
* @param currentTime
|
||||
* <code>Calendar</code> representing time (needed for DRT mode).
|
||||
* <code>Date</code> representing time (needed for DRT mode).
|
||||
* @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
|
||||
|
@ -123,7 +124,7 @@ public class GetNextEtnRequest implements IServerRequest {
|
|||
* 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.
|
||||
* String, Date, List<IRequestRouter>)} for more information.
|
||||
* @param reportConflictOnly
|
||||
* Affects which kinds of errors get reported back to the
|
||||
* 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.
|
||||
*/
|
||||
public GetNextEtnRequest(String siteID, ActiveTableMode mode,
|
||||
String phensig, Calendar currentTime, boolean lockEtn,
|
||||
String phensig, Date currentTime, boolean lockEtn,
|
||||
boolean performISC, boolean reportConflictOnly, Integer etnOverride) {
|
||||
this.siteID = siteID;
|
||||
this.mode = mode;
|
||||
|
@ -180,11 +181,11 @@ public class GetNextEtnRequest implements IServerRequest {
|
|||
this.lockEtn = lockEtn;
|
||||
}
|
||||
|
||||
public Calendar getCurrentTime() {
|
||||
public Date getCurrentTime() {
|
||||
return currentTime;
|
||||
}
|
||||
|
||||
public void setCurrentTime(Calendar currentTime) {
|
||||
public void setCurrentTime(Date currentTime) {
|
||||
this.currentTime = currentTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
**/
|
||||
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.serialization.annotations.DynamicSerialize;
|
||||
|
@ -37,6 +37,7 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 19, 2013 #1843 dgilling Initial creation
|
||||
* Oct 21, 2013 #1843 dgilling Add ETN override field.
|
||||
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,7 +61,7 @@ public class LockAndGetNextEtnRequest implements IServerRequest {
|
|||
private String phensig;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Calendar currentTime;
|
||||
private Date currentTime;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Integer etnOverride;
|
||||
|
@ -70,12 +71,12 @@ public class LockAndGetNextEtnRequest implements IServerRequest {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public LockAndGetNextEtnRequest(String siteID, String requestorSiteID,
|
||||
ActiveTableMode mode, String phensig, Calendar currentTime,
|
||||
ActiveTableMode mode, String phensig, Date currentTime,
|
||||
Integer etnOverride) {
|
||||
this.siteID = siteID;
|
||||
this.requestorSiteID = requestorSiteID;
|
||||
|
@ -117,11 +118,11 @@ public class LockAndGetNextEtnRequest implements IServerRequest {
|
|||
this.phensig = phensig;
|
||||
}
|
||||
|
||||
public Calendar getCurrentTime() {
|
||||
public Date getCurrentTime() {
|
||||
return currentTime;
|
||||
}
|
||||
|
||||
public void setCurrentTime(Calendar currentTime) {
|
||||
public void setCurrentTime(Date currentTime) {
|
||||
this.currentTime = currentTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.activetable.request;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.raytheon.uf.common.activetable.ActiveTableMode;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -34,6 +36,7 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 19, 2013 #1843 dgilling Initial creation
|
||||
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -54,7 +57,7 @@ public class UnlockAndSetNextEtnRequest implements IServerRequest {
|
|||
private ActiveTableMode mode;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private int year;
|
||||
private Date currentTime;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String phensig;
|
||||
|
@ -67,11 +70,11 @@ public class UnlockAndSetNextEtnRequest implements IServerRequest {
|
|||
}
|
||||
|
||||
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.requestorSiteID = requestorSiteID;
|
||||
this.mode = mode;
|
||||
this.year = year;
|
||||
this.currentTime = currentTime;
|
||||
this.phensig = phensig;
|
||||
this.newEtn = newEtn;
|
||||
}
|
||||
|
@ -100,12 +103,12 @@ public class UnlockAndSetNextEtnRequest implements IServerRequest {
|
|||
this.mode = mode;
|
||||
}
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
public Date getCurrentTime() {
|
||||
return currentTime;
|
||||
}
|
||||
|
||||
public void setYear(int year) {
|
||||
this.year = year;
|
||||
public void setCurrentTime(Date currentTime) {
|
||||
this.currentTime = currentTime;
|
||||
}
|
||||
|
||||
public String getPhensig() {
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
|
||||
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
|
||||
* table write at a time.
|
||||
* 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>
|
||||
*
|
||||
|
@ -447,7 +450,7 @@ public class ActiveTable {
|
|||
@SuppressWarnings("unchecked")
|
||||
private static List<ActiveTableRecord> queryTable(String siteId,
|
||||
ActiveTableMode mode, String phensigList, String action,
|
||||
String etn, Calendar currentTime, boolean requestValidTimes,
|
||||
String etn, Date currentTime, boolean requestValidTimes,
|
||||
boolean latestEtn) {
|
||||
DatabaseQuery query = null;
|
||||
CoreDao dao = null;
|
||||
|
@ -472,27 +475,18 @@ public class ActiveTable {
|
|||
query.addQueryParam("etn", etn, "in");
|
||||
}
|
||||
|
||||
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) {
|
||||
if (requestValidTimes && (currentTime != null)) {
|
||||
// Current Time
|
||||
query.addQueryParam("endTime", currentTime, "greater_than");
|
||||
query.addQueryParam("endTime", currentTime, ">");
|
||||
}
|
||||
if (latestEtn && currentTime != null) {
|
||||
Calendar yearStart = Calendar.getInstance();
|
||||
yearStart.set(currentTime.get(Calendar.YEAR), Calendar.JANUARY, 1,
|
||||
if (latestEtn && (currentTime != null)) {
|
||||
Calendar yearStart = Calendar.getInstance(TimeZone
|
||||
.getTimeZone("GMT"));
|
||||
yearStart.setTime(currentTime);
|
||||
yearStart.set(yearStart.get(Calendar.YEAR), Calendar.JANUARY, 1, 0,
|
||||
0, 0);
|
||||
query.addQueryParam("issueTime", yearStart, "greater_than");
|
||||
yearStart.set(Calendar.MILLISECOND, 0);
|
||||
query.addQueryParam("issueTime", yearStart.getTime(), ">=");
|
||||
query.addOrder("etn", false);
|
||||
query.setMaxResults(1);
|
||||
}
|
||||
|
@ -713,14 +707,14 @@ public class ActiveTable {
|
|||
* @param phensig
|
||||
* The phenomenon and significance combination to search for.
|
||||
* @param currentTime
|
||||
* <code>Calendar</code> representing time to perform search from
|
||||
* <code>Date</code> representing time to perform search from
|
||||
* (needed for DRT mode).
|
||||
* @return The last ETN assigned to the particular site and phensig
|
||||
* combination, or <code>null</code> if no ETNs have been assigned
|
||||
* to this combination.
|
||||
*/
|
||||
public static Integer getLastUsedEtn(String siteId, ActiveTableMode mode,
|
||||
String phensig, Calendar currentTime) {
|
||||
String phensig, Date currentTime) {
|
||||
Integer lastEtn = null;
|
||||
List<ActiveTableRecord> records = ActiveTable.queryTable(siteId, mode,
|
||||
phensig, null, null, currentTime, false, true);
|
||||
|
|
|
@ -26,11 +26,12 @@ import java.io.IOException;
|
|||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.rmi.RemoteException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -38,6 +39,7 @@ import java.util.Map.Entry;
|
|||
import java.util.Properties;
|
||||
import java.util.Queue;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TimeZone;
|
||||
import java.util.TreeMap;
|
||||
|
||||
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
|
||||
* Dec 18, 2013 #2641 dgilling Fix ClusterTask locking.
|
||||
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -118,7 +121,7 @@ public final class GetNextEtnUtil {
|
|||
* The phenomenon and significance combination (e.g., TO.W or
|
||||
* DU.Y).
|
||||
* @param currentTime
|
||||
* <code>Calendar</code> representing time (needed for DRT mode).
|
||||
* <code>Date</code> representing time (needed for DRT mode).
|
||||
* @param isLock
|
||||
* Whether or not to return a unique ETN--one that has not and
|
||||
* 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.
|
||||
*/
|
||||
public static GetNextEtnResponse getNextEtn(String siteId,
|
||||
ActiveTableMode mode, String phensig, Calendar currentTime,
|
||||
ActiveTableMode mode, String phensig, Date currentTime,
|
||||
boolean isLock, boolean performISC, boolean reportConflictOnly,
|
||||
Integer etnOverride) {
|
||||
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
|
||||
* DU.Y).
|
||||
* @param currentTime
|
||||
* <code>Calendar</code> representing time (needed for DRT mode).
|
||||
* <code>Date</code> representing time (needed for DRT mode).
|
||||
* @param isLock
|
||||
* Whether or not to actually obtain the cluster task lock. Not
|
||||
* 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.
|
||||
*/
|
||||
public static int lockAndGetNextEtn(String siteId, ActiveTableMode mode,
|
||||
String phensig, Calendar currentTime, boolean isLock,
|
||||
String phensig, Date currentTime, boolean isLock,
|
||||
Integer etnOverride) {
|
||||
String lockName = getEtnClusterLockName(siteId, mode);
|
||||
ClusterTask ct = null;
|
||||
|
@ -306,7 +309,9 @@ public final class GetNextEtnUtil {
|
|||
|
||||
int sysNextEtn = -1;
|
||||
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();
|
||||
|
||||
statusHandler.info("ClusterTask Lock info: " + eInfo);
|
||||
|
@ -342,16 +347,20 @@ public final class GetNextEtnUtil {
|
|||
* @param phensig
|
||||
* The phenomenon and significance combination (e.g., TO.W or
|
||||
* DU.Y).
|
||||
* @param year
|
||||
* Year the next ETN is effective for.
|
||||
* @param currentTime
|
||||
* <code>Date</code> used to determine year for ETN.
|
||||
* @param nextEtn
|
||||
* The ETN to persist.
|
||||
*/
|
||||
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);
|
||||
ClusterLockUtils.updateExtraInfo(lockName, phensig,
|
||||
Integer.toString(year) + ":" + nextEtn);
|
||||
ClusterLockUtils.updateExtraInfo(lockName, phensig, year + ":"
|
||||
+ nextEtn);
|
||||
ClusterLockUtils.unlock(lockName, phensig);
|
||||
statusHandler.info("Unlocking::[nextEtn = " + nextEtn + "]");
|
||||
}
|
||||
|
@ -369,20 +378,19 @@ public final class GetNextEtnUtil {
|
|||
* The phenomenon and significance combination (e.g., TO.W or
|
||||
* DU.Y).
|
||||
* @param currentTime
|
||||
* <code>Calendar</code> representing time (needed for DRT mode).
|
||||
* <code>Date</code> representing time (needed for DRT mode).
|
||||
* @param isLock
|
||||
* Whether or not to return a unique ETN--one that has not and
|
||||
* cannot be used by any other requestor.
|
||||
* @return The next ETN to be used in sequence.
|
||||
*/
|
||||
public static Integer getNextEtnFromLocal(String siteId,
|
||||
ActiveTableMode mode, String phensig, Calendar currentTime,
|
||||
ActiveTableMode mode, String phensig, Date currentTime,
|
||||
boolean isLock) {
|
||||
int nextEtn = lockAndGetNextEtn(siteId, mode, phensig, currentTime,
|
||||
isLock, null);
|
||||
if (isLock) {
|
||||
setNextEtnAndUnlock(siteId, mode, phensig,
|
||||
currentTime.get(Calendar.YEAR), nextEtn);
|
||||
setNextEtnAndUnlock(siteId, mode, phensig, currentTime, nextEtn);
|
||||
}
|
||||
return nextEtn;
|
||||
}
|
||||
|
@ -405,7 +413,7 @@ public final class GetNextEtnUtil {
|
|||
* The phenomenon and significance combination (e.g., TO.W or
|
||||
* DU.Y).
|
||||
* @param currentTime
|
||||
* <code>Calendar</code> representing time (needed for DRT mode).
|
||||
* <code>Date</code> representing time (needed for DRT mode).
|
||||
* @param hostsToQuery
|
||||
* The remote hosts to query. This should also include the local
|
||||
* EDEX instance initiating this operation.
|
||||
|
@ -424,7 +432,7 @@ public final class GetNextEtnUtil {
|
|||
* @throws UnknownHostException
|
||||
*/
|
||||
public static GetNextEtnResponse getNextEtnFromPartners(String siteId,
|
||||
ActiveTableMode mode, String phensig, Calendar currentTime,
|
||||
ActiveTableMode mode, String phensig, Date currentTime,
|
||||
SortedMap<String, IRequestRouter> hostsToQuery,
|
||||
boolean reportConflictOnly, Integer etnOverride) {
|
||||
Queue<Entry<String, IRequestRouter>> unlockQueue = Collections
|
||||
|
@ -474,8 +482,7 @@ public final class GetNextEtnUtil {
|
|||
}
|
||||
|
||||
IServerRequest unlockReq = new UnlockAndSetNextEtnRequest(siteId,
|
||||
mySiteId, mode, currentTime.get(Calendar.YEAR), phensig,
|
||||
nextEtn);
|
||||
mySiteId, mode, currentTime, phensig, nextEtn);
|
||||
for (Entry<String, IRequestRouter> host : unlockQueue) {
|
||||
IRequestRouter router = host.getValue();
|
||||
try {
|
||||
|
|
|
@ -25,6 +25,8 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.activetable.ActiveTable;
|
||||
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.
|
||||
|
@ -38,6 +40,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
|
|||
* Apr 23, 2010 wkwock Initial creation
|
||||
* Apr 09, 2014 #3004 dgilling Move to activetable plugin, remove GFE
|
||||
* dependencies.
|
||||
* Apr 28, 2015 #4027 randerso Added clearing of practice warning table
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -55,6 +58,10 @@ public class ClearPracticeVTECTableHandler implements
|
|||
throws Exception {
|
||||
try {
|
||||
ActiveTable.clearPracticeTable(request.getSiteID());
|
||||
PluginDao dao = PluginFactory.getInstance().getPluginDao(
|
||||
"practicewarning");
|
||||
dao.purgeAllData();
|
||||
|
||||
} catch (DataAccessLayerException e) {
|
||||
statusHandler.error("Error failed to clear practice VTEC table", e);
|
||||
throw new Exception("Unable to clear practice VTEC table.", e);
|
||||
|
|
|
@ -21,8 +21,7 @@ package com.raytheon.uf.edex.activetable.handler;
|
|||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -60,6 +59,7 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* and use MergeVTEC.py to perform merge.
|
||||
* Jul 23, 2013 #2212 dgilling Fix ClassCastExceptions on flood
|
||||
* fields.
|
||||
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -160,21 +160,17 @@ public class MergeActiveTableHandler implements
|
|||
atr.setPhensig(template.get("phensig").toString());
|
||||
atr.setAct(template.get("act").toString());
|
||||
atr.setSeg((Integer) template.get("seg"));
|
||||
Calendar start = GregorianCalendar.getInstance();
|
||||
start.setTimeInMillis(((Number) template.get("startTime"))
|
||||
.longValue() * 1000L);
|
||||
Date start = new Date(
|
||||
((Number) template.get("startTime")).longValue() * 1000L);
|
||||
atr.setStartTime(start);
|
||||
Calendar end = GregorianCalendar.getInstance();
|
||||
end.setTimeInMillis(((Number) template.get("endTime"))
|
||||
.longValue() * 1000L);
|
||||
Date end = new Date(
|
||||
((Number) template.get("endTime")).longValue() * 1000L);
|
||||
atr.setEndTime(end);
|
||||
Calendar purge = GregorianCalendar.getInstance();
|
||||
purge.setTimeInMillis(((Number) template.get("purgeTime"))
|
||||
.longValue() * 1000L);
|
||||
Date purge = new Date(
|
||||
((Number) template.get("purgeTime")).longValue() * 1000L);
|
||||
atr.setPurgeTime(purge);
|
||||
Calendar issue = GregorianCalendar.getInstance();
|
||||
issue.setTimeInMillis(((Number) template.get("issueTime"))
|
||||
.longValue() * 1000L);
|
||||
Date issue = new Date(
|
||||
((Number) template.get("issueTime")).longValue() * 1000L);
|
||||
atr.setIssueTime(issue);
|
||||
atr.setUfn((Boolean) template.get("ufn"));
|
||||
atr.setOfficeid(template.get("officeid").toString());
|
||||
|
@ -187,22 +183,20 @@ public class MergeActiveTableHandler implements
|
|||
|
||||
Number floodBeginTime = (Number) template.get("floodBegin");
|
||||
if (floodBeginTime != null) {
|
||||
Calendar floodBegin = GregorianCalendar.getInstance();
|
||||
floodBegin
|
||||
.setTimeInMillis(floodBeginTime.longValue() * 1000L);
|
||||
Date floodBegin = new Date(
|
||||
floodBeginTime.longValue() * 1000L);
|
||||
atr.setFloodBegin(floodBegin);
|
||||
}
|
||||
Number floodCrestTime = (Number) template.get("floodCrest");
|
||||
if (floodCrestTime != null) {
|
||||
Calendar floodCrest = GregorianCalendar.getInstance();
|
||||
floodCrest
|
||||
.setTimeInMillis(floodCrestTime.longValue() * 1000L);
|
||||
Date floodCrest = new Date(
|
||||
floodCrestTime.longValue() * 1000L);
|
||||
atr.setFloodCrest(floodCrest);
|
||||
}
|
||||
Number floodEndTime = (Number) template.get("floodEnd");
|
||||
if (floodEndTime != null) {
|
||||
Calendar floodEnd = GregorianCalendar.getInstance();
|
||||
floodEnd.setTimeInMillis(floodEndTime.longValue() * 1000L);
|
||||
Date floodEnd = new Date(
|
||||
floodEndTime.longValue() * 1000L);
|
||||
atr.setFloodEnd(floodEnd);
|
||||
}
|
||||
atr.setFloodRecordStatus((String) template
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.raytheon.uf.edex.activetable.GetNextEtnUtil;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 19, 2013 #1843 dgilling Initial creation
|
||||
* Apr 28, 2015 #4027 randerso Expunged Calendar from ActiveTableRecord
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,8 +66,8 @@ public class UnlockActiveTablePhenSigHandler implements
|
|||
+ request.getSiteID() + "]: phensig= " + request.getPhensig()
|
||||
+ ", nextETN= " + request.getNewEtn());
|
||||
GetNextEtnUtil.setNextEtnAndUnlock(request.getSiteID(),
|
||||
request.getMode(), request.getPhensig(), request.getYear(),
|
||||
request.getNewEtn());
|
||||
request.getMode(), request.getPhensig(),
|
||||
request.getCurrentTime(), request.getNewEtn());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
# 02/26/13 1447 dgilling Implement __eq__() and
|
||||
# __ne__().
|
||||
# 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':
|
||||
return self.atr.getSeg()
|
||||
elif key == 'startTime':
|
||||
return self.atr.getStartTime().getTimeInMillis() / 1000
|
||||
return self.atr.getStartTime().getTime() / 1000
|
||||
elif key == 'endTime':
|
||||
return self.atr.getEndTime().getTimeInMillis() / 1000
|
||||
return self.atr.getEndTime().getTime() / 1000
|
||||
elif key == 'ufn':
|
||||
return self.atr.isUfn()
|
||||
elif key == 'officeid':
|
||||
return self.atr.getOfficeid()
|
||||
elif key == 'purgeTime':
|
||||
return self.atr.getPurgeTime().getTimeInMillis() / 1000
|
||||
return self.atr.getPurgeTime().getTime() / 1000
|
||||
elif key == 'issueTime':
|
||||
return self.atr.getIssueTime().getTimeInMillis() / 1000
|
||||
return self.atr.getIssueTime().getTime() / 1000
|
||||
elif key == 'state':
|
||||
return self.state
|
||||
elif key == 'xxxid':
|
||||
|
|
|
@ -29,7 +29,8 @@ import copy
|
|||
#
|
||||
# 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['act'] = atr.getAct()
|
||||
template['seg'] = atr.getSeg()
|
||||
template['startTime'] = atr.getStartTime().getTimeInMillis() / 1000
|
||||
template['endTime'] = atr.getEndTime().getTimeInMillis() / 1000
|
||||
template['startTime'] = atr.getStartTime().getTime() / 1000
|
||||
template['endTime'] = atr.getEndTime().getTime() / 1000
|
||||
template['ufn'] = atr.isUfn()
|
||||
template['officeid'] = atr.getOfficeid()
|
||||
template['purgeTime'] = atr.getPurgeTime().getTimeInMillis() / 1000
|
||||
template['issueTime'] = atr.getIssueTime().getTimeInMillis() / 1000
|
||||
template['purgeTime'] = atr.getPurgeTime().getTime() / 1000
|
||||
template['issueTime'] = atr.getIssueTime().getTime() / 1000
|
||||
template['state'] = "Decoded"
|
||||
template['xxxid'] = atr.getXxxid()
|
||||
|
||||
|
@ -98,7 +99,7 @@ def transfomActiveTableToThrift(table, mode='PRACTICE'):
|
|||
from dynamicserialize.dstypes.com.raytheon.uf.common.activetable.OperationalActiveTableRecord \
|
||||
import OperationalActiveTableRecord
|
||||
# TODO: Eliminate use of Calendar
|
||||
from dynamicserialize.dstypes.java.util import GregorianCalendar
|
||||
from dynamicserialize.dstypes.java.util import Date
|
||||
tableList = []
|
||||
|
||||
if mode.upper()=='PRACTICE':
|
||||
|
@ -120,17 +121,13 @@ def transfomActiveTableToThrift(table, mode='PRACTICE'):
|
|||
atr.setAct(template['act'])
|
||||
atr.setSeg(template['seg'])
|
||||
|
||||
start = GregorianCalendar.getInstance()
|
||||
start.setTimeInMillis(template['startTime'] * 1000)
|
||||
start = Date(template['startTime'] * 1000)
|
||||
atr.setStartTime(start)
|
||||
end = GregorianCalendar.getInstance()
|
||||
end.setTimeInMillis(template['endTime'] * 1000)
|
||||
end = Date(template['endTime'] * 1000)
|
||||
atr.setEndTime(end)
|
||||
purge = GregorianCalendar.getInstance()
|
||||
purge.setTimeInMillis(template['purgeTime'] * 1000)
|
||||
purge = Date(template['purgeTime'] * 1000)
|
||||
atr.setPurgeTime(purge)
|
||||
issue = GregorianCalendar.getInstance()
|
||||
issue.setTimeInMillis(template['issueTime'] * 1000)
|
||||
issue = Date(template['issueTime'] * 1000)
|
||||
atr.setIssueTime(issue)
|
||||
|
||||
atr.setUfn(template['ufn'])
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
# 01/24/14 2504 randerso change to use iscUtil.getLogger for consistency
|
||||
# 05/15/14 #3157 dgilling Support multiple TPC and SPC sites.
|
||||
# 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:
|
||||
continue
|
||||
|
||||
recIssueTime = float(rec.getIssueTime().getTimeInMillis() / TimeUtil.MILLIS_PER_SECOND)
|
||||
recIssueTime = float(rec.getIssueTime().getTime() / TimeUtil.MILLIS_PER_SECOND)
|
||||
#track latest
|
||||
issueTime = max(recIssueTime, issueTime)
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#Sun Mar 20 15:17:07 CDT 2011
|
||||
eclipse.preferences.version=1
|
||||
encoding//werkzeug/examples/plnt/__init__.py=utf-8
|
||||
encoding//werkzeug/werkzeug/http.py=utf-8
|
||||
|
|
|
@ -17,12 +17,20 @@
|
|||
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
# 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):
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, timeInMillis=None):
|
||||
self.time = None
|
||||
|
||||
def getTime(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue