Merge "Omaha #3091 Remove the use of aviationForecastConfig.xml file and only using OUP." into omaha_14.4.1
Former-commit-id:40b7623c87
[formerly40b7623c87
[formerly 1f786fd25cab2956c2cc3318a7adbabf6e8c306d]] Former-commit-id:87da8bd952
Former-commit-id:8baf897297
This commit is contained in:
commit
1776389eb7
14 changed files with 477 additions and 681 deletions
|
@ -25,8 +25,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import javax.xml.bind.JAXB;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
@ -44,7 +42,6 @@ import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Layout;
|
import org.eclipse.swt.widgets.Layout;
|
||||||
import org.eclipse.swt.widgets.List;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.raytheon.uf.common.localization.IPathManager;
|
import com.raytheon.uf.common.localization.IPathManager;
|
||||||
|
@ -61,10 +58,7 @@ import com.raytheon.viz.aviation.model.ForecastModel;
|
||||||
import com.raytheon.viz.aviation.observer.TafMonitorDlg;
|
import com.raytheon.viz.aviation.observer.TafMonitorDlg;
|
||||||
import com.raytheon.viz.aviation.resource.ResourceConfigMgr;
|
import com.raytheon.viz.aviation.resource.ResourceConfigMgr;
|
||||||
import com.raytheon.viz.aviation.utility.IBackupRestart;
|
import com.raytheon.viz.aviation.utility.IBackupRestart;
|
||||||
import com.raytheon.viz.aviation.xml.AviationForecasterConfig;
|
|
||||||
import com.raytheon.viz.aviation.xml.ForecasterConfig;
|
|
||||||
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
|
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
|
||||||
import com.raytheon.viz.avnconfig.AvnConfigFileUtil;
|
|
||||||
import com.raytheon.viz.avnconfig.ITafSiteConfig;
|
import com.raytheon.viz.avnconfig.ITafSiteConfig;
|
||||||
import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
@ -103,6 +97,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* 04/10/2013 1735 rferrel Changes for taf monitor speed up.
|
* 04/10/2013 1735 rferrel Changes for taf monitor speed up.
|
||||||
* 08/09/2013 2033 mschenke Switched File.separator to IPathManager.SEPARATOR
|
* 08/09/2013 2033 mschenke Switched File.separator to IPathManager.SEPARATOR
|
||||||
* 12 Aug 2013 #2256 lvenable Removed unnecessary font code and other code clean up.
|
* 12 Aug 2013 #2256 lvenable Removed unnecessary font code and other code clean up.
|
||||||
|
* 06 May 2014 3091 rferrel Use OUP authorization to bring up send dialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -113,10 +108,6 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(AviationDialog.class);
|
.getHandler(AviationDialog.class);
|
||||||
|
|
||||||
private static String FORECAST_CONFIG_FILE = "aviation"
|
|
||||||
+ IPathManager.SEPARATOR + "avnwatch" + IPathManager.SEPARATOR
|
|
||||||
+ "aviationForecasterConfig.xml";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Font list to dispose of.
|
* Font list to dispose of.
|
||||||
*/
|
*/
|
||||||
|
@ -153,30 +144,23 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
|
||||||
private ClimateMenuDlg climateMenuDlg;
|
private ClimateMenuDlg climateMenuDlg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selected user id number in the forecaster list.
|
* Label to display forecaster.
|
||||||
*/
|
*/
|
||||||
public static int USERID = 0;
|
private Label forecasterLabel;
|
||||||
|
|
||||||
/**
|
|
||||||
* Selected user name in the forecaster list control.
|
|
||||||
*/
|
|
||||||
public static String USERNAME = "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Selected user name in the forecaster list control.
|
|
||||||
*/
|
|
||||||
public static boolean USERTRANSMIT = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List control containing forecaster names.
|
|
||||||
*/
|
|
||||||
private List forecasterList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of dialogs currently open,
|
* Number of dialogs currently open,
|
||||||
*/
|
*/
|
||||||
private final AtomicInteger dlgCount = new AtomicInteger(0);
|
private final AtomicInteger dlgCount = new AtomicInteger(0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return forecaster
|
||||||
|
*/
|
||||||
|
public static String getForecaster() {
|
||||||
|
return LocalizationManager.getInstance().getCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a non-blocking dialog.
|
* Create a non-blocking dialog.
|
||||||
*
|
*
|
||||||
|
@ -286,7 +270,7 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
|
||||||
*/
|
*/
|
||||||
private void initializeComponents() {
|
private void initializeComponents() {
|
||||||
createLabel();
|
createLabel();
|
||||||
createList();
|
createForecasterLabel();
|
||||||
createComposite();
|
createComposite();
|
||||||
initAcarsSounding();
|
initAcarsSounding();
|
||||||
}
|
}
|
||||||
|
@ -316,13 +300,6 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
|
||||||
createAvnFPSLabel();
|
createAvnFPSLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the list on the display.
|
|
||||||
*/
|
|
||||||
private void createList() {
|
|
||||||
createForecasterList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the Composite that will contain the parts of the dialog.
|
* Create the Composite that will contain the parts of the dialog.
|
||||||
*/
|
*/
|
||||||
|
@ -476,65 +453,13 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the forecaster list.
|
* Create the forecaster label.
|
||||||
*/
|
*/
|
||||||
private void createForecasterList() {
|
private void createForecasterLabel() {
|
||||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
gd.heightHint = 200;
|
forecasterLabel = new Label(shell, SWT.CENTER);
|
||||||
forecasterList = new List(shell, SWT.BORDER | SWT.SINGLE);
|
forecasterLabel.setText(getForecaster());
|
||||||
forecasterList.setLayoutData(gd);
|
forecasterLabel.setLayoutData(gd);
|
||||||
|
|
||||||
forecasterList.addSelectionListener(new SelectionAdapter() {
|
|
||||||
@Override
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
updateUsername();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Load the Forecaster Configuration Information.
|
|
||||||
ArrayList<ForecasterConfig> forecasterArray = getForecasterConfig();
|
|
||||||
|
|
||||||
if (forecasterArray == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ForecasterConfig forecaster : forecasterArray) {
|
|
||||||
forecasterList.add(forecaster.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
forecasterList.setSelection(0);
|
|
||||||
|
|
||||||
updateUsername();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the user name and the transmit flag when a new users is selected
|
|
||||||
* from the list.
|
|
||||||
*/
|
|
||||||
private void updateUsername() {
|
|
||||||
USERNAME = forecasterList.getItem(forecasterList.getSelectionIndex());
|
|
||||||
if (USERNAME == null) {
|
|
||||||
USERID = 0;
|
|
||||||
USERNAME = "";
|
|
||||||
USERTRANSMIT = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<ForecasterConfig> forecasterArray = getForecasterConfig();
|
|
||||||
|
|
||||||
if (forecasterArray == null) {
|
|
||||||
USERID = 0;
|
|
||||||
USERTRANSMIT = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ForecasterConfig forecaster : forecasterArray) {
|
|
||||||
if (forecaster.getName().compareTo(USERNAME) == 0) {
|
|
||||||
USERID = forecaster.getId();
|
|
||||||
USERTRANSMIT = forecaster.getXmitPrivilege();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -544,58 +469,6 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
|
||||||
shell.dispose();
|
shell.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Forecaster Configuration information for current user.
|
|
||||||
*/
|
|
||||||
public static ArrayList<ForecasterConfig> getForecasterConfig() {
|
|
||||||
File f = AvnConfigFileUtil.getStaticFile(FORECAST_CONFIG_FILE);
|
|
||||||
ArrayList<ForecasterConfig> fcList = null;
|
|
||||||
ForecasterConfig fc = null;
|
|
||||||
String loginName = LocalizationManager.getInstance().getCurrentUser();
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (f == null) {
|
|
||||||
fcList = null;
|
|
||||||
} else {
|
|
||||||
fcList = JAXB.unmarshal(f, AviationForecasterConfig.class)
|
|
||||||
.getForecasterConfig();
|
|
||||||
}
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
statusHandler
|
|
||||||
.handle(Priority.PROBLEM,
|
|
||||||
"Error loading forecaster config no transmit privileges granted",
|
|
||||||
e);
|
|
||||||
fcList = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fcList == null) {
|
|
||||||
// Unable to determine transmit privileges
|
|
||||||
fc = new ForecasterConfig();
|
|
||||||
fc.setName(loginName);
|
|
||||||
fc.setXmit(false);
|
|
||||||
fcList = new ArrayList<ForecasterConfig>();
|
|
||||||
fcList.add(fc);
|
|
||||||
} else {
|
|
||||||
fc = null;
|
|
||||||
for (ForecasterConfig tmpFc : fcList) {
|
|
||||||
if (loginName.equals(tmpFc.getName())) {
|
|
||||||
fc = tmpFc;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fc == null) {
|
|
||||||
// Unknown user
|
|
||||||
fc = new ForecasterConfig();
|
|
||||||
fc.setName(loginName);
|
|
||||||
fc.setXmit(false);
|
|
||||||
}
|
|
||||||
fcList.clear();
|
|
||||||
fcList.add(fc);
|
|
||||||
}
|
|
||||||
return fcList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden method to restart the Taf Monitor.
|
* Overridden method to restart the Taf Monitor.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -234,6 +234,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* 02/12/2014 17076 lvenable Mark guidance tabs as not current so they get refreshed
|
* 02/12/2014 17076 lvenable Mark guidance tabs as not current so they get refreshed
|
||||||
* 02/19/2014 16980 zhao add code to ensure the Alt flag is false after the Alt kay is released
|
* 02/19/2014 16980 zhao add code to ensure the Alt flag is false after the Alt kay is released
|
||||||
* 21Mar2014 #2925 lvenable Fixed NPE error found during testing.
|
* 21Mar2014 #2925 lvenable Fixed NPE error found during testing.
|
||||||
|
* 06May2014 3091 rferrel Use OUP authorization to bring up send dialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -1783,9 +1784,9 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
||||||
syntaxBtn.addSelectionListener(new SelectionAdapter() {
|
syntaxBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
if ( checkBasicSyntaxError(true) ) {
|
if (checkBasicSyntaxError(true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
syntaxCheck();
|
syntaxCheck();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1816,11 +1817,13 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
||||||
Button sendBtn = new Button(buttonComp, SWT.PUSH);
|
Button sendBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
sendBtn.setText("Send");
|
sendBtn.setText("Send");
|
||||||
sendBtn.setLayoutData(gd);
|
sendBtn.setLayoutData(gd);
|
||||||
sendBtn.setEnabled(AviationDialog.USERTRANSMIT);
|
|
||||||
configMgr.setDefaultFontAndColors(sendBtn);
|
configMgr.setDefaultFontAndColors(sendBtn);
|
||||||
sendBtn.addSelectionListener(new SelectionAdapter() {
|
sendBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
|
if (!SendDialog.isAuthorized()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Assume editorTafTabComp is for the active tab.
|
// Assume editorTafTabComp is for the active tab.
|
||||||
if (editorTafTabComp.isTafSent()) {
|
if (editorTafTabComp.isTafSent()) {
|
||||||
putMessageToForecaster("Cannot send forecast: Forecast already sent");
|
putMessageToForecaster("Cannot send forecast: Forecast already sent");
|
||||||
|
@ -2843,7 +2846,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
||||||
.getTextEditorControl();
|
.getTextEditorControl();
|
||||||
StringBuilder sb = new StringBuilder("Printed by ");
|
StringBuilder sb = new StringBuilder("Printed by ");
|
||||||
|
|
||||||
sb.append(AviationDialog.USERNAME);
|
sb.append(AviationDialog.getForecaster());
|
||||||
sb.append(" on ");
|
sb.append(" on ");
|
||||||
sb.append(dt.format(Calendar.getInstance(
|
sb.append(dt.format(Calendar.getInstance(
|
||||||
TimeZone.getTimeZone("GMT")).getTime()));
|
TimeZone.getTimeZone("GMT")).getTime()));
|
||||||
|
@ -3694,10 +3697,10 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
||||||
if (endIndex == -1) {
|
if (endIndex == -1) {
|
||||||
endIndex = in.length();
|
endIndex = in.length();
|
||||||
}
|
}
|
||||||
boolean isWrapping = false;
|
boolean isWrapping = false;
|
||||||
String thisSite = "";
|
String thisSite = "";
|
||||||
String lastLine = "";
|
String lastLine = "";
|
||||||
String line = in.substring(beginIndex, endIndex);
|
String line = in.substring(beginIndex, endIndex);
|
||||||
int lineNumber = 1;
|
int lineNumber = 1;
|
||||||
Set<List<String>> keySet = results.keySet();
|
Set<List<String>> keySet = results.keySet();
|
||||||
int maxLevel = 0;
|
int maxLevel = 0;
|
||||||
|
@ -3707,9 +3710,9 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
||||||
int level = 0;
|
int level = 0;
|
||||||
int start = -1;
|
int start = -1;
|
||||||
int length = -1;
|
int length = -1;
|
||||||
|
|
||||||
if (line.startsWith("TAF")) {
|
if (line.startsWith("TAF")) {
|
||||||
thisSite = in.substring(endIndex+1, endIndex+5);
|
thisSite = in.substring(endIndex + 1, endIndex + 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!line.startsWith("TAF")) {
|
if (!line.startsWith("TAF")) {
|
||||||
|
@ -3739,25 +3742,33 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
||||||
.get(key);
|
.get(key);
|
||||||
|
|
||||||
if (lineNumber == keyLineNum) {
|
if (lineNumber == keyLineNum) {
|
||||||
if (!isWrappingLine(line,thisSite)) {
|
if (!isWrappingLine(line, thisSite)) {
|
||||||
isWrapping = false;
|
isWrapping = false;
|
||||||
text = result.get("text").toString() + "\n";
|
text = result.get("text").toString() + "\n";
|
||||||
level = Integer.parseInt(result.get("level").toString());
|
level = Integer.parseInt(result
|
||||||
start = Integer.parseInt(temp.substring(temp.indexOf('.') + 1));
|
.get("level").toString());
|
||||||
temp = key.get(1);
|
start = Integer.parseInt(temp
|
||||||
length = Integer.parseInt(temp.substring(temp.indexOf('.') + 1));
|
.substring(temp.indexOf('.') + 1));
|
||||||
length = length - start;
|
temp = key.get(1);
|
||||||
start = beginIndex + start;
|
length = Integer.parseInt(temp
|
||||||
break;
|
.substring(temp.indexOf('.') + 1));
|
||||||
} else {
|
length = length - start;
|
||||||
// a PROB30 group is wrapped in two lines
|
start = beginIndex + start;
|
||||||
isWrapping = true;
|
break;
|
||||||
text = result.get("text").toString() +"\n";
|
} else {
|
||||||
level = Integer.parseInt(result.get("level").toString());
|
// a PROB30 group is wrapped in two lines
|
||||||
start = beginIndex - 1 - lastLine.length() + lastLine.indexOf("PROB30");
|
isWrapping = true;
|
||||||
length = lastLine.substring(lastLine.indexOf("PROB30")).length() + 1 + line.length();
|
text = result.get("text").toString() + "\n";
|
||||||
break;
|
level = Integer.parseInt(result
|
||||||
}
|
.get("level").toString());
|
||||||
|
start = beginIndex - 1 - lastLine.length()
|
||||||
|
+ lastLine.indexOf("PROB30");
|
||||||
|
length = lastLine.substring(
|
||||||
|
lastLine.indexOf("PROB30"))
|
||||||
|
.length()
|
||||||
|
+ 1 + line.length();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3770,7 +3781,8 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
||||||
start = beginIndex + start;
|
start = beginIndex + start;
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleRange sr = new StyleRange(start, length, null,qcColors[level]);
|
StyleRange sr = new StyleRange(start, length, null,
|
||||||
|
qcColors[level]);
|
||||||
st.setStyleRange(sr);
|
st.setStyleRange(sr);
|
||||||
qcResultMap.put(sr, text);
|
qcResultMap.put(sr, text);
|
||||||
|
|
||||||
|
@ -3795,7 +3807,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
||||||
beginIndex = endIndex = in.length();
|
beginIndex = endIndex = in.length();
|
||||||
line = "";
|
line = "";
|
||||||
} else {
|
} else {
|
||||||
lastLine = line;
|
lastLine = line;
|
||||||
line = in.substring(beginIndex, endIndex);
|
line = in.substring(beginIndex, endIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3813,21 +3825,22 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
setMessageStatusError("An Error occured while performing the QC check.");
|
setMessageStatusError("An Error occured while performing the QC check.");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
setMessageStatusError("An Error occured while performing the QC check.");
|
setMessageStatusError("An Error occured while performing the QC check.");
|
||||||
} finally {
|
} finally {
|
||||||
setWaitCursor(false);
|
setWaitCursor(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWrappingLine(String line, String site) {
|
private boolean isWrappingLine(String line, String site) {
|
||||||
String tempLine = line.trim();
|
String tempLine = line.trim();
|
||||||
if (tempLine.startsWith(site)||tempLine.startsWith("TEMPO")||tempLine.startsWith("FM")||tempLine.startsWith("PROB30")) {
|
if (tempLine.startsWith(site) || tempLine.startsWith("TEMPO")
|
||||||
return false;
|
|| tempLine.startsWith("FM") || tempLine.startsWith("PROB30")) {
|
||||||
}
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read in the TAF viewer editor config XML.
|
* Read in the TAF viewer editor config XML.
|
||||||
*
|
*
|
||||||
* @return An array of viewer tab configuration data.
|
* @return An array of viewer tab configuration data.
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Layout;
|
import org.eclipse.swt.widgets.Layout;
|
||||||
import org.eclipse.swt.widgets.List;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Spinner;
|
import org.eclipse.swt.widgets.Spinner;
|
||||||
|
|
||||||
|
@ -52,7 +51,6 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||||
import com.raytheon.viz.aviation.AviationDialog;
|
import com.raytheon.viz.aviation.AviationDialog;
|
||||||
import com.raytheon.viz.aviation.editor.EditorTafTabComp;
|
import com.raytheon.viz.aviation.editor.EditorTafTabComp;
|
||||||
import com.raytheon.viz.aviation.resource.ResourceConfigMgr;
|
import com.raytheon.viz.aviation.resource.ResourceConfigMgr;
|
||||||
import com.raytheon.viz.aviation.xml.ForecasterConfig;
|
|
||||||
import com.raytheon.viz.avnconfig.IStatusSettable;
|
import com.raytheon.viz.avnconfig.IStatusSettable;
|
||||||
import com.raytheon.viz.avnconfig.ITafSiteConfig;
|
import com.raytheon.viz.avnconfig.ITafSiteConfig;
|
||||||
import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
||||||
|
@ -72,6 +70,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* 08AUG2012 15613 zhao Determine proper BBB for transmission
|
* 08AUG2012 15613 zhao Determine proper BBB for transmission
|
||||||
* 09OCT2012 1229 rferrel Make dialog non-blocking.
|
* 09OCT2012 1229 rferrel Make dialog non-blocking.
|
||||||
* 0yJUN2013 1981 mpduff Set user on the request.
|
* 0yJUN2013 1981 mpduff Set user on the request.
|
||||||
|
* 06May2014 3091 rferrel Use OUP authorization to bring up send dialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -111,9 +110,9 @@ public class SendDialog extends CaveSWTDialog {
|
||||||
private Spinner secondSpnr;
|
private Spinner secondSpnr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Person list control.
|
* Forecaster.
|
||||||
*/
|
*/
|
||||||
private List personList;
|
private Label forecasterLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tab composite containing the TAF Viewer and the TAF Editor.
|
* Tab composite containing the TAF Viewer and the TAF Editor.
|
||||||
|
@ -130,16 +129,29 @@ public class SendDialog extends CaveSWTDialog {
|
||||||
*/
|
*/
|
||||||
private Composite mainComp;
|
private Composite mainComp;
|
||||||
|
|
||||||
/**
|
|
||||||
* Forecaster array.
|
|
||||||
*/
|
|
||||||
private ArrayList<ForecasterConfig> forecasterArray = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the TAFs individually or as a collective.
|
* Send the TAFs individually or as a collective.
|
||||||
*/
|
*/
|
||||||
private final boolean sendCollective;
|
private final boolean sendCollective;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true when user authorized to send TAFs.
|
||||||
|
*/
|
||||||
|
public static boolean isAuthorized() {
|
||||||
|
TafQueueRequest request = new TafQueueRequest();
|
||||||
|
request.setType(Type.CHECK_AUTHORIZED);
|
||||||
|
request.setUser(UserController.getUserObject());
|
||||||
|
request.setState(TafQueueRecord.TafQueueState.SENT);
|
||||||
|
boolean response = false;
|
||||||
|
try {
|
||||||
|
ThriftClient.sendRequest(request);
|
||||||
|
response = true;
|
||||||
|
} catch (VizException e) {
|
||||||
|
response = false;
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
@ -295,21 +307,10 @@ public class SendDialog extends CaveSWTDialog {
|
||||||
configMgr.setDefaultFontAndColors(repsonsibleLbl);
|
configMgr.setDefaultFontAndColors(repsonsibleLbl);
|
||||||
|
|
||||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||||
personList = new List(listComp, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
|
forecasterLabel = new Label(listComp, SWT.CENTER);
|
||||||
personList.setLayoutData(gd);
|
forecasterLabel.setText(AviationDialog.getForecaster());
|
||||||
configMgr.setListBoxFont(personList);
|
forecasterLabel.setLayoutData(gd);
|
||||||
|
configMgr.setListBoxFont(forecasterLabel);
|
||||||
forecasterArray = AviationDialog.getForecasterConfig();
|
|
||||||
|
|
||||||
for (ForecasterConfig forecaster : forecasterArray) {
|
|
||||||
personList.add(forecaster.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = personList.indexOf(AviationDialog.USERNAME);
|
|
||||||
|
|
||||||
if (index >= 0) {
|
|
||||||
personList.select(index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -351,8 +352,7 @@ public class SendDialog extends CaveSWTDialog {
|
||||||
request.setUser(UserController.getUserObject());
|
request.setUser(UserController.getUserObject());
|
||||||
|
|
||||||
// Forecaster ID
|
// Forecaster ID
|
||||||
int forecasterId = forecasterArray.get(personList.getSelectionIndex())
|
String forecasterId = forecasterLabel.getText();
|
||||||
.getId();
|
|
||||||
Calendar xmitTime = Calendar.getInstance();
|
Calendar xmitTime = Calendar.getInstance();
|
||||||
xmitTime.setTimeZone(TimeZone.getTimeZone("GMT"));
|
xmitTime.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
xmitTime.set(Calendar.HOUR_OF_DAY, hourSpnr.getSelection());
|
xmitTime.set(Calendar.HOUR_OF_DAY, hourSpnr.getSelection());
|
||||||
|
@ -502,8 +502,7 @@ public class SendDialog extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
// TODO Auto-generated catch block
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return type + "A";
|
return type + "A";
|
||||||
|
|
|
@ -48,6 +48,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Initial creation
|
* Initial creation
|
||||||
* Oct 10, 2012 1229 rferrel Make dialog non-blocking.
|
* Oct 10, 2012 1229 rferrel Make dialog non-blocking.
|
||||||
|
* May 07, 2014 3091 rferrel Use OUP authorization to bring up send dialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -98,7 +99,7 @@ public class ResourceEditorDlg extends CaveSWTDialog implements IResize {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTopLabelAndButtons() {
|
private void createTopLabelAndButtons() {
|
||||||
String userName = AviationDialog.USERNAME;
|
String userName = AviationDialog.getForecaster();
|
||||||
|
|
||||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
Label title = new Label(shell, SWT.CENTER);
|
Label title = new Label(shell, SWT.CENTER);
|
||||||
|
|
|
@ -1,75 +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.
|
|
||||||
**/
|
|
||||||
package com.raytheon.viz.aviation.xml;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Aviation Forecaster Configuration
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* 2/7/2008 817 grichard Initial Creation.
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author grichard
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@XmlRootElement(name = "aviationForecasterConfig")
|
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
|
||||||
public class AviationForecasterConfig implements ISerializableObject {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The aviation forecaster configuration.
|
|
||||||
*/
|
|
||||||
@XmlElement(name = "forecaster")
|
|
||||||
private ArrayList<ForecasterConfig> forecasterConfig;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method that gets the aviation forecaster configuration
|
|
||||||
*
|
|
||||||
* @return forecasterConfig
|
|
||||||
*/
|
|
||||||
public ArrayList<ForecasterConfig> getForecasterConfig() {
|
|
||||||
return forecasterConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method that sets the aviation forecaster configuration
|
|
||||||
*
|
|
||||||
* @param forecasterConfig
|
|
||||||
* -- the aviation forecaster configuration
|
|
||||||
*/
|
|
||||||
public void setForecasterConfig(ArrayList<ForecasterConfig> forecasterConfig) {
|
|
||||||
this.forecasterConfig = forecasterConfig;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,90 +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.
|
|
||||||
**/
|
|
||||||
package com.raytheon.viz.aviation.xml;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Forecaster Configuration class
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* 2/6/2008 817 grichard Initial Creation.
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author grichard
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
|
||||||
public class ForecasterConfig {
|
|
||||||
/**
|
|
||||||
* The forecaster's id number
|
|
||||||
*/
|
|
||||||
@XmlElement(name = "id")
|
|
||||||
private String forecasterId = "0";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The forecaster's name
|
|
||||||
*/
|
|
||||||
@XmlElement(name = "name")
|
|
||||||
private String forecasterName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The forecaster's transmit privilege
|
|
||||||
*/
|
|
||||||
@XmlElement(name = "xmit")
|
|
||||||
private String xmitPrivilege;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getters and setters
|
|
||||||
*/
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return forecasterName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getXmitPrivilege() {
|
|
||||||
System.out.println("xmitPrivilege = " + xmitPrivilege);
|
|
||||||
return Boolean.parseBoolean(xmitPrivilege);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return Integer.parseInt(forecasterId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.forecasterName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setXmit(boolean privilege) {
|
|
||||||
this.xmitPrivilege = Boolean.toString(privilege);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.forecasterId = String.format("%1$03d", id);
|
|
||||||
}
|
|
||||||
}
|
|
18
deltaScripts/14.4.1/DR3091/alter_taf_queue.sh
Executable file
18
deltaScripts/14.4.1/DR3091/alter_taf_queue.sh
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# DR #3091 This changes the awips.taf_queue forecasterid column from type integer
|
||||||
|
# to a varchar converting any values in the table.
|
||||||
|
|
||||||
|
PSQL="/awips2/psql/bin/psql"
|
||||||
|
|
||||||
|
echo "INFO: Altering awips.taf_queue's forecaster column."
|
||||||
|
|
||||||
|
${PSQL} -U awips -d metadata -c "alter table awips.taf_queue alter column forecasterid set data type varchar(255)
|
||||||
|
using to_char(forecasterid, '000');"
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: Failed to alter tabelawips.taf_queue's column forecasterid."
|
||||||
|
echo "FATAL: The update has failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "INFO: awips.taf_queue's forecaster column altered successfully."
|
|
@ -48,6 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* Aug 27, 2009 avarani Initial creation
|
* Aug 27, 2009 avarani Initial creation
|
||||||
* Apr 30, 2012 14715 rferrel Refactored and moved.
|
* Apr 30, 2012 14715 rferrel Refactored and moved.
|
||||||
* Mar 21, 2013 15375 zhao Modified getInfo() to also handle VFT product
|
* Mar 21, 2013 15375 zhao Modified getInfo() to also handle VFT product
|
||||||
|
* May 07, 2014 3091 rferrel Use OUP authorization to bring up send dialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -57,7 +58,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "taf_queue")
|
@Table(name = "taf_queue")
|
||||||
@DynamicSerialize
|
@DynamicSerialize
|
||||||
public class TafQueueRecord implements IPersistableDataObject,
|
public class TafQueueRecord implements IPersistableDataObject<Integer>,
|
||||||
Comparable<TafQueueRecord> {
|
Comparable<TafQueueRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -73,7 +74,7 @@ public class TafQueueRecord implements IPersistableDataObject,
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
@Column
|
@Column
|
||||||
private int forecasterId;
|
private String forecasterId;
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
@Column(columnDefinition = "timestamp without time zone", nullable = false)
|
@Column(columnDefinition = "timestamp without time zone", nullable = false)
|
||||||
|
@ -134,7 +135,7 @@ public class TafQueueRecord implements IPersistableDataObject,
|
||||||
* @param stationId
|
* @param stationId
|
||||||
* @param headerTime
|
* @param headerTime
|
||||||
*/
|
*/
|
||||||
public TafQueueRecord(int forecasterId, Date xmitTime, String tafText,
|
public TafQueueRecord(String forecasterId, Date xmitTime, String tafText,
|
||||||
String bbb, String siteId, String wmoId, String stationId,
|
String bbb, String siteId, String wmoId, String stationId,
|
||||||
Date headerTime) {
|
Date headerTime) {
|
||||||
this.forecasterId = forecasterId;
|
this.forecasterId = forecasterId;
|
||||||
|
@ -159,14 +160,14 @@ public class TafQueueRecord implements IPersistableDataObject,
|
||||||
*/
|
*/
|
||||||
public String getInfo() {
|
public String getInfo() {
|
||||||
String productTag = "TAF";
|
String productTag = "TAF";
|
||||||
if (forecasterId == TafQueueVftConfigMgr.getInstance().getFcstid()) { // for
|
// for VFT product (DR15375)
|
||||||
// VFT
|
if ((forecasterId != null)
|
||||||
// product
|
&& forecasterId.equals(TafQueueVftConfigMgr.getInstance()
|
||||||
// (DR15375)
|
.getFcstid())) {
|
||||||
productTag = "VFT";
|
productTag = "VFT";
|
||||||
}
|
}
|
||||||
return String
|
return String
|
||||||
.format("%1$03d-%7$s%8$s%5$s-%6$s-%7$s-%2$ty%2$tm%2$td%2$tH%2$tM-%4$s-%9$d",
|
.format("%1$s-%7$s%8$s%5$s-%6$s-%7$s-%2$ty%2$tm%2$td%2$tH%2$tM-%4$s-%9$d",
|
||||||
forecasterId, headerTime, tafText, bbb, siteId, wmoId,
|
forecasterId, headerTime, tafText, bbb, siteId, wmoId,
|
||||||
stationId, productTag, (xmitTime.getTime() / 1000));
|
stationId, productTag, (xmitTime.getTime() / 1000));
|
||||||
}
|
}
|
||||||
|
@ -241,11 +242,11 @@ public class TafQueueRecord implements IPersistableDataObject,
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getForecasterId() {
|
public String getForecasterId() {
|
||||||
return forecasterId;
|
return forecasterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForecasterId(int forecasterId) {
|
public void setForecasterId(String forecasterId) {
|
||||||
this.forecasterId = forecasterId;
|
this.forecasterId = forecasterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,9 +298,15 @@ public class TafQueueRecord implements IPersistableDataObject,
|
||||||
this.wmoId = wmoId;
|
this.wmoId = wmoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject#
|
||||||
|
* getIdentifier()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object getIdentifier() {
|
public Integer getIdentifier() {
|
||||||
return id;
|
return getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -39,6 +39,7 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* May 3, 2012 14715 rferrel Initial creation
|
* May 3, 2012 14715 rferrel Initial creation
|
||||||
* Jun 07, 2013 1981 mpduff This is now an AbstractPrivilegedRequest
|
* Jun 07, 2013 1981 mpduff This is now an AbstractPrivilegedRequest
|
||||||
|
* May 08, 2014 3091 rferrel Added CHECK_AUTHORIZED.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -50,7 +51,7 @@ public class TafQueueRequest extends AbstractPrivilegedRequest implements
|
||||||
IServerRequest {
|
IServerRequest {
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
UNKNOWN, CREATE, GET_LIST, GET_LOG, GET_TAFS, REMOVE_SELECTED, RETRANSMIT
|
UNKNOWN, CREATE, GET_LIST, GET_LOG, GET_TAFS, REMOVE_SELECTED, RETRANSMIT, CHECK_AUTHORIZED
|
||||||
}
|
}
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.io.File;
|
||||||
|
|
||||||
import org.apache.commons.configuration.ConfigurationException;
|
import org.apache.commons.configuration.ConfigurationException;
|
||||||
import org.apache.commons.configuration.HierarchicalINIConfiguration;
|
import org.apache.commons.configuration.HierarchicalINIConfiguration;
|
||||||
|
import org.apache.commons.lang.math.NumberUtils;
|
||||||
|
|
||||||
import com.raytheon.uf.common.localization.IPathManager;
|
import com.raytheon.uf.common.localization.IPathManager;
|
||||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||||
|
@ -36,7 +37,8 @@ import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to read in configuration for AvnFPS verification (VFT) product.
|
* This class is used to read in configuration for AvnFPS verification (VFT)
|
||||||
|
* product.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
|
@ -45,129 +47,160 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 21, 2013 15375 zhao Initial creation
|
* Mar 21, 2013 15375 zhao Initial creation
|
||||||
|
* May 07, 2014 3091 rferrel fcstid now a string.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author zhao
|
* @author zhao
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TafQueueVftConfigMgr {
|
public class TafQueueVftConfigMgr {
|
||||||
|
|
||||||
private final IUFStatusHandler statusHandler = UFStatus.getHandler(TafQueueVftConfigMgr.class);
|
private final IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(TafQueueVftConfigMgr.class);
|
||||||
|
|
||||||
private static TafQueueVftConfigMgr instance = null;
|
private static TafQueueVftConfigMgr instance = null;
|
||||||
|
|
||||||
private String wmoid = "NXUS98"; // default, to be replaced by wmo in config file
|
/** Default, to be replaced by wmo in config file. */
|
||||||
private String siteid = "OAX"; // default (siteid in taf_queue table)
|
private String wmoid = "NXUS98";
|
||||||
private String stationid = "KOAX"; // default (stationid in taf_queue table)
|
|
||||||
private int fcstid = 0; // default forecasterid for VFT
|
/** Default (siteid in taf_queue table). */
|
||||||
private int period = 6; // number of hours; default period for VFT product creation, to be replaced by period in config file
|
private String siteid = "OAX";
|
||||||
|
|
||||||
|
/** Default (stationid in taf_queue table). */
|
||||||
|
private String stationid = "KOAX";
|
||||||
|
|
||||||
|
/** Default forecasterid for VFT. */
|
||||||
|
private String fcstid = "000";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of hours; default period for VFT product creation, to be replaced
|
||||||
|
* by period in config file.
|
||||||
|
*/
|
||||||
|
private int period = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BBB field for VFT product; non-configurable
|
* BBB field for VFT product; non-configurable
|
||||||
*/
|
*/
|
||||||
private String bbb = "___";
|
private String bbb = "___";
|
||||||
|
|
||||||
private static final String XMIT_FILE = "aviation" + File.separator + "config" + File.separator + "xmit.cfg";
|
private static final String XMIT_FILE = "aviation" + File.separator
|
||||||
|
+ "config" + File.separator + "xmit.cfg";
|
||||||
private HierarchicalINIConfiguration xmitConfig = null;
|
|
||||||
|
private HierarchicalINIConfiguration xmitConfig = null;
|
||||||
public static TafQueueVftConfigMgr getInstance() {
|
|
||||||
if ( instance == null ) {
|
public static synchronized TafQueueVftConfigMgr getInstance() {
|
||||||
instance = new TafQueueVftConfigMgr();
|
if (instance == null) {
|
||||||
}
|
instance = new TafQueueVftConfigMgr();
|
||||||
return instance;
|
}
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TafQueueVftConfigMgr() {
|
private TafQueueVftConfigMgr() {
|
||||||
// read in configuration
|
// read in configuration
|
||||||
loadXmitConfigFile();
|
loadXmitConfigFile();
|
||||||
if ( xmitConfig != null ) {
|
if (xmitConfig != null) {
|
||||||
readConfiguration();
|
readConfiguration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadXmitConfigFile() {
|
private void loadXmitConfigFile() {
|
||||||
IPathManager pm = PathManagerFactory.getPathManager();
|
IPathManager pm = PathManagerFactory.getPathManager();
|
||||||
LocalizationContext context = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
LocalizationContext context = pm.getContext(
|
||||||
|
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
||||||
LocalizationFile lFile = pm.getLocalizationFile(context, XMIT_FILE);
|
LocalizationFile lFile = pm.getLocalizationFile(context, XMIT_FILE);
|
||||||
HierarchicalINIConfiguration config = new HierarchicalINIConfiguration();
|
HierarchicalINIConfiguration config = new HierarchicalINIConfiguration();
|
||||||
config.setDelimiterParsingDisabled(true);
|
config.setDelimiterParsingDisabled(true);
|
||||||
try {
|
try {
|
||||||
config.load(lFile.getFile());
|
config.load(lFile.getFile());
|
||||||
} catch (ConfigurationException e) {
|
} catch (ConfigurationException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM, "Tafqueue VFT Configuration Manager: loading xmit.cfg file failed.\n" + e.getLocalizedMessage(), e);
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
return;
|
"Tafqueue VFT Configuration Manager: loading xmit.cfg file failed.\n"
|
||||||
}
|
+ e.getLocalizedMessage(), e);
|
||||||
this.xmitConfig =config;
|
return;
|
||||||
}
|
}
|
||||||
|
this.xmitConfig = config;
|
||||||
private void readConfiguration() {
|
}
|
||||||
try {
|
|
||||||
String wmo = xmitConfig.getString("verification.wmo");
|
|
||||||
String [] wmosplits = wmo.split(" ");
|
|
||||||
wmoid = wmosplits[0];
|
|
||||||
stationid = wmosplits[1];
|
|
||||||
siteid = stationid.substring(1);
|
|
||||||
String fcstidStr = xmitConfig.getString("verification.fcstid");
|
|
||||||
fcstid = Integer.parseInt(fcstidStr);
|
|
||||||
String periodStr = xmitConfig.getString("verification.period");
|
|
||||||
period = Integer.parseInt(periodStr);
|
|
||||||
} catch (Exception e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM, "Tafqueue VFT Configuration Manager: error occurred while reading configuration.\n" + e.getLocalizedMessage(), e);
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT Configuration Manager: wmo = " + wmoid + " " + stationid + "; forecasterid = " + fcstid + "; period = " + period );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWmoid() {
|
private void readConfiguration() {
|
||||||
return wmoid;
|
try {
|
||||||
}
|
String wmo = xmitConfig.getString("verification.wmo");
|
||||||
|
String[] wmosplits = wmo.split(" ");
|
||||||
|
wmoid = wmosplits[0];
|
||||||
|
stationid = wmosplits[1];
|
||||||
|
siteid = stationid.substring(1);
|
||||||
|
String fcstidStr = xmitConfig.getString("verification.fcstid");
|
||||||
|
if (fcstidStr != null) {
|
||||||
|
setFcstid(fcstidStr);
|
||||||
|
}
|
||||||
|
String periodStr = xmitConfig.getString("verification.period");
|
||||||
|
period = Integer.parseInt(periodStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM,
|
||||||
|
"Tafqueue VFT Configuration Manager: error occurred while reading configuration.\n"
|
||||||
|
+ e.getLocalizedMessage(), e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
statusHandler.handle(Priority.INFO,
|
||||||
|
"Tafqueue VFT Configuration Manager: wmo = " + wmoid + " "
|
||||||
|
+ stationid + "; forecasterid = " + fcstid
|
||||||
|
+ "; period = " + period);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
public void setWmoid(String wmoid) {
|
public String getWmoid() {
|
||||||
this.wmoid = wmoid;
|
return wmoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSiteid() {
|
public void setWmoid(String wmoid) {
|
||||||
return siteid;
|
this.wmoid = wmoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSiteid(String siteid) {
|
public String getSiteid() {
|
||||||
this.siteid = siteid;
|
return siteid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStationid() {
|
public void setSiteid(String siteid) {
|
||||||
return stationid;
|
this.siteid = siteid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStationid(String stationid) {
|
public String getStationid() {
|
||||||
this.stationid = stationid;
|
return stationid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFcstid() {
|
public void setStationid(String stationid) {
|
||||||
return fcstid;
|
this.stationid = stationid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFcstid(int fcstid) {
|
public String getFcstid() {
|
||||||
this.fcstid = fcstid;
|
return fcstid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPeriod() {
|
public void setFcstid(String fcstid) {
|
||||||
return period;
|
if (NumberUtils.isNumber(fcstid)) {
|
||||||
}
|
// Handle old style ids.
|
||||||
|
int id = Integer.parseInt(fcstid);
|
||||||
|
this.fcstid = String.format("%03d", id);
|
||||||
|
} else {
|
||||||
|
this.fcstid = fcstid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setPeriod(int period) {
|
public int getPeriod() {
|
||||||
this.period = period;
|
return period;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBbb() {
|
public void setPeriod(int period) {
|
||||||
return bbb;
|
this.period = period;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBbb() {
|
||||||
|
return bbb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBbb(String bbb) {
|
||||||
|
this.bbb = bbb;
|
||||||
|
}
|
||||||
|
|
||||||
public void setBbb(String bbb) {
|
|
||||||
this.bbb = bbb;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* May 1, 2012 14715 rferrel Initial creation
|
* May 1, 2012 14715 rferrel Initial creation
|
||||||
* Mar 21, 2013 15375 zhao Added methods for handling VFT product
|
* Mar 21, 2013 15375 zhao Added methods for handling VFT product
|
||||||
|
* May 07, 2014 3091 rferrel forecasterId now a string.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -277,40 +278,49 @@ public class TafQueueDao extends CoreDao {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (for DR15375)
|
* (for DR15375) Get last xmit time for a forecaster id (for VFT purpose)
|
||||||
* Get last xmit time for a forecaster id (for VFT purpose)
|
*
|
||||||
* @param forecasterid
|
* @param forecasterid
|
||||||
* @return last xmittime; return null if no record exists
|
* @return last xmittime; return null if no record exists
|
||||||
* @throws DataAccessLayerException
|
* @throws DataAccessLayerException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Date getLastXmitTimeByForecasterId(int forecasterid) throws DataAccessLayerException {
|
public Date getLastXmitTimeByForecasterId(String forecasterid)
|
||||||
Date lastXmittime = null;
|
throws DataAccessLayerException {
|
||||||
DatabaseQuery query = new DatabaseQuery(TafQueueRecord.class.getName());
|
Date lastXmittime = null;
|
||||||
query.addQueryParam("forecasterId", forecasterid, QueryOperand.EQUALS);
|
DatabaseQuery query = new DatabaseQuery(TafQueueRecord.class.getName());
|
||||||
query.addOrder("xmitTime", false);
|
query.addQueryParam("forecasterId", forecasterid, QueryOperand.EQUALS);
|
||||||
List<TafQueueRecord> records = (List<TafQueueRecord>) queryByCriteria(query);
|
query.addOrder("xmitTime", false);
|
||||||
if ( records.size() > 0 ) {
|
List<TafQueueRecord> records = (List<TafQueueRecord>) queryByCriteria(query);
|
||||||
lastXmittime = records.get(0).getXmitTime();
|
if (records.size() > 0) {
|
||||||
}
|
lastXmittime = records.get(0).getXmitTime();
|
||||||
return lastXmittime;
|
}
|
||||||
}
|
return lastXmittime;
|
||||||
|
}
|
||||||
|
|
||||||
/** (for DR15375)
|
/**
|
||||||
* Retrieves a list of TAF records sent since the last VFT product was created
|
* (for DR15375) Retrieves a list of TAF records sent since the last VFT
|
||||||
* @param lastVftTime (last VFT creation time)
|
* product was created
|
||||||
* @param forecasterid (forecaster ID for VFT)
|
*
|
||||||
* @return a list of TAF records sent since lastVftTime or null when no such records exit
|
* @param lastVftTime
|
||||||
|
* (last VFT creation time)
|
||||||
|
* @param forecasterid
|
||||||
|
* (forecaster ID for VFT)
|
||||||
|
* @return a list of TAF records sent since lastVftTime or null when no such
|
||||||
|
* records exit
|
||||||
* @throws DataAccessLayerException
|
* @throws DataAccessLayerException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<TafQueueRecord> getRecordsForVFT(Date lastVftTime, int forecasterid) throws DataAccessLayerException {
|
public List<TafQueueRecord> getRecordsForVFT(Date lastVftTime,
|
||||||
DatabaseQuery query = new DatabaseQuery(TafQueueRecord.class.getName());
|
String forecasterid) throws DataAccessLayerException {
|
||||||
query.addQueryParam("xmitTime", lastVftTime, QueryOperand.GREATERTHANEQUALS);
|
DatabaseQuery query = new DatabaseQuery(TafQueueRecord.class.getName());
|
||||||
query.addQueryParam("forecasterId", forecasterid, QueryOperand.NOTEQUALS);
|
query.addQueryParam("xmitTime", lastVftTime,
|
||||||
query.addQueryParam("state", TafQueueState.SENT, QueryOperand.EQUALS);
|
QueryOperand.GREATERTHANEQUALS);
|
||||||
query.addOrder("xmitTime", true);
|
query.addQueryParam("forecasterId", forecasterid,
|
||||||
List<TafQueueRecord> records = (List<TafQueueRecord>) queryByCriteria(query);
|
QueryOperand.NOTEQUALS);
|
||||||
return records;
|
query.addQueryParam("state", TafQueueState.SENT, QueryOperand.EQUALS);
|
||||||
}
|
query.addOrder("xmitTime", true);
|
||||||
|
List<TafQueueRecord> records = (List<TafQueueRecord>) queryByCriteria(query);
|
||||||
|
return records;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||||
* May 1, 2012 14715 rferrel Initial creation
|
* May 1, 2012 14715 rferrel Initial creation
|
||||||
* May 08, 2013 1814 rjpeter Added time to live to topic
|
* May 08, 2013 1814 rjpeter Added time to live to topic
|
||||||
* Jun 07, 2013 1981 mpduff TafQueueRequest is now protected.
|
* Jun 07, 2013 1981 mpduff TafQueueRequest is now protected.
|
||||||
|
* May 08, 2014 3091 rferrel Added CHECK_AUTHORIZED.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author rferrel
|
* @author rferrel
|
||||||
|
@ -140,6 +141,10 @@ public class TafQueueRequestHandler extends
|
||||||
sendNotification(Type.RETRANSMIT);
|
sendNotification(Type.RETRANSMIT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CHECK_AUTHORIZED:
|
||||||
|
response = new ServerResponse<String>();
|
||||||
|
response.addMessage("User is authorized.");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
response = new ServerResponse<String>();
|
response = new ServerResponse<String>();
|
||||||
response.addMessage("Unknown type: " + request.getType());
|
response.addMessage("Unknown type: " + request.getType());
|
||||||
|
|
|
@ -42,163 +42,201 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 07, 2013 15375 zhao Initial creation
|
* Mar 07, 2013 15375 zhao Initial creation
|
||||||
|
* May 07, 2014 3091 rferrel fcstid now a String.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author zhao
|
* @author zhao
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TafQueueVFTMgr {
|
public class TafQueueVFTMgr {
|
||||||
|
|
||||||
private final IUFStatusHandler statusHandler = UFStatus.getHandler(TafQueueVFTMgr.class);
|
private final IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(TafQueueVFTMgr.class);
|
||||||
private static TafQueueVFTMgr instance = null;
|
|
||||||
|
private static TafQueueVFTMgr instance = null;
|
||||||
|
|
||||||
private TafQueueVftConfigMgr config = null;
|
private TafQueueVftConfigMgr config = null;
|
||||||
|
|
||||||
private String wmoid = "NXUS98"; // default, to be replaced by wmo in config file
|
/** The wmo in config file. */
|
||||||
private String siteid = "OAX"; // default (siteid in taf_queue table)
|
private String wmoid;
|
||||||
private String stationid = "KOAX"; // default (stationid in taf_queue table)
|
|
||||||
private int fcstid = 0; // default forecasterid for VFT
|
/** The siteid in config file. */
|
||||||
private int period = 6; // number of hours; default period of VFT product creation, to be replaced by period in config file
|
private String siteid;
|
||||||
private String bbb = "___"; // default BBB field for a VFT product
|
|
||||||
|
/** The stationid in config file. */
|
||||||
|
private String stationid;
|
||||||
|
|
||||||
|
/** The forecasterid for VFT in config file. */
|
||||||
|
private String fcstid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of hours; default period of VFT product creation, to be replaced
|
||||||
|
* by period in config file.
|
||||||
|
*/
|
||||||
|
private int period;
|
||||||
|
|
||||||
|
/** Default BBB field for a VFT product. */
|
||||||
|
private String bbb;
|
||||||
|
|
||||||
private Date lastVftTime = null;
|
private Date lastVftTime = null;
|
||||||
|
|
||||||
private Date nextVftTime = null;
|
private Date nextVftTime = null;
|
||||||
|
|
||||||
private TafQueueVFTMgr() {
|
private TafQueueVFTMgr() {
|
||||||
init();
|
init();
|
||||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager created.");
|
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager created.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an AvnFPS VFT product, and updates time for next VFT product
|
* Create an AvnFPS VFT product, and updates time for next VFT product,
|
||||||
*/
|
*/
|
||||||
public void makeVftProduct() {
|
public void makeVftProduct() {
|
||||||
TafQueueDao dao = new TafQueueDao();
|
TafQueueDao dao = new TafQueueDao();
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
|
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
nextVftTime = cal.getTime();
|
nextVftTime = cal.getTime();
|
||||||
try {
|
try {
|
||||||
List<TafQueueRecord> records = dao.getRecordsForVFT(lastVftTime, fcstid);
|
List<TafQueueRecord> records = dao.getRecordsForVFT(lastVftTime,
|
||||||
if (records != null) {
|
fcstid);
|
||||||
if (records.size() > 0) {
|
if (records != null) {
|
||||||
StringBuilder sb = new StringBuilder();
|
if (records.size() > 0) {
|
||||||
for (TafQueueRecord record : records) {
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(formatVftTafRecord(record));
|
for (TafQueueRecord record : records) {
|
||||||
sb.append("\n");
|
sb.append(formatVftTafRecord(record));
|
||||||
}
|
sb.append("\n");
|
||||||
String vftText = sb.toString();
|
}
|
||||||
vftText = vftText.substring(0, vftText.length()-1);
|
String vftText = sb.toString();
|
||||||
TafQueueRecord vftRecord = new TafQueueRecord(fcstid, nextVftTime, vftText, bbb, siteid, wmoid, stationid, nextVftTime);
|
vftText = vftText.substring(0, vftText.length() - 1);
|
||||||
dao.create(vftRecord);
|
TafQueueRecord vftRecord = new TafQueueRecord(fcstid,
|
||||||
}
|
nextVftTime, vftText, bbb, siteid, wmoid,
|
||||||
}
|
stationid, nextVftTime);
|
||||||
} catch (Exception e) {
|
dao.create(vftRecord);
|
||||||
statusHandler.handle(Priority.PROBLEM,"Tafqueue VFT manager: error occurred while making a VFT product.\n" + e.getLocalizedMessage(), e);
|
}
|
||||||
}
|
}
|
||||||
lastVftTime = nextVftTime;
|
} catch (Exception e) {
|
||||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Last VFT xmit time = " + lastVftTime.toString());
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
cal.add(Calendar.HOUR_OF_DAY, period);
|
"Tafqueue VFT manager: error occurred while making a VFT product.\n"
|
||||||
nextVftTime = cal.getTime();
|
+ e.getLocalizedMessage(), e);
|
||||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Next VFT xmit time = " + nextVftTime.toString());
|
}
|
||||||
}
|
lastVftTime = nextVftTime;
|
||||||
|
statusHandler.handle(
|
||||||
|
Priority.INFO,
|
||||||
|
"Tafqueue VFT manager: Last VFT xmit time = "
|
||||||
|
+ lastVftTime.toString());
|
||||||
|
cal.add(Calendar.HOUR_OF_DAY, period);
|
||||||
|
nextVftTime = cal.getTime();
|
||||||
|
statusHandler.handle(
|
||||||
|
Priority.INFO,
|
||||||
|
"Tafqueue VFT manager: Next VFT xmit time = "
|
||||||
|
+ nextVftTime.toString());
|
||||||
|
}
|
||||||
|
|
||||||
private String formatVftTafRecord(TafQueueRecord record) {
|
private String formatVftTafRecord(TafQueueRecord record) {
|
||||||
String tafText = record.getTafText();
|
String tafText = record.getTafText();
|
||||||
int indexOfTafPeriod = tafText.indexOf('/');
|
int indexOfTafPeriod = tafText.indexOf('/');
|
||||||
String tafPeriod = tafText.substring(indexOfTafPeriod-4, indexOfTafPeriod+5);
|
String tafPeriod = tafText.substring(indexOfTafPeriod - 4,
|
||||||
String tafBbb = record.getBbb();
|
indexOfTafPeriod + 5);
|
||||||
if ( tafBbb.equals("") || tafBbb.equals(" ") ) {
|
String tafBbb = record.getBbb();
|
||||||
tafBbb = "___";
|
if (tafBbb.equals("") || tafBbb.equals(" ")) {
|
||||||
}
|
tafBbb = "___";
|
||||||
return String.format("%1$s %2$s %3$ty%3$tm%3$td%3$tH%4$s " +
|
}
|
||||||
"%5$s %6$s %7$ty%7$tm%7$td%7$tH%7$tm%8$s %9$s %10$03d",
|
return String.format("%1$s %2$s %3$ty%3$tm%3$td%3$tH%4$s "
|
||||||
record.getWmoId(), record.getStationId(), record.getHeaderTime(), "00",
|
+ "%5$s %6$s %7$ty%7$tm%7$td%7$tH%7$tm%8$s %9$s %10$s",
|
||||||
tafBbb, record.getStationId().charAt(0)+record.getSiteId(),
|
record.getWmoId(), record.getStationId(),
|
||||||
record.getXmitTime(), "Z", tafPeriod, record.getForecasterId());
|
record.getHeaderTime(), "00", tafBbb, record.getStationId()
|
||||||
}
|
.charAt(0) + record.getSiteId(), record.getXmitTime(),
|
||||||
|
"Z", tafPeriod, record.getForecasterId());
|
||||||
private void init() {
|
|
||||||
config = TafQueueVftConfigMgr.getInstance();
|
|
||||||
wmoid = config.getWmoid();
|
|
||||||
siteid = config.getSiteid();
|
|
||||||
stationid = config.getStationid();
|
|
||||||
fcstid = config.getFcstid();
|
|
||||||
period = config.getPeriod();
|
|
||||||
bbb = config.getBbb();
|
|
||||||
|
|
||||||
// determine lastVftTime and nextVftTime
|
|
||||||
TafQueueDao dao = new TafQueueDao();
|
|
||||||
try {
|
|
||||||
lastVftTime = dao.getLastXmitTimeByForecasterId(fcstid);
|
|
||||||
} catch (DataAccessLayerException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM, "Tafqueue VFT manager: error occurred while querying for last VFT xmit time.\n" + e.getLocalizedMessage(), e);
|
|
||||||
}
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
|
|
||||||
if ( lastVftTime == null ) {
|
|
||||||
nextVftTime = cal.getTime();
|
|
||||||
cal.add(Calendar.HOUR_OF_DAY, -period);
|
|
||||||
lastVftTime = cal.getTime();
|
|
||||||
} else {
|
|
||||||
cal.setTime(lastVftTime);
|
|
||||||
cal.add(Calendar.HOUR_OF_DAY, period);
|
|
||||||
nextVftTime = cal.getTime();
|
|
||||||
}
|
|
||||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Last VFT xmit time = " + lastVftTime.toString());
|
|
||||||
statusHandler.handle(Priority.INFO, "Tafqueue VFT manager: Next VFT xmit time = " + nextVftTime.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TafQueueVFTMgr getInstance() {
|
|
||||||
if ( instance == null ) {
|
|
||||||
instance = new TafQueueVFTMgr();
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWmoid(String wmoid) {
|
|
||||||
this.wmoid = wmoid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWmoid() {
|
private void init() {
|
||||||
return wmoid;
|
config = TafQueueVftConfigMgr.getInstance();
|
||||||
}
|
wmoid = config.getWmoid();
|
||||||
|
siteid = config.getSiteid();
|
||||||
|
stationid = config.getStationid();
|
||||||
|
fcstid = config.getFcstid();
|
||||||
|
period = config.getPeriod();
|
||||||
|
bbb = config.getBbb();
|
||||||
|
|
||||||
public void setPeriod(int period) {
|
// determine lastVftTime and nextVftTime
|
||||||
this.period = period;
|
TafQueueDao dao = new TafQueueDao();
|
||||||
}
|
try {
|
||||||
|
lastVftTime = dao.getLastXmitTimeByForecasterId(fcstid);
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Tafqueue VFT manager: error occurred while querying for last VFT xmit time.\n"
|
||||||
|
+ e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
|
if (lastVftTime == null) {
|
||||||
|
nextVftTime = cal.getTime();
|
||||||
|
cal.add(Calendar.HOUR_OF_DAY, -period);
|
||||||
|
lastVftTime = cal.getTime();
|
||||||
|
} else {
|
||||||
|
cal.setTime(lastVftTime);
|
||||||
|
cal.add(Calendar.HOUR_OF_DAY, period);
|
||||||
|
nextVftTime = cal.getTime();
|
||||||
|
}
|
||||||
|
statusHandler.handle(
|
||||||
|
Priority.INFO,
|
||||||
|
"Tafqueue VFT manager: Last VFT xmit time = "
|
||||||
|
+ lastVftTime.toString());
|
||||||
|
statusHandler.handle(
|
||||||
|
Priority.INFO,
|
||||||
|
"Tafqueue VFT manager: Next VFT xmit time = "
|
||||||
|
+ nextVftTime.toString());
|
||||||
|
}
|
||||||
|
|
||||||
public int getPeriod() {
|
public static synchronized TafQueueVFTMgr getInstance() {
|
||||||
return period;
|
if (instance == null) {
|
||||||
}
|
instance = new TafQueueVFTMgr();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
public void setSiteid(String siteid) {
|
public void setWmoid(String wmoid) {
|
||||||
this.siteid = siteid;
|
this.wmoid = wmoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSiteid() {
|
public String getWmoid() {
|
||||||
return siteid;
|
return wmoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStationid(String stationid) {
|
public void setPeriod(int period) {
|
||||||
this.stationid = stationid;
|
this.period = period;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStationid() {
|
public int getPeriod() {
|
||||||
return stationid;
|
return period;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFcstid(int fcstid) {
|
public void setSiteid(String siteid) {
|
||||||
this.fcstid = fcstid;
|
this.siteid = siteid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFcstid() {
|
public String getSiteid() {
|
||||||
return fcstid;
|
return siteid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getNextVftTime() {
|
public void setStationid(String stationid) {
|
||||||
return nextVftTime;
|
this.stationid = stationid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getStationid() {
|
||||||
|
return stationid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFcstid(String fcstid) {
|
||||||
|
this.fcstid = fcstid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFcstid() {
|
||||||
|
return fcstid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getNextVftTime() {
|
||||||
|
return nextVftTime;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
<aviationForecasterConfig>
|
|
||||||
<forecaster>
|
|
||||||
<id>001</id>
|
|
||||||
<name>Amanda</name>
|
|
||||||
<xmit>true</xmit>
|
|
||||||
</forecaster>
|
|
||||||
<forecaster>
|
|
||||||
<id>002</id>
|
|
||||||
<name>Bailing</name>
|
|
||||||
<xmit>true</xmit>
|
|
||||||
</forecaster>
|
|
||||||
<forecaster>
|
|
||||||
<id>003</id>
|
|
||||||
<name>Belinda</name>
|
|
||||||
<xmit>true</xmit>
|
|
||||||
</forecaster>
|
|
||||||
<forecaster>
|
|
||||||
<id>004</id>
|
|
||||||
<name>George</name>
|
|
||||||
<xmit>true</xmit>
|
|
||||||
</forecaster>
|
|
||||||
<forecaster>
|
|
||||||
<id>005</id>
|
|
||||||
<name>Mark</name>
|
|
||||||
<xmit>true</xmit>
|
|
||||||
</forecaster>
|
|
||||||
<forecaster>
|
|
||||||
<id>006</id>
|
|
||||||
<name>Matt</name>
|
|
||||||
<xmit>true</xmit>
|
|
||||||
</forecaster>
|
|
||||||
<forecaster>
|
|
||||||
<id>007</id>
|
|
||||||
<name>Mike</name>
|
|
||||||
<xmit>true</xmit>
|
|
||||||
</forecaster>
|
|
||||||
</aviationForecasterConfig>
|
|
Loading…
Add table
Reference in a new issue