Merge branch 'omaha_16.1.1' into omaha_16.2.1

Conflicts:
	edexOsgi/com.raytheon.uf.common.dataplugin.climate/src/com/raytheon/uf/common/dataplugin/climate/ClimateGeometryFactory.java


Former-commit-id: 0e4bb5edcd4f05b880e70b3f2c66d70209be11fa
This commit is contained in:
Steve Harris 2015-08-27 11:40:53 -05:00
commit e524aa5148
11 changed files with 170 additions and 9 deletions

View file

@ -48,6 +48,8 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* May 14, 2015 4409 mapeters Initial creation.
* May 21, 2015 4409 mapeters Extract query results correctly in getTimeColumnNames()
* Aug 05, 2015 4486 rjpeter Changed Timestamp to Date.
* Aug 21, 2015 4409 mapeters Alias columns that are automatically retrieved when
* getting geometry data
* </pre>
*
* @author mapeters
@ -88,6 +90,14 @@ public class ClimateGeometryFactory extends AbstractGeometryDatabaseFactory {
private static final String RPT = "rpt";
private static final String CLI_STA_SETUP_LON = "longitude_e";
private static final String LOCATION_COLUMN_ALIAS_PREFIX = "location_column_";
private static final String TIME_COLUMN_ALIAS_PREFIX = "time_column_";
private static final String GEOM_COLUMN_ALIAS_PREFIX = "geom_column_";
public ClimateGeometryFactory() {
super(HMDB_DATABASE, new String[] { TABLE },
new String[] { COL_NAME_OPTION });
@ -419,6 +429,15 @@ public class ClimateGeometryFactory extends AbstractGeometryDatabaseFactory {
boolean hasStationCode = locationColumnName.equals(STATION_CODE);
// Build SELECT statement
StringBuilder sqlQuery = new StringBuilder("select ");
/*
* We must alias all columns making up the geometry. If a
* location/lat/lon/time column is also requested as a parameter, this
* makes them differentiable.
*/
String locColumnAsAlias;
String latColumnAsAlias;
String lonColumnAsAlias;
/*
* rpt table is used to get location names and coordinates for tables
* with station_code location column (or rpt table itself). Other tables
@ -426,9 +445,15 @@ public class ClimateGeometryFactory extends AbstractGeometryDatabaseFactory {
* cli_sta_setup table to get location name and coordinates.
*/
if (hasStationCode || isRpt) {
sqlQuery.append(RPT).append(".").append(ICAO_LOC_ID).append(", ")
.append(RPT).append(".lat, ").append(RPT).append(".lon");
locColumnAsAlias = buildAlias(RPT, ICAO_LOC_ID,
LOCATION_COLUMN_ALIAS_PREFIX);
latColumnAsAlias = buildAlias(RPT, "lat", GEOM_COLUMN_ALIAS_PREFIX);
lonColumnAsAlias = buildAlias(RPT, "lon", GEOM_COLUMN_ALIAS_PREFIX);
} else {
locColumnAsAlias = buildAlias(CLI_STA_SETUP, STATION_CODE,
LOCATION_COLUMN_ALIAS_PREFIX);
latColumnAsAlias = buildAlias(CLI_STA_SETUP, "latitude_n",
GEOM_COLUMN_ALIAS_PREFIX);
/*
* TODO: The longitude values in cli_sta_setup are all positive when
* they should all be negative. This problem is inherited from A1,
@ -436,14 +461,18 @@ public class ClimateGeometryFactory extends AbstractGeometryDatabaseFactory {
* covered. Changing the longitude sign works for now, but potential
* future stations in different hemispheres may cause problems here.
*/
sqlQuery.append(CLI_STA_SETUP).append(".").append(STATION_CODE)
.append(", ").append(CLI_STA_SETUP).append(".latitude_n, ")
.append(CLI_STA_SETUP).append(".longitude_e * -1");
lonColumnAsAlias = new StringBuilder(CLI_STA_SETUP).append(".")
.append(CLI_STA_SETUP_LON).append(" * -1 as ")
.append(GEOM_COLUMN_ALIAS_PREFIX).append(CLI_STA_SETUP_LON)
.toString();
}
sqlQuery.append(locColumnAsAlias).append(", ").append(latColumnAsAlias)
.append(", ").append(lonColumnAsAlias);
for (String timeColumnName : timeColumnNames) {
sqlQuery.append(", ").append(tableName).append(".")
.append(timeColumnName);
sqlQuery.append(", ").append(
buildAlias(tableName, timeColumnName,
TIME_COLUMN_ALIAS_PREFIX));
}
String[] params = request.getParameters();
@ -503,6 +532,21 @@ public class ClimateGeometryFactory extends AbstractGeometryDatabaseFactory {
return sqlQuery.toString();
}
/**
* Alias the given column by prepending the aliasPrefix to it, to be used in
* a select statement.
*
* @param table
* @param column
* @param aliasPrefix
* @return the aliased column, in the format: "table.column as alias"
*/
private static String buildAlias(String table, String column,
String aliasPrefix) {
return new StringBuilder(table).append(".").append(column)
.append(" as ").append(aliasPrefix).append(column).toString();
}
private static String buildLocationNameConstraint(String[] locationNames,
String locationColumnName) {
StringBuilder locationConstraint = new StringBuilder();

View file

@ -62,6 +62,7 @@
<include>purge-logs.xml</include>
<exclude>fssobs-ingest.xml</exclude>
<exclude>fssobs-common.xml</exclude>
<include>ndm-ingest.xml</include>
</mode>
<mode name="requestHydro">
<include>ohd-common-database.xml</include>
@ -89,5 +90,7 @@
<include>event-common.xml</include>
<include>eventbus-common.xml</include>
<include>edex-request.xml</include>
<include>request-service.xml</include>
<include>request-service-common.xml</include>
</mode>
</edexModes>

View file

@ -62,4 +62,10 @@
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>

View file

@ -31,4 +31,10 @@
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>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.edex.registry.request</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Request
Bundle-SymbolicName: com.raytheon.uf.edex.registry.request
Bundle-Version: 1.15.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.7

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
res/

View file

@ -0,0 +1,41 @@
/**
* 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.uf.edex.registry.request;
/**
* Marker class because this plugin is only required for the Spring files at
* this time, but a class is required for the including feature to not have a
* warning.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 24, 2015 4774 dhladky Initial creation
*
* </pre>
*
* @author dhladky
* @version 1.0
*/
public class MarkerClass {
}

View file

@ -17,8 +17,14 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
# File auto-generated by PythonFileGenerator
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/22/2015 4573 randerso Added svcbu package
#
##
__all__ = [
'GridDataHistory',
@ -29,6 +35,7 @@ __all__ = [
'request',
'server',
'slice',
'svcbu',
'weather'
]