Merge branch 'omaha_16.2.1' into field_16.2.1

Change-Id: Ib193c2e2f06fd4b36560b8baeeaa8ecc2266228a

Former-commit-id: 6e5ce4d828b936561da1f5cca85b735a08763857
This commit is contained in:
Ana Rivera 2015-10-23 15:35:21 +00:00
commit df408c7633
58 changed files with 2231 additions and 1179 deletions

View file

@ -120,7 +120,7 @@ public class ElevationInfo {
private ArrayList<VCPInfo> vcpInfo = new ArrayList<VCPInfo>(); private ArrayList<VCPInfo> vcpInfo = new ArrayList<VCPInfo>();
private HashMap<Sel, int[]> staticInfo = new HashMap<Sel, int[]>(); private HashMap<Sel, int[]> staticInfo = new HashMap<Sel, int[]>();
public ElevationInfo() { /*package*/ ElevationInfo() {
Scanner fs; Scanner fs;
InputStream s; InputStream s;

View file

@ -0,0 +1,113 @@
#!/bin/bash
# This script can be used to install additional features into CAVE. This
# script will also handle the removal and installation of a feature if
# a feature is upgraded.
# This script currently expects two arguments: the location of the Eclipse repository
# and the id of the feature that should be installed.
# Only the root user and the awips user are able to successfully run this script.
if [ "${USER}" != "root" -a "${USER}" != "awips" ]; then
echo "ERROR: ${USER} does not have the required privileges to run ${0}."
exit 1
fi
_awips_tmp_dir=/awips2/tmp
_cave_install_prefix=cave-install-
# Common function to print usage information.
function usage() {
echo "Usage: ${0} <repository-location> <feature-id>"
echo "Example: ${0} /path/to/repo-location/eclipse/v2.7 com.raytheon.uf.viz.base.feature"
exit 1
}
# Verify that the expected arguments have been provided.
if [ $# -ne 2 ]; then
echo "ERROR: Invalid arguments provided!"
usage
fi
repository_loc=${1}
feature_id=${2}
# Verify that the specified repository exists.
if [ ! -d ${repository_loc} ]; then
echo "ERROR: The specified repository does not exist!"
usage
fi
_feature_zip=${repository_loc}/${feature_id}.zip
# Verify that a feature repository exists for the specified feature.
if [ ! -f ${_feature_zip} ]; then
echo "ERROR: Unable to find a repository for the specified feature!"
usage
fi
# Prepare to stage the repository.
_unique_ident=`echo $$`
_staging_dir=${_awips_tmp_dir}/${_cave_install_prefix}${_unique_ident}
if [ -d ${_staging_dir} ]; then
rm -rf ${_staging_dir}
if [ $? -ne 0 ]; then
echo "ERROR: Failed to remove the existing staging directory: ${_staging_dir}!"
exit 1
fi
fi
mkdir -p ${_staging_dir}
if [ $? -ne 0 ]; then
echo "ERROR: Failed to create the staging directory: ${_staging_dir}!"
exit 1
fi
unzip ${_feature_zip} -d ${_staging_dir} > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: Failed to stage the repository: ${_feature_zip}!"
exit 1
fi
# Installation / Upgrade Constants.
CAVE_EXE="/awips2/cave/cave"
NOSPLASH_ARG="-nosplash"
DIRECTOR_APP="-application org.eclipse.equinox.p2.director"
DESTINATION_ARG="-destination /awips2/cave"
INSTALL_ARG="-i ${feature_id}.feature.group"
UNINSTALL_ARG="-u ${feature_id}.feature.group"
# Used to ensure that the awips2-java is used.
VM_ARG=/awips2/java/bin/java
REPO="-repository file:${_staging_dir}"
COMMON_CMD="${CAVE_EXE} -vm ${VM_ARG} ${NOSPLASH_ARG} ${DIRECTOR_APP} ${DESTINATION_ARG}"
INSTALL_CMD="${COMMON_CMD} ${INSTALL_ARG} ${REPO}"
UNINSTALL_CMD="${COMMON_CMD} ${UNINSTALL_ARG}"
# Determine if this is an upgrade. A version of the feature is currently
# already installed.
${UNINSTALL_CMD} -verifyOnly > /dev/null 2>&1
if [ $? -eq 0 ]; then
# An existing feature is installed. Remove the existing for an upgrade.
${UNINSTALL_CMD}
if [ $? -ne 0 ]; then
echo "ERROR: Failed to remove feature: ${feature_id} during upgrade preparation!"
exit 1
fi
fi
# Install the new feature.
${INSTALL_CMD}
if [ $? -ne 0 ]; then
echo "ERROR: Failed to install feature: ${feature_id}!"
exit 1
fi
rm -rf ${_staging_dir}
if [ $? -ne 0 ]; then
echo "WARNING: Failed to purge the staging directory: ${_staging_dir}!"
exit 1
fi
echo "Successfully installed feature: ${feature_id}."
exit 0

View file

@ -95,7 +95,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Aug 25, 2014 3467 mapeters Removed changing of editability from swapPanes(). * Aug 25, 2014 3467 mapeters Removed changing of editability from swapPanes().
* Mar 02, 2015 4204 njensen Support for swapping part names * Mar 02, 2015 4204 njensen Support for swapping part names
* Apr 02, 2015 4204 njensen Fix 4-panel swap of renamed parts * Apr 02, 2015 4204 njensen Fix 4-panel swap of renamed parts
* Sep 18, 2015 DR 17996 D. Friedman Clear editor pane's renderable display before swap * Sep 18, 2015 DR 17996 D. Friedman Clear editor pane's IRenderableDisplay before swap
* *
* </pre> * </pre>
* *
@ -389,6 +389,11 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
int viewPaneCount = viewPanes.length; int viewPaneCount = viewPanes.length;
try { try {
boolean isCompatibleEditor = theEditor
.getSite()
.getId()
.equals(DescriptorMap.getEditorId(myRenderables[0]
.getDescriptor().getClass().getName()));
// I have my renderables saved off, load editor renderables // I have my renderables saved off, load editor renderables
// to me first // to me first
if (viewPaneCount > editorPaneCount) { if (viewPaneCount > editorPaneCount) {
@ -399,7 +404,15 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
for (int i = 0; i < editorPaneCount; ++i) { for (int i = 0; i < editorPaneCount; ++i) {
IRenderableDisplay display = editorPanes[i] IRenderableDisplay display = editorPanes[i]
.getRenderableDisplay(); .getRenderableDisplay();
/*
* TODO: This condition is currently needed because the
* NSHARP input handlers incorrectly retain references
* to VizDisplayPane instances. Should do this
* unconditionally when that is fixed.
*/
if (isCompatibleEditor) {
editorPanes[i].setRenderableDisplay(null); editorPanes[i].setRenderableDisplay(null);
}
viewPanes[i].setRenderableDisplay(display); viewPanes[i].setRenderableDisplay(display);
if (editorHiddenDisplays.contains(editorPanes[i] if (editorHiddenDisplays.contains(editorPanes[i]
.getRenderableDisplay()) == false .getRenderableDisplay()) == false
@ -412,7 +425,10 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
IRenderableDisplay display = editorPanes[i] IRenderableDisplay display = editorPanes[i]
.getRenderableDisplay(); .getRenderableDisplay();
boolean hide = editorHiddenDisplays.contains(display); boolean hide = editorHiddenDisplays.contains(display);
// TODO: See note above for the isCompatibleEditor condition.
if (isCompatibleEditor) {
editorPanes[i].setRenderableDisplay(null); editorPanes[i].setRenderableDisplay(null);
}
if (i < viewPaneCount) { if (i < viewPaneCount) {
viewPanes[i].setRenderableDisplay(display); viewPanes[i].setRenderableDisplay(display);
if (hide) { if (hide) {
@ -429,11 +445,7 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
} }
} }
if (theEditor if (isCompatibleEditor) {
.getSite()
.getId()
.equals(DescriptorMap.getEditorId(myRenderables[0]
.getDescriptor().getClass().getName()))) {
// swap loop properties // swap loop properties
LoopProperties editorLoopProperties = theEditor LoopProperties editorLoopProperties = theEditor

View file

@ -17,6 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs; package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs;
import java.util.ArrayList; import java.util.ArrayList;
@ -53,6 +54,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Initial creation * Initial creation
* Dec 6, 2012 rferrel Change to non-blocking dialog. * Dec 6, 2012 rferrel Change to non-blocking dialog.
* Oct, 21 2015 4821 dhladky Fixed bad ffgType subString and width.
* *
* </pre> * </pre>
* *
@ -243,11 +245,11 @@ public class AttributesDlg extends CaveSWTDialog {
addSeparator(attrComp); addSeparator(attrComp);
gd.horizontalIndent = 15; gd.horizontalIndent = 15;
gd.widthHint = 140; gd.widthHint = 180;
String fcolumnName = ffmpTableCfgData.getTableColumnAttr( String fcolumnName = ffmpTableCfgData.getTableColumnAttr(
ffmpTableCfgData.getTableColumnKeys()[6]).getName(); ffmpTableCfgData.getTableColumnKeys()[6]).getName();
String ffgType = fcolumnName.substring(0, columnName.indexOf(" ")); String ffgType = fcolumnName.substring(0, fcolumnName.indexOf("::"));
ArrayList<String> guidTypes = productRun.getGuidanceTypes(prodXml); ArrayList<String> guidTypes = productRun.getGuidanceTypes(prodXml);
for (String name : guidTypes) { for (String name : guidTypes) {

View file

@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.cwat;bundle-version="1.11.17", com.raytheon.uf.viz.cwat;bundle-version="1.11.17",
com.raytheon.uf.common.dataplugin.cwat;bundle-version="1.11.17", com.raytheon.uf.common.dataplugin.cwat;bundle-version="1.11.17",
com.raytheon.uf.common.dataplugin.scan;bundle-version="1.12.1112", com.raytheon.uf.common.dataplugin.scan;bundle-version="1.12.1112",
com.raytheon.rcm.lib;bundle-version="1.12.1174" com.raytheon.rcm.lib;bundle-version="1.12.1174",
com.raytheon.uf.viz.radarapps.core;bundle-version="1.15.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.monitor.scan, Export-Package: com.raytheon.uf.viz.monitor.scan,

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML; import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML;
import com.raytheon.uf.viz.monitor.scan.TrendGraphData; import com.raytheon.uf.viz.monitor.scan.TrendGraphData;
import com.raytheon.uf.viz.monitor.scan.config.SCANConfig; import com.raytheon.uf.viz.monitor.scan.config.SCANConfig;
import com.raytheon.uf.viz.radarapps.core.RadarApps;
/** /**
* *
@ -398,7 +399,7 @@ public class TrendGraphCanvas {
scanTable, "rng", ident); scanTable, "rng", ident);
LinkedHashMap<Date, Double> rngDateMap = tgd.getGraphData(); LinkedHashMap<Date, Double> rngDateMap = tgd.getGraphData();
ElevationInfo eleInfo = new ElevationInfo(); ElevationInfo eleInfo = RadarApps.getElevationInfo();
int[] elevationAngles = eleInfo.getScanElevations(null, vcp); int[] elevationAngles = eleInfo.getScanElevations(null, vcp);
if (elevationAngles == null) if (elevationAngles == null)
return; return;

View file

@ -33,6 +33,7 @@ import com.raytheon.rcm.config.RadarType;
import com.raytheon.rcm.config.RcmUtil; import com.raytheon.rcm.config.RcmUtil;
import com.raytheon.rcm.mqsrvr.ReplyObj.ConfigReply; import com.raytheon.rcm.mqsrvr.ReplyObj.ConfigReply;
import com.raytheon.rcm.mqsrvr.ReqObj; import com.raytheon.rcm.mqsrvr.ReqObj;
import com.raytheon.rcm.products.ElevationInfo;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
@ -134,4 +135,12 @@ public class RadarApps {
return null; return null;
} }
/** Obtains an ElevationInfo instance.
* <p>
* Using this method ensures RcmResourceProvider has been set up correctly.
*/
public static ElevationInfo getElevationInfo() {
return ElevationInfo.getInstance();
}
} }

View file

@ -102,6 +102,8 @@ import com.raytheon.uf.common.python.PythonScript;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.ISimulatedTimeChangeListener;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.RGBColors; import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
@ -128,10 +130,12 @@ import com.raytheon.viz.avnconfig.ITafSiteConfig;
import com.raytheon.viz.avnconfig.MessageStatusComp; import com.raytheon.viz.avnconfig.MessageStatusComp;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.avnconfig.TafSiteData; import com.raytheon.viz.avnconfig.TafSiteData;
import com.raytheon.viz.core.mode.CAVEMode;
import com.raytheon.viz.texteditor.TextDisplayModel; import com.raytheon.viz.texteditor.TextDisplayModel;
import com.raytheon.viz.texteditor.msgs.IAviationObserver; import com.raytheon.viz.texteditor.msgs.IAviationObserver;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
/** /**
* This class displays the TAF Viewer and Editor dialog. * This class displays the TAF Viewer and Editor dialog.
@ -240,6 +244,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 06/23/2015 2282 skorolev Corrected "CLEAR" case in updateSettings. * 06/23/2015 2282 skorolev Corrected "CLEAR" case in updateSettings.
* 06/26/2015 4588 skorolev Fixed Insert/Overwrite issue. * 06/26/2015 4588 skorolev Fixed Insert/Overwrite issue.
* Sep 15, 2015 4880 njensen Removed dead code * Sep 15, 2015 4880 njensen Removed dead code
* Sep 28, 2015 4898 rferrel Disable sending of TAF when CAVE not in real time.
* Oct 05, 2015 4855 skorolev Fixed an unhandled event loop exception in createErrorStyleRange. * Oct 05, 2015 4855 skorolev Fixed an unhandled event loop exception in createErrorStyleRange.
* Oct 16, 2015 4645 skorolev Added updateWordWrap. * Oct 16, 2015 4645 skorolev Added updateWordWrap.
* *
@ -250,10 +255,16 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* *
*/ */
public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
IEditActions { ISimulatedTimeChangeListener, IEditActions {
private final transient IUFStatusHandler statusHandler = UFStatus private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TafViewerEditorDlg.class); .getHandler(TafViewerEditorDlg.class);
/**
* Developer can use this for debug purposes by making it true. This can go
* away once AlertViz respects the Priorty setting of the status handler.
*/
private static final boolean trace = false;
private final String SPLIT_REGEX = "=+[\\s\n]*|\n{2,}|\n$"; private final String SPLIT_REGEX = "=+[\\s\n]*|\n{2,}|\n$";
/** /**
@ -554,6 +565,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
this.stationList = stationList; this.stationList = stationList;
setText("AvnFPS TAF Editor"); setText("AvnFPS TAF Editor");
SimulatedTime.getSystemTime().addSimulatedTimeChangeListener(this);
} }
/** /**
@ -640,6 +652,18 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
// Select the editor tab on the tab folder. // Select the editor tab on the tab folder.
tabFolder.setSelection(editorTab); tabFolder.setSelection(editorTab);
/*
* Queue the validation so that this dialog will be displayed prior
* to the validation. This allows any validate warning to be
* displayed over this dialog.
*/
VizApp.runAsync(new Runnable() {
@Override
public void run() {
validateTime();
}
});
// Do not set editorTafTabComp radial buttons here it can corrupt a // Do not set editorTafTabComp radial buttons here it can corrupt a
// populated selected tab. // populated selected tab.
// Any changes must be done after a open tab is found and populated. // Any changes must be done after a open tab is found and populated.
@ -871,6 +895,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
@Override @Override
public void disposeDialog() { public void disposeDialog() {
disposeDialog = true; disposeDialog = true;
SimulatedTime.getSystemTime().removeSimulatedTimeChangeListener(this);
AvnSmartToolJob.shutdown(); AvnSmartToolJob.shutdown();
for (ViewerTab viewerTab : modelsTabs) { for (ViewerTab viewerTab : modelsTabs) {
viewerTab.dispose(); viewerTab.dispose();
@ -1486,6 +1511,16 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
// Make the editor tab the default selection on the tab folder. // Make the editor tab the default selection on the tab folder.
tabFolder.setSelection(editorTab); tabFolder.setSelection(editorTab);
tabFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
super.widgetSelected(e);
if (e.item == editorTab) {
validateTime();
}
}
});
} }
/** /**
@ -1709,81 +1744,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
sendBtn.addSelectionListener(new SelectionAdapter() { sendBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (!SendDialog.isAuthorized()) { sendAction();
return;
}
// Assume editorTafTabComp is for the active tab.
if (editorTafTabComp.isTafSent()) {
putMessageToForecaster("Cannot send forecast: Forecast already sent");
return;
} else if (editorTafTabComp.isSyntaxChecked()) {
if (disallowSend.equals("always")) {
putMessageToForecaster("Cannot send forecast: Send is disabled");
return;
}
// Flag to allow sending if the syntax error threshold is
// met.
boolean okToSend = true;
if (editorTafTabComp.isErrorsInBulletin()) {
if (disallowSend.equals("warning")
&& (editorTafTabComp.getErrorLevel() >= 1)) {
okToSend = false;
} else if (disallowSend.equals("error")
&& (editorTafTabComp.getErrorLevel() >= 2)) {
okToSend = false;
} else if (disallowSend.equals("fatal")
&& (editorTafTabComp.getErrorLevel() >= 3)) {
okToSend = false;
}
}
if (okToSend) {
if (confirmSend) {
String bbb = editorTafTabComp.getBBB();
if (bbb.startsWith("AA") || bbb.startsWith("CC")) {
MessageBox mb = new MessageBox(shell,
SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
mb.setMessage("Attempting to send an AMD or COR TAF, please confirm.");
if (mb.open() == SWT.CANCEL) {
return;
}
}
}
} else {
putMessageToForecaster("Cannot send forecast: Bulletin has errors"
+ "\n"
+ "Use Clear Errors to send it without changes");
return;
}
if (autoPrintMI.getSelection()) {
printForecast(editorTafTabComp.getTextEditorControl()
.getText());
}
if (mustCreate(sendDlg)) {
sendDlg = new SendDialog(shell, editorTafTabComp,
msgStatComp, sendCollectMI.getSelection());
sendDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
// sendDlg sets the "taf sent" field only
if (editorTafTabComp.isTafSent()) {
editorTafTabComp.updateTafSent(true);
}
sendDlg = null;
}
});
sendDlg.open();
} else {
sendDlg.bringToTop();
}
} else {
putMessageToForecaster("Cannot send forecast: Press Syntax before transmission");
}
} }
}); });
@ -2081,6 +2042,88 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
return errorFound; return errorFound;
} }
private void sendAction() {
if (!SendDialog.isAuthorized()) {
putMessageToForecaster("Not authorized to send TAF.");
return;
}
if (!validateTime()) {
return;
}
// Assume editorTafTabComp is for the active tab.
if (editorTafTabComp.isTafSent()) {
putMessageToForecaster("Cannot send forecast: Forecast already sent");
return;
} else if (editorTafTabComp.isSyntaxChecked()) {
if (disallowSend.equals("always")) {
putMessageToForecaster("Cannot send forecast: Send is disabled");
return;
}
// Flag to allow sending if the syntax error threshold is
// met.
boolean okToSend = true;
if (editorTafTabComp.isErrorsInBulletin()) {
if (disallowSend.equals("warning")
&& (editorTafTabComp.getErrorLevel() >= 1)) {
okToSend = false;
} else if (disallowSend.equals("error")
&& (editorTafTabComp.getErrorLevel() >= 2)) {
okToSend = false;
} else if (disallowSend.equals("fatal")
&& (editorTafTabComp.getErrorLevel() >= 3)) {
okToSend = false;
}
}
if (okToSend) {
if (confirmSend) {
String bbb = editorTafTabComp.getBBB();
if (bbb.startsWith("AA") || bbb.startsWith("CC")) {
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
| SWT.OK | SWT.CANCEL);
mb.setMessage("Attempting to send an AMD or COR TAF, please confirm.");
if (mb.open() == SWT.CANCEL) {
return;
}
}
}
} else {
putMessageToForecaster("Cannot send forecast: Bulletin has errors"
+ "\n" + "Use Clear Errors to send it without changes");
return;
}
if (autoPrintMI.getSelection()) {
printForecast(editorTafTabComp.getTextEditorControl().getText());
}
if (mustCreate(sendDlg)) {
sendDlg = new SendDialog(shell, editorTafTabComp, msgStatComp,
sendCollectMI.getSelection());
sendDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
// sendDlg sets the "taf sent" field only
if (editorTafTabComp.isTafSent()) {
editorTafTabComp.updateTafSent(true);
}
sendDlg = null;
}
});
sendDlg.open();
} else {
sendDlg.bringToTop();
}
} else {
putMessageToForecaster("Cannot send forecast: Press Syntax before transmission");
}
}
private void syntaxCheck() { private void syntaxCheck() {
// Assume editorTafTabComp is for the active tab. // Assume editorTafTabComp is for the active tab.
st = editorTafTabComp.getTextEditorControl(); st = editorTafTabComp.getTextEditorControl();
@ -2651,8 +2694,9 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
.getText()); .getText());
setMessageStatusOK("Temporary WRKTAF Stored in DB"); setMessageStatusOK("Temporary WRKTAF Stored in DB");
} catch (Exception e) { } catch (Exception e) {
String msg = e.toString(); statusHandler
System.out.println(msg); .error("Problem storing temporary WRKTAF in text product database.",
e);
} }
} }
} }
@ -3048,12 +3092,16 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
// The keys are: index, fatal, ident, amd, itime, vtime, group, and // The keys are: index, fatal, ident, amd, itime, vtime, group, and
// bbb // bbb
for (String k : parsedText.keySet()) { for (String k : parsedText.keySet()) {
// System.out.println("The outer key is " + k); if (traceEnabled()) {
statusHandler.debug("The outer key is " + k);
}
if ((!k.equals("group")) && (!k.equals("bbb"))) { if ((!k.equals("group")) && (!k.equals("bbb"))) {
HashMap<String, java.util.List<String>> m = (HashMap<String, java.util.List<String>>) parsedText HashMap<String, java.util.List<String>> m = (HashMap<String, java.util.List<String>>) parsedText
.get(k); .get(k);
for (String k2 : m.keySet()) { for (String k2 : m.keySet()) {
// System.out.println("The inner key is " + k2); if (traceEnabled()) {
statusHandler.debug("The inner key is " + k2);
}
if (k2.equals("warning") || k2.equals("error") if (k2.equals("warning") || k2.equals("error")
|| k2.equals("fatal") || k2.equals("index")) { || k2.equals("fatal") || k2.equals("index")) {
results = m.get(k2); results = m.get(k2);
@ -3085,29 +3133,43 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
} }
} else if (k.equals("group")) { } else if (k.equals("group")) {
Object o1 = parsedText.get(k); Object o1 = parsedText.get(k);
// System.out.println(o1.getClass().getName()); if (traceEnabled()) {
java.util.ArrayList<HashMap> lm1 = (java.util.ArrayList) o1; statusHandler.debug(o1.getClass().getName());
for (HashMap<String, Object> m1 : lm1) { }
java.util.List<Map<String, Object>> lm1 = (List<Map<String, Object>>) o1;
for (Map<String, Object> m1 : lm1) {
for (String k2 : m1.keySet()) { for (String k2 : m1.keySet()) {
// System.out.println("The next inner key is " + if (traceEnabled()) {
// k2); statusHandler.debug("The next inner key is "
+ k2);
}
Object o2 = m1.get(k2); Object o2 = m1.get(k2);
// System.out.println(o2.getClass().getName()); if (traceEnabled()) {
HashMap<String, Object> m2 = (HashMap) o2; statusHandler.debug(o2.getClass().getName());
}
Map<String, Object> m2 = (Map<String, Object>) o2;
for (String k3 : m2.keySet()) { for (String k3 : m2.keySet()) {
// System.out.println("The next next inner key is " if (traceEnabled()) {
// + k3); statusHandler
.debug("The next next inner key is "
+ k3);
}
Object o3 = m2.get(k3); Object o3 = m2.get(k3);
// System.out.println(o3.getClass().getName()); if (traceEnabled()) {
if (o3.getClass().getName() statusHandler
.equals("java.util.HashMap")) { .debug(o3.getClass().getName());
HashMap<String, Object> m3 = (HashMap) o3; }
if (o3 instanceof Map) {
Map<String, Object> m3 = (Map<String, Object>) o3;
for (String k4 : m3.keySet()) { for (String k4 : m3.keySet()) {
// System.out if (traceEnabled()) {
// .println("The next next next inner key is " statusHandler
// + k4); .debug("The next next next inner key is "
// Object o4 = m3.get(k4); + k4);
// System.out.println(o4.getClass().getName()); Object o4 = m3.get(k4);
statusHandler.debug(o4.getClass()
.getName());
}
if (k4.equals("warning") if (k4.equals("warning")
|| k4.equals("error") || k4.equals("error")
|| k4.equals("fatal") || k4.equals("fatal")
@ -3118,23 +3180,21 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
if (k4.equals("index")) { if (k4.equals("index")) {
getRange(range, results); getRange(range, results);
} else { } else {
// System.out
// .print("The result is: ");
for (String s : results) { for (String s : results) {
errorMsg.append(s); errorMsg.append(s);
} }
// System.out.println("At line " if (traceEnabled()) {
// + range[frLineIndex] StringBuilder sb = new StringBuilder();
// + " in column " sb.append(
// + range[frColIndex] + "The result is: At line ")
// "..."); .append(range[frLineIndex])
// System.out.println(errorMsg .append(" in column ")
// .toString()); .append(range[frColIndex])
// st.setCaretOffset(st .append("...\n")
// .getOffsetAtLine(currentLineNo .append(errorMsg);
// + range[frLineIndex] statusHandler.debug(sb
// - 1) .toString());
// + range[frColIndex]); }
errorLevel = createErrorStyleRange( errorLevel = createErrorStyleRange(
"'" "'"
+ errorMsg + errorMsg
@ -3160,9 +3220,9 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
} }
} }
} else if (k.equals("bbb")) { } else if (k.equals("bbb") && traceEnabled()) {
// Object o = parsedText.get(k); Object o = parsedText.get(k);
// System.out.println(o.getClass().getName()); statusHandler.debug(o.getClass().getName());
} }
} }
} }
@ -3656,7 +3716,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
if (endIndex == -1) { if (endIndex == -1) {
endIndex = in.length(); endIndex = in.length();
} }
boolean isWrapping = false;
String thisSite = ""; String thisSite = "";
String lastLine = ""; String lastLine = "";
String line = in.substring(beginIndex, endIndex); String line = in.substring(beginIndex, endIndex);
@ -3702,7 +3761,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
if (lineNumber == keyLineNum) { if (lineNumber == keyLineNum) {
if (!isWrappingLine(line, thisSite)) { if (!isWrappingLine(line, thisSite)) {
isWrapping = false;
text = result.get("text").toString() + "\n"; text = result.get("text").toString() + "\n";
level = Integer.parseInt(result level = Integer.parseInt(result
.get("level").toString()); .get("level").toString());
@ -3716,7 +3774,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
break; break;
} else { } else {
// a PROB30 group is wrapped in two lines // a PROB30 group is wrapped in two lines
isWrapping = true;
text = result.get("text").toString() + "\n"; text = result.get("text").toString() + "\n";
level = Integer.parseInt(result level = Integer.parseInt(result
.get("level").toString()); .get("level").toString());
@ -3830,8 +3887,6 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
File path = pm.getStaticFile("aviation" + fs + "config" + fs File path = pm.getStaticFile("aviation" + fs + "config" + fs
+ "gui" + fs + "SyntaxMonitorCfg.xml"); + "gui" + fs + "SyntaxMonitorCfg.xml");
System.out.println("path = " + path);
syntaxMonCfg = JAXB.unmarshal(path, SyntaxMonitorCfg.class); syntaxMonCfg = JAXB.unmarshal(path, SyntaxMonitorCfg.class);
} catch (Exception e) { } catch (Exception e) {
@ -3910,7 +3965,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
sb.append(TafUtil.safeFormatTaf(t, showHeaders)); sb.append(TafUtil.safeFormatTaf(t, showHeaders));
sb.append("\n"); sb.append("\n");
} }
}// System.out.println("TEMPO "+sb.toString().indexOf("TEMPO")+"/"+sb.toString().indexOf("\n",72)); }
tafViewerStTxt.setText(sb.toString()); tafViewerStTxt.setText(sb.toString());
hightlightTAF(); hightlightTAF();
@ -3968,27 +4023,27 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
.getCurrentTempoMap(stationName);// 20120711 .getCurrentTempoMap(stationName);// 20120711
if (tempoMap != null) { if (tempoMap != null) {
int tempoStart = taf.indexOf(TEMPO_TXT); int tempoStart = taf.indexOf(TEMPO_TXT);
int tempoEnd = taf.indexOf(TafUtil.LINE_BREAK, tempoStart);// end // end of the TEMPO line
// of int tempoEnd = taf.indexOf(TafUtil.LINE_BREAK, tempoStart);
// the
// TEMPO
// line
StringBuilder str = new StringBuilder(" "); StringBuilder str = new StringBuilder(" ");
for (String alertKey : tempoMap.keySet()) { for (String alertKey : tempoMap.keySet()) {
// System.out.println("2___alertKey: "+ alertKey); if (traceEnabled()) {
statusHandler.debug("2___alertKey: " + alertKey);
}
for (String value : tempoMap.get(alertKey)) { for (String value : tempoMap.get(alertKey)) {
// System.out.println("3___value: "+ value); if (traceEnabled()) {
statusHandler.debug("3___value: " + value);
}
str.setLength(1); str.setLength(1);
str.append(value); str.append(value);
int len = str.length(); int len = str.length();
str.append(" "); str.append(" ");
// for tempo only
int startIndex = taf int startIndex = taf
.indexOf(str.toString(), tempoStart);// for .indexOf(str.toString(), tempoStart);
// tempo
// only
if (startIndex < 0) { if (startIndex < 0) {
str.setLength(len); str.setLength(len);
@ -4258,7 +4313,7 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
font.dispose(); font.dispose();
printer.dispose(); printer.dispose();
} else { } else {
System.out.println("No default printer set."); putMessageToForecaster("Auto Print failed. No default printer set.");
} }
} }
@ -4275,13 +4330,8 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
// Only load the latest TAF, and assume it is the first one in // Only load the latest TAF, and assume it is the first one in
// the Viewer. // the Viewer.
sb.append(TafUtil.safeFormatTaf(tafsInViewer[0], false)); sb.append(TafUtil.safeFormatTaf(tafsInViewer[0], false));
String originalBbb = "";
String[] header = tafsInViewer[0].getWmoHeader().split(" "); String[] header = tafsInViewer[0].getWmoHeader().split(" ");
if (header.length > 3) {
originalBbb = header[3];
}
ITafSiteConfig config = TafSiteConfigFactory.getInstance(); ITafSiteConfig config = TafSiteConfigFactory.getInstance();
TafSiteData siteData = config.getSite(site); TafSiteData siteData = config.getSite(site);
@ -4458,6 +4508,45 @@ public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable,
} }
} }
/**
* Validate CAVE can send a TAF.
*
* @return true when in real time.
*/
private boolean validateTime() {
if ((shell != null) && !shell.isDisposed() && shell.isVisible()) {
/*
* Currently practice mode not supported.
*/
if (CAVEMode.getMode() == CAVEMode.PRACTICE) {
putMessageToForecaster("Not allowed to send TAF when in practice mode.");
return false;
} else if (!SimulatedTimeOperations.isTransmitAllowed()) {
SimulatedTimeOperations.displayFeatureLevelWarning(shell,
"Send TAF");
return false;
}
}
return true;
}
@Override
public void timechanged() {
validateTime();
}
/**
*
* @return
*/
private boolean traceEnabled() {
/*
* TODO When alertviz respects Prioirty change this to use the
* statusHander priority debug enabled.
*/
return trace;
}
/** /**
* Internal class to up date the Viewer tab highlights when the Metar tab * Internal class to up date the Viewer tab highlights when the Metar tab
* selections change what should be highlighted. * selections change what should be highlighted.

View file

@ -178,8 +178,9 @@ HazardsConflictDict = {
"SC.Y", "SW.Y", "SE.W", "RB.Y", "SI.Y", "CF.S", "TY.W", "SC.Y", "SW.Y", "SE.W", "RB.Y", "SI.Y", "CF.S", "TY.W",
"GL.A", "SR.A", "HF.A", "SE.A", "CF.W", "CF.A", "CF.Y", "GL.A", "SR.A", "HF.A", "SE.A", "CF.W", "CF.A", "CF.Y",
"SU.W", "SU.Y"], "SU.W", "SU.Y"],
"TS.A" : ["TS.W"], "TS.A" : ["TS.W", "TS.Y"],
"TS.W" : ["TS.A"], "TS.W" : ["TS.A", "TS.Y"],
"TS.Y" : ["TS.A", "TS.W"],
"TY.A" : ["TR.A", "TY.W", "HU.S", "HF.W", "GL.A", "SR.A", "HF.A", "SE.A", "CF.A", "CF.S"], "TY.A" : ["TR.A", "TY.W", "HU.S", "HF.W", "GL.A", "SR.A", "HF.A", "SE.A", "CF.A", "CF.S"],
"TY.W" : ["TY.A", "HU.S", "TR.A", "TR.W", "GL.A", "SR.A", "HF.A", "SE.A", "CF.A", "CF.S", "SU.Y", "TY.W" : ["TY.A", "HU.S", "TR.A", "TR.W", "GL.A", "SR.A", "HF.A", "SE.A", "CF.A", "CF.S", "SU.Y",
"GL.W", "SR.W", "HF.W", "BW.Y","SC.Y", "SW.Y", "SE.W", "RB.Y", "SI.Y", "CF.W", "CF.Y", "SU.W"], "GL.W", "SR.W", "HF.W", "BW.Y","SC.Y", "SW.Y", "SE.W", "RB.Y", "SI.Y", "CF.W", "CF.Y", "SU.W"],

View file

@ -62,7 +62,7 @@ hazardDict = OrderedDict([
"GL.A", "GL.W", "SE.A", "SE.W", "UP.A", "UP.W", "HF.A", "HF.W", "LO.Y", "SC.Y", "SW.Y", "GL.A", "GL.W", "SE.A", "SE.W", "UP.A", "UP.W", "HF.A", "HF.W", "LO.Y", "SC.Y", "SW.Y",
"RB.Y", "SI.Y", "MS.Y", "SR.A", "SR.W"]), "RB.Y", "SI.Y", "MS.Y", "SR.A", "SR.W"]),
('Tropical Cyclone', ["HU.W", "HU.A", "TR.W", "TR.A"]), ('Tropical Cyclone', ["HU.W", "HU.A", "TR.W", "TR.A"]),
('Tsunami', ["TS.A", "TS.W"]), ('Tsunami', ["TS.A", "TS.W", "TS.Y"]),
# ('Local', ["TEST"]), #example of adding local hazards # ('Local', ["TEST"]), #example of adding local hazards
# you can define your own groups of hazards by adding new categories # you can define your own groups of hazards by adding new categories

View file

@ -86,8 +86,7 @@ public class ShowIscRequestReplyDialog extends AbstractHandler {
public boolean isEnabled() { public boolean isEnabled() {
DataManager dm = DataManagerUIFactory.getCurrentInstance(); DataManager dm = DataManagerUIFactory.getCurrentInstance();
if (dm != null) { if (dm != null) {
return (!dm.sendIscOnSave() || !dm.sendIscOnPublish()) return CAVEMode.getMode().equals(CAVEMode.OPERATIONAL)
&& CAVEMode.getMode().equals(CAVEMode.OPERATIONAL)
&& dm.requestISC(); && dm.requestISC();
} }

View file

@ -76,6 +76,7 @@ import com.raytheon.viz.gfe.smarttool.script.SmartToolRunnerController;
* Jul 23, 2015 4263 dgilling Support SmartToolMetadataManager. * Jul 23, 2015 4263 dgilling Support SmartToolMetadataManager.
* Aug 27, 2015 4749 njensen Call shutdown() on PythonJobCoordinator * Aug 27, 2015 4749 njensen Call shutdown() on PythonJobCoordinator
* Sep 16, 2015 4871 randerso Return modified varDict from Tool * Sep 16, 2015 4871 randerso Return modified varDict from Tool
* 10/08/2015 18125 bhunder Modified CANCEL_MSG_START to work with Jep updates
* *
* </pre> * </pre>
* *
@ -90,7 +91,7 @@ public class Tool {
private final IPerformanceStatusHandler perfLog = PerformanceStatus private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:"); .getHandler("GFE:");
private static final String CANCEL_MSG_START = "jep.JepException: <type 'exceptions.RuntimeError'>: Cancel: Cancel >>>"; private static final String CANCEL_MSG_START = "jep.JepException: <type 'exceptions.RuntimeError'>: Cancel: Cancel";
private final IParmManager parmMgr; private final IParmManager parmMgr;

View file

@ -81,6 +81,8 @@ import com.raytheon.viz.hydrocommon.util.HydroDialogStatus;
* asynchronously and display a progress * asynchronously and display a progress
* indicator on the main interface. * indicator on the main interface.
* Feb 11, 2014 #15829 lbousaidi check for Missing before processing River Threat. * Feb 11, 2014 #15829 lbousaidi check for Missing before processing River Threat.
* Oct 05, 2015 #17978 lbousaidi updated addStationEntry() to use StationEntryDetails.getPeDTsE()
*
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -1079,7 +1081,7 @@ public class PointDataControlManager extends Job {
* the StationEntryDetails object to add * the StationEntryDetails object to add
*/ */
public void addStationEntry(StationEntryDetails sed) { public void addStationEntry(StationEntryDetails sed) {
stationEntryMap.put(sed.getLid(), sed); stationEntryMap.put(sed.getPeDTsE(), sed);
} }
/** /**

View file

@ -31,6 +31,7 @@ import java.util.Calendar;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 4, 2009 mpduff Initial creation * Feb 4, 2009 mpduff Initial creation
* Oct 05, 015 17978 lbousaidi added getPeDTsE()
* *
* </pre> * </pre>
* *
@ -422,5 +423,18 @@ public class StationEntryDetails {
return sb.toString(); return sb.toString();
} }
/**
* Get the ingest filter table primary key value for this data object.
*
* @return The primary key object
*/
public String getPeDTsE() {
StringBuilder sb = new StringBuilder();
sb.append(this.lid);
sb.append(this.pe);
sb.append(this.ts);
return sb.toString();
}
} }

View file

@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.TimeZone; import java.util.TimeZone;
import javax.measure.unit.NonSI; import javax.measure.unit.NonSI;
@ -89,6 +90,7 @@ import com.raytheon.viz.hydrocommon.HydroDisplayManager;
import com.raytheon.viz.hydrocommon.colorscalemgr.HydroColorManager; import com.raytheon.viz.hydrocommon.colorscalemgr.HydroColorManager;
import com.raytheon.viz.hydrocommon.data.GageData; import com.raytheon.viz.hydrocommon.data.GageData;
import com.raytheon.viz.hydrocommon.data.GageData.ThreatIndex; import com.raytheon.viz.hydrocommon.data.GageData.ThreatIndex;
import com.raytheon.viz.hydrocommon.data.GageDataTimeStep;
import com.raytheon.viz.hydrocommon.data.RiverStat; import com.raytheon.viz.hydrocommon.data.RiverStat;
import com.raytheon.viz.hydrocommon.pdc.PDCOptionData; import com.raytheon.viz.hydrocommon.pdc.PDCOptionData;
import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.ColorThreshold; import com.raytheon.viz.hydrocommon.whfslib.colorthreshold.ColorThreshold;
@ -133,6 +135,7 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* Apr 09, 2015 4215 mpduff Check strTree before removing items. * Apr 09, 2015 4215 mpduff Check strTree before removing items.
* Jun 26, 2015 17386 xwei Fixed : HydroView crashes in when Refresh Data after loading saved display files * Jun 26, 2015 17386 xwei Fixed : HydroView crashes in when Refresh Data after loading saved display files
* Jul 06, 2015 4215 mpduff Correct the fact that user's cannot click and view time series. * Jul 06, 2015 4215 mpduff Correct the fact that user's cannot click and view time series.
* Oct 05, 2015 17978 lbousaidi Enable TimeStep GUI to display multiple values and Parameter Codes for a given lid
* *
* </pre> * </pre>
* *
@ -218,8 +221,12 @@ public class MultiPointResource extends
private final Map<String, GageData> dataMap = new HashMap<String, GageData>(); private final Map<String, GageData> dataMap = new HashMap<String, GageData>();
private final Map<String, GageDataTimeStep> dataMapTimeStep = new HashMap<String, GageDataTimeStep>();
private STRtree strTree = new STRtree(); private STRtree strTree = new STRtree();
private STRtree strTreeTimeStep = new STRtree();
private IFont font; private IFont font;
private int fontSize; private int fontSize;
@ -332,18 +339,45 @@ public class MultiPointResource extends
for (GageData gage : data) { for (GageData gage : data) {
/* Get the point color for this location */ /* Get the point color for this location */
if ((gage.getLid() != null) && gage.isUse()) { if ((gage.getLid() != null) && gage.isUse()) {
if ( pcOptions.getQueryMode() == 1 ){
addPointTimeStep(gage);
}else{
addPoint(gage); addPoint(gage);
} }
} }
} }
} }
}
/** /**
* Add a point to this resource. * Add a point to this resource in TimeStep Mode.
* *
* @param gage * @param gage
* GageData object * GageData object
*/ */
private synchronized void addPointTimeStep(GageData gage) {
String lid = gage.getLid();
if ( !dataMapTimeStep.containsKey(lid) ) {
Coordinate xy = new Coordinate(gage.getLon(), gage.getLat());
gage.setCoordinate(xy);
/* Create a small envelope around the point */
PixelExtent pe = getPixelExtent( gage, getShiftWidth(gage), getShiftHeight(gage) );
Envelope newEnv = descriptor.pixelToWorld( pe );
GageDataTimeStep newGageTS = new GageDataTimeStep( gage );
strTree.insert(newEnv, newGageTS);
dataMapTimeStep.put(lid, newGageTS);
} else{
dataMapTimeStep.get(lid).Update(gage);
}
}
private synchronized void addPoint(GageData gage) { private synchronized void addPoint(GageData gage) {
String lid = gage.getLid(); String lid = gage.getLid();
GageData existing = dataMap.get(lid); GageData existing = dataMap.get(lid);
@ -422,6 +456,216 @@ public class MultiPointResource extends
return new PixelExtent(coors); return new PixelExtent(coors);
} }
/**
* Draws the plot information for TimeStep
*
* @param data
* the gage data obj
* @param shiftWidth
* the shift width coordinate
* @param shiftHeight
* the shift height coordinate
* @param paintProps
* the paint properties
* @param target
* the graphics target
* @throws VizException
*/
private Collection<DrawableString> drawPlotInfoTimeStep(GageDataTimeStep gageTimeStep,
double shiftWidth, double shiftHeight, PaintProperties paintProps,
IGraphicsTarget target) throws VizException {
List<DrawableString> strings = new ArrayList<DrawableString>();
Coordinate c = gageTimeStep.getCoordinate();
/* Logic for determining how the data values are displayed. */
boolean showValue1 = pdcManager.isValue();
double[] centerpixels = descriptor
.worldToPixel(new double[] { c.x, c.y });
if (showValue1) {
String [] valueStrings;
if ( pcOptions.getElementType() == 1 ){
valueStrings = gageTimeStep.getRainValue( pcOptions.getPrecipPeFilter() ).split("\n");
}else{
valueStrings = gageTimeStep.getOtherValue().split("\n");
}
int strSize = valueStrings.length;
RGB[] strColor = new RGB[strSize];
if ( strSize > 0){
for (int i=0; i<strSize; i++){
if (valueStrings[i]!=""){
if ( valueStrings[i].equalsIgnoreCase("M") ){
strColor[i] = RGBColors.getRGBColor("White");
}else{
strColor[i] = getValueLabelColorTimeStep( gageTimeStep.getLid(), Double.parseDouble( valueStrings[i] ) );
}
}
}
}
Coordinate valueCoor = new Coordinate(
(centerpixels[0] + shiftWidth) - getScaleWidth(),
(centerpixels[1] + shiftHeight) - getScaleHeight() / 2);
/*
* If in timestep mode and icon drawing off, draw a circle
* matching the color of the text
*/
if (pcOptions.getIcon() == 0) {
Coordinate cd = gageTimeStep.getCoordinate();
centerpixels = descriptor.worldToPixel(new double[] { cd.x,
cd.y });
Coordinate[] coors = new Coordinate[4];
coors[0] = new Coordinate((centerpixels[0] + shiftWidth)
- getScaleWidth(), (centerpixels[1] + shiftHeight)
- getScaleHeight());
coors[1] = new Coordinate((centerpixels[0] + shiftWidth)
+ getScaleWidth(), (centerpixels[1] + shiftHeight)
- getScaleHeight());
coors[2] = new Coordinate((centerpixels[0] + shiftWidth)
+ getScaleWidth(), (centerpixels[1] + shiftHeight)
+ getScaleHeight());
coors[3] = new Coordinate((centerpixels[0] + shiftWidth)
- getScaleWidth(), (centerpixels[1] + shiftHeight)
+ getScaleHeight());
PixelExtent pe = new PixelExtent(coors);
pe.scale(.07);
target.drawShadedRect(pe, RGBColors.getRGBColor("White"), 1, null);
}
DrawableString string = new DrawableString(valueStrings, strColor);
string.font = font;
string.horizontalAlignment = HorizontalAlignment.RIGHT;
string.setCoordinates(valueCoor.x, valueCoor.y);
strings.add(string);
}
if (pdcManager.isTime()) {
Coordinate dateCoor1 = new Coordinate(
(centerpixels[0] + shiftWidth) + getScaleWidth(),
(centerpixels[1] + shiftHeight) - getScaleHeight() / 0.9);
Coordinate dateCoor2 = new Coordinate(
(centerpixels[0] + shiftWidth) + getScaleWidth(),
centerpixels[1] + shiftHeight + getScaleHeight() / -2);
// draw the date and time
DrawableString string = new DrawableString(sdf1.format(gageTimeStep
.getValidtime().getTime()), LABEL_COLOR);
string.font = font;
string.setCoordinates(dateCoor1.x, dateCoor1.y);
strings.add(string);
string = new DrawableString(sdf2.format(gageTimeStep.getValidtime()
.getTime()), LABEL_COLOR);
string.font = font;
string.setCoordinates(dateCoor2.x, dateCoor2.y);
strings.add(string);
}
// draw the ID
if (pdcManager.isID()) {
Coordinate idCoor = new Coordinate(centerpixels[0] + shiftWidth
- getScaleWidth(), centerpixels[1] + shiftHeight
+ getScaleHeight());
DrawableString string = new DrawableString(gageTimeStep.getLid(),
LABEL_COLOR);
string.font = font;
string.horizontalAlignment = HorizontalAlignment.RIGHT;
string.setCoordinates(idCoor.x, idCoor.y);
strings.add(string);
}
if (pdcManager.isName()) {
// draw the Name
Coordinate nameCoor = new Coordinate(centerpixels[0] + shiftWidth
+ getScaleWidth(), centerpixels[1] + shiftHeight
+ getScaleHeight());
DrawableString string = new DrawableString(gageTimeStep.getName(),
LABEL_COLOR);
string.font = font;
string.setCoordinates(nameCoor.x, nameCoor.y);
strings.add(string);
}
if (pdcManager.isPE()) {
String pe = "";
if ( pcOptions.getElementType() == 1 ){
pe = gageTimeStep.getRainParam(pcOptions.getPrecipPeFilter());
}else{
pe = gageTimeStep.getOtherParam();
}
Coordinate peCoor = new Coordinate(centerpixels[0] + shiftWidth
+ getScaleWidth(), centerpixels[1] + shiftHeight
- getScaleHeight() / 2);
DrawableString string = new DrawableString(pe, LABEL_COLOR);
string.font = font;
string.setCoordinates(peCoor.x, peCoor.y);
strings.add(string);
}
if (pdcManager.isElevation()) {
// draw the elevation
Coordinate elCoor = new Coordinate(centerpixels[0] + shiftWidth
+ getScaleWidth(), centerpixels[1] + shiftHeight
- getScaleHeight() / 2);
DrawableString string = new DrawableString(df.format(gageTimeStep.getElevation()), LABEL_COLOR);
string.font = font;
string.setCoordinates(elCoor.x, elCoor.y);
strings.add(string);
}
return strings;
}
/**
* Gets the color for value label in TimeStep mode
*
* @param plid lid string
*
* @param pValue value
*
* @throws VizException
*/
private RGB getValueLabelColorTimeStep( String pLid, double pValue ){
RGB textColor = RGBColors.getRGBColor("White");
if ((pcOptions.getTsDataElement() == HydroConstants.TimeStepDataElement.STAGE_POOL_TSDE
.getElementType())
|| (pcOptions.getTsDataElement() == HydroConstants.TimeStepDataElement.FLOW_STORAGE_TSDE
.getElementType())) {
textColor = getRiverValueColorForTimeStepMode( pLid, pValue );
} else {
// textColor = new RGB(255, 255, 255);
textColor = determineValueColor( pValue );
}
return textColor;
}
/** /**
* Draws the plot information * Draws the plot information
* *
@ -446,19 +690,11 @@ public class MultiPointResource extends
int floodLevel = pcOptions.getFloodLevel(); int floodLevel = pcOptions.getFloodLevel();
int deriveStageFlow = pcOptions.getDeriveStageFlow(); int deriveStageFlow = pcOptions.getDeriveStageFlow();
boolean isTimeStepMode = false;
String valueLabel = null; String valueLabel = null;
String formatStr = null; String formatStr = null;
int queryMode = pcOptions.getQueryMode(); formatStr = GageData.getDataFormat(gage.getPe());
if (queryMode == 1) {
// TimeStep Mode
isTimeStepMode = true;
}
formatStr = getDataFormat(gage.getPe());
/* Logic for determining how the data values are displayed. */ /* Logic for determining how the data values are displayed. */
boolean showValue1 = pdcManager.isValue(); boolean showValue1 = pdcManager.isValue();
@ -470,11 +706,7 @@ public class MultiPointResource extends
&& (pcOptions.getElementType() == HydroConstants.AdHocDataElementType.RIVER_AD_HOC_TYPE && (pcOptions.getElementType() == HydroConstants.AdHocDataElementType.RIVER_AD_HOC_TYPE
.getAdHocDataElementType())) { .getAdHocDataElementType())) {
showValue2 = true; showValue2 = true;
if (pcOptions.getQueryMode() == PDCConstants.QueryMode.TIME_STEP_MODE
.getQueryMode()) {
// never show value2 in TimeStep Mode
showValue2 = false;
}
} }
} }
@ -493,48 +725,7 @@ public class MultiPointResource extends
(centerpixels[0] + shiftWidth) - getScaleWidth(), (centerpixels[0] + shiftWidth) - getScaleWidth(),
(centerpixels[1] + shiftHeight) - getScaleHeight() / 2); (centerpixels[1] + shiftHeight) - getScaleHeight() / 2);
// Color text based on value and thresholds
if (isTimeStepMode) {
if ((pcOptions.getTsDataElement() == HydroConstants.TimeStepDataElement.STAGE_POOL_TSDE
.getElementType())
|| (pcOptions.getTsDataElement() == HydroConstants.TimeStepDataElement.FLOW_STORAGE_TSDE
.getElementType())) {
textColor = getRiverValueColorForTimeStepMode(gage);
} else {
// textColor = new RGB(255, 255, 255);
textColor = determineValueColor(gage.getValue());
}
/*
* If in timestep mode and icon drawing off, draw a circle
* matching the color of the text
*/
if (pcOptions.getIcon() == 0) {
Coordinate cd = gage.getCoordinate();
centerpixels = descriptor.worldToPixel(new double[] { cd.x,
cd.y });
Coordinate[] coors = new Coordinate[4];
coors[0] = new Coordinate((centerpixels[0] + shiftWidth)
- getScaleWidth(), (centerpixels[1] + shiftHeight)
- getScaleHeight());
coors[1] = new Coordinate((centerpixels[0] + shiftWidth)
+ getScaleWidth(), (centerpixels[1] + shiftHeight)
- getScaleHeight());
coors[2] = new Coordinate((centerpixels[0] + shiftWidth)
+ getScaleWidth(), (centerpixels[1] + shiftHeight)
+ getScaleHeight());
coors[3] = new Coordinate((centerpixels[0] + shiftWidth)
- getScaleWidth(), (centerpixels[1] + shiftHeight)
+ getScaleHeight());
PixelExtent pe = new PixelExtent(coors);
pe.scale(.4);
target.drawShadedRect(pe, textColor, 1, null);
}
} else { // in AD_HOC_MODE, color the text labelColor
textColor = RGBColors.getRGBColor("white"); textColor = RGBColors.getRGBColor("white");
}
DrawableString string = new DrawableString(valueLabel, textColor); DrawableString string = new DrawableString(valueLabel, textColor);
string.font = font; string.font = font;
@ -789,22 +980,134 @@ public class MultiPointResource extends
pdcManager.setColorUseName(colorUseName); pdcManager.setColorUseName(colorUseName);
pdcManager.setMultiPointResource(this); pdcManager.setMultiPointResource(this);
setScaleValues(paintProps); setScaleValues(paintProps);
IExtent extent = paintProps.getView().getExtent();
List<GageData> data = pdcManager.getObsReportList();
resetDataMap(); resetDataMap();
if (data != null) {
List<PointImage> images = new ArrayList<PointImage>(data.size()); if ( pcOptions.getQueryMode() == 1 ){
List<DrawableString> strings = new ArrayList<DrawableString>( paintInternalHelperTimeStep( target, paintProps );
data.size() * 3); }else{
paintInternalHelper( target, paintProps );
}
GageData currentData = manager.getCurrentData();
if (currentData != null) {
List<GageData> siteList = pdcManager.getObsReportList();
if ((siteList != null) && siteList.contains(currentData)) {
double shiftHeightValue = getShiftHeight(currentData);
double shiftWidthValue = getShiftWidth(currentData);
PixelExtent pe = getPixelExtent(currentData, shiftWidthValue,
shiftHeightValue);
target.drawRect(pe, HydroConstants.SQUARE_COLOR, 2, 1);
}
}
}
/**
* Paint method called to display this resource in TimeStep mode.
*
* @param target
* The IGraphicsTarget
* @param paintProps
* The Paint Properties
* @throws VizException
*/
private void paintInternalHelperTimeStep(IGraphicsTarget target, PaintProperties paintProps) throws VizException {
List<GageData> data = pdcManager.getObsReportList();
if (data == null) {
return;
}
for (GageData gage : data) { for (GageData gage : data) {
/* Get the point color for this location */ /* Get the point color for this location */
if ((gage.getLid() != null) && gage.isUse()) { if ((gage.getLid() != null) && gage.isUse()) {
addPointTimeStep(gage);
}
}
IExtent extent = paintProps.getView().getExtent();
List<PointImage> images = new ArrayList<PointImage>( dataMapTimeStep.size() );
List<DrawableString> strings = new ArrayList<DrawableString>( dataMapTimeStep.size() * 3 );
Iterator<Entry<String, GageDataTimeStep>> it = dataMapTimeStep.entrySet().iterator();
Map.Entry<String, GageDataTimeStep> gageTS = null;
while ( it.hasNext() ) {
gageTS = it.next();
Coordinate c = gageTS.getValue().getCoordinate();
double[] pixel = descriptor.worldToPixel(new double[] { c.x, c.y });
if (pixel != null && extent.contains(pixel)) {
double shiftHeightValue = getShiftHeight(gageTS.getValue());
double shiftWidthValue = getShiftWidth(gageTS.getValue());
/* Draw the icons */
if (pcOptions.getIcon() == 1) {
RGB color = null;
if (pcOptions.getRiverStatus() == 1) {
color = gageTS.getValue().getColor();
} else {
color = RGBColors.getRGBColor(colorSet.get(0)
.getColorname().getColorName());
}
PointImage image = new PointImage(
getIcon(target, gageTS.getValue(), color), pixel[0], pixel[1]
);
image.setSiteId(gageTS.getValue().getLid());
images.add(image);
}
strings.addAll( drawPlotInfoTimeStep( gageTS.getValue(), shiftWidthValue, shiftHeightValue, paintProps, target ) );
}
}
if (images.size() > 0) {
target.getExtension(IPointImageExtension.class)
.drawPointImages(paintProps, images);
}
if (strings.size() > 0) {
target.drawStrings(strings);
}
}
/**
* Paint method called to display this resource.
*
* @param target
* The IGraphicsTarget
* @param paintProps
* The Paint Properties
* @throws VizException
*/
private void paintInternalHelper(IGraphicsTarget target, PaintProperties paintProps) throws VizException {
List<GageData> data = pdcManager.getObsReportList();
if (data == null) {
return;
}
IExtent extent = paintProps.getView().getExtent();
List<PointImage> images = new ArrayList<PointImage>( data.size() );
List<DrawableString> strings = new ArrayList<DrawableString>( data.size() * 3 );
for (GageData gage : data) {
/* Get the point color for this location */
if ((gage.getLid() != null) && gage.isUse()) {
addPoint(gage); addPoint(gage);
Coordinate c = gage.getCoordinate(); Coordinate c = gage.getCoordinate();
double[] pixel = descriptor.worldToPixel(new double[] { double[] pixel = descriptor.worldToPixel(new double[] { c.x, c.y });
c.x, c.y });
if (pixel != null && extent.contains(pixel)) { if (pixel != null && extent.contains(pixel)) {
double shiftHeightValue = getShiftHeight(gage); double shiftHeightValue = getShiftHeight(gage);
double shiftWidthValue = getShiftWidth(gage); double shiftWidthValue = getShiftWidth(gage);
@ -822,11 +1125,11 @@ public class MultiPointResource extends
image.setSiteId(gage.getLid()); image.setSiteId(gage.getLid());
images.add(image); images.add(image);
} }
strings.addAll(drawPlotInfo(gage, shiftWidthValue, strings.addAll( drawPlotInfo(gage, shiftWidthValue, shiftHeightValue, paintProps, target) );
shiftHeightValue, paintProps, target));
} }
} }
} }
if (images.size() > 0) { if (images.size() > 0) {
target.getExtension(IPointImageExtension.class) target.getExtension(IPointImageExtension.class)
.drawPointImages(paintProps, images); .drawPointImages(paintProps, images);
@ -836,21 +1139,6 @@ public class MultiPointResource extends
} }
} }
GageData currentData = manager.getCurrentData();
if (currentData != null) {
List<GageData> siteList = pdcManager.getObsReportList();
if ((siteList != null) && siteList.contains(currentData)) {
double shiftHeightValue = getShiftHeight(currentData);
double shiftWidthValue = getShiftWidth(currentData);
PixelExtent pe = getPixelExtent(currentData, shiftWidthValue,
shiftHeightValue);
target.drawRect(pe, HydroConstants.SQUARE_COLOR, 2, 1);
}
}
}
/** /**
* Set the selected coordinate * Set the selected coordinate
* *
@ -942,48 +1230,8 @@ public class MultiPointResource extends
return null; return null;
} }
private String getDataFormat(String pe) {
String format = "6.2f";
if (pe.toUpperCase().startsWith("H")) { private RGB getRiverValueColorForTimeStepMode( String pLid, double pValue ) {
/* Height data */
format = "%6.2f";
} else if (pe.toUpperCase().startsWith("P")) {
/* Precip/Pressure data */
format = "%6.2f";
} else if (pe.toUpperCase().startsWith("T")) {
/* Temperature data */
format = "%6.0f";
} else if (pe.toUpperCase().startsWith("S")) {
/* Snow data */
if (pe.equalsIgnoreCase("SL")) {
format = "%6.2f";
} else {
format = "%6.1f";
}
} else if (pe.toUpperCase().startsWith("U")) {
/* Wind data */
if (pe.equalsIgnoreCase("UQ")) {
format = "%8.4f";
} else {
format = "%6.0f";
}
} else if (pe.toUpperCase().startsWith("X")) {
/* Weather data */
format = "%5.0f";
} else if (pe.toUpperCase().startsWith("Q")) {
/* Flow/Runoff data */
if (!pe.equalsIgnoreCase("QB")) {
format = "%6.0f";
} else {
format = "%6.2f";
}
}
return format;
}
private RGB getRiverValueColorForTimeStepMode(GageData gage) {
RGB color = null; RGB color = null;
String threatIndex = ThreatIndex.THREAT_MISSING_DATA.getThreatIndex(); String threatIndex = ThreatIndex.THREAT_MISSING_DATA.getThreatIndex();
@ -991,7 +1239,7 @@ public class MultiPointResource extends
double floodLevel = PDCConstants.MISSING_VALUE; double floodLevel = PDCConstants.MISSING_VALUE;
/* Get the river status object for this lid */ /* Get the river status object for this lid */
RiverStat riverStat = dataManager.getRiverStatus(gage.getLid()); RiverStat riverStat = dataManager.getRiverStatus(pLid);
int selectedTimeStepElement = pcOptions.getTsDataElement(); int selectedTimeStepElement = pcOptions.getTsDataElement();
@ -1012,12 +1260,12 @@ public class MultiPointResource extends
} }
// determine the threat level // determine the threat level
if ((gage.getValue()) != PDCConstants.MISSING_VALUE) { if (( pValue ) != PDCConstants.MISSING_VALUE) {
threatIndex = ThreatIndex.THREAT_MISSING_STAGE.getThreatIndex(); threatIndex = ThreatIndex.THREAT_MISSING_STAGE.getThreatIndex();
if ((actionLevel != PDCConstants.MISSING_VALUE) if ((actionLevel != PDCConstants.MISSING_VALUE)
&& (actionLevel != 0)) { && (actionLevel != 0)) {
if (gage.getValue() >= actionLevel) { if ( pValue >= actionLevel) {
threatIndex = ThreatIndex.THREAT_ACTION.getThreatIndex(); threatIndex = ThreatIndex.THREAT_ACTION.getThreatIndex();
} else { } else {
threatIndex = ThreatIndex.THREAT_NONE.getThreatIndex(); threatIndex = ThreatIndex.THREAT_NONE.getThreatIndex();
@ -1025,7 +1273,7 @@ public class MultiPointResource extends
} }
if ((floodLevel != PDCConstants.MISSING_VALUE) && (floodLevel != 0)) { if ((floodLevel != PDCConstants.MISSING_VALUE) && (floodLevel != 0)) {
if (gage.getValue() >= floodLevel) { if ( pValue >= floodLevel) {
threatIndex = ThreatIndex.THREAT_FLOOD.getThreatIndex(); threatIndex = ThreatIndex.THREAT_FLOOD.getThreatIndex();
} else if (actionLevel == PDCConstants.MISSING_VALUE) { } else if (actionLevel == PDCConstants.MISSING_VALUE) {
threatIndex = ThreatIndex.THREAT_NONE.getThreatIndex(); threatIndex = ThreatIndex.THREAT_NONE.getThreatIndex();
@ -1246,10 +1494,19 @@ public class MultiPointResource extends
* Clear the data map. * Clear the data map.
*/ */
public void resetDataMap() { public void resetDataMap() {
if (pcOptions.getQueryMode() == 1){
dataMapTimeStep.clear();
strTreeTimeStep = new STRtree();
}else{
dataMap.clear(); dataMap.clear();
strTree = new STRtree(); strTree = new STRtree();
} }
}
private class TimeSeriesLaunchAction extends AbstractRightClickAction { private class TimeSeriesLaunchAction extends AbstractRightClickAction {
/* /*

View file

@ -69,6 +69,7 @@ import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.hydrocommon.HydroConstants; import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.hydrocommon.util.DbUtils;
import com.raytheon.viz.hydrocommon.util.RatingUtils; import com.raytheon.viz.hydrocommon.util.RatingUtils;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
@ -1202,6 +1203,8 @@ public class FloodReportDlg extends CaveSWTDialog {
sql.append(", q"); sql.append(", q");
} }
cremark = DbUtils.escapeSpecialCharforStr(cremark);
sql.append(") values('" + data.getLid() + "', "); sql.append(") values('" + data.getLid() + "', ");
sql.append("'" + dateFormat.format(eventDate) + "', "); sql.append("'" + dateFormat.format(eventDate) + "', ");
sql.append("'" + hourFormat.format(eventDate) + "', "); sql.append("'" + hourFormat.format(eventDate) + "', ");

View file

@ -31,6 +31,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.HydroConstants; import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.hydrocommon.HydroConstants.ArealTypeSelection; import com.raytheon.viz.hydrocommon.HydroConstants.ArealTypeSelection;
import com.raytheon.viz.hydrocommon.datamanager.HydroDataManager; import com.raytheon.viz.hydrocommon.datamanager.HydroDataManager;
import com.raytheon.viz.hydrocommon.util.DbUtils;
/** /**
* GeoData Data Manager class. * GeoData Data Manager class.
@ -50,7 +51,8 @@ import com.raytheon.viz.hydrocommon.datamanager.HydroDataManager;
*/ */
public class GeoDataManager extends HydroDataManager { public class GeoDataManager extends HydroDataManager {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(GeoDataManager.class); private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GeoDataManager.class);
private static GeoDataManager instance = null; private static GeoDataManager instance = null;
private GeoDataManager() { private GeoDataManager() {
@ -60,8 +62,7 @@ public class GeoDataManager extends HydroDataManager {
/** /**
* Get an instance of this class * Get an instance of this class
* *
* @return * @return The instance
* The instance
*/ */
public static synchronized GeoDataManager getInstance() { public static synchronized GeoDataManager getInstance() {
if (instance == null) { if (instance == null) {
@ -76,16 +77,14 @@ public class GeoDataManager extends HydroDataManager {
* *
* @param type * @param type
* The type of area looking for * The type of area looking for
* @return * @return List of GeoAreaData objects
* List of GeoAreaData objects
* @throws VizException * @throws VizException
*/ */
public ArrayList<GeoAreaData> getGeoArea(ArealTypeSelection type) public ArrayList<GeoAreaData> getGeoArea(ArealTypeSelection type)
throws VizException { throws VizException {
ArrayList<GeoAreaData> returnList = new ArrayList<GeoAreaData>(); ArrayList<GeoAreaData> returnList = new ArrayList<GeoAreaData>();
StringBuilder query = new StringBuilder(); StringBuilder query = new StringBuilder();
query query.append("select area_id, name, boundary_type, interior_lat, interior_lon from geoarea ");
.append("select area_id, name, boundary_type, interior_lat, interior_lon from geoarea ");
query.append(" where boundary_type = '" query.append(" where boundary_type = '"
+ HydroConstants.GEOAREA_DATANAMES[type.ordinal()] + HydroConstants.GEOAREA_DATANAMES[type.ordinal()]
+ "' order by area_id"); + "' order by area_id");
@ -112,8 +111,7 @@ public class GeoDataManager extends HydroDataManager {
* *
* @param type * @param type
* The type of data to delete * The type of data to delete
* @return * @return The number of lines modified
* The number of lines modified
* @throws VizException * @throws VizException
*/ */
public int deleteLineSegs(String type) throws VizException { public int deleteLineSegs(String type) throws VizException {
@ -129,10 +127,10 @@ public class GeoDataManager extends HydroDataManager {
/** /**
* Delete data from the geoarea table. * Delete data from the geoarea table.
*
* @param type * @param type
* The type of data to delete * The type of data to delete
* @return * @return The number of lines modified
* The number of lines modified
* @throws VizException * @throws VizException
*/ */
public int deleteGeoArea(String type) throws VizException { public int deleteGeoArea(String type) throws VizException {
@ -150,8 +148,7 @@ public class GeoDataManager extends HydroDataManager {
* *
* @param data * @param data
* The GeoAreaData object to write * The GeoAreaData object to write
* @return * @return The number of rows modified
* The number of rows modified
* @throws VizException * @throws VizException
*/ */
public int putGeoArea(GeoAreaData data) throws VizException { public int putGeoArea(GeoAreaData data) throws VizException {
@ -171,6 +168,8 @@ public class GeoDataManager extends HydroDataManager {
return status; return status;
} }
DbUtils.escapeSpecialCharforData(data);
/* /*
* if the interior lat, lon were provided from the input file, then use * if the interior lat, lon were provided from the input file, then use
* them. otherwise compute them. * them. otherwise compute them.
@ -276,7 +275,8 @@ public class GeoDataManager extends HydroDataManager {
} catch (VizException e) { } catch (VizException e) {
status = -1; status = -1;
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error putting data into LineSegs for area_id: " + areaId); "Error putting data into LineSegs for area_id: "
+ areaId);
} }
} else { } else {
/* delete the record and insert the new record */ /* delete the record and insert the new record */

View file

@ -32,8 +32,7 @@ package com.raytheon.viz.hydrocommon.cresthistory;
* Nov 04, 2010 5518 lbousaid added all/above/bellow flag to * Nov 04, 2010 5518 lbousaid added all/above/bellow flag to
* getRiverCrestData * getRiverCrestData
* Jan 09, 2015 16698 JingtaoD Crest History failed validation dialog pops up when OK button clicked * Jan 09, 2015 16698 JingtaoD Crest History failed validation dialog pops up when OK button clicked
* April 08 2015 17338 JingtaoD "Apostrophe" entered into Hydrobase text fields in dialog window are not *
* written to the IHFS database
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -50,6 +49,7 @@ import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.hydrocommon.data.RiverDataPoint; import com.raytheon.viz.hydrocommon.data.RiverDataPoint;
import com.raytheon.viz.hydrocommon.datamanager.RiverDataManager; import com.raytheon.viz.hydrocommon.datamanager.RiverDataManager;
import com.raytheon.viz.hydrocommon.datamanager.HydroDBDataManager; import com.raytheon.viz.hydrocommon.datamanager.HydroDBDataManager;
import com.raytheon.viz.hydrocommon.util.DbUtils;
public class CrestHistoryDataManager { public class CrestHistoryDataManager {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
@ -82,7 +82,8 @@ public class CrestHistoryDataManager {
* @param rdp * @param rdp
* @return * @return
*/ */
public CrestHistoryData getRiverCrestData(String lid, boolean control, int allFlag) { public CrestHistoryData getRiverCrestData(String lid, boolean control,
int allFlag) {
RiverDataManager rdm = RiverDataManager.getInstance(); RiverDataManager rdm = RiverDataManager.getInstance();
RiverDataPoint rdp = rdm.getRiverDataPoint(lid); RiverDataPoint rdp = rdm.getRiverDataPoint(lid);
@ -96,27 +97,24 @@ public class CrestHistoryDataManager {
* @param cd * @param cd
*/ */
public void deleteCrest(CrestData cd, String lid) { public void deleteCrest(CrestData cd, String lid) {
String deleteCrest = "delete from crest where lid = '" + lid + "' and datcrst = '" String deleteCrest = "delete from crest where lid = '" + lid
+ cd.getDateString() + "' and timcrst ='" + cd.getTimeString() + "' and datcrst = '" + cd.getDateString() + "' and timcrst ='"
+ "'"; + cd.getTimeString() + "'";
try { try {
AppsDefaults ad = AppsDefaults.getInstance(); AppsDefaults ad = AppsDefaults.getInstance();
boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN, false); boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN,
false);
if (debug) { if (debug) {
System.out.println(ad.getToken(HydroConstants.PGHOST) + ":" + System.out.println(ad.getToken(HydroConstants.PGHOST) + ":"
ad.getToken(HydroConstants.PGPORT) + ":" + + ad.getToken(HydroConstants.PGPORT) + ":"
ad.getToken(HydroConstants.DB_NAME)); + ad.getToken(HydroConstants.DB_NAME));
System.out.println("Query: " + deleteCrest); System.out.println("Query: " + deleteCrest);
} }
// check if dataQuery contains any apostrophe, if does, replace it to two single appostrophe
deleteCrest = HydroDBDataManager.getInstance().checkAppostrophe(deleteCrest);
DirectDbQuery.executeStatement(deleteCrest, HydroConstants.IHFS, DirectDbQuery.executeStatement(deleteCrest, HydroConstants.IHFS,
QueryLanguage.SQL); QueryLanguage.SQL);
} catch (VizException ve) { } catch (VizException ve) {
statusHandler.error("Error deleting the crest: " statusHandler.error("Error deleting the crest: " + lid, ve);
+ lid, ve);
} }
} }
@ -134,32 +132,39 @@ public class CrestHistoryDataManager {
* @return Error Message, or null if no errors * @return Error Message, or null if no errors
* @throws VizException * @throws VizException
*/ */
public String insertCrest(CrestData cd, String lid, CrestData selectedCrest, int mode) { public String insertCrest(CrestData cd, String lid,
CrestData selectedCrest, int mode) {
String errMsg = null; String errMsg = null;
DbUtils.escapeSpecialCharforData(cd);
if (mode == 3) { if (mode == 3) {
// Did the primary key change? // Did the primary key change?
if ((selectedCrest != null) && (cd.getDateString().equals(selectedCrest.getDateString()) if ((selectedCrest != null)
&& cd.getTimeString().equals(selectedCrest.getTimeString()))) { && (cd.getDateString()
.equals(selectedCrest.getDateString()) && cd
.getTimeString().equals(
selectedCrest.getTimeString()))) {
// The PK is different, delete the record, then insert // The PK is different, delete the record, then insert
String query = "delete from crest where lid = '" + lid + String query = "delete from crest where lid = '" + lid
"' and datcrst = '" + selectedCrest.getDateString() + + "' and datcrst = '" + selectedCrest.getDateString()
"' and timcrst = '" + selectedCrest.getTimeString() + "'"; + "' and timcrst = '" + selectedCrest.getTimeString()
+ "'";
try { try {
AppsDefaults ad = AppsDefaults.getInstance(); AppsDefaults ad = AppsDefaults.getInstance();
boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN, false); boolean debug = ad.getBoolean(
HydroConstants.DEBUG_HYDRO_DB_TOKEN, false);
if (debug) { if (debug) {
System.out.println(ad.getToken(HydroConstants.PGHOST) + ":" + System.out.println(ad.getToken(HydroConstants.PGHOST)
ad.getToken(HydroConstants.PGPORT) + ":" + + ":" + ad.getToken(HydroConstants.PGPORT)
ad.getToken(HydroConstants.DB_NAME)); + ":" + ad.getToken(HydroConstants.DB_NAME));
System.out.println("Query: " + query); System.out.println("Query: " + query);
} }
// check if dataQuery contains any apostrophe, if does, replace it to two single appostrophe
query = HydroDBDataManager.getInstance().checkAppostrophe(query);
DirectDbQuery.executeStatement(query, HydroConstants.IHFS, QueryLanguage.SQL); DirectDbQuery.executeStatement(query, HydroConstants.IHFS,
QueryLanguage.SQL);
} catch (VizException e) { } catch (VizException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -176,7 +181,7 @@ public class CrestHistoryDataManager {
remarks = remarks.replaceAll("\n", "\\n"); remarks = remarks.replaceAll("\n", "\\n");
back.append("'" + remarks + "', "); back.append("'" + remarks + "', ");
front.append("cremark, "); front.append("cremark, ");
// back.append("'" + cd.getRemarks() + "', "); // back.append("'" + cd.getRemarks() + "', ");
} }
if (cd.isHighWater()) { if (cd.isHighWater()) {
front.append("hw, "); front.append("hw, ");
@ -205,17 +210,16 @@ public class CrestHistoryDataManager {
boolean executeUpdate = false; boolean executeUpdate = false;
AppsDefaults ad = AppsDefaults.getInstance(); AppsDefaults ad = AppsDefaults.getInstance();
boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN, false); boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN,
false);
if (debug) { if (debug) {
System.out.println(ad.getToken(HydroConstants.PGHOST) + ":" + System.out.println(ad.getToken(HydroConstants.PGHOST) + ":"
ad.getToken(HydroConstants.PGPORT) + ":" + + ad.getToken(HydroConstants.PGPORT) + ":"
ad.getToken(HydroConstants.DB_NAME)); + ad.getToken(HydroConstants.DB_NAME));
System.out.println("Query: " + insertCrest); System.out.println("Query: " + insertCrest);
} }
try { try {
// check if dataQuery contains any apostrophe, if does, replace it to two single appostrophe
insertCrest = HydroDBDataManager.getInstance().checkAppostrophe(insertCrest);
DirectDbQuery.executeStatement(insertCrest, HydroConstants.IHFS, DirectDbQuery.executeStatement(insertCrest, HydroConstants.IHFS,
QueryLanguage.SQL); QueryLanguage.SQL);
@ -223,7 +227,7 @@ public class CrestHistoryDataManager {
e.printStackTrace(); e.printStackTrace();
//exception with duplicate key value is throwed in the 2nd cause // exception with duplicate key value is throwed in the 2nd cause
if (e.getCause().getCause().getMessage().contains("crest_pk")) { if (e.getCause().getCause().getMessage().contains("crest_pk")) {
executeUpdate = true; executeUpdate = true;
@ -236,14 +240,14 @@ public class CrestHistoryDataManager {
/* execute an update */ /* execute an update */
StringBuilder query = new StringBuilder("update crest set "); StringBuilder query = new StringBuilder("update crest set ");
// query.append("lid = '" + lid + "', "); // query.append("lid = '" + lid + "', ");
// query.append("datcrst = '" + cd.getDateString() + "', "); // query.append("datcrst = '" + cd.getDateString() + "', ");
if (cd.getRemarks() != null) { if (cd.getRemarks() != null) {
String remarks = cd.getRemarks(); String remarks = cd.getRemarks();
remarks = remarks.replace("\n", "\\n"); remarks = remarks.replace("\n", "\\n");
query.append("cremark = E'" + remarks + "', "); query.append("cremark = E'" + remarks + "', ");
// query.append("cremark = '" + cd.getRemarks() + "', "); // query.append("cremark = '" + cd.getRemarks() + "', ");
} }
if (cd.isHighWater()) { if (cd.isHighWater()) {
@ -279,16 +283,14 @@ public class CrestHistoryDataManager {
query.append("and timcrst = '" + cd.getTimeString() + "' "); query.append("and timcrst = '" + cd.getTimeString() + "' ");
try { try {
if (debug) { if (debug) {
System.out.println(ad.getToken(HydroConstants.PGHOST) + ":" + System.out.println(ad.getToken(HydroConstants.PGHOST) + ":"
ad.getToken(HydroConstants.PGPORT) + ":" + + ad.getToken(HydroConstants.PGPORT) + ":"
ad.getToken(HydroConstants.DB_NAME)); + ad.getToken(HydroConstants.DB_NAME));
System.out.println("Query: " + query.toString()); System.out.println("Query: " + query.toString());
} }
// check if dataQuery contains any apostrophe, if does, replace it to two single appostrophe DirectDbQuery.executeStatement(query.toString(),
String newquery = HydroDBDataManager.getInstance().checkAppostrophe(query.toString()); HydroConstants.IHFS, QueryLanguage.SQL);
DirectDbQuery.executeStatement(newquery, HydroConstants.IHFS, QueryLanguage.SQL);
} catch (VizException e) { } catch (VizException e) {
errMsg = "Error updating data in database"; errMsg = "Error updating data in database";
e.printStackTrace(); e.printStackTrace();

View file

@ -42,6 +42,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* 05Nov2008 --- dhladky Initial Creation * 05Nov2008 --- dhladky Initial Creation
* 14Mar2012 1790 rferrel Fix Comparable to remove eclipse warnings. * 14Mar2012 1790 rferrel Fix Comparable to remove eclipse warnings.
* Aug 05, 2015 4486 rjpeter Changed Timestamp to Date. * Aug 05, 2015 4486 rjpeter Changed Timestamp to Date.
* 05Oct2015 17978 lbousaidi Added getParamCode(), getShefDurCode(), convertDur(),
* getDataFormat().
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -908,7 +910,7 @@ public class GageData implements Comparable<GageData> {
return retVal; return retVal;
} }
/* /**
* (non-Javadoc) * (non-Javadoc)
* *
* @see java.lang.Object#toString() * @see java.lang.Object#toString()
@ -917,4 +919,169 @@ public class GageData implements Comparable<GageData> {
public String toString() { public String toString() {
return this.getLid(); return this.getLid();
} }
/**
* Get Parameter Code
*
* @return String Parameter Code
*
*/
public String getParamCode(){
return getPe() + getShefDurCode()+ getTs() + getExtremum();
}
/**
* Get Shef Duration Code
*
* @return String Shef Duration Code
*
*/
public String getShefDurCode(){
String shefDurCode;
if ( getPe().equalsIgnoreCase("PC") ) {
// PC is always "I", but sometimes the duration might have been
// screwed up
shefDurCode = "I";
} else {
shefDurCode = convertDur((int) getDur());
if (shefDurCode == null) {
shefDurCode = "?";
}
}
return shefDurCode;
}
/**
* Convert duration int to String character.
*
* @param dur
* The duration value
* @return The single character duration value
*/
public static String convertDur(int dur) {
String value = null;
switch (dur) {
case 0:
value = "I";
break;
case 1:
value = "U";
break;
case 5:
value = "E";
break;
case 10:
value = "G";
break;
case 15:
value = "C";
break;
case 30:
value = "J";
break;
case 1001:
value = "H";
break;
case 1002:
value = "B";
break;
case 1003:
value = "T";
break;
case 1004:
value = "F";
break;
case 1006:
value = "Q";
break;
case 1008:
value = "A";
break;
case 1012:
value = "K";
break;
case 1018:
value = "L";
break;
case 2001:
value = "D";
break;
case 2007:
value = "W";
break;
case 3001:
value = "M";
break;
case 4001:
value = "Y";
break;
case 5004:
value = "P";
break;
case 5001:
value = "S";
break;
case 5002:
value = "R";
break;
case 5005:
value = "X";
break;
}
return value;
}
/**
* Get data format
*
* @param pe - element type
*
* @return String - format string
*/
public static String getDataFormat(String pe) {
String format = "6.2f";
if (pe.toUpperCase().startsWith("H")) {
/* Height data */
format = "%6.2f";
} else if (pe.toUpperCase().startsWith("P")) {
/* Precip/Pressure data */
format = "%6.2f";
} else if (pe.toUpperCase().startsWith("T")) {
/* Temperature data */
format = "%6.0f";
} else if (pe.toUpperCase().startsWith("S")) {
/* Snow data */
if (pe.equalsIgnoreCase("SL")) {
format = "%6.2f";
} else {
format = "%6.1f";
}
} else if (pe.toUpperCase().startsWith("U")) {
/* Wind data */
if (pe.equalsIgnoreCase("UQ")) {
format = "%8.4f";
} else {
format = "%6.0f";
}
} else if (pe.toUpperCase().startsWith("X")) {
/* Weather data */
format = "%5.0f";
} else if (pe.toUpperCase().startsWith("Q")) {
/* Flow/Runoff data */
if (!pe.equalsIgnoreCase("QB")) {
format = "%6.0f";
} else {
format = "%6.2f";
}
}
return format;
}
} }

View file

@ -0,0 +1,340 @@
/**
* 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.hydrocommon.data;
/**
* Class for packaging the gage data in TimeStep mode.
*
* <pre>
* SOFTWARE HISTOR
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 14, 2015 17978 lbousaidi Initial Creation
* </pre>
*
* @author lbousaidi
* @version 1.0
*/
public class GageDataTimeStep extends GageData {
private String PP_p = "";
private String PC_p = "";
private String Other_p = "";
private String PP_v = "";
private String PC_v = "";
private String Other_v = "";
/**
* public constructor
*/
public GageDataTimeStep(){
super();
}
/**
* public constructor
*
* @param gage
*/
public GageDataTimeStep( GageData gage ){
setLid(gage.getLid());
setName(gage.getName());
setElevation(gage.getElevation());
setValidtime(gage.getValidtime());
setCoordinate(gage.getCoordinate());
setDispClass(gage.getDispClass());
setValue( gage.getValue() );
setThreatIndex( gage.getThreatIndex() );
setP( gage );
setV( gage );
return;
}
/**
* Update by a gage
*
* @param gage
*/
public void Update( GageData gage ){
if (getValue() < gage.getValue()){
setValue( gage.getValue() );
setThreatIndex(gage.getThreatIndex());
}
addParam( gage );
addValue( gage );
return;
}
/**
* Get both PP and PC Parameter codes
*/
public String getPpAndPcParam() {
return combineString( PP_p, PC_p );
}
/**
* Get both PP and PC Values
*/
public String getPpAndPcValue() {
return combineString( PP_v, PC_v );
}
/**
* Get PP Parameter codes
*/
public String getPpParam( ) {
return PP_p;
}
/**
* Get both PP values
*/
public String getPpValue() {
return PP_v;
}
/**
* Get PC Parameter codes
*/
public String getPcParam( ) {
return PC_p;
}
/**
* Get both PC values
*/
public String getPcValue() {
return PC_v;
}
/**
* Get Parameter codes for rain
*/
public String getRainParam(int a){
if (a == 0){
return getPpAndPcParam();
}
if (a == 1){
return getPcParam();
}
if (a == 2){
return getPpParam();
}
return "";
}
/**
* Get Parameter values for rain
*/
public String getRainValue(int a){
if (a == 0){
return getPpAndPcValue();
}
if (a == 1){
return getPcValue();
}
if (a == 2){
return getPpValue();
}
return "";
}
/**
* Get both Parameter codes for other
*/
public String getOtherParam() {
return Other_p;
}
/**
* Get both values for other
*/
public String getOtherValue() {
return Other_v;
}
/**
* Set Parameter codes
*
* @param gage
*
*/
private void setP( GageData gage ) {
if (gage.getPe().equalsIgnoreCase("PP")){
PP_p = gage.getParamCode();
return;
}
if (gage.getPe().equalsIgnoreCase("PC")){
PC_p = gage.getParamCode();
return;
}
Other_p = gage.getParamCode();
}
/**
* Set values
*
* @param gage
*
*/
private void setV( GageData gage ) {
if (gage.getPe().equalsIgnoreCase("PP")){
PP_v = formatValue(gage);
return;
}
if (gage.getPe().equalsIgnoreCase("PC")){
PC_v = formatValue(gage);
return;
}
Other_v = formatValue(gage);
}
/**
* Add Parameter codes
*
* @param gage
*
*/
private void addParam( GageData gage ) {
if (gage.getPe().equalsIgnoreCase("PP")){
PP_p = combineString(PP_p, gage.getParamCode());
}
if (gage.getPe().equalsIgnoreCase("PC")){
PC_p = combineString(PC_p, gage.getParamCode());
}
Other_p = combineString (Other_p, gage.getParamCode());
}
/**
* Add values
*
* @param gage
*
*/
private void addValue( GageData gage ) {
if (gage.getPe().equalsIgnoreCase("PP")){
PP_v = combineString( PP_v, formatValue(gage) );
}
if (gage.getPe().equalsIgnoreCase("PC")){
PC_v = combineString( PC_v, formatValue(gage) );
}
Other_v = combineString ( Other_v, formatValue(gage) );
}
/**
* Combine two strings
*
* @param strOne first string
*
* @param strTwo second string
*/
private String combineString( String strOne, String strTwo ) {
String combinedStr = "";
if (strOne.equalsIgnoreCase("")){
combinedStr = strTwo;
}else {
if ( !strTwo.equalsIgnoreCase("") ){
combinedStr = strOne + "\n" + strTwo;
}else{
combinedStr = strOne;
}
}
return combinedStr;
}
public static String formatValue( GageData pGage ){
String valueLabel;
String formatStr = null;
formatStr = getDataFormat( pGage.getPe() );
if ( pGage.getValue() == -9999 ) {
valueLabel = "M";
} else {
valueLabel = String.format( formatStr, pGage.getValue() );
}
return valueLabel;
}
}

View file

@ -784,7 +784,7 @@ public class RiverStatData extends HydroDBData implements IHydroDBData {
String rval = "INSERT INTO riverstat ( " + columns String rval = "INSERT INTO riverstat ( " + columns
+ " ) VALUES ( %s, %s, %s, %s, %s, %s, %s," + " ) VALUES ( %s, %s, %s, %s, %s, %s, %s,"
+ " %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, $$%s$$, %s," + " %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, '%s', %s,"
+ " %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )"; + " %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )";
rval = String.format(rval, getDBString(lid), getDBString(primaryPE), rval = String.format(rval, getDBString(lid), getDBString(primaryPE),
@ -830,7 +830,7 @@ public class RiverStatData extends HydroDBData implements IHydroDBData {
public String getUpdateStatement() { public String getUpdateStatement() {
// Set the basic update statement // Set the basic update statement
String rval = "UPDATE riverstat SET lid=%s, primary_pe=%s, bf=%s, cb=%s, da=%s, response_time=%s, threshold_runoff=%s," String rval = "UPDATE riverstat SET lid=%s, primary_pe=%s, bf=%s, cb=%s, da=%s, response_time=%s, threshold_runoff=%s,"
+ " fq=%s, fs=%s, gsno=%s, level=%s, mile=%s, pool=%s, por=%s, rated=%s, lat=%s, lon=%s, remark=$$%s$$, rrevise=%s," + " fq=%s, fs=%s, gsno=%s, level=%s, mile=%s, pool=%s, por=%s, rated=%s, lat=%s, lon=%s, remark='%s', rrevise=%s,"
+ " rsource=%s, stream=%s, tide=%s, backwater=%s, vdatum=%s, action_flow=%s, wstg=%s, zd=%s, ratedat=%s," + " rsource=%s, stream=%s, tide=%s, backwater=%s, vdatum=%s, action_flow=%s, wstg=%s, zd=%s, ratedat=%s,"
+ " usgs_ratenum=%s, uhgdur=%s, use_latest_fcst=%s, issuestg=%s, issueflow=%s WHERE %s"; + " usgs_ratenum=%s, uhgdur=%s, use_latest_fcst=%s, issuestg=%s, issueflow=%s WHERE %s";

View file

@ -25,6 +25,7 @@ import com.raytheon.uf.common.dataquery.db.QueryResult;
import com.raytheon.uf.common.dataquery.db.QueryResultRow; import com.raytheon.uf.common.dataquery.db.QueryResultRow;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.data.ContactsData; import com.raytheon.viz.hydrocommon.data.ContactsData;
import com.raytheon.viz.hydrocommon.util.DbUtils;
/** /**
* This class is the data manager for the contacts data. * This class is the data manager for the contacts data.
@ -42,8 +43,7 @@ import com.raytheon.viz.hydrocommon.data.ContactsData;
* @author lvenable * @author lvenable
* @version 1.0 * @version 1.0
*/ */
public class ContactsDataManager extends HydroDataManager public class ContactsDataManager extends HydroDataManager {
{
/** /**
* Instance of this class. * Instance of this class.
*/ */
@ -72,12 +72,12 @@ public class ContactsDataManager extends HydroDataManager
/** /**
* Constructor. * Constructor.
*/ */
public ContactsDataManager() public ContactsDataManager() {
{
} }
/** /**
* Get an instance of this class. * Get an instance of this class.
*
* @return An instance of this class. * @return An instance of this class.
*/ */
public static synchronized ContactsDataManager getInstance() { public static synchronized ContactsDataManager getInstance() {
@ -90,12 +90,15 @@ public class ContactsDataManager extends HydroDataManager
/** /**
* Get the list of contacts from the specified location ID. * Get the list of contacts from the specified location ID.
* @param lid Location ID. *
* @param lid
* Location ID.
* @return ArrayList of ContactsData. * @return ArrayList of ContactsData.
* @throws VizException Database exception. * @throws VizException
* Database exception.
*/ */
public ArrayList<ContactsData> getContactData(String lid) throws VizException public ArrayList<ContactsData> getContactData(String lid)
{ throws VizException {
ArrayList<ContactsData> rval = new ArrayList<ContactsData>(); ArrayList<ContactsData> rval = new ArrayList<ContactsData>();
QueryResult result = runMappedQuery(SELECT_STATEMENT + " WHERE lid='" QueryResult result = runMappedQuery(SELECT_STATEMENT + " WHERE lid='"
@ -109,15 +112,21 @@ public class ContactsDataManager extends HydroDataManager
} }
/** /**
* Delete the record from the database the specified location ID and Contact. * Delete the record from the database the specified location ID and
* @param contactsData Contacts data. * Contact.
* @throws VizException Database exception. *
* @param contactsData
* Contacts data.
* @throws VizException
* Database exception.
*/ */
public void deleteRecord(ContactsData contactsData) throws VizException public void deleteRecord(ContactsData contactsData) throws VizException {
{ DbUtils.escapeSpecialCharforData(contactsData);
StringBuilder query = new StringBuilder(DELETE_STATEMENT); StringBuilder query = new StringBuilder(DELETE_STATEMENT);
String whereClaus = String.format(" WHERE lid = '%s' AND contact = '%s' ", String whereClaus = String.format(
contactsData.getLid(), contactsData.getContact()); " WHERE lid = '%s' AND contact = '%s' ", contactsData.getLid(),
contactsData.getContact());
query.append(whereClaus); query.append(whereClaus);
runStatement(query.toString()); runStatement(query.toString());
@ -125,23 +134,28 @@ public class ContactsDataManager extends HydroDataManager
/** /**
* Check if a specific record exists in the contacts table. * Check if a specific record exists in the contacts table.
* @param lid Location ID. *
* @param contactName Contact name. * @param lid
* Location ID.
* @param contactName
* Contact name.
* @return True if the record exists, false otherwise. * @return True if the record exists, false otherwise.
* @throws VizException Database exception. * @throws VizException
* Database exception.
*/ */
public boolean recordExists(String lid, String contactName) throws VizException public boolean recordExists(String lid, String contactName)
{ throws VizException {
contactName = DbUtils.escapeSpecialCharforStr(contactName);
StringBuilder query = new StringBuilder(SELECT_STATEMENT); StringBuilder query = new StringBuilder(SELECT_STATEMENT);
String whereClaus = String.format(" WHERE lid = '%s' AND contact = '%s' ", String whereClaus = String.format(
lid, contactName); " WHERE lid = '%s' AND contact = '%s' ", lid, contactName);
query.append(whereClaus); query.append(whereClaus);
QueryResult result = runMappedQuery(query.toString()); QueryResult result = runMappedQuery(query.toString());
if (result.getResultCount() == 0) if (result.getResultCount() == 0) {
{
return false; return false;
} }
@ -150,11 +164,15 @@ public class ContactsDataManager extends HydroDataManager
/** /**
* Insert the new contact data into the database. * Insert the new contact data into the database.
* @param data Contacts data. *
* @throws VizException Database exception. * @param data
* Contacts data.
* @throws VizException
* Database exception.
*/ */
public void insertContactData(ContactsData data) throws VizException public void insertContactData(ContactsData data) throws VizException {
{ DbUtils.escapeSpecialCharforData(data);
String query = String.format(INSERT_STATEMENT, data.getLid(), String query = String.format(INSERT_STATEMENT, data.getLid(),
data.getContact(), data.getPhone(), data.getEmail(), data.getContact(), data.getPhone(), data.getEmail(),
data.getRemark(), data.getPriority()); data.getRemark(), data.getPriority());
@ -164,12 +182,18 @@ public class ContactsDataManager extends HydroDataManager
/** /**
* Update an existing record in the contacts table with the new information. * Update an existing record in the contacts table with the new information.
* @param data Contacts data. *
* @throws VizException Database exception. * @param data
* Contacts data.
* @throws VizException
* Database exception.
*/ */
public void updateContactData(ContactsData data, public void updateContactData(ContactsData data, String originalContactName)
String originalContactName) throws VizException throws VizException {
{ DbUtils.escapeSpecialCharforData(data);
originalContactName = DbUtils
.escapeSpecialCharforStr(originalContactName);
String query = String.format(UPDATE_STATEMENT, data.getContact(), String query = String.format(UPDATE_STATEMENT, data.getContact(),
data.getPhone(), data.getEmail(), data.getRemark(), data.getPhone(), data.getEmail(), data.getRemark(),
data.getPriority(), data.getLid(), originalContactName); data.getPriority(), data.getLid(), originalContactName);

View file

@ -25,6 +25,7 @@ import com.raytheon.uf.common.dataquery.db.QueryResult;
import com.raytheon.uf.common.dataquery.db.QueryResultRow; import com.raytheon.uf.common.dataquery.db.QueryResultRow;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.data.DescriptionData; import com.raytheon.viz.hydrocommon.data.DescriptionData;
import com.raytheon.viz.hydrocommon.util.DbUtils;
/** /**
* This class is the data manager for the description data. * This class is the data manager for the description data.
@ -42,8 +43,7 @@ import com.raytheon.viz.hydrocommon.data.DescriptionData;
* @author lvenable * @author lvenable
* @version 1.0 * @version 1.0
*/ */
public class DescriptionDataManager extends HydroDataManager public class DescriptionDataManager extends HydroDataManager {
{
/** /**
* Instance of this class. * Instance of this class.
*/ */
@ -57,8 +57,7 @@ public class DescriptionDataManager extends HydroDataManager
/** /**
* Insert statement. * Insert statement.
*/ */
private final String INSERT_STATEMENT = private final String INSERT_STATEMENT = "INSERT INTO descrip (lid, bed, divert, remark, ice, proximity, reach, res, topo) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')";
"INSERT INTO descrip (lid, bed, divert, remark, ice, proximity, reach, res, topo) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')";
/** /**
* Delete statement. * Delete statement.
@ -68,18 +67,17 @@ public class DescriptionDataManager extends HydroDataManager
/** /**
* Update statement. * Update statement.
*/ */
private final String UPDATE_STATEMENT = private final String UPDATE_STATEMENT = "UPDATE descrip SET bed='%s', divert='%s', remark='%s', ice='%s', proximity='%s', reach='%s', res='%s', topo='%s' WHERE lid='%s'";
"UPDATE descrip SET bed='%s', divert='%s', remark='%s', ice='%s', proximity='%s', reach='%s', res='%s', topo='%s' WHERE lid='%s'";
/** /**
* Private Constructor. * Private Constructor.
*/ */
private DescriptionDataManager() private DescriptionDataManager() {
{
} }
/** /**
* Get an instance of this class. * Get an instance of this class.
*
* @return An instance of this class. * @return An instance of this class.
*/ */
public static synchronized DescriptionDataManager getInstance() { public static synchronized DescriptionDataManager getInstance() {
@ -92,12 +90,15 @@ public class DescriptionDataManager extends HydroDataManager
/** /**
* Get the description data. * Get the description data.
* @param lid Location ID. *
* @param lid
* Location ID.
* @return An array of description data. * @return An array of description data.
* @throws VizException Database exception. * @throws VizException
* Database exception.
*/ */
public ArrayList<DescriptionData> getDescriptionData(String lid) throws VizException public ArrayList<DescriptionData> getDescriptionData(String lid)
{ throws VizException {
ArrayList<DescriptionData> rval = new ArrayList<DescriptionData>(); ArrayList<DescriptionData> rval = new ArrayList<DescriptionData>();
QueryResult result = runMappedQuery(SELECT_STATEMENT + " WHERE lid='" QueryResult result = runMappedQuery(SELECT_STATEMENT + " WHERE lid='"
@ -112,11 +113,13 @@ public class DescriptionDataManager extends HydroDataManager
/** /**
* Delete a specified description. * Delete a specified description.
* @param lid Location ID. *
* @throws VizException Database exception. * @param lid
* Location ID.
* @throws VizException
* Database exception.
*/ */
public void deleteDescription(String lid) throws VizException public void deleteDescription(String lid) throws VizException {
{
StringBuilder query = new StringBuilder(DELETE_STATEMENT); StringBuilder query = new StringBuilder(DELETE_STATEMENT);
String whereClaus = String.format(" WHERE lid = '%s'", lid); String whereClaus = String.format(" WHERE lid = '%s'", lid);
query.append(whereClaus); query.append(whereClaus);
@ -126,14 +129,20 @@ public class DescriptionDataManager extends HydroDataManager
/** /**
* Insert description data. * Insert description data.
* @param descData Description data. *
* @throws VizException Database exception. * @param descData
* Description data.
* @throws VizException
* Database exception.
*/ */
public void insertDescriptionData(DescriptionData descData) throws VizException public void insertDescriptionData(DescriptionData descData)
{ throws VizException {
DbUtils.escapeSpecialCharforData(descData);
String query = String.format(INSERT_STATEMENT, descData.getLid(), String query = String.format(INSERT_STATEMENT, descData.getLid(),
descData.getStreamBed(), descData.getDivert(), descData.getRemark(), descData.getStreamBed(), descData.getDivert(),
descData.getIce(), descData.getProximity(), descData.getReach(), descData.getRemark(), descData.getIce(),
descData.getProximity(), descData.getReach(),
descData.getRegulation(), descData.getTopo()); descData.getRegulation(), descData.getTopo());
runStatement(query); runStatement(query);
@ -141,27 +150,36 @@ public class DescriptionDataManager extends HydroDataManager
/** /**
* Update description data. * Update description data.
* @param descData Description data. *
* @throws VizException Database exception. * @param descData
* Description data.
* @throws VizException
* Database exception.
*/ */
public void updateDescriptionData(DescriptionData descData) throws VizException public void updateDescriptionData(DescriptionData descData)
{ throws VizException {
String query = String.format(UPDATE_STATEMENT, DbUtils.escapeSpecialCharforData(descData);
descData.getStreamBed(), descData.getDivert(), descData.getRemark(),
descData.getIce(), descData.getProximity(), descData.getReach(), String query = String
descData.getRegulation(), descData.getTopo(), descData.getLid()); .format(UPDATE_STATEMENT, descData.getStreamBed(),
descData.getDivert(), descData.getRemark(),
descData.getIce(), descData.getProximity(),
descData.getReach(), descData.getRegulation(),
descData.getTopo(), descData.getLid());
runStatement(query); runStatement(query);
} }
/** /**
* Check if a record exists. * Check if a record exists.
* @param lid Location ID. *
* @param lid
* Location ID.
* @return True if the record exists, false otherwise. * @return True if the record exists, false otherwise.
* @throws VizException Database exception. * @throws VizException
* Database exception.
*/ */
public boolean recordExists(String lid) throws VizException public boolean recordExists(String lid) throws VizException {
{
StringBuilder query = new StringBuilder(SELECT_STATEMENT); StringBuilder query = new StringBuilder(SELECT_STATEMENT);
String whereClaus = String.format(" WHERE lid = '%s'", lid); String whereClaus = String.format(" WHERE lid = '%s'", lid);
@ -169,8 +187,7 @@ public class DescriptionDataManager extends HydroDataManager
QueryResult result = runMappedQuery(query.toString()); QueryResult result = runMappedQuery(query.toString());
if (result.getResultCount() == 0) if (result.getResultCount() == 0) {
{
return false; return false;
} }

View file

@ -29,6 +29,7 @@ import com.raytheon.uf.common.dataquery.db.QueryResult;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.HydroConstants; import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.hydrocommon.data.FloodCategoryData; import com.raytheon.viz.hydrocommon.data.FloodCategoryData;
import com.raytheon.viz.hydrocommon.util.DbUtils;
import com.raytheon.viz.hydrocommon.util.HydroDataUtils; import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
/** /**
@ -50,7 +51,6 @@ import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
public class FloodCategoryDataManager extends HydroDataManager { public class FloodCategoryDataManager extends HydroDataManager {
protected static FloodCategoryDataManager manager = null; protected static FloodCategoryDataManager manager = null;
private static final String INSERT_STATEMENT = "INSERT INTO floodcat (lid, major_stage, moderate_stage, minor_stage, major_flow, moderate_flow, minor_flow) VALUES ('%s', %s, %s, %s, %s, %s, %s)"; private static final String INSERT_STATEMENT = "INSERT INTO floodcat (lid, major_stage, moderate_stage, minor_stage, major_flow, moderate_flow, minor_flow) VALUES ('%s', %s, %s, %s, %s, %s, %s)";
private static final String SELECT_STATEMENT = "SELECT lid, major_stage, moderate_stage, minor_stage, major_flow, moderate_flow, minor_flow FROM floodcat"; private static final String SELECT_STATEMENT = "SELECT lid, major_stage, moderate_stage, minor_stage, major_flow, moderate_flow, minor_flow FROM floodcat";
@ -100,8 +100,8 @@ public class FloodCategoryDataManager extends HydroDataManager {
*/ */
public void deleteRecord(FloodCategoryData recordToDelete) public void deleteRecord(FloodCategoryData recordToDelete)
throws VizException { throws VizException {
runStatement(String.format(DELETE_STATEMENT, HydroDataUtils runStatement(String.format(DELETE_STATEMENT,
.getPKStatement(recordToDelete))); HydroDataUtils.getPKStatement(recordToDelete)));
} }
/** /**
@ -128,8 +128,8 @@ public class FloodCategoryDataManager extends HydroDataManager {
QueryResult result = runMappedQuery(SELECT_STATEMENT + " WHERE lid='" QueryResult result = runMappedQuery(SELECT_STATEMENT + " WHERE lid='"
+ lid + "'"); + lid + "'");
return (result.getResultCount() > 0) ? new FloodCategoryData(result return (result.getResultCount() > 0) ? new FloodCategoryData(
.getRows()[0], result.getColumnNames()) result.getRows()[0], result.getColumnNames())
: new FloodCategoryData(); : new FloodCategoryData();
} }
@ -149,7 +149,9 @@ public class FloodCategoryDataManager extends HydroDataManager {
private void updateFloodCategoryData(FloodCategoryData data) private void updateFloodCategoryData(FloodCategoryData data)
throws VizException { throws VizException {
Double majorS =null, minorS=null, moderateS=null, majorD=null, minorD=null, moderateD=null; Double majorS = null, minorS = null, moderateS = null, majorD = null, minorD = null, moderateD = null;
DbUtils.escapeSpecialCharforData(data);
if (data.getMajorStage() != HydroConstants.MISSING_VALUE) if (data.getMajorStage() != HydroConstants.MISSING_VALUE)
majorS = data.getMajorStage(); majorS = data.getMajorStage();
@ -164,16 +166,20 @@ public class FloodCategoryDataManager extends HydroDataManager {
if (data.getMinorDischarge() != HydroConstants.MISSING_VALUE) if (data.getMinorDischarge() != HydroConstants.MISSING_VALUE)
minorD = data.getMinorDischarge(); minorD = data.getMinorDischarge();
/*
/*check if any of the stages or flows is missing, then assign null into database;*/ * check if any of the stages or flows is missing, then assign null into
runStatement(String.format(UPDATE_STATEMENT, majorS, moderateS, minorS, majorD, * database;
moderateD, minorD, HydroDataUtils.getPKStatement(data))); */
runStatement(String.format(UPDATE_STATEMENT, majorS, moderateS, minorS,
majorD, moderateD, minorD, HydroDataUtils.getPKStatement(data)));
} }
private void insertFloodData(FloodCategoryData currData) private void insertFloodData(FloodCategoryData currData)
throws VizException { throws VizException {
Double majorS =null, minorS=null, moderateS=null, majorD=null, minorD=null, moderateD=null; Double majorS = null, minorS = null, moderateS = null, majorD = null, minorD = null, moderateD = null;
DbUtils.escapeSpecialCharforData(currData);
if (currData.getMajorStage() != HydroConstants.MISSING_VALUE) if (currData.getMajorStage() != HydroConstants.MISSING_VALUE)
majorS = currData.getMajorStage(); majorS = currData.getMajorStage();
@ -189,8 +195,8 @@ public class FloodCategoryDataManager extends HydroDataManager {
minorD = currData.getMinorDischarge(); minorD = currData.getMinorDischarge();
/* if any of the stage or flows is missing, the assign null to database */ /* if any of the stage or flows is missing, the assign null to database */
runStatement(String.format(INSERT_STATEMENT, currData.getLid(), runStatement(String.format(INSERT_STATEMENT, currData.getLid(), majorS,
majorS, moderateS, minorS, majorD, moderateD, minorD)); moderateS, minorS, majorD, moderateD, minorD));
} }
public boolean putFloodCategoryData(String lid, String majorStage, public boolean putFloodCategoryData(String lid, String majorStage,
@ -198,7 +204,7 @@ public class FloodCategoryDataManager extends HydroDataManager {
String modDischarge, String minorDischarge, Shell shell) String modDischarge, String minorDischarge, Shell shell)
throws VizException { throws VizException {
boolean rval = false; boolean rval = false;
String blankStr=""; String blankStr = "";
FloodCategoryData newData = new FloodCategoryData(); FloodCategoryData newData = new FloodCategoryData();

View file

@ -25,6 +25,7 @@ import com.raytheon.uf.common.dataquery.db.QueryResult;
import com.raytheon.uf.common.dataquery.db.QueryResultRow; import com.raytheon.uf.common.dataquery.db.QueryResultRow;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.data.FloodData; import com.raytheon.viz.hydrocommon.data.FloodData;
import com.raytheon.viz.hydrocommon.util.DbUtils;
import com.raytheon.viz.hydrocommon.util.HydroDataUtils; import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
/** /**
@ -93,8 +94,8 @@ public class FloodDataManager extends HydroDataManager {
* @throws VizException * @throws VizException
*/ */
public void deleteRecord(FloodData recordToDelete) throws VizException { public void deleteRecord(FloodData recordToDelete) throws VizException {
runStatement(String.format(DELETE_STATEMENT, HydroDataUtils runStatement(String.format(DELETE_STATEMENT,
.getPKStatement(recordToDelete))); HydroDataUtils.getPKStatement(recordToDelete)));
} }
/** /**
@ -160,14 +161,22 @@ public class FloodDataManager extends HydroDataManager {
} }
private void updateFloodData(FloodData data) throws VizException { private void updateFloodData(FloodData data) throws VizException {
runStatement(String.format(UPDATE_STATEMENT, data.getDamage(), data
.getDisplayStatement(), HydroDataUtils.getPKStatement(data))); DbUtils.escapeSpecialCharforData(data);
runStatement(String
.format(UPDATE_STATEMENT, data.getDamage(),
data.getDisplayStatement(),
HydroDataUtils.getPKStatement(data)));
} }
private void insertFloodData(FloodData currData) throws VizException { private void insertFloodData(FloodData currData) throws VizException {
runStatement(String.format(INSERT_STATEMENT, currData.getLid(), String
.format("%8.2f", currData.getStage()), currData.getDamage(), DbUtils.escapeSpecialCharforData(currData);
currData.getDisplayStatement()));
runStatement(String.format(INSERT_STATEMENT, currData.getLid(),
String.format("%8.2f", currData.getStage()),
currData.getDamage(), currData.getDisplayStatement()));
} }
public void putFloodCategoryData(String lid, double stage, String damage, public void putFloodCategoryData(String lid, double stage, String damage,

View file

@ -30,6 +30,7 @@ import com.raytheon.uf.common.dataquery.db.QueryResult;
import com.raytheon.uf.common.dataquery.db.QueryResultRow; import com.raytheon.uf.common.dataquery.db.QueryResultRow;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.data.HydroDBData; import com.raytheon.viz.hydrocommon.data.HydroDBData;
import com.raytheon.viz.hydrocommon.util.DbUtils;
/** /**
* Class for managing database query calls. * Class for managing database query calls.
@ -89,6 +90,9 @@ public class HydroDBDataManager extends HydroDataManager {
public <T extends HydroDBData> void deleteRecord(T recordToDelete) public <T extends HydroDBData> void deleteRecord(T recordToDelete)
throws VizException { throws VizException {
try { try {
DbUtils.escapeSpecialCharforData(recordToDelete);
String deleteQuery = (String) recordToDelete.getClass() String deleteQuery = (String) recordToDelete.getClass()
.getMethod("getDeleteStatement").invoke(recordToDelete); .getMethod("getDeleteStatement").invoke(recordToDelete);
@ -215,6 +219,9 @@ public class HydroDBDataManager extends HydroDataManager {
*/ */
public <T extends HydroDBData> void updateData(T data) throws VizException { public <T extends HydroDBData> void updateData(T data) throws VizException {
try { try {
DbUtils.escapeSpecialCharforData(data);
// Get the update statement with the values filled in // Get the update statement with the values filled in
String updateQuery = (String) data.getClass() String updateQuery = (String) data.getClass()
.getMethod("getUpdateStatement").invoke(data); .getMethod("getUpdateStatement").invoke(data);
@ -239,9 +246,11 @@ public class HydroDBDataManager extends HydroDataManager {
throws VizException { throws VizException {
try { try {
DbUtils.escapeSpecialCharforData(newData);
String updateQuery = (String) newData.getClass() String updateQuery = (String) newData.getClass()
.getMethod("getUpdateStatement").invoke(newData); .getMethod("getUpdateStatement").invoke(newData);
DbUtils.escapeSpecialCharforData(updateData);
String pkquery = (String) updateData.getClass() String pkquery = (String) updateData.getClass()
.getMethod("getPKStatement").invoke(updateData); .getMethod("getPKStatement").invoke(updateData);
@ -268,6 +277,7 @@ public class HydroDBDataManager extends HydroDataManager {
String insertQuery = null; String insertQuery = null;
try { try {
DbUtils.escapeSpecialCharforData(currData);
// if (currData.getClass() == LocationAgencyOfficeData.class) { // if (currData.getClass() == LocationAgencyOfficeData.class) {
Method getSQLMethod = currData.getClass().getMethod( Method getSQLMethod = currData.getClass().getMethod(
"getInsertStatement"); "getInsertStatement");

View file

@ -19,7 +19,6 @@
**/ **/
package com.raytheon.viz.hydrocommon.datamanager; package com.raytheon.viz.hydrocommon.datamanager;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -44,7 +43,7 @@ import com.raytheon.viz.hydrocommon.data.RatingShift;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 22, 2008 1636 askripsky Initial Creation * Oct 22, 2008 1636 askripsky Initial Creation
* Sep 09, 2009 2259 mpduff Added rating shift data * Sep 09, 2009 2259 mpduff Added rating shift data
* April 8, 2015 17338 jingtaoD add checkAppostrophe method *
* </pre> * </pre>
* *
* @author askripsky * @author askripsky
@ -74,11 +73,12 @@ public abstract class HydroDataManager {
*/ */
protected ArrayList<Object[]> runQuery(String dataQuery) { protected ArrayList<Object[]> runQuery(String dataQuery) {
AppsDefaults ad = AppsDefaults.getInstance(); AppsDefaults ad = AppsDefaults.getInstance();
boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN, false); boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN,
false);
if (debug) { if (debug) {
System.out.println(ad.getToken(HydroConstants.PGHOST) + ":" + System.out.println(ad.getToken(HydroConstants.PGHOST) + ":"
ad.getToken(HydroConstants.PGPORT) + ":" + + ad.getToken(HydroConstants.PGPORT) + ":"
ad.getToken(HydroConstants.DB_NAME)); + ad.getToken(HydroConstants.DB_NAME));
System.out.println("Query: " + dataQuery); System.out.println("Query: " + dataQuery);
} }
ArrayList<Object[]> data = null; ArrayList<Object[]> data = null;
@ -103,18 +103,16 @@ public abstract class HydroDataManager {
*/ */
public QueryResult runMappedQuery(String dataQuery) throws VizException { public QueryResult runMappedQuery(String dataQuery) throws VizException {
AppsDefaults ad = AppsDefaults.getInstance(); AppsDefaults ad = AppsDefaults.getInstance();
boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN, false); boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN,
false);
if (debug) { if (debug) {
System.out.println(ad.getToken(HydroConstants.PGHOST) + ":" + System.out.println(ad.getToken(HydroConstants.PGHOST) + ":"
ad.getToken(HydroConstants.PGPORT) + ":" + + ad.getToken(HydroConstants.PGPORT) + ":"
ad.getToken(HydroConstants.DB_NAME)); + ad.getToken(HydroConstants.DB_NAME));
System.out.println("Query: " + dataQuery); System.out.println("Query: " + dataQuery);
} }
QueryResult data = null; QueryResult data = null;
// check if dataQuery contains any apostrophe, if does, replace it to two single appostrophe
dataQuery = checkAppostrophe(dataQuery);
data = DirectDbQuery.executeMappedQuery(dataQuery, HydroConstants.IHFS, data = DirectDbQuery.executeMappedQuery(dataQuery, HydroConstants.IHFS,
QueryLanguage.SQL); QueryLanguage.SQL);
@ -129,120 +127,20 @@ public abstract class HydroDataManager {
public void runStatement(String dataQuery) throws VizException { public void runStatement(String dataQuery) throws VizException {
AppsDefaults ad = AppsDefaults.getInstance(); AppsDefaults ad = AppsDefaults.getInstance();
boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN, false); boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN,
false);
if (debug) { if (debug) {
System.out.println(ad.getToken(HydroConstants.PGHOST) + ":" + System.out.println(ad.getToken(HydroConstants.PGHOST) + ":"
ad.getToken(HydroConstants.PGPORT) + ":" + + ad.getToken(HydroConstants.PGPORT) + ":"
ad.getToken(HydroConstants.DB_NAME)); + ad.getToken(HydroConstants.DB_NAME));
System.out.println("Query: " + dataQuery); System.out.println("Query: " + dataQuery);
} }
// check if dataQuery contains any apostrophe, if does, replace it to two single appostrophe
dataQuery = checkAppostrophe(dataQuery);
DirectDbQuery.executeStatement(dataQuery, HydroConstants.IHFS, DirectDbQuery.executeStatement(dataQuery, HydroConstants.IHFS,
QueryLanguage.SQL); QueryLanguage.SQL);
} }
public String checkAppostrophe (String dataQuery) {
/* Check if text fields include single apostrophe, if it does, replace to
two single apostrophe since it is treated as special char in Postgres */
String newDataQuery = "";
String PDCDataStr = "";
int PDC_presetStr_begindex = 0;
/* special handling for PDC*/
if (dataQuery.toLowerCase().contains("preset_string"))
{
PDC_presetStr_begindex = dataQuery.toLowerCase().indexOf("'at=");
if (PDC_presetStr_begindex > 0)
{
PDCDataStr = dataQuery.substring(PDC_presetStr_begindex);
dataQuery = dataQuery.substring(0, PDC_presetStr_begindex);
}
}
String[] dataElement = dataQuery.split(", ");
for (int j = 0; j < dataElement.length; j++)
{
String elem = dataElement[j];
String newSubData = "";
String[] subdataElement = elem.split("=");
for (int i = 0; i < subdataElement.length; i++)
{
String subelem = subdataElement[i];
String likeStr="";
// handle the where clause contains "like '%'"
if (subelem.toUpperCase().contains("WHERE") &&
subelem.toUpperCase().contains("LIKE"))
{
int likeindex = subelem.toUpperCase().indexOf("LIKE");
likeStr = subelem.substring(likeindex , subelem.length());
subelem = subelem.substring(0, likeindex);
}
String endStr = "";
String beginStr = "";
String checkStr;
int startappostraphe, endappostraphe;
if (subelem.contains("'"))
{
if (subelem.startsWith("$$") && subelem.endsWith("$$"))
{
startappostraphe = subelem.indexOf("$$");
endappostraphe = subelem.lastIndexOf("$$");
checkStr = subelem.substring(startappostraphe+2, endappostraphe);
if (checkStr.contains("'"))
{
checkStr = checkStr.replace("'", "''");
subelem = "'" + checkStr +"'";
}
}
else
{
startappostraphe = subelem.indexOf("'");
endappostraphe = subelem.lastIndexOf("'");
checkStr = subelem.substring(startappostraphe+1, endappostraphe);
if (checkStr.contains("'"))
{
if (startappostraphe > 0)
beginStr = subelem.substring(0, startappostraphe);
if (endappostraphe + 1 < subelem.length())
endStr = subelem.substring(endappostraphe + 1, subelem.length());
checkStr = checkStr.replace("'", "''");
subelem = beginStr + "'" + checkStr +"'" + endStr;
}
}
}
if (i == subdataElement.length -1 )
newSubData = newSubData + subelem + likeStr;
else
newSubData = newSubData + subelem + "=";
}
if (j == dataElement.length - 1)
newDataQuery = newDataQuery + newSubData;
else
newDataQuery = newDataQuery + newSubData + ", ";
}
if (PDC_presetStr_begindex > 0)
{
if (newDataQuery.toLowerCase().startsWith("insert"))
newDataQuery = newDataQuery + ", " + PDCDataStr;
else if (newDataQuery.toLowerCase().startsWith("update"))
newDataQuery = newDataQuery + PDCDataStr;
}
return newDataQuery;
}
/** /**
* Runs functions defined in the DB * Runs functions defined in the DB
* *

View file

@ -25,6 +25,7 @@ import com.raytheon.uf.common.dataquery.db.QueryResult;
import com.raytheon.uf.common.dataquery.db.QueryResultRow; import com.raytheon.uf.common.dataquery.db.QueryResultRow;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.data.LocationAreaData; import com.raytheon.viz.hydrocommon.data.LocationAreaData;
import com.raytheon.viz.hydrocommon.util.DbUtils;
/** /**
* This class is the data manager for the location area data. * This class is the data manager for the location area data.
@ -42,8 +43,7 @@ import com.raytheon.viz.hydrocommon.data.LocationAreaData;
* @author lvenable * @author lvenable
* @version 1.0 * @version 1.0
*/ */
public class LocationAreaManager extends HydroDataManager public class LocationAreaManager extends HydroDataManager {
{
/** /**
* Instance of this class. * Instance of this class.
*/ */
@ -72,12 +72,12 @@ public class LocationAreaManager extends HydroDataManager
/** /**
* Private constructor. * Private constructor.
*/ */
private LocationAreaManager() private LocationAreaManager() {
{
} }
/** /**
* Get an instance of this class. * Get an instance of this class.
*
* @return An instance of this class. * @return An instance of this class.
*/ */
public static synchronized LocationAreaManager getInstance() { public static synchronized LocationAreaManager getInstance() {
@ -90,12 +90,15 @@ public class LocationAreaManager extends HydroDataManager
/** /**
* Get the location area data. * Get the location area data.
* @param lid Location ID. *
* @param lid
* Location ID.
* @return Array of location area data. * @return Array of location area data.
* @throws VizException Database exception. * @throws VizException
* Database exception.
*/ */
public ArrayList<LocationAreaData> getLocationAreaData(String lid) throws VizException public ArrayList<LocationAreaData> getLocationAreaData(String lid)
{ throws VizException {
ArrayList<LocationAreaData> rval = new ArrayList<LocationAreaData>(); ArrayList<LocationAreaData> rval = new ArrayList<LocationAreaData>();
QueryResult result = runMappedQuery(SELECT_STATEMENT + " WHERE lid='" QueryResult result = runMappedQuery(SELECT_STATEMENT + " WHERE lid='"
@ -110,14 +113,15 @@ public class LocationAreaManager extends HydroDataManager
/** /**
* Delete an existing location area record. * Delete an existing location area record.
* @param locationID Location ID. *
* @throws VizException Database exception. * @param locationID
* Location ID.
* @throws VizException
* Database exception.
*/ */
public void deleteRecord(String locationID) throws VizException public void deleteRecord(String locationID) throws VizException {
{
StringBuilder query = new StringBuilder(DELETE_STATEMENT); StringBuilder query = new StringBuilder(DELETE_STATEMENT);
String whereClaus = String.format(" WHERE lid = '%s'", String whereClaus = String.format(" WHERE lid = '%s'", locationID);
locationID);
query.append(whereClaus); query.append(whereClaus);
runStatement(query.toString()); runStatement(query.toString());
@ -125,11 +129,16 @@ public class LocationAreaManager extends HydroDataManager
/** /**
* Insert location area data. * Insert location area data.
* @param data Location area data. *
* @throws VizException Database exception. * @param data
* Location area data.
* @throws VizException
* Database exception.
*/ */
public void insertLocationAreaData(LocationAreaData data) throws VizException public void insertLocationAreaData(LocationAreaData data)
{ throws VizException {
DbUtils.escapeSpecialCharforData(data);
String query = String.format(INSERT_STATEMENT, data.getLid(), String query = String.format(INSERT_STATEMENT, data.getLid(),
data.getArea()); data.getArea());
@ -138,11 +147,16 @@ public class LocationAreaManager extends HydroDataManager
/** /**
* Update existing location area data. * Update existing location area data.
* @param data Location area data. *
* @throws VizException Database exception. * @param data
* Location area data.
* @throws VizException
* Database exception.
*/ */
public void updateLocationAreaData(LocationAreaData data) throws VizException public void updateLocationAreaData(LocationAreaData data)
{ throws VizException {
DbUtils.escapeSpecialCharforData(data);
String query = String.format(UPDATE_STATEMENT, data.getArea(), String query = String.format(UPDATE_STATEMENT, data.getArea(),
data.getLid()); data.getLid());
@ -151,12 +165,14 @@ public class LocationAreaManager extends HydroDataManager
/** /**
* Check of a location area record exists. * Check of a location area record exists.
* @param lid Location ID. *
* @param lid
* Location ID.
* @return True if the record exists, false otherwise. * @return True if the record exists, false otherwise.
* @throws VizException Database exception. * @throws VizException
* Database exception.
*/ */
public boolean recordExists(String lid) throws VizException public boolean recordExists(String lid) throws VizException {
{
StringBuilder query = new StringBuilder(SELECT_STATEMENT); StringBuilder query = new StringBuilder(SELECT_STATEMENT);
String whereClaus = String.format(" WHERE lid = '%s'", lid); String whereClaus = String.format(" WHERE lid = '%s'", lid);
@ -164,8 +180,7 @@ public class LocationAreaManager extends HydroDataManager
QueryResult result = runMappedQuery(query.toString()); QueryResult result = runMappedQuery(query.toString());
if (result.getResultCount() == 0) if (result.getResultCount() == 0) {
{
return false; return false;
} }

View file

@ -29,6 +29,7 @@ import com.raytheon.uf.common.dataquery.db.QueryResult;
import com.raytheon.uf.common.dataquery.db.QueryResultRow; import com.raytheon.uf.common.dataquery.db.QueryResultRow;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.data.LowWaterData; import com.raytheon.viz.hydrocommon.data.LowWaterData;
import com.raytheon.viz.hydrocommon.util.DbUtils;
import com.raytheon.viz.hydrocommon.util.HydroDataUtils; import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
/** /**
@ -161,6 +162,9 @@ public class LowWaterDataManager extends HydroDataManager {
} }
private void updateLowWaterData(LowWaterData data) throws VizException { private void updateLowWaterData(LowWaterData data) throws VizException {
DbUtils.escapeSpecialCharforData(data);
runStatement(String.format( runStatement(String.format(
UPDATE_STATEMENT, UPDATE_STATEMENT,
(data.getFlow() == LowWaterData.MISSING_VALUE) ? "null" : data (data.getFlow() == LowWaterData.MISSING_VALUE) ? "null" : data
@ -170,6 +174,9 @@ public class LowWaterDataManager extends HydroDataManager {
} }
private void insertLowWaterData(LowWaterData currData) throws VizException { private void insertLowWaterData(LowWaterData currData) throws VizException {
DbUtils.escapeSpecialCharforData(currData);
runStatement(String.format(INSERT_STATEMENT, currData.getLid(), runStatement(String.format(INSERT_STATEMENT, currData.getLid(),
dateFormat.format(currData.getDate()), dateFormat.format(currData.getDate()),
(currData.getFlow() == LowWaterData.MISSING_VALUE) ? "null" (currData.getFlow() == LowWaterData.MISSING_VALUE) ? "null"

View file

@ -25,6 +25,7 @@ import com.raytheon.uf.common.dataquery.db.QueryResult;
import com.raytheon.uf.common.dataquery.db.QueryResultRow; import com.raytheon.uf.common.dataquery.db.QueryResultRow;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.data.LowWaterStatementData; import com.raytheon.viz.hydrocommon.data.LowWaterStatementData;
import com.raytheon.viz.hydrocommon.util.DbUtils;
import com.raytheon.viz.hydrocommon.util.HydroDataUtils; import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
/** /**
@ -94,8 +95,8 @@ public class LowWaterStatementDataManager extends HydroDataManager {
*/ */
public void deleteRecord(LowWaterStatementData recordToDelete) public void deleteRecord(LowWaterStatementData recordToDelete)
throws VizException { throws VizException {
runStatement(String.format(DELETE_STATEMENT, HydroDataUtils runStatement(String.format(DELETE_STATEMENT,
.getPKStatement(recordToDelete))); HydroDataUtils.getPKStatement(recordToDelete)));
} }
/** /**
@ -114,9 +115,7 @@ public class LowWaterStatementDataManager extends HydroDataManager {
+ lid + "' ORDER BY criteria_rank, lower_value ASC"); + lid + "' ORDER BY criteria_rank, lower_value ASC");
for (QueryResultRow currRow : result.getRows()) { for (QueryResultRow currRow : result.getRows()) {
rval rval.add(new LowWaterStatementData(currRow, result.getColumnNames()));
.add(new LowWaterStatementData(currRow, result
.getColumnNames()));
} }
return rval; return rval;
@ -139,17 +138,23 @@ public class LowWaterStatementDataManager extends HydroDataManager {
private void updateLowWaterStatementData(LowWaterStatementData data) private void updateLowWaterStatementData(LowWaterStatementData data)
throws VizException { throws VizException {
runStatement(String.format(UPDATE_STATEMENT, data
.getUpperValueDBString(), data.getStatement(), data DbUtils.escapeSpecialCharforData(data);
.getLowWaterCriteria(), data.getLowWaterSource(),
runStatement(String.format(UPDATE_STATEMENT,
data.getUpperValueDBString(), data.getStatement(),
data.getLowWaterCriteria(), data.getLowWaterSource(),
HydroDataUtils.getPKStatement(data))); HydroDataUtils.getPKStatement(data)));
} }
private void insertLowWaterData(LowWaterStatementData currData) private void insertLowWaterData(LowWaterStatementData currData)
throws VizException { throws VizException {
DbUtils.escapeSpecialCharforData(currData);
runStatement(String.format(INSERT_STATEMENT, currData.getLid(), runStatement(String.format(INSERT_STATEMENT, currData.getLid(),
currData.getPe(), currData.getLowerValue(), currData currData.getPe(), currData.getLowerValue(),
.getUpperValueDBString(), currData.getCriteriaRank(), currData.getUpperValueDBString(), currData.getCriteriaRank(),
currData.getStatement(), currData.getLowWaterCriteria(), currData.getStatement(), currData.getLowWaterCriteria(),
currData.getLowWaterSource())); currData.getLowWaterSource()));
} }

View file

@ -23,8 +23,10 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.lang.reflect.Field;
import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.viz.hydrocommon.data.HydroDBData;
/** /**
* Hydro Database Utilities * Hydro Database Utilities
@ -36,7 +38,8 @@ import com.raytheon.uf.common.ohd.AppsDefaults;
* Jul 9, 2008 1194 mpduff Initial creation. * Jul 9, 2008 1194 mpduff Initial creation.
* Mar 7, 2014 16692 lbousaidi Any Forecast source other than * Mar 7, 2014 16692 lbousaidi Any Forecast source other than
* H*,P*,Q*,T* should be handled by fcstother. * H*,P*,Q*,T* should be handled by fcstother.
* * Oct 10, 2015 17935 special char (e.g apostrophe) can not be saved/updated in Hyrobase
* *
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -80,8 +83,7 @@ public class DbUtils {
} }
/* if observed data or processed data being treated as observed */ /* if observed data or processed data being treated as observed */
if (ts.toUpperCase().startsWith("R") if (ts.toUpperCase().startsWith("R") || treatProcessedAsObserverd
|| treatProcessedAsObserverd
|| ts.toUpperCase().startsWith("XX")) { || ts.toUpperCase().startsWith("XX")) {
Set<String> tableKeys = tableMap.keySet(); Set<String> tableKeys = tableMap.keySet();
@ -112,8 +114,8 @@ public class DbUtils {
* data * data
*/ */
retVal = fcstTableMap.get(pe.substring(0, 1).toLowerCase()); retVal = fcstTableMap.get(pe.substring(0, 1).toLowerCase());
if (retVal==null) { if (retVal == null) {
retVal="Fcstother"; retVal = "Fcstother";
} }
matchFound = true; matchFound = true;
} else { /* if type-source not valid */ } else { /* if type-source not valid */
@ -188,4 +190,54 @@ public class DbUtils {
fcstTableMap.put("t", "Fcsttemperature"); fcstTableMap.put("t", "Fcsttemperature");
} }
} }
/**
* replace string fields in table class which contains apostrophe
*
* @param curData
*/
public static <T> void escapeSpecialCharforData(T curData) {
Class<?> c = curData.getClass();
Field fields[] = c.getDeclaredFields();
for (Field f : fields) {
try {
if (f.getType().isAssignableFrom(String.class)) {
f.setAccessible(true);
if (f.get(curData) != null) {
String value = (String) f.get(curData).toString();
if (value != null) {
if (value.contains("'")) {
value = value.replace("'", "''");
f.set(curData, value);
}
}
}
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
/**
* replace apostrophe for string
*
* @param strValue
* @return
*/
public static String escapeSpecialCharforStr(String strValue) {
String rVal;
if (strValue != null) {
if (strValue.contains("'")) {
strValue = strValue.replace("'", "''");
}
}
rVal = strValue;
return rVal;
}
} }

View file

@ -64,6 +64,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Nov 24, 2014 16911 xwei The day of Hydrologic Date is set to the next day * Nov 24, 2014 16911 xwei The day of Hydrologic Date is set to the next day
* if hour is greater than 18Z. * if hour is greater than 18Z.
* Mar 10, 2015 14575 snaples Added additional status flags. * Mar 10, 2015 14575 snaples Added additional status flags.
* Oct 14, 2015 17977 snaples Fixed loadData to read station
* lists when new area, which means it needs to read some tokens also.
* *
* </pre> * </pre>
* *
@ -75,7 +77,6 @@ public class DailyQcUtils {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DailyQcUtils.class); .getHandler(DailyQcUtils.class);
// private static final int MAX_QC_DAYS = 10;
private static DailyQcUtils instance; private static DailyQcUtils instance;
public double[][][] QPEaccum24hr; public double[][][] QPEaccum24hr;
@ -108,8 +109,6 @@ public class DailyQcUtils {
private static AppsDefaults appsDefaults = AppsDefaults.getInstance(); private static AppsDefaults appsDefaults = AppsDefaults.getInstance();
private String loc_area;
private String station_climo_file; private String station_climo_file;
private String hrap_gage_file; private String hrap_gage_file;
@ -931,6 +930,7 @@ public class DailyQcUtils {
if (lastQcArea == "") { if (lastQcArea == "") {
newarea = true; newarea = true;
lastQcArea = currentQcArea; lastQcArea = currentQcArea;
firstTok = 1;
} }
curHrMinSec = getCurrentHrMinSec(currentDate); curHrMinSec = getCurrentHrMinSec(currentDate);
if (curHrMinSec != -1) { if (curHrMinSec != -1) {
@ -958,6 +958,7 @@ public class DailyQcUtils {
Cursor prevCursor = shell.getCursor(); Cursor prevCursor = shell.getCursor();
shell.setCursor(Display.getDefault().getSystemCursor( shell.setCursor(Display.getDefault().getSystemCursor(
SWT.CURSOR_WAIT)); SWT.CURSOR_WAIT));
firstTok = 1;
int retval = loadDataSet(); int retval = loadDataSet();
if (retval == 2) { if (retval == 2) {
load_gage_data_once = 1; load_gage_data_once = 1;
@ -1292,7 +1293,6 @@ public class DailyQcUtils {
+ currentQcArea + "_stddev_"; + currentQcArea + "_stddev_";
temp_bad_file = mpe_bad_temperature_dir + "/temperature_" temp_bad_file = mpe_bad_temperature_dir + "/temperature_"
+ currentQcArea + "_bad_"; + currentQcArea + "_bad_";
loc_area = appsDefaults.getToken("mpe_site_id").trim();
mpe_editor_logs_dir = appsDefaults.getToken("mpe_editor_logs_dir"); mpe_editor_logs_dir = appsDefaults.getToken("mpe_editor_logs_dir");
/* /*
* create mpe_td_details_file to store the details of Time * create mpe_td_details_file to store the details of Time
@ -1359,21 +1359,12 @@ public class DailyQcUtils {
} }
if (currentQcArea.equals(loc_area)) {
master_file = true;
}
// ReadFreezingStationList zl = new ReadFreezingStationList();
// ReadPrecipStationList pl = new ReadPrecipStationList();
// ReadTemperatureStationList tl = new ReadTemperatureStationList();
if (newarea == true) { if (newarea == true) {
StationListManager slm = StationListManager.getInstance(); StationListManager slm = StationListManager.getInstance();
System.out.println("DQC: Reading Freezing Stations List. "); System.out.println("DQC: Reading Freezing Stations List. ");
// zl.read_freezing_station_list(currentQcArea,
// master_file);
try { try {
slm.getStationInfo(currentQcArea, master_file, slm.getStationInfo(currentQcArea, newarea,
freezing_stations, temperature_stations, freezing_stations, temperature_stations,
precip_stations); precip_stations);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
@ -1387,8 +1378,7 @@ public class DailyQcUtils {
return DAILYQC_FAILED; return DAILYQC_FAILED;
} }
System.out.println("DQC: Reading Temperature Stations List. "); System.out.println("DQC: Reading Temperature Stations List. ");
// tl.read_temperature_station_list(
// currentQcArea, master_file);
if (temperature_stations == null) { if (temperature_stations == null) {
statusHandler statusHandler
.handle(Priority.PROBLEM, .handle(Priority.PROBLEM,
@ -1396,8 +1386,7 @@ public class DailyQcUtils {
return DAILYQC_FAILED; return DAILYQC_FAILED;
} }
System.out.println("DQC: Reading Precip Stations List. "); System.out.println("DQC: Reading Precip Stations List. ");
// pl.read_precip_station_list(currentQcArea,
// master_file);
if (precip_stations == null) { if (precip_stations == null) {
statusHandler statusHandler
.handle(Priority.PROBLEM, .handle(Priority.PROBLEM,
@ -2147,7 +2136,7 @@ public class DailyQcUtils {
* the hrap_grid to set * the hrap_grid to set
*/ */
public void setHrap_grid(Hrap_Grid hrap_grid) { public void setHrap_grid(Hrap_Grid hrap_grid) {
this.hrap_grid = hrap_grid; DailyQcUtils.hrap_grid = hrap_grid;
} }
/** /**

View file

@ -59,6 +59,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 7, 2011 snaples Initial creation * Jul 7, 2011 snaples Initial creation
* Oct 14, 2015 17977 snaples Updated readStationLists to recognize
* sub area as a new area and not use masterFileFlag.
* *
* </pre> * </pre>
* *
@ -75,7 +77,7 @@ public class StationListManager {
private final String station_dir = appsDefaults private final String station_dir = appsDefaults
.getToken("mpe_station_list_dir"); .getToken("mpe_station_list_dir");
private final String sitename = appsDefaults.getToken("mpe_site_id"); private final String sitename = "";
private final DailyQcUtils dqc = DailyQcUtils.getInstance(); private final DailyQcUtils dqc = DailyQcUtils.getInstance();
@ -96,7 +98,7 @@ public class StationListManager {
return instance; return instance;
} }
public void getStationInfo(String qcArea, boolean masterFileFlag, public void getStationInfo(String qcArea, boolean newarea,
ArrayList<Station> freezingStationList, ArrayList<Station> freezingStationList,
ArrayList<Station> temperatureStationList, ArrayList<Station> temperatureStationList,
ArrayList<Station> precipStationList) throws FileNotFoundException { ArrayList<Station> precipStationList) throws FileNotFoundException {
@ -119,8 +121,8 @@ public class StationListManager {
currentLabelModifiedTime = labelPositionFile.lastModified(); currentLabelModifiedTime = labelPositionFile.lastModified();
currentStationsModifiedTime = stationListFile.lastModified(); currentStationsModifiedTime = stationListFile.lastModified();
if ((currentLabelModifiedTime != previousLabelModifiedTime) if ((newarea == true) || (((currentLabelModifiedTime != previousLabelModifiedTime)
|| (currentStationsModifiedTime != previousStationsModifiedTime)) { || (currentStationsModifiedTime != previousStationsModifiedTime)))) {
LabelPositionManager labelPositionManager = new LabelPositionManager(); LabelPositionManager labelPositionManager = new LabelPositionManager();
previousLabelModifiedTime = currentLabelModifiedTime; previousLabelModifiedTime = currentLabelModifiedTime;
@ -137,7 +139,7 @@ public class StationListManager {
FileReader stationListFileReader = new FileReader(pathName); FileReader stationListFileReader = new FileReader(pathName);
readStationLists(stationListFileReader, masterFileFlag, readStationLists(stationListFileReader,
labelPositionManager, freezingStationList, labelPositionManager, freezingStationList,
temperatureStationList, precipStationList); temperatureStationList, precipStationList);
@ -165,7 +167,7 @@ public class StationListManager {
*/ */
private void readStationLists(FileReader stationListFileReader, private void readStationLists(FileReader stationListFileReader,
boolean masterFileFlag, LabelPositionManager labelPositionManager, LabelPositionManager labelPositionManager,
ArrayList<Station> freezingStationList, ArrayList<Station> freezingStationList,
ArrayList<Station> temperatureStationList, ArrayList<Station> temperatureStationList,
ArrayList<Station> precipStationList) throws IOException { ArrayList<Station> precipStationList) throws IOException {
@ -174,7 +176,6 @@ public class StationListManager {
String inputLine; // one line of input String inputLine; // one line of input
BufferedReader inputReader = new BufferedReader(stationListFileReader); BufferedReader inputReader = new BufferedReader(stationListFileReader);
if (masterFileFlag) {
try { try {
String[] commentTokens; // tokens broken into input and comments String[] commentTokens; // tokens broken into input and comments
String[] stationTokens; // tokens from line of input (actual String[] stationTokens; // tokens from line of input (actual
@ -281,8 +282,6 @@ public class StationListManager {
} /* finally */ } /* finally */
} /* if (master_file_flag) */
} /* readStationLists */ } /* readStationLists */
private String getStationListPath(String qcArea) { private String getStationListPath(String qcArea) {
@ -337,7 +336,7 @@ public class StationListManager {
public void computeClosestNeighbors(ArrayList<Station> stationList) { public void computeClosestNeighbors(ArrayList<Station> stationList) {
// String header = "StationListManager.computeClosestNeighbors(): "; // String header = "StationListManager.computeClosestNeighbors(): ";
final int maxNeighborListSize = dqc.mpe_dqc_max_precip_neighbors; final int maxNeighborListSize = DailyQcUtils.mpe_dqc_max_precip_neighbors;
// System.out.println(header + "max_neighbor_list_size = " + // System.out.println(header + "max_neighbor_list_size = " +
// maxNeighborListSize); // maxNeighborListSize);

View file

@ -0,0 +1,40 @@
package com.raytheon.viz.texteditor.dialogs;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlList;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Describe rules for modifying VTEC ETNs.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 07, 2015 ASM #18132 D. Friedman Initial creation
*
* </pre>
*
*/
@XmlRootElement(name = "etnRules")
@XmlAccessorType(XmlAccessType.NONE)
public class EtnRules {
private List<String> excludePhenSigs = new ArrayList<String>();
@XmlElement
@XmlList
public List<String> getExcludePhenSigs() {
return excludePhenSigs;
}
public void setExcludePhenSigs(List<String> excludePhenSigs) {
this.excludePhenSigs = excludePhenSigs;
}
}

View file

@ -142,6 +142,7 @@ import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.ISimulatedTimeChangeListener;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.wmo.WMOHeader; import com.raytheon.uf.common.wmo.WMOHeader;
@ -187,6 +188,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.dialogs.SWTMessageBox; import com.raytheon.viz.ui.dialogs.SWTMessageBox;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
/** /**
* Main Text Editor dialog. * Main Text Editor dialog.
@ -350,7 +352,10 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* 8Jul2015 DR 15044 dhuffman Implemented tabbing and tabs to spaces. * 8Jul2015 DR 15044 dhuffman Implemented tabbing and tabs to spaces.
* Aug 31, 2015 4749 njensen Changed setCloseCallback to addCloseCallback * Aug 31, 2015 4749 njensen Changed setCloseCallback to addCloseCallback
* Sep 02, 2015 4781 dgilling Used different constructor for SpellCheckDlg. * Sep 02, 2015 4781 dgilling Used different constructor for SpellCheckDlg.
* Sep 29 2015 4899 rferrel Do not send product while in operational mode and
* simulated time.
* Sep 30, 2015 4860 skorolev Corrected misspelling. * Sep 30, 2015 4860 skorolev Corrected misspelling.
* 07Oct2015 RM 18132 D. Friedman Exlucde certain phensigs from automatic ETN incrementing.
* *
* </pre> * </pre>
* *
@ -359,7 +364,8 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
IAfosBrowserCallback, IWmoBrowserCallback, IRecoverEditSessionCallback, IAfosBrowserCallback, IWmoBrowserCallback, IRecoverEditSessionCallback,
ITextCharWrapCallback, IScriptRunnerObserver, IScriptEditorObserver, ITextCharWrapCallback, IScriptRunnerObserver, IScriptEditorObserver,
INotificationObserver, IProductQueryCallback { INotificationObserver, IProductQueryCallback,
ISimulatedTimeChangeListener {
/** /**
* Handler used for messges. * Handler used for messges.
@ -381,6 +387,18 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
private static List<String> gfePils = Arrays.asList("WSW", "NPW", "HLS", private static List<String> gfePils = Arrays.asList("WSW", "NPW", "HLS",
"CFW", "WCN", "FFA", "MWW", "RFW"); "CFW", "WCN", "FFA", "MWW", "RFW");
/**
* Default list of VTEC phenomena significance codes for which the ETN
* should not be changed when sending a NEW-action product.
*/
private static final List<String> defaultNoETNIncrementPhenSigs = Arrays
.asList("HU.A", "HU.S", "HU.W", "TR.A", "TR.W", "SS.A", "SS.W",
"TY.A", "TY.W");
/**
* Path of ETN rules localization file
*/
private static final String ETN_RULES_FILE = "textws/gui/EtnRules.xml";
/** /**
* Auto wrap start range column.. * Auto wrap start range column..
*/ */
@ -1468,6 +1486,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
callbackClient = cbClient; callbackClient = cbClient;
this.textWorkstationFlag = textWorkstationFlag; this.textWorkstationFlag = textWorkstationFlag;
SimulatedTime.getSystemTime().addSimulatedTimeChangeListener(this);
} }
private static JAXBManager getJaxbManager() throws JAXBException { private static JAXBManager getJaxbManager() throws JAXBException {
@ -4189,6 +4208,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* Enter the text editor mode. * Enter the text editor mode.
*/ */
private void enterEditor() { private void enterEditor() {
if (!validateTime()) {
return;
}
initTemplateOverwriteMode(); initTemplateOverwriteMode();
StdTextProduct product = TextDisplayModel.getInstance() StdTextProduct product = TextDisplayModel.getInstance()
.getStdTextProduct(token); .getStdTextProduct(token);
@ -4910,6 +4933,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* true if product is to be resent * true if product is to be resent
*/ */
synchronized private void sendProduct(final boolean resend) { synchronized private void sendProduct(final boolean resend) {
if (!validateTime()) {
return;
}
StdTextProduct prod = getStdTextProduct(); StdTextProduct prod = getStdTextProduct();
if (warnGenFlag) { if (warnGenFlag) {
QCConfirmationMsg qcMsg = new QCConfirmationMsg(); QCConfirmationMsg qcMsg = new QCConfirmationMsg();
@ -5076,8 +5102,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* this case (isOpertional && ! resend) case, * this case (isOpertional && ! resend) case,
* saveEditedProduct, does not actually save anything. * saveEditedProduct, does not actually save anything.
*/ */
if (shouldSetETNtoNextValue(prod)) {
statusHandler.handle(Priority.INFO, "Will increment ETN for this product.");
prod.setProduct(VtecUtil.getVtec( prod.setProduct(VtecUtil.getVtec(
removeSoftReturns(prod.getProduct()), true)); removeSoftReturns(prod.getProduct()), true));
} else {
statusHandler.handle(Priority.INFO, "Will NOT increment ETN for this product.");
}
/* /*
* This silly bit of code updates the ETN of a VTEC in the * This silly bit of code updates the ETN of a VTEC in the
* text pane to reflect the ETN that was actually used, but * text pane to reflect the ETN that was actually used, but
@ -5108,10 +5139,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
} else { } else {
try { try {
if (!resend) { if (!resend) {
if (shouldSetETNtoNextValue(prod)) {
statusHandler.handle(Priority.INFO, "Will increment ETN for this product.");
body = VtecUtil body = VtecUtil
.getVtec(removeSoftReturns(MixedCaseProductSupport .getVtec(removeSoftReturns(MixedCaseProductSupport
.conditionalToUpper(prod.getNnnid(), .conditionalToUpper(prod.getNnnid(),
textEditor.getText()))); textEditor.getText())));
} else {
statusHandler.handle(Priority.INFO, "Will NOT increment ETN for this product.");
}
} }
updateTextEditor(body); updateTextEditor(body);
if ((inEditMode || resend) if ((inEditMode || resend)
@ -5154,6 +5190,34 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
} }
} }
private EtnRules getETNRules() throws Exception {
LocalizationFile lf = PathManagerFactory.getPathManager()
.getStaticLocalizationFile(ETN_RULES_FILE);
if (lf == null) {
throw new Exception("ETN rules file (" + ETN_RULES_FILE + ") not found.");
}
return JAXB.unmarshal(lf.getFile(), EtnRules.class);
}
private boolean shouldSetETNtoNextValue(StdTextProduct prod) {
List<String> excludedPhenSigs = null;
try {
excludedPhenSigs = getETNRules().getExcludePhenSigs();
} catch (Exception e) {
statusHandler.handle(Priority.WARN,
"Error loading ETN assignment rules. Will use default rules.",
e);
excludedPhenSigs = defaultNoETNIncrementPhenSigs;
}
boolean result = true;
VtecObject vo = VtecUtil.parseMessage(prod.getProduct());
if (vo != null && excludedPhenSigs != null
&& excludedPhenSigs.contains(vo.getPhensig())) {
result = false;
}
return result;
}
private OUPRequest createOUPRequest(StdTextProduct prod, String text) { private OUPRequest createOUPRequest(StdTextProduct prod, String text) {
OUPRequest req = new OUPRequest(); OUPRequest req = new OUPRequest();
OfficialUserProduct oup = new OfficialUserProduct(); OfficialUserProduct oup = new OfficialUserProduct();
@ -7797,6 +7861,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
highlightBackgroundClr.dispose(); highlightBackgroundClr.dispose();
} }
SimulatedTime.getSystemTime().removeSimulatedTimeChangeListener(this);
inEditMode = false; inEditMode = false;
} }
@ -8044,8 +8110,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
&& (allText.charAt(eol + 1) == '\n')) { && (allText.charAt(eol + 1) == '\n')) {
deleteLen = 2; deleteLen = 2;
} else if (allText.charAt(eol) == '\n') { } else if (allText.charAt(eol) == '\n') {
if ((allText.charAt(eol - 1) == '.') if (allText.charAt(eol - 1) == '.'
&& (allText.charAt(eol - 2) != '.')) { && allText.charAt(eol - 2) != '.') {
// do not extend this line. // do not extend this line.
return; return;
} else { } else {
@ -8716,4 +8782,25 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
return header; return header;
} }
/**
* Validate CAVE is in a state to allow sending of text product; and display
* a warning when unable to send.
*
* @return true when able to send text product
*/
private boolean validateTime() {
if ((shell != null) && !shell.isDisposed() && shell.isVisible()
&& !SimulatedTimeOperations.isTransmitAllowed()) {
SimulatedTimeOperations.displayFeatureLevelWarning(shell,
"Send Text Product");
return false;
}
return true;
}
@Override
public void timechanged() {
validateTime();
}
} }

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<etnRules>
<excludePhenSigs>HU.A HU.S HU.W TR.A TR.W SS.A SS.W TY.A TY.W</excludePhenSigs>
</etnRules>

View file

@ -68,7 +68,7 @@
<vbSource key="HPE" category="SfcGrid" views="PLANVIEW TIMESERIES" /> <vbSource key="HPE" category="SfcGrid" views="PLANVIEW TIMESERIES" />
<vbSource key="MPE-Local" category="SfcGrid" views="PLANVIEW TIMESERIES" /> <vbSource key="MPE-Local" category="SfcGrid" views="PLANVIEW TIMESERIES" />
<vbSource key="MSAS" category="SfcGrid" views="PLANVIEW TIMESERIES" /> <vbSource key="MSAS" category="SfcGrid" views="PLANVIEW TIMESERIES" />
<vbSource key="NamDNG" category="SfcGrid" views="PLANVIEW TIMESERIES" /> <vbSource key="NamDNG5" category="SfcGrid" views="PLANVIEW TIMESERIES" />
<vbSource key="ETA212" category="SfcGrid" views="PLANVIEW TIMESERIES" /> <vbSource key="ETA212" category="SfcGrid" views="PLANVIEW TIMESERIES" />
<vbSource key="NAHwave15" category="SfcGrid" views="PLANVIEW TIMESERIES" /> <vbSource key="NAHwave15" category="SfcGrid" views="PLANVIEW TIMESERIES" />
<vbSource key="NAHwave10" category="SfcGrid" views="PLANVIEW TIMESERIES" /> <vbSource key="NAHwave10" category="SfcGrid" views="PLANVIEW TIMESERIES" />

View file

@ -117,6 +117,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* 05/29/2014 #3071 randerso Fix NPE in getCachedParmID * 05/29/2014 #3071 randerso Fix NPE in getCachedParmID
* 09/21/2014 #3648 randerso Changed deleteDatabase to handle database already being deleted by other JVM * 09/21/2014 #3648 randerso Changed deleteDatabase to handle database already being deleted by other JVM
* 01/13/2015 #3955 randerso Changed a few private methods to protected to allow TopoDatabase to subclass IFPGridDatabase * 01/13/2015 #3955 randerso Changed a few private methods to protected to allow TopoDatabase to subclass IFPGridDatabase
* 10/13/2015 16938 ryu Remove existing HDF5 data before calling saveGridsToHdf5 when storage type changed
* *
* </pre> * </pre>
* *
@ -501,6 +502,10 @@ public class IFPGridDatabase extends GridDatabase {
if (!updatedRecords.isEmpty()) { if (!updatedRecords.isEmpty()) {
try { try {
// storage data type has changed - remove existing data first
if (!newPSI.getStorageType().equals(oldPSI.getStorageType())) {
this.removeFromHDF5(updatedRecords);
}
this.saveGridsToHdf5(updatedRecords, newPSI); this.saveGridsToHdf5(updatedRecords, newPSI);
} catch (Exception e) { } catch (Exception e) {
statusHandler statusHandler
@ -2088,6 +2093,22 @@ public class IFPGridDatabase extends GridDatabase {
} }
} }
/**
* Removes records of a single parm from the HDF5 repository. If the records
* do not exist in the HDF5, the operation is ignored.
*
* @param records
* The records to be removed
*/
private void removeFromHDF5(List<GFERecord> records) {
List<TimeRange> times = new ArrayList<TimeRange>(records.size());
for (GFERecord record: records) {
times.add(record.getTimeRange());
}
removeFromHDF5(records.get(0).getParmId(), times);
}
/** /**
* Removes records from the HDF5 repository. If the records do not exist in * Removes records from the HDF5 repository. If the records do not exist in
* the HDF5, the operation is ignored * the HDF5, the operation is ignored

View file

@ -1107,4 +1107,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
('FW.W', allActions, 'FireWx'), # RED FLAG WARNING ('FW.W', allActions, 'FireWx'), # RED FLAG WARNING
('FW.A', allActions, 'FireWx1'), # FIRE WEATHER WATCH ('FW.A', allActions, 'FireWx1'), # FIRE WEATHER WATCH
('LO.Y', marineActions, 'LowWater'), # LOW WATER ADVISORY ('LO.Y', marineActions, 'LowWater'), # LOW WATER ADVISORY
('TS.W', allActions, 'Tsunami'), # TSUNAMI WARNING
('TS.Y', allActions, 'Tsunami'), # TSUNAMI ADVISORY
('TS.A', allActions, 'Tsunami'), # TSUNAMI WATCH
] ]

View file

@ -1516,4 +1516,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
('LO.Y', allActions, 'Drought'), # LOW WATER ADVISORY ('LO.Y', allActions, 'Drought'), # LOW WATER ADVISORY
('TO.A', allActions, 'Convective'), # TORNADO WATCH ('TO.A', allActions, 'Convective'), # TORNADO WATCH
('SV.A', allActions, 'Convective'), # SEVERE THUNDERSTORM WATCH ('SV.A', allActions, 'Convective'), # SEVERE THUNDERSTORM WATCH
('TS.W', allActions, 'Tsunami'), # TSUNAMI WARNING
('TS.Y', allActions, 'Tsunami'), # TSUNAMI ADVISORY
('TS.A', allActions, 'Tsunami'), # TSUNAMI WATCH
] ]

View file

@ -1950,5 +1950,8 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
('SU.Y', allActions, 'Marine'), # HIGH SURF ADVISORY ('SU.Y', allActions, 'Marine'), # HIGH SURF ADVISORY
('RP.S', allActions, 'Rip'), # High Rip Threat ('RP.S', allActions, 'Rip'), # High Rip Threat
('BH.S', allActions, 'BeachHaz'), # Beach Hazards Statement ('BH.S', allActions, 'BeachHaz'), # Beach Hazards Statement
('TS.W', allActions, 'Tsunami'), # TSUNAMI WARNING
('TS.Y', allActions, 'Tsunami'), # TSUNAMI ADVISORY
('TS.A', allActions, 'Tsunami'), # TSUNAMI WATCH
] ]

View file

@ -84,6 +84,7 @@
<color r = "0.898039215686275" g = "0.0666666666666667" b = "0.00784313725490196" a = "1.0" /> <color r = "0.898039215686275" g = "0.0666666666666667" b = "0.00784313725490196" a = "1.0" />
<color r = "0.501960784313725" g = "0.611764705882353" b = "0.898039215686275" a = "1.0" /> <color r = "0.501960784313725" g = "0.611764705882353" b = "0.898039215686275" a = "1.0" />
<color r = "0" g = "0.164705882352941" b = "0.898039215686275" a = "1.0" /> <color r = "0" g = "0.164705882352941" b = "0.898039215686275" a = "1.0" />
<color r = "0.854901960784314" g = "0.933333333333333" b = "0.952941176470588" a = "1.0" />
<color r = "0.898039215686275" g = "0.305882352941176" b = "0" a = "1.0" /> <color r = "0.898039215686275" g = "0.305882352941176" b = "0" a = "1.0" />
<color r = "0.898039215686275" g = "0.576470588235294" b = "0.854901960784314" a = "1.0" /> <color r = "0.898039215686275" g = "0.576470588235294" b = "0.854901960784314" a = "1.0" />
<color r = "0.133333333333333" g = "0.603921568627451" b = "0.988235294117647" a = "1.0" /> <color r = "0.133333333333333" g = "0.603921568627451" b = "0.988235294117647" a = "1.0" />

View file

@ -60,6 +60,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* for county based products. * for county based products.
* Jan 13, 2015 3996 ccody Correct NPE caused by calculating portions of Geometry objects with multiple sub Geometry objects * Jan 13, 2015 3996 ccody Correct NPE caused by calculating portions of Geometry objects with multiple sub Geometry objects
* This is a Jim Ramer fix * This is a Jim Ramer fix
* Oct 9, 2015 #18154 Qinglu Lin Updated calculateLocationPortion().
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -353,12 +354,6 @@ public class GisUtil {
public static EnumSet<Direction> calculateLocationPortion( public static EnumSet<Direction> calculateLocationPortion(
Geometry locationGeom, Geometry reference, boolean useExtreme, Geometry locationGeom, Geometry reference, boolean useExtreme,
boolean notUseShapefileCentroid) { boolean notUseShapefileCentroid) {
CountyUserData cud = (CountyUserData) locationGeom.getUserData();
Map<String, Object> atts = cud.entry.attributes;
Number lonNumber = (Number) atts.get("LON");
double lonDouble = lonNumber.doubleValue();
Number latNumber = (Number) atts.get("LAT");
double latDouble = latNumber.doubleValue();
for (int i = 0; i < locationGeom.getNumGeometries(); i++) { for (int i = 0; i < locationGeom.getNumGeometries(); i++) {
Geometry geom = locationGeom.getGeometryN(i); Geometry geom = locationGeom.getGeometryN(i);
if (geom.intersects(reference)) { if (geom.intersects(reference)) {
@ -368,9 +363,10 @@ public class GisUtil {
geomCentroid = geom.getEnvelope().getCentroid() geomCentroid = geom.getEnvelope().getCentroid()
.getCoordinate(); .getCoordinate();
} else { } else {
Map<String, Object> atts = ((CountyUserData) locationGeom.getUserData()).entry.attributes;
geomCentroid = new Coordinate(); geomCentroid = new Coordinate();
geomCentroid.x = lonDouble; geomCentroid.x = ((Number) atts.get("LON")).doubleValue();
geomCentroid.y = latDouble; geomCentroid.y = ((Number) atts.get("LAT")).doubleValue();
} }
Coordinate refCentroid = reference.getCentroid() Coordinate refCentroid = reference.getCentroid()
.getCoordinate(); .getCoordinate();

View file

@ -133,7 +133,7 @@ Must be paired with proper vm code (also commented out in flashFloodWarning.vm)!
<bullet bulletText="**** CALL TO ACTIONS (CHOOSE 1 OR MORE) ****" bulletType="title"/> <bullet bulletText="**** CALL TO ACTIONS (CHOOSE 1 OR MORE) ****" bulletType="title"/>
<!-- end all call to action bullets with "CTA" ex: "obviousNameCTA" --> <!-- end all call to action bullets with "CTA" ex: "obviousNameCTA" -->
<bullet bulletName="ffwEmergencyCTA" bulletText="**FLASH FLOOD EMERGENCY CTA**" bulletGroup="cta1" parseString="FLASH FLOOD EMERGENCY"/> <bullet bulletName="ffwEmergencyCTA" bulletText="**FLASH FLOOD EMERGENCY CTA**" bulletGroup="cta1" parseString="FLASH FLOOD EMERGENCY"/>
<bullet bulletName="actQuicklyCTA" bulletText="Act Quickly..." bulletDefault="true" bulletGroup="cta1" parseString="HIGHER GROUND NOW. ACT QUICKLY TO PROTECT YOUR LIFE."/> <bullet bulletName="actQuicklyCTA" bulletText="Act Quickly..." bulletDefault="true" bulletGroup="cta1" parseString="HIGHER GROUND NOW! ACT QUICKLY TO PROTECT YOUR LIFE."/>
<bullet bulletName="childSafetyCTA" bulletText="Child Safety..." parseString="KEEP CHILDREN AWAY FROM STORM DRAINS"/> <bullet bulletName="childSafetyCTA" bulletText="Child Safety..." parseString="KEEP CHILDREN AWAY FROM STORM DRAINS"/>
<bullet bulletName="nighttimeCTA" bulletText="Nighttime flooding..." parseString="BE ESPECIALLY CAUTIOUS AT NIGHT WHEN"/> <bullet bulletName="nighttimeCTA" bulletText="Nighttime flooding..." parseString="BE ESPECIALLY CAUTIOUS AT NIGHT WHEN"/>
<bullet bulletName="safetyCTA" bulletText="Safety...by foot or motorist" parseString="DO NOT ENTER OR CROSS FLOWING WATER"/> <bullet bulletName="safetyCTA" bulletText="Safety...by foot or motorist" parseString="DO NOT ENTER OR CROSS FLOWING WATER"/>
@ -183,7 +183,7 @@ Must be paired with proper vm code (also commented out in flashFloodWarning.vm)!
<bullet bulletName="drainages" bulletText="Automated list of drainages" parseString="THIS INCLUDES THE FOLLOWING STREAMS AND DRAINAGES" loadMap="River Drainage Basins"/> <bullet bulletName="drainages" bulletText="Automated list of drainages" parseString="THIS INCLUDES THE FOLLOWING STREAMS AND DRAINAGES" loadMap="River Drainage Basins"/>
<bullet bulletText="**** CALL TO ACTIONS (CHOOSE 1 OR MORE) ****" bulletType="title"/> <bullet bulletText="**** CALL TO ACTIONS (CHOOSE 1 OR MORE) ****" bulletType="title"/>
<bullet bulletName="ffwEmergencyCTA" bulletText="**FLASH FLOOD EMERGENCY CTA**" parseString="FLASH FLOOD EMERGENCY"/> <bullet bulletName="ffwEmergencyCTA" bulletText="**FLASH FLOOD EMERGENCY CTA**" parseString="FLASH FLOOD EMERGENCY"/>
<bullet bulletName="actQuicklyCTA" bulletText="Act Quickly..." parseString="HIGHER GROUND NOW. ACT QUICKLY TO PROTECT YOUR LIFE."/> <bullet bulletName="actQuicklyCTA" bulletText="Act Quickly..." parseString="HIGHER GROUND NOW! ACT QUICKLY TO PROTECT YOUR LIFE."/>
<bullet bulletName="childSafetyCTA" bulletText="Child Safety..." parseString="KEEP CHILDREN AWAY FROM STORM DRAINS"/> <bullet bulletName="childSafetyCTA" bulletText="Child Safety..." parseString="KEEP CHILDREN AWAY FROM STORM DRAINS"/>
<bullet bulletName="nighttimeCTA" bulletText="Nighttime flooding..." parseString="BE ESPECIALLY CAUTIOUS AT NIGHT WHEN"/> <bullet bulletName="nighttimeCTA" bulletText="Nighttime flooding..." parseString="BE ESPECIALLY CAUTIOUS AT NIGHT WHEN"/>
<bullet bulletName="safetyCTA" bulletText="Safety...by foot or motorist" parseString="DO NOT ENTER OR CROSS FLOWING WATER"/> <bullet bulletName="safetyCTA" bulletText="Safety...by foot or motorist" parseString="DO NOT ENTER OR CROSS FLOWING WATER"/>
@ -234,7 +234,7 @@ Must be paired with proper vm code (also commented out in flashFloodWarning.vm)!
<bullet bulletText="**** CALL TO ACTIONS (CHOOSE 1 OR MORE) ****" bulletType="title"/> <bullet bulletText="**** CALL TO ACTIONS (CHOOSE 1 OR MORE) ****" bulletType="title"/>
<!-- end all call to action bullets with "CTA" ex: "obviousNameCTA" --> <!-- end all call to action bullets with "CTA" ex: "obviousNameCTA" -->
<bullet bulletName="ffwEmergencyCTA" bulletText="**FLASH FLOOD EMERGENCY CTA**" parseString="FLASH FLOOD EMERGENCY"/> <bullet bulletName="ffwEmergencyCTA" bulletText="**FLASH FLOOD EMERGENCY CTA**" parseString="FLASH FLOOD EMERGENCY"/>
<bullet bulletName="actQuicklyCTA" bulletText="Act Quickly..." parseString="HIGHER GROUND NOW. ACT QUICKLY TO PROTECT YOUR LIFE."/> <bullet bulletName="actQuicklyCTA" bulletText="Act Quickly..." parseString="HIGHER GROUND NOW! ACT QUICKLY TO PROTECT YOUR LIFE."/>
<bullet bulletName="childSafetyCTA" bulletText="Child Safety..." parseString="KEEP CHILDREN AWAY FROM STORM DRAINS"/> <bullet bulletName="childSafetyCTA" bulletText="Child Safety..." parseString="KEEP CHILDREN AWAY FROM STORM DRAINS"/>
<bullet bulletName="nighttimeCTA" bulletText="Nighttime flooding..." parseString="BE ESPECIALLY CAUTIOUS AT NIGHT WHEN"/> <bullet bulletName="nighttimeCTA" bulletText="Nighttime flooding..." parseString="BE ESPECIALLY CAUTIOUS AT NIGHT WHEN"/>
<bullet bulletName="safetyCTA" bulletText="Safety...by foot or motorist" parseString="DO NOT ENTER OR CROSS FLOWING WATER"/> <bullet bulletName="safetyCTA" bulletText="Safety...by foot or motorist" parseString="DO NOT ENTER OR CROSS FLOWING WATER"/>

View file

@ -134,7 +134,7 @@ Must be paired with proper vm code (also commented out in flashFloodWarningFollo
<bullet bulletText="**** CALL TO ACTIONS (CHOOSE 1 OR MORE) ****" bulletType="title"/> <bullet bulletText="**** CALL TO ACTIONS (CHOOSE 1 OR MORE) ****" bulletType="title"/>
<!-- end all call to action bullets with "CTA" ex: "obviousNameCTA" --> <!-- end all call to action bullets with "CTA" ex: "obviousNameCTA" -->
<bullet bulletName="ffwEmergencyCTA" bulletText="**FLASH FLOOD EMERGENCY CTA**" parseString="FLASH FLOOD EMERGENCY"/> <bullet bulletName="ffwEmergencyCTA" bulletText="**FLASH FLOOD EMERGENCY CTA**" parseString="FLASH FLOOD EMERGENCY"/>
<bullet bulletName="actQuicklyCTA" bulletText="Act Quickly..." parseString="HIGHER GROUND NOW. ACT QUICKLY TO PROTECT YOUR LIFE."/> <bullet bulletName="actQuicklyCTA" bulletText="Act Quickly..." parseString="HIGHER GROUND NOW! ACT QUICKLY TO PROTECT YOUR LIFE."/>
<bullet bulletName="childSafetyCTA" bulletText="Child Safety..." parseString="KEEP CHILDREN AWAY FROM STORM DRAINS"/> <bullet bulletName="childSafetyCTA" bulletText="Child Safety..." parseString="KEEP CHILDREN AWAY FROM STORM DRAINS"/>
<bullet bulletName="nighttimeCTA" bulletText="Nighttime flooding..." parseString="BE ESPECIALLY CAUTIOUS AT NIGHT WHEN"/> <bullet bulletName="nighttimeCTA" bulletText="Nighttime flooding..." parseString="BE ESPECIALLY CAUTIOUS AT NIGHT WHEN"/>
<bullet bulletName="safetyCTA" bulletText="Safety...by foot or motorist" parseString="DO NOT ENTER OR CROSS FLOWING WATER"/> <bullet bulletName="safetyCTA" bulletText="Safety...by foot or motorist" parseString="DO NOT ENTER OR CROSS FLOWING WATER"/>
@ -186,7 +186,7 @@ Must be paired with proper vm code (also commented out in flashFloodWarningFollo
<bullet bulletText="**** CALL TO ACTIONS (CHOOSE 1 OR MORE) ****" bulletType="title"/> <bullet bulletText="**** CALL TO ACTIONS (CHOOSE 1 OR MORE) ****" bulletType="title"/>
<!-- end all call to action bullets with "CTA" ex: "obviousNameCTA" --> <!-- end all call to action bullets with "CTA" ex: "obviousNameCTA" -->
<bullet bulletName="ffwEmergencyCTA" bulletText="**FLASH FLOOD EMERGENCY CTA**" parseString="FLASH FLOOD EMERGENCY"/> <bullet bulletName="ffwEmergencyCTA" bulletText="**FLASH FLOOD EMERGENCY CTA**" parseString="FLASH FLOOD EMERGENCY"/>
<bullet bulletName="actQuicklyCTA" bulletText="Act Quickly..." parseString="HIGHER GROUND NOW. ACT QUICKLY TO PROTECT YOUR LIFE."/> <bullet bulletName="actQuicklyCTA" bulletText="Act Quickly..." parseString="HIGHER GROUND NOW! ACT QUICKLY TO PROTECT YOUR LIFE."/>
<bullet bulletName="childSafetyCTA" bulletText="Child Safety..." parseString="KEEP CHILDREN AWAY FROM STORM DRAINS"/> <bullet bulletName="childSafetyCTA" bulletText="Child Safety..." parseString="KEEP CHILDREN AWAY FROM STORM DRAINS"/>
<bullet bulletName="nighttimeCTA" bulletText="Nighttime flooding..." parseString="BE ESPECIALLY CAUTIOUS AT NIGHT WHEN"/> <bullet bulletName="nighttimeCTA" bulletText="Nighttime flooding..." parseString="BE ESPECIALLY CAUTIOUS AT NIGHT WHEN"/>
<bullet bulletName="safetyCTA" bulletText="Safety...by foot or motorist" parseString="DO NOT ENTER OR CROSS FLOWING WATER"/> <bullet bulletName="safetyCTA" bulletText="Safety...by foot or motorist" parseString="DO NOT ENTER OR CROSS FLOWING WATER"/>

View file

@ -281,6 +281,9 @@ VTECTable = {
'TS.W' : {'phen': 'TS', 'TS.W' : {'phen': 'TS',
'sig': 'W', 'sig': 'W',
'hdln': 'Tsunami Warning'}, 'hdln': 'Tsunami Warning'},
'TS.Y' : {'phen': 'TS',
'sig': 'Y',
'hdln': 'Tsunami Advisory'},
'TY.A' : {'phen': 'TY', 'TY.A' : {'phen': 'TY',
'sig': 'A', 'sig': 'A',
'hdln': 'Typhoon Watch'}, 'hdln': 'Typhoon Watch'},

View file

@ -34,6 +34,7 @@ import java.util.HashSet;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 29, 2015 4759 bkowal Initial creation * Sep 29, 2015 4759 bkowal Initial creation
* Oct 09, 2015 4759 bkowal Build cycles now cause failure. * Oct 09, 2015 4759 bkowal Build cycles now cause failure.
* Oct 20, 2015 4759 bkowal Added {@link #eclipse}.
* *
* </pre> * </pre>
* *
@ -49,6 +50,11 @@ public class BuildFeature {
private final Path featurePath; private final Path featurePath;
/*
* Indicates that this feature is provided by Eclipse.
*/
private final boolean eclipse;
/* /*
* A {@link Set} of the {@link BuildFeature}s that are dependent on this * A {@link Set} of the {@link BuildFeature}s that are dependent on this
* {@link BuildFeature}. This {@link BuildFeature} must be built before the * {@link BuildFeature}. This {@link BuildFeature} must be built before the
@ -72,7 +78,12 @@ public class BuildFeature {
private boolean topoMark = false; private boolean topoMark = false;
public BuildFeature(final Path featurePath) { public BuildFeature(final Path featurePath) {
this(featurePath, false);
}
public BuildFeature(final Path featurePath, boolean eclipse) {
this.featurePath = featurePath; this.featurePath = featurePath;
this.eclipse = eclipse;
} }
public void addDependentFeature(BuildFeature buildFeature) { public void addDependentFeature(BuildFeature buildFeature) {
@ -158,6 +169,13 @@ public class BuildFeature {
return topoMark; return topoMark;
} }
/**
* @return the eclipse
*/
public boolean isEclipse() {
return eclipse;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

View file

@ -73,6 +73,8 @@ import org.eclipse.pde.internal.core.product.ProductModel;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 29, 2015 4759 bkowal Initial creation * Sep 29, 2015 4759 bkowal Initial creation
* Oct 09, 2015 4759 bkowal Added an exclude features parameter. * Oct 09, 2015 4759 bkowal Added an exclude features parameter.
* Oct 20, 2015 4759 bkowal Handle non-Eclipse features that are
* embedded in other features.
* *
* </pre> * </pre>
* *
@ -424,6 +426,12 @@ public class Main {
* all plugins and features in the baseline. * all plugins and features in the baseline.
*/ */
for (BuildFeature buildFeature : orderedFeatures) { for (BuildFeature buildFeature : orderedFeatures) {
if (buildFeature.isEclipse()) {
/*
* Do not copy Eclipse features.
*/
continue;
}
final Path copyFeaturePath = this.buildFeaturesPath final Path copyFeaturePath = this.buildFeaturesPath
.resolve(buildFeature.getId()); .resolve(buildFeature.getId());
Files.createDirectories(copyFeaturePath); Files.createDirectories(copyFeaturePath);
@ -731,11 +739,11 @@ public class Main {
+ featureChild.getId() + "!"); + featureChild.getId() + "!");
} }
embeddedBuildFeature = new BuildFeature(resourcePaths.get(0) embeddedBuildFeature = new BuildFeature(resourcePaths.get(0)
.resolve(BuildFeature.FILENAME)); .resolve(BuildFeature.FILENAME), true);
} }
this.scanFeature(embeddedBuildFeature, containingBuildFeature); this.scanFeature(embeddedBuildFeature, containingBuildFeature);
} }
this.buildFeaturesMap.put(feature.getId(), containingBuildFeature); this.buildFeaturesMap.put(feature.getId(), buildFeature);
} }
private void scanStagingPlugin(final BuildPlugin buildPlugin) private void scanStagingPlugin(final BuildPlugin buildPlugin)

View file

@ -0,0 +1,13 @@
MIT License
Copyright (c) 2012 Benjamin Diedrichsen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,17 +0,0 @@
Copyright (c) 2002-2008 John D. Hunter; All Rights Reserved.
1. This LICENSE AGREEMENT is between John D. Hunter (“JDH”), and the Individual or Organization (“Licensee”) accessing and otherwise using matplotlib software in source or binary form and its associated documentation.
2. Subject to the terms and conditions of this License Agreement, JDH hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use matplotlib 0.98.3 alone or in any derivative version, provided, however, that JDHs License Agreement and JDHs notice of copyright, i.e., “Copyright (c) 2002-2008 John D. Hunter; All Rights Reserved” are retained in matplotlib 0.98.3 alone or in any derivative version prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on or incorporates matplotlib 0.98.3 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to matplotlib 0.98.3.
4. JDH is making matplotlib 0.98.3 available to Licensee on an “AS IS” basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.98.3 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB 0.98.3 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING MATPLOTLIB 0.98.3, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between JDH and Licensee. This License Agreement does not grant permission to use JDH trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
8. By copying, installing or otherwise using matplotlib 0.98.3, Licensee agrees to be bound by the terms and conditions of this License Agreement.

View file

@ -1,11 +0,0 @@
License
Matplotlib only uses BSD compatible code, and its license is based on the PSF license. See the Open Source Initiative licenses page for details on individual licenses. Non-BSD compatible licenses (eg LGPL) are acceptable in matplotlib Toolkits. For a discussion of the motivations behind the licencing choice, see Testing.
License agreement for matplotlib 1.0.1¶
1. This LICENSE AGREEMENT is between John D. Hunter (“JDH”), and the Individual or Organization (“Licensee”) accessing and otherwise using matplotlib software in source or binary form and its associated documentation.
2. Subject to the terms and conditions of this License Agreement, JDH hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use matplotlib 1.0.1 alone or in any derivative version, provided, however, that JDHs License Agreement and JDHs notice of copyright, i.e., “Copyright (c) 2002-2009 John D. Hunter; All Rights Reserved” are retained in matplotlib 1.0.1 alone or in any derivative version prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on or incorporates matplotlib 1.0.1 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to matplotlib 1.0.1.
4. JDH is making matplotlib 1.0.1 available to Licensee on an “AS IS” basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 1.0.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB 1.0.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING MATPLOTLIB 1.0.1, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between JDH and Licensee. This License Agreement does not grant permission to use JDH trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
8. By copying, installing or otherwise using matplotlib 1.0.1, Licensee agrees to be bound by the terms and conditions of this License Agreement.

View file

@ -1,278 +0,0 @@
Mozilla Public License version 1.0MOZILLA PUBLIC LICENSE
Version 1.0
1. Definitions.
1.1. ``Contributor'' means each entity that creates or contributes to the
creation of Modifications.
1.2. ``Contributor Version'' means the combination of the Original Code, prior
Modifications used by a Contributor, and the Modifications made by that
particular Contributor.
1.3. ``Covered Code'' means the Original Code or Modifications or the
combination of the Original Code and Modifications, in each case including
portions thereof.
1.4. ``Electronic Distribution Mechanism'' means a mechanism generally
accepted in the software development community for the electronic transfer of
data.
1.5. ``Executable'' means Covered Code in any form other than Source Code.
1.6. ``Initial Developer'' means the individual or entity identified as the
Initial Developer in the Source Code notice required by Exhibit A.
1.7. ``Larger Work'' means a work which combines Covered Code or portions
thereof with code not governed by the terms of this License.
1.8. ``License'' means this document.
1.9. ``Modifications'' means any addition to or deletion from the substance or
structure of either the Original Code or any previous Modifications. When
Covered Code is released as a series of files, a Modification is:
A. Any addition to or deletion from the contents of a file containing
Original Code or previous Modifications.
B. Any new file that contains any part of the Original Code or previous
Modifications.
1.10. ``Original Code'' means Source Code of computer software code which is
described in the Source Code notice required by Exhibit A as Original Code,
and which, at the time of its release under this License is not already
Covered Code governed by this License.
1.11. ``Source Code'' means the preferred form of the Covered Code for making
modifications to it, including all modules it contains, plus any associated
interface definition files, scripts used to control compilation and
installation of an Executable, or a list of source code differential
comparisons against either the Original Code or another well known, available
Covered Code of the Contributor's choice. The Source Code can be in a
compressed or archival form, provided the appropriate decompression or
de-archiving software is widely available for no charge.
1.12. ``You'' means an individual or a legal entity exercising rights under,
and complying with all of the terms of, this License or a future version of
this License issued under Section 6.1. For legal entities, ``You'' includes
any entity which controls, is controlled by, or is under common control with
You. For purposes of this definition, ``control'' means (a) the power, direct
or indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (b) ownership of fifty percent (50%) or more of the
outstanding shares or beneficial ownership of such entity.
2. Source Code License.
2.1. The Initial Developer Grant.
The Initial Developer hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property claims:
(a) to use, reproduce, modify, display, perform, sublicense and distribute
the Original Code (or portions thereof) with or without Modifications, or as
part of a Larger Work; and
(b) under patents now or hereafter owned or controlled by Initial Developer,
to make, have made, use and sell (``Utilize'') the Original Code (or
portions thereof), but solely to the extent that any such patent is
reasonably necessary to enable You to Utilize the Original Code (or portions
thereof) and not to any greater extent that may be necessary to Utilize
further Modifications or combinations.
2.2. Contributor Grant.
Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive
license, subject to third party intellectual property claims:
(a) to use, reproduce, modify, display, perform, sublicense and distribute
the Modifications created by such Contributor (or portions thereof) either
on an unmodified basis, with other Modifications, as Covered Code or as part
of a Larger Work; and
(b) under patents now or hereafter owned or controlled by Contributor, to
Utilize the Contributor Version (or portions thereof), but solely to the
extent that any such patent is reasonably necessary to enable You to Utilize
the Contributor Version (or portions thereof), and not to any greater extent
that may be necessary to Utilize further Modifications or combinations.
3. Distribution Obligations.
3.1. Application of License.
The Modifications which You create or to which You contribute are governed by
the terms of this License, including without limitation Section 2.2. The
Source Code version of Covered Code may be distributed only under the terms of
this License or a future version of this License released under Section 6.1,
and You must include a copy of this License with every copy of the Source Code
You distribute. You may not offer or impose any terms on any Source Code
version that alters or restricts the applicable version of this License or the
recipients' rights hereunder. However, You may include an additional document
offering the additional rights described in Section 3.5.
3.2. Availability of Source Code.
Any Modification which You create or to which You contribute must be made
available in Source Code form under the terms of this License either on the
same media as an Executable version or via an accepted Electronic Distribution
Mechanism to anyone to whom you made an Executable version available; and if
made available via Electronic Distribution Mechanism, must remain available
for at least twelve (12) months after the date it initially became available,
or at least six (6) months after a subsequent version of that particular
Modification has been made available to such recipients. You are responsible
for ensuring that the Source Code version remains available even if the
Electronic Distribution Mechanism is maintained by a third party.
3.3. Description of Modifications.
You must cause all Covered Code to which you contribute to contain a file
documenting the changes You made to create that Covered Code and the date of
any change. You must include a prominent statement that the Modification is
derived, directly or indirectly, from Original Code provided by the Initial
Developer and including the name of the Initial Developer in (a) the Source
Code, and (b) in any notice in an Executable version or related documentation
in which You describe the origin or ownership of the Covered Code.
3.4. Intellectual Property Matters
(a) Third Party Claims.
If You have knowledge that a party claims an intellectual property right in
particular functionality or code (or its utilization under this License),
you must include a text file with the source code distribution titled
``LEGAL'' which describes the claim and the party making the claim in
sufficient detail that a recipient will know whom to contact. If you obtain
such knowledge after You make Your Modification available as described in
Section 3.2, You shall promptly modify the LEGAL file in all copies You make
available thereafter and shall take other steps (such as notifying
appropriate mailing lists or newsgroups) reasonably calculated to inform
those who received the Covered Code that new knowledge has been obtained.
(b) Contributor APIs.
If Your Modification is an application programming interface and You own or
control patents which are reasonably necessary to implement that API, you
must also include this information in the LEGAL file.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source Code,
and this License in any documentation for the Source Code, where You describe
recipients' rights relating to Covered Code. If You created one or more
Modification(s), You may add your name as a Contributor to the notice
described in Exhibit A. If it is not possible to put such notice in a
particular Source Code file due to its structure, then you must include such
notice in a location (such as a relevant directory file) where a user would be
likely to look for such a notice. You may choose to offer, and to charge a fee
for, warranty, support, indemnity or liability obligations to one or more
recipients of Covered Code. However, You may do so only on Your own behalf,
and not on behalf of the Initial Developer or any Contributor. You must make
it absolutely clear than any such warranty, support, indemnity or liability
obligation is offered by You alone, and You hereby agree to indemnify the
Initial Developer and every Contributor for any liability incurred by the
Initial Developer or such Contributor as a result of warranty, support,
indemnity or liability terms You offer.
3.6. Distribution of Executable Versions.
You may distribute Covered Code in Executable form only if the requirements of
Section 3.1-3.5 have been met for that Covered Code, and if You include a
notice stating that the Source Code version of the Covered Code is available
under the terms of this License, including a description of how and where You
have fulfilled the obligations of Section 3.2. The notice must be
conspicuously included in any notice in an Executable version, related
documentation or collateral in which You describe recipients' rights relating
to the Covered Code. You may distribute the Executable version of Covered Code
under a license of Your choice, which may contain terms different from this
License, provided that You are in compliance with the terms of this License
and that the license for the Executable version does not attempt to limit or
alter the recipient's rights in the Source Code version from the rights set
forth in this License. If You distribute the Executable version under a
different license You must make it absolutely clear that any terms which
differ from this License are offered by You alone, not by the Initial
Developer or any Contributor. You hereby agree to indemnify the Initial
Developer and every Contributor for any liability incurred by the Initial
Developer or such Contributor as a result of any such terms You offer.
3.7. Larger Works.
You may create a Larger Work by combining Covered Code with other code not
governed by the terms of this License and distribute the Larger Work as a
single product. In such a case, You must make sure the requirements of this
License are fulfilled for the Covered Code.
4. Inability to Comply Due to Statute or Regulation.
If it is impossible for You to comply with any of the terms of this License
with respect to some or all of the Covered Code due to statute or regulation
then You must: (a) comply with the terms of this License to the maximum extent
possible; and (b) describe the limitations and the code they affect. Such
description must be included in the LEGAL file described in Section 3.4 and
must be included with all distributions of the Source Code. Except to the
extent prohibited by statute or regulation, such description must be
sufficiently detailed for a recipient of ordinary skill to be able to
understand it.
5. Application of this License.
This License applies to code to which the Initial Developer has attached the
notice in Exhibit A, and to related Covered Code.
6. Versions of the License.
6.1. New Versions.
Netscape Communications Corporation (``Netscape'') may publish revised and/or
new versions of the License from time to time. Each version will be given a
distinguishing version number.
6.2. Effect of New Versions.
Once Covered Code has been published under a particular version of the
License, You may always continue to use it under the terms of that version.
You may also choose to use such Covered Code under the terms of any subsequent
version of the License published by Netscape. No one other than Netscape has
the right to modify the terms applicable to Covered Code created under this
License.
6.3. Derivative Works.
If you create or use a modified version of this License (which you may only do
in order to apply it to code which is not already Covered Code governed by
this License), you must (a) rename Your license so that the phrases
``Mozilla'', ``MOZILLAPL'', ``MOZPL'', ``Netscape'', ``NPL'' or any
confusingly similar phrase do not appear anywhere in your license and (b)
otherwise make it clear that your version of the license contains terms which
differ from the Mozilla Public License and Netscape Public License. (Filling
in the name of the Initial Developer, Original Code or Contributor in the
notice described in Exhibit A shall not of themselves be deemed to be
modifications of this License.)
7. DISCLAIMER OF WARRANTY.
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS, WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE,
FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE
QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED
CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR
CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
DISCLAIMER.
8. TERMINATION.
This License and the rights granted hereunder will terminate automatically if
You fail to comply with terms herein and fail to cure such breach within 30
days of becoming aware of the breach. All sublicenses to the Covered Code
which are properly granted shall survive any termination of this License.
Provisions which, by their nature, must remain in effect beyond the
termination of this License shall survive.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING
NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY OTHER
CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF
SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY INDIRECT, SPECIAL,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR
MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH
PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS
LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND
LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
The Covered Code is a ``commercial item,'' as that term is defined in 48
C.F.R. 2.101 (Oct. 1995), consisting of ``commercial computer software'' and
``commercial computer software documentation,'' as such terms are used in 48
C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R.
227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users
acquire Covered Code with only those rights set forth herein.
11. MISCELLANEOUS.
This License represents the complete agreement concerning subject matter
hereof. If any provision of this License is held to be unenforceable, such
provision shall be reformed only to the extent necessary to make it
enforceable. This License shall be governed by California law provisions
(except to the extent applicable law, if any, provides otherwise), excluding
its conflict-of-law provisions. With respect to disputes in which at least one
party is a citizen of, or an entity chartered or registered to do business in,
the United States of America: (a) unless otherwise agreed in writing, all
disputes relating to this License (excepting any dispute relating to
intellectual property rights) shall be subject to final and binding
arbitration, with the losing party paying all costs of arbitration; (b) any
arbitration relating to this Agreement shall be held in Santa Clara County,
California, under the auspices of JAMS/EndDispute; and (c) any litigation
relating to this Agreement shall be subject to the jurisdiction of the Federal
Courts of the Northern District of California, with venue lying in Santa Clara
County, California, with the losing party responsible for costs, including
without limitation, court costs and reasonable attorneys fees and expenses.
The application of the United Nations Convention on Contracts for the
International Sale of Goods is expressly excluded. Any law or regulation which
provides that the language of a contract shall be construed against the
drafter shall not apply to this License.
12. RESPONSIBILITY FOR CLAIMS.
Except in cases where another Contributor has failed to comply with Section
3.4, You are responsible for damages arising, directly or indirectly, out of
Your utilization of rights under this License, based on the number of copies
of Covered Code you made available, the revenues you received from utilizing
such rights, and other relevant factors. You agree to work with affected
parties to distribute responsibility on an equitable basis.
EXHIBIT A.
``The contents of this file are subject to the Mozilla Public License Version
1.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is ______________________________________.
The Initial Developer of the Original Code is ________________________.
Portions created by ______________________ are Copyright (C) ______
_______________________. All Rights Reserved.
Contributor(s): ______________________________________.''

View file

@ -1,24 +0,0 @@
Open Geospatial Consortium, Inc.
License Agreement
BEFORE YOU CLICK ON THE ACCEPT BUTTON AT THE END OF THIS DOCUMENT, CAREFULLY READ ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT. BY CLICKING ON THE ACCEPT BUTTON, YOU ARE CONSENTING TO BE BOUND BY AND ARE BECOMING A PARTY TO THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, CLICK THE "DO NOT ACCEPT" BUTTON AND DO NOT DOWNLOAD THIS INTELLECTUAL PROPERTY.
Readers of this document are requested to submit to Open Geospatial Consortium, Inc. ("Licensor"), with their comments, notification of any relevant patent rights or other intellectual property rights of which they may be aware which might be infringed by any use of the copyrighted material that follows (the "Intellectual Property"), as appropriate, and to provide supporting documentation.
Open Geospatial Consortium Inc., OGC, OPENGIS, and the OGC CERTIFIED COMPLIANT logo are registered trademarks or trademarks of Licensor in the United States and in other countries.
Permission is hereby granted, free of charge and subject to the terms set forth below, to any person obtaining a copy of this Intellectual Property and any associated documentation, to deal in the Intellectual Property without restriction (except as set forth below), including without limitation the rights to implement, use, copy, modify, merge, publish, distribute, and/or sublicense copies of the Intellectual Property, and to permit persons to whom the Intellectual Property is furnished to do so, provided that all copyright notices on the intellectual property are retained intact and that each person to whom the Intellectual Property is furnished agrees to the terms of this Agreement.
If you modify the Intellectual Property, all copies of the modified Intellectual Property must include, in addition to the above copyright notice, a notice that the Intellectual Property includes modifications that have not been approved or adopted by LICENSOR.
THIS LICENSE IS A COPYRIGHT LICENSE ONLY, AND DOES NOT CONVEY ANY RIGHTS UNDER ANY PATENTS THAT MAY BE IN FORCE ANYWHERE IN THE WORLD.
THE INTELLECTUAL PROPERTY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE DO NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE INTELLECTUAL PROPERTY WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION OF THE INTELLECTUAL PROPERTY WILL BE UNINTERRUPTED OR ERROR FREE. ANY USE OF THE INTELLECTUAL PROPERTY SHALL BE MADE ENTIRELY AT THE USERS OWN RISK. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ANY CONTRIBUTOR OF INTELLECTUAL PROPERTY RIGHTS TO THE INTELLECTUAL PROPERTY BE LIABLE FOR ANY CLAIM, OR ANY DIRECT, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM ANY ALLEGED INFRINGEMENT OR ANY LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR UNDER ANY OTHER LEGAL THEORY, ARISING OUT OF OR IN CONNECTION WITH THE IMPLEMENTATION, USE, COMMERCIALIZATION OR PERFORMANCE OF THIS INTELLECTUAL PROPERTY.
This license is effective until terminated. You may terminate it at any time by destroying the Intellectual Property together with all copies in any form. It will also terminate if you fail to comply with any term or condition of this Agreement. Except as provided in the following sentence, no such termination of this license shall require the termination of any third party end-user sublicense to the Intellectual Property which is in force as of the date of notice of such termination. In addition, should the Intellectual Property, or the operation of the Intellectual Property, infringe, or in LICENSORs sole opinion be likely to infringe, any patent, copyright, trademark or other right of a third party, you agree that LICENSOR, in its sole discretion, may terminate this license without any compensation or liability to you, your licensees or any other party. You agree upon termination of any kind to destroy or cause to be destroyed the Intellectual Property together with all copies in any form, whether held by you or by any third party.
Except as contained in this notice, the name of LICENSOR or of any other holder of a copyright in all or part of the Intellectual Property shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Intellectual Property without prior written authorization of LICENSOR or such copyright holder. LICENSOR is and shall at all times be the sole entity that may authorize you or any third party to use certification marks, trademarks or other special designations to indicate compliance with any LICENSOR standards or specifications.
This Agreement is governed by the laws of the Commonwealth of Massachusetts. The application to this Agreement of the United Nations Convention on Contracts for the International Sale of Goods is hereby expressly excluded. In the event any provision of this Agreement shall be deemed unenforceable, void or invalid, such provision shall be modified so as to make it valid and enforceable, and as so modified the entire Agreement shall remain in full force and effect. No decision, action or inaction by LICENSOR shall be construed to be a waiver of any rights or remedies available to it.
None of the Intellectual Property or underlying information or technology may be downloaded or otherwise exported or reexported in violation of U.S. export laws and regulations. In addition, you are responsible for complying with any local laws in your jurisdiction which may impact your right to import, export or use the Intellectual Property, and you represent that you have complied with any regulations or registration procedures required by applicable law to make this license enforceable.

View file

@ -0,0 +1,10 @@
The Python Imaging Library (PIL) is
Copyright © 1997-2011 by Secret Labs AB
Copyright © 1995-2011 by Fredrik Lundh
By obtaining, using, and/or copying this software and/or its associated documentation, you agree that you have read, understood, and will comply with the following terms and conditions:
Permission to use, copy, modify, and distribute this software and its associated documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies, and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Secret Labs AB or the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.
SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View file

@ -0,0 +1,26 @@
A. Sun Microsystems, Inc. ("Sun") ENTITLEMENT for
SOFTWARE
Licensee/Company: Entity receiving Software.
Effective Date: Date of delivery of the Software to You.
Software: JavaBeans Activation Framework 1.1.
License Term: Perpetual (subject to termination under the SLA).
Licensed Unit: Software Copy.
Licensed unit Count: Unlimited.
Permitted Uses:
1. You may reproduce and use the Software for Individual, Commercial, or Research and Instructional Use for the purposes of designing, developing, testing, and running Your applets andapplication("Programs").
2. Subject to the terms and conditions of this Agreement and restrictions and exceptions set forth in the Software's documentation, You may reproduce and distribute portions of Software identified as a redistributable in the documentation "Redistributable"), provided that:
(a) you distribute Redistributable complete and unmodified and only bundled as part of Your Programs,
(b) your Programs add significant and primary functionality to the Redistributable,
(c) you distribute Redistributable for the sole purpose of running your Programs,
(d) you do not distribute additional software intended to replace any component(s) of the Redistributable,
(e) you do not remove or alter any proprietary legends or notices contained in or on the Redistributable.
(f) you only distribute the Redistributable subject to a license agreement that protects Sun's interests consistent with the terms contained in this Agreement, and
(g) you agree to defend and indemnify Sun and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Redistributable.
3. Java Technology Restrictions. You may not create, modify, or change the behavior of, or authorize your licensees to create, modify, or change the behavior of, classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by Sun in any naming convention designation.

View file

@ -0,0 +1,72 @@
The authors make NO WARRANTY or representation, either express or implied,
with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-1998, Thomas G. Lane.
All Rights Reserved except as specified below.
Permission is hereby granted to use, copy, modify, and distribute this
software (or portions thereof) for any purpose, without fee, subject to these
conditions:
(1) If any part of the source code for this software is distributed, then this
README file must be included, with this copyright and no-warranty notice
unaltered; and any additions, deletions, or changes to the original files
must be clearly indicated in accompanying documentation.
(2) If only executable code is distributed, then the accompanying
documentation must state that "this software is based in part on the work of
the Independent JPEG Group".
(3) Permission for use of this software is granted only if the user accepts
full responsibility for any undesirable consequences; the authors accept
NO LIABILITY for damages of any kind.
These conditions apply to any software derived from or based on the IJG code,
not just to the unmodified library. If you use our work, you ought to
acknowledge us.
Permission is NOT granted for the use of any IJG author's name or company name
in advertising or publicity relating to this software or products derived from
it. This software may be referred to only as "the Independent JPEG Group's
software".
We specifically permit and encourage the use of this software as the basis of
commercial products, provided that all warranty or liability claims are
assumed by the product vendor.
ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
ansi2knr.c is NOT covered by the above copyright and conditions, but instead
by the usual distribution terms of the Free Software Foundation; principally,
that you must include source code if you redistribute it. (See the file
ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
of any program generated from the IJG code, this does not limit you more than
the foregoing paragraphs do.
The Unix configuration script "configure" was produced with GNU Autoconf.
It is copyright by the Free Software Foundation but is freely distributable.
The same holds for its supporting scripts (config.guess, config.sub,
ltconfig, ltmain.sh). Another support script, install-sh, is copyright
by M.I.T. but is also freely distributable.
It appears that the arithmetic coding option of the JPEG spec is covered by
patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot
legally be used without obtaining one or more licenses. For this reason,
support for arithmetic coding has been removed from the free JPEG software.
(Since arithmetic coding provides only a marginal gain over the unpatented
Huffman mode, it is unlikely that very many implementations will support it.)
So far as we are aware, there are no patent restrictions on the remaining
code.
The IJG distribution formerly included code to read and write GIF files.
To avoid entanglement with the Unisys LZW patent, GIF reading support has
been removed altogether, and the GIF writer has been simplified to produce
"uncompressed GIFs". This technique does not use the LZW algorithm; the
resulting GIF files are larger than usual, but are readable by all standard
GIF decoders.
We are required to state that
"The Graphics Interchange Format(c) is the Copyright property of
CompuServe Incorporated. GIF(sm) is a Service Mark property of
CompuServe Incorporated."

View file

@ -0,0 +1,30 @@
jMock Project License
Copyright (c) 2000-2007, jMock.org
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer. Redistributions in binary form must reproduce
the above copyright notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
Neither the name of jMock nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

Binary file not shown.