From 57e5bbfe846a3ce4f4c0f502eb72af1b13f94dd3 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Tue, 22 Apr 2014 12:03:44 -0500 Subject: [PATCH] Issue #2984 remove unnecessary dependencies Change-Id: I2066a1e903680068e0d25f7faa99bc7bda2b8877 Former-commit-id: d03afcdcba50a231b45e5620fb18d3848f7e9862 [formerly d03afcdcba50a231b45e5620fb18d3848f7e9862 [formerly 290ec544e38e71332be2072435aff3b933c649ab]] Former-commit-id: be21c415121a0d08ab57866813aeaa71fea7f640 Former-commit-id: 8f893545f1a08b32b3c94b63d6dc5900ed3240ba --- .../feature.xml | 14 ------ .../META-INF/MANIFEST.MF | 3 +- .../uf/common/dataplugin/ffmp/FFMPUtils.java | 43 +++++++++++++++++-- 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/cave/com.raytheon.uf.viz.common.core.feature/feature.xml b/cave/com.raytheon.uf.viz.common.core.feature/feature.xml index 30fb8a0f18..15fe41794c 100644 --- a/cave/com.raytheon.uf.viz.common.core.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.common.core.feature/feature.xml @@ -64,13 +64,6 @@ version="0.0.0" unpack="false"/> - - - - * * @author dhladky @@ -209,9 +213,8 @@ public class FFMPUtils { + "where lid in " + "(select distinct(lid) from IngestFilter " + "where pe in ('PC', 'PP') " + "and ingest = 'T' " + "and dur < 2000)"; - CoreDao dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS)); try { - Object[] results = dao.executeSQLQuery(sql.toString()); + Object[] results = executeSqlQuery(sql, ShefConstants.IHFS); Geometry poly = getCwaGeometry(cwa, mode); PreparedGeometry pg = PreparedGeometryFactory.prepare(poly); Coordinate coor = poly.getCentroid().getCoordinate(); @@ -1362,4 +1365,36 @@ public class FFMPUtils { + sourceSiteDataKey + ".h5"); } + /** + * Queries the specified database + * + * @param query + * the SQL query to run + * @param database + * the database to query + * @return a two dimensional Object[] representing rows and columns + * @throws Exception + */ + private static Object[] executeSqlQuery(String query, String database) + throws Exception { + // code shamelessly modeled after DirectDbQuery + // TODO DirectDbQuery should be changed to use RequestRouter instead of + // ThriftClient and should be promoted to a common plugin + Map constraints = new HashMap(); + constraints.put("query", new RequestConstraint(query)); + constraints.put("database", new RequestConstraint(database)); + constraints.put("mode", new RequestConstraint("sqlquery")); + QlServerRequest request = new QlServerRequest(constraints); + ResponseMessageGeneric resp = (ResponseMessageGeneric) RequestRouter + .route(request); + + QueryResult result = (QueryResult) resp.getContents(); + List unmappedResults = new ArrayList(); + for (QueryResultRow row : result.getRows()) { + unmappedResults.add(row.getColumnValues()); + } + + return unmappedResults.toArray(new Object[0]); + } + }