Merge branch 'omaha_16.1.1' into omaha_16.2.1

Conflicts:
	cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/datamanager/RiverDataManager.java
	edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/GAFFDB.java


Former-commit-id: 4c99916da16fdf0db42218106824b13b2c2668b3
This commit is contained in:
Steve Harris 2015-09-08 15:51:57 -05:00
commit c94adfbac9
10 changed files with 37 additions and 59 deletions

View file

@ -33,7 +33,7 @@ import java.util.TimeZone;
* ------------ ---------- ----------- --------------------------
* OCT 8, 2007 1580 askripsky Initial creation.
* 21 Feb 2010 2915 mpduff Fixed Time Zone problem.
*
* Sep 03, 2015 4845 rjpeter Fix NPE.
* </pre>
*
* @author askripsky
@ -245,8 +245,8 @@ public class StationReportingData implements Comparable<StationReportingData> {
return qualityCode;
}
public void setQualityCode(Integer qualityCode) {
this.qualityCode = (qualityCode != null) ? qualityCode : 0;
public void setQualityCode(Number qualityCode) {
this.qualityCode = (qualityCode != null) ? qualityCode.intValue() : 0;
}
public String getProductId() {

View file

@ -50,6 +50,7 @@ import com.raytheon.viz.hydrocommon.HydroDataCache;
* 13Oct2008 1580 askripsky Refactored
* 21 Feb 2010 2915 mpduff Fixed Time Zone problem.
* Jul 21, 2015 4500 rjpeter Use Number in blind cast.
* Sep 03, 2015 4845 rjpeter Fix NPE.
* </pre>
*
* @author ebabin
@ -252,7 +253,7 @@ public class StationReportingDataManager {
srd.setValue((Double) oa[6]);
srd.setRevision(((Number) oa[7]).shortValue());
srd.setShefQualCode((String) oa[8]);
srd.setQualityCode(((Number) oa[9]).intValue());
srd.setQualityCode((Number) oa[9]);
srd.setProductId((String) oa[10]);
srd.setProducttime(currentTimeFormat
.format((Date) oa[11]));
@ -303,7 +304,7 @@ public class StationReportingDataManager {
retVal.setShefQualCode(dataRow[7].toString());
if (dataRow[8] != null) {
retVal.setQualityCode(((Number) dataRow[8]).intValue());
retVal.setQualityCode((Number) dataRow[8]);
}
if (dataRow[9] != null) {

View file

@ -49,7 +49,7 @@ import com.raytheon.viz.hydrocommon.data.LocationData;
* the database.
* Apr 18, 2013 1790 rferrel Cleanup method interfaces;
* part of non-blocking dialogs.
*
* Sep 04, 2015 4846 rjpeter Fix query.
* </pre>
*
* @author askripsky
@ -200,7 +200,7 @@ public class AddModifyLocationDataManager extends HydroDataManager {
public List<String> getHSAsForFilter() throws VizException {
List<String> rval = new ArrayList<String>();
String query = "Select distinct(hsa) from location order by hsa";
String query = "Select distinct hsa from location order by hsa";
QueryResult data = HydroDBDataManager.getInstance().runMappedQuery(
query);

View file

@ -35,8 +35,8 @@ import com.raytheon.viz.hydrocommon.data.ContactsData;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20 Nov 2008 lvenable Initial creation
*
* 20 Nov 2008 lvenable Initial creation
* Sep 03, 2015 4846 rjpeter List out columns in select.
* </pre>
*
* @author lvenable
@ -52,7 +52,7 @@ public class ContactsDataManager extends HydroDataManager
/**
* Select statement.
*/
private final String SELECT_STATEMENT = "SELECT * FROM contacts";
private final String SELECT_STATEMENT = "SELECT lid, contact, phone, email, remark, priority FROM contacts";
/**
* Insert statement.

View file

@ -36,7 +36,7 @@ import com.raytheon.viz.hydrocommon.data.DescriptionData;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02 Dec 2008 lvenable Initial creation
*
* Sep 03, 2015 4846 rjpeter List out columns in select.
* </pre>
*
* @author lvenable
@ -52,7 +52,7 @@ public class DescriptionDataManager extends HydroDataManager
/**
* Select statement.
*/
private final String SELECT_STATEMENT = "SELECT * FROM descrip";
private final String SELECT_STATEMENT = "SELECT lid, bed, divert, remark, ice, proximity, reach, res, topo FROM descrip";
/**
* Insert statement.

View file

@ -36,7 +36,7 @@ import com.raytheon.viz.hydrocommon.data.LocationAreaData;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02 Dec 2008 lvenable Initial creation
*
* Sep 03, 2015 4846 rjpeter List out columns in select.
* </pre>
*
* @author lvenable
@ -52,7 +52,7 @@ public class LocationAreaManager extends HydroDataManager
/**
* Select statement.
*/
private final String SELECT_STATEMENT = "SELECT * FROM locarea";
private final String SELECT_STATEMENT = "SELECT lid, area FROM locarea";
/**
* Insert statement.

View file

@ -36,7 +36,7 @@ import com.raytheon.viz.hydrocommon.data.ProximityData;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02 Dec 2008 lvenable Initial creation
*
* Sep 03, 2015 4846 rjpeter List out columns in select.
* </pre>
*
* @author lvenable
@ -52,7 +52,7 @@ public class ProximityDataManager extends HydroDataManager
/**
* Select statement.
*/
private final String SELECT_STATEMENT = "SELECT * FROM proximity";
private final String SELECT_STATEMENT = "SELECT proximity FROM proximity";
/**
* Private constructor.

View file

@ -58,6 +58,7 @@ import com.raytheon.viz.hydrocommon.data.RiverDataPoint;
* set riverName using locationquery instead of
* riverInfoQuery, added rb field in locationQuery
* Aug 05, 2015 4486 rjpeter Changed Timestamp to Date.
* Sep 03, 2015 4845 rjpeter Remove use of duplicate alias.
* </pre>
*
* @author dhladky
@ -109,7 +110,7 @@ public class RiverDataManager {
+ "rmg.group_name, "
+ "r.stream, r.mile, r.zd AS zero, r.tide, r.bf AS bankfull, r.wstg AS action_stage, r.fs AS flood_stage, r.fq AS flood_flow, r.action_flow, r.primary_pe, "
+ "d.proximity, d.reach, "
+ "f.minor_stage AS minor, f.moderate_stage AS moderate, f.major_stage AS major, f.minor_flow AS minor, f.moderate_flow AS moderate, f.major_flow AS major "
+ "f.minor_stage, f.moderate_stage, f.major_stage, f.minor_flow, f.moderate_flow, f.major_flow "
+ "FROM location l "
+ "LEFT JOIN floodcat f ON l.lid::text = f.lid::text "
+ "LEFT JOIN descrip d ON l.lid::text = d.lid::text, riverstat r, rivermonlocation rml "

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.edex.ohd.pproc;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
@ -51,6 +50,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* Apr 21, 2014 2060 njensen Remove dependency on grid dataURI column
* Jul 09, 2015 4500 rjpeter Fix SQL Injection concern.
* Aug 05, 2015 4486 rjpeter Changed Timestamp to Date.
* Sep 08, 2015 4846 rjpeter Fixed paramMap data types.
* </pre>
*
* @author mpduff
@ -205,14 +205,11 @@ public class GAFFDB {
public void writeContingency(String areaId, long validTimeMillis,
int duration, double avgVal) throws DataAccessLayerException {
// validtime = timestamp from selected gridded FFG file
Calendar validTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
validTime.setTimeInMillis(validTimeMillis);
Calendar validDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
validDate.setTimeInMillis(validTimeMillis);
Calendar postDate = Calendar.getInstance(
TimeZone.getTimeZone("GMT"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String postDate = sdf.format(Calendar.getInstance(
TimeZone.getTimeZone("GMT")).getTime());
String validDate = sdf.format(validTime.getTime());
String basisTime = validDate;
// duration in units of hours, possible values = 1,3,6,12,24
short dur = 0;
@ -230,42 +227,38 @@ public class GAFFDB {
// Do we insert or update here
String countSql = "select count(*) from contingencyvalue where "
+ "lid = '" + areaId + "' and pe = 'PP' and dur = " + dur
+ "lid = :areaId and pe = 'PP' and dur = :dur"
+ " and ts = 'CP' and extremum = 'Z' and probability = -1.0 "
+ " and validtime = '" + validDate + "' and basistime = '"
+ basisTime + "'";
+ " and validtime = :validDate and basistime = :validDate";
Map<String, Object> paramMap = new HashMap<>(8, 1);
paramMap.put("areaId", areaId);
paramMap.put("dur", dur);
paramMap.put("validDate", validDate);
CoreDao dao = null;
dao = new CoreDao(DaoConfig.forDatabase(IHFS));
Object[] rs = dao.executeSQLQuery(countSql);
Object[] rs = dao.executeSQLQuery(countSql, paramMap);
BigInteger count = new BigInteger("0");
if ((rs != null) && (rs.length > 0)) {
count = (BigInteger) rs[0];
}
if (count == BigInteger.ZERO) {
paramMap.put("avgVal", avgVal);
paramMap.put("qc", DEFAULT_QC_VALUE);
paramMap.put("postDate", postDate);
if (count == BigInteger.ZERO) {
// Write data to the table
String sql = "insert into contingencyvalue (lid, pe, dur, ts, "
+ "extremum, probability, validtime, basistime, value, "
+ "shef_qual_code, quality_code, revision, product_id, "
+ "producttime, postingtime) values (:areaId, 'PP', "
+ ":dur, 'CP', 'Z', -1.0, :validDate, :basisTime, :avgVal, "
+ ":dur, 'CP', 'Z', -1.0, :validDate, :validDate, :avgVal, "
+ "'Z', :qc, 0, 'GRIDFFG', :validDate, :postDate)";
log.debug(sql);
Map<String, Object> paramMap = new HashMap<>(8, 1);
paramMap.put("areaId", areaId);
paramMap.put("dur", dur);
paramMap.put("validDate", validDate);
paramMap.put("basisTime", basisTime);
paramMap.put("avgVal", avgVal);
paramMap.put("qc", DEFAULT_QC_VALUE);
paramMap.put("validDate", validDate);
paramMap.put("postDate", postDate);
dao.executeSQLUpdate(sql, paramMap);
} else {
// Need to do an update to the row
@ -274,18 +267,7 @@ public class GAFFDB {
+ "product_id = 'GRIDFFG', producttime = :validDate, "
+ "postingtime = :postDate where lid = :areaId and pe = 'PP' "
+ "and dur = :dur and ts = 'CP' and extremum = 'Z' and probability = -1.0 "
+ " and validtime = :validDate and basistime = :basisTime";
Map<String, Object> paramMap = new HashMap<>(8, 1);
paramMap.put("avgVal", avgVal);
paramMap.put("qc", DEFAULT_QC_VALUE);
paramMap.put("validDate", validDate);
paramMap.put("postDate", postDate);
paramMap.put("areaId", areaId);
paramMap.put("dur", dur);
paramMap.put("validDate", validDate);
paramMap.put("basisTime", basisTime);
+ " and validtime = :validDate and basistime = :validDate";
dao.executeSQLUpdate(updateSql, paramMap);
}
}

View file

@ -35,10 +35,4 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.registry.request"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>