Issue #2060 dropping grid dataURI column
Change-Id: I8b8ba3f2ec71e15aa3c40e7eab42525dbf09157e Former-commit-id: 1aab87d9572089a09351ebdfb8fbcef884866feb
This commit is contained in:
parent
35891b2dcd
commit
5dfb652775
12 changed files with 201 additions and 135 deletions
|
@ -19,7 +19,6 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.hydro.flashfloodguidance;
|
package com.raytheon.viz.hydro.flashfloodguidance;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -27,12 +26,10 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
|
||||||
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
|
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
|
||||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||||
import com.raytheon.uf.common.datastorage.StorageException;
|
|
||||||
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;
|
||||||
|
@ -51,6 +48,7 @@ import com.raytheon.viz.hydrocommon.HydroConstants;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 03Sept2008 #1507 dhladky Initial Creation.
|
* 03Sept2008 #1507 dhladky Initial Creation.
|
||||||
* 12Oct2009 2256 mpduff Added additional data query capability.
|
* 12Oct2009 2256 mpduff Added additional data query capability.
|
||||||
|
* Apr 21, 2014 2060 njensen Remove dependency on grid dataURI column
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -59,13 +57,12 @@ import com.raytheon.viz.hydrocommon.HydroConstants;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class FlashFloodGuidanceDataManager {
|
public class FlashFloodGuidanceDataManager {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(FlashFloodGuidanceDataManager.class);
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(FlashFloodGuidanceDataManager.class);
|
||||||
|
|
||||||
/** Instance of this class */
|
/** Instance of this class */
|
||||||
private static FlashFloodGuidanceDataManager instance = null;
|
private static FlashFloodGuidanceDataManager instance = null;
|
||||||
|
|
||||||
private static final String LINESEGS_QUERY = "select hrap_row, hrap_beg_col, "
|
|
||||||
+ "hrap_end_col, area from linesegs";
|
|
||||||
|
|
||||||
/** RFC Site name to RFC lookup map */
|
/** RFC Site name to RFC lookup map */
|
||||||
public static Map<String, String> RFCMAP = new HashMap<String, String>();
|
public static Map<String, String> RFCMAP = new HashMap<String, String>();
|
||||||
|
|
||||||
|
@ -136,8 +133,6 @@ public class FlashFloodGuidanceDataManager {
|
||||||
query.addColumn(GridConstants.DATASET_ID);
|
query.addColumn(GridConstants.DATASET_ID);
|
||||||
query.addColumn(GridConstants.PARAMETER_ABBREVIATION);
|
query.addColumn(GridConstants.PARAMETER_ABBREVIATION);
|
||||||
query.addColumn("dataTime.refTime");
|
query.addColumn("dataTime.refTime");
|
||||||
query.addColumn("dataURI");
|
|
||||||
query.addColumn("id");
|
|
||||||
query.addConstraint(GridConstants.DATASET_ID, new RequestConstraint(
|
query.addConstraint(GridConstants.DATASET_ID, new RequestConstraint(
|
||||||
"FFG%", ConstraintType.LIKE));
|
"FFG%", ConstraintType.LIKE));
|
||||||
query.addConstraint(GridConstants.SECONDARY_ID, "Version0");
|
query.addConstraint(GridConstants.SECONDARY_ID, "Version0");
|
||||||
|
@ -174,8 +169,7 @@ public class FlashFloodGuidanceDataManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridRecord getGridRecord(String uri) throws PluginException,
|
public GridRecord getGridRecord(String uri) {
|
||||||
FileNotFoundException, StorageException {
|
|
||||||
StringBuilder query = new StringBuilder();
|
StringBuilder query = new StringBuilder();
|
||||||
query.append("from "
|
query.append("from "
|
||||||
+ com.raytheon.uf.common.dataplugin.grid.GridRecord.class
|
+ com.raytheon.uf.common.dataplugin.grid.GridRecord.class
|
||||||
|
@ -197,8 +191,9 @@ public class FlashFloodGuidanceDataManager {
|
||||||
List<Object[]> rs = null;
|
List<Object[]> rs = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rs = DirectDbQuery.executeQuery("select area_id, interior_lat, interior_lon from geoArea " + where,
|
rs = DirectDbQuery.executeQuery(
|
||||||
HydroConstants.IHFS, QueryLanguage.SQL);
|
"select area_id, interior_lat, interior_lon from geoArea "
|
||||||
|
+ where, HydroConstants.IHFS, QueryLanguage.SQL);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM, "FFG Query"
|
statusHandler.handle(Priority.PROBLEM, "FFG Query"
|
||||||
+ " Error querying GeoArea table");
|
+ " Error querying GeoArea table");
|
||||||
|
@ -207,7 +202,8 @@ public class FlashFloodGuidanceDataManager {
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object[]> getContingencyValue(String areaId, int duration, Date refTime) {
|
public List<Object[]> getContingencyValue(String areaId, int duration,
|
||||||
|
Date refTime) {
|
||||||
List<Object[]> rs = null;
|
List<Object[]> rs = null;
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
|
@ -227,14 +223,14 @@ public class FlashFloodGuidanceDataManager {
|
||||||
dur = 2001;
|
dur = 2001;
|
||||||
}
|
}
|
||||||
|
|
||||||
String where = " where pe = 'PP' and ts = 'CF' and " +
|
String where = " where pe = 'PP' and ts = 'CF' and " + "validtime >= '"
|
||||||
"validtime >= '" + date + "' and lid = '" + areaId + "' " +
|
+ date + "' and lid = '" + areaId + "' " + "and dur = " + dur
|
||||||
"and dur = " + dur + " order by validtime desc;";
|
+ " order by validtime desc;";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rs = DirectDbQuery.executeQuery("select lid, validtime, value from " +
|
rs = DirectDbQuery.executeQuery(
|
||||||
"contingencyvalue " + where,
|
"select lid, validtime, value from " + "contingencyvalue "
|
||||||
HydroConstants.IHFS, QueryLanguage.SQL);
|
+ where, HydroConstants.IHFS, QueryLanguage.SQL);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM, "FFG Query"
|
statusHandler.handle(Priority.PROBLEM, "FFG Query"
|
||||||
+ " Error querying ContingencyValue table");
|
+ " Error querying ContingencyValue table");
|
||||||
|
@ -246,15 +242,11 @@ public class FlashFloodGuidanceDataManager {
|
||||||
|
|
||||||
public List<Object[]> getContingencyValue(String boundaryType) {
|
public List<Object[]> getContingencyValue(String boundaryType) {
|
||||||
List<Object[]> rs = null;
|
List<Object[]> rs = null;
|
||||||
|
|
||||||
String where = " where pe='PP' and ts='CF' and lid in (select area_id from " +
|
|
||||||
"GeoArea where boundary_type = '" + boundaryType.toUpperCase() +
|
|
||||||
"') order by validtime desc, dur asc";
|
|
||||||
String sql = "select distinct(validtime), dur from contingencyvalue";
|
String sql = "select distinct(validtime), dur from contingencyvalue";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rs = DirectDbQuery.executeQuery(sql,
|
rs = DirectDbQuery.executeQuery(sql, HydroConstants.IHFS,
|
||||||
HydroConstants.IHFS, QueryLanguage.SQL);
|
QueryLanguage.SQL);
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM, "FFG Query"
|
statusHandler.handle(Priority.PROBLEM, "FFG Query"
|
||||||
+ " Error querying ContingencyValue table");
|
+ " Error querying ContingencyValue table");
|
||||||
|
|
41
deltaScripts/14.3.1/dropGridDataURI.sh
Normal file
41
deltaScripts/14.3.1/dropGridDataURI.sh
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# DR #2060 - this update script will drop the dataURI column from the grid table
|
||||||
|
|
||||||
|
PSQL="/awips2/psql/bin/psql"
|
||||||
|
|
||||||
|
# drops the datauri constraint and column if they exist
|
||||||
|
function dropDatauri {
|
||||||
|
echo "INFO: Dropping DataURI column from grid"
|
||||||
|
${PSQL} -U awips -d metadata -c "ALTER TABLE grid DROP CONSTRAINT IF EXISTS grid_datauri_key;"
|
||||||
|
${PSQL} -U awips -d metadata -c "ALTER TABLE grid DROP COLUMN IF EXISTS datauri;"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: Failed to drop dataURI column for grid"
|
||||||
|
echo "FATAL: The update has failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# takes three args: table, constraint name, unique columns
|
||||||
|
# will first drop the constraint if it exists and then adds it back, this is
|
||||||
|
# fairly inefficient if it does exist but operationally it won't exist and for
|
||||||
|
# testing this allows the script to be run easily as a noop.
|
||||||
|
function dropAndAddConstraint {
|
||||||
|
${PSQL} -U awips -d metadata -c "ALTER TABLE $1 DROP CONSTRAINT IF EXISTS $2;"
|
||||||
|
${PSQL} -U awips -d metadata -c "ALTER TABLE $1 ADD CONSTRAINT $2 UNIQUE $3;"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "ERROR: Failed to add new unique constraint for $1"
|
||||||
|
echo "FATAL: The update has failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
${PSQL} -U awips -d metadata -c "VACUUM FULL ANALYZE $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "INFO: Dropping dataURI columns."
|
||||||
|
|
||||||
|
dropDatauri
|
||||||
|
dropAndAddConstraint grid grid_reftime_forecasttime_rangestart_rangeend_info_id "(refTime, forecastTime, rangestart, rangeend, info_id)"
|
||||||
|
dropAndAddConstraint grid_info grid_info_datasetid_secondaryid_ensembleid_location_id_parameter_abbreviation_level_id "(datasetid, secondaryid, ensembleid, location_id, parameter_abbreviation, level_id)"
|
||||||
|
|
||||||
|
|
||||||
|
echo "INFO: grid dataURI column dropped successfully"
|
|
@ -58,8 +58,8 @@ import com.raytheon.uf.edex.core.EDEXUtil;
|
||||||
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
|
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
|
||||||
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
|
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
|
||||||
import com.raytheon.uf.edex.database.cluster.ClusterTask;
|
import com.raytheon.uf.edex.database.cluster.ClusterTask;
|
||||||
|
import com.raytheon.uf.edex.database.plugin.DataURIDatabaseUtil;
|
||||||
import com.raytheon.uf.edex.database.plugin.PluginFactory;
|
import com.raytheon.uf.edex.database.plugin.PluginFactory;
|
||||||
import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
|
||||||
import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,6 +81,7 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
||||||
* Oct 15, 2013 2473 bsteffen Remove deprecated method calls.
|
* Oct 15, 2013 2473 bsteffen Remove deprecated method calls.
|
||||||
* Nov 19, 2013 2478 rjpeter Make update process update database also.
|
* Nov 19, 2013 2478 rjpeter Make update process update database also.
|
||||||
* Dec 06, 2013 2170 rjpeter Update to pass PluginDataObject[] to notification.
|
* Dec 06, 2013 2170 rjpeter Update to pass PluginDataObject[] to notification.
|
||||||
|
* Apr 21, 2014 2060 njensen Remove dependency on grid dataURI column
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author bphillip
|
* @author bphillip
|
||||||
|
@ -214,15 +215,11 @@ public class EnsembleGridAssembler implements IDecoderPostProcessor {
|
||||||
*/
|
*/
|
||||||
private void processGrid(GridRecord record, CompositeModel thinned)
|
private void processGrid(GridRecord record, CompositeModel thinned)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
GridDao dao = (GridDao) PluginFactory.getInstance().getPluginDao(
|
GridDao dao = (GridDao) PluginFactory.getInstance().getPluginDao(
|
||||||
GridConstants.GRID);
|
GridConstants.GRID);
|
||||||
GridRecord assembledRecord = createAssembledRecord(record, thinned);
|
GridRecord assembledRecord = createAssembledRecord(record, thinned);
|
||||||
DatabaseQuery query = new DatabaseQuery(GridRecord.class);
|
boolean exists = DataURIDatabaseUtil.existingDataURI(assembledRecord);
|
||||||
query.addReturnedField("dataURI");
|
if (!exists) {
|
||||||
query.addQueryParam("dataURI", assembledRecord.getDataURI());
|
|
||||||
List<?> result = dao.queryByCriteria(query);
|
|
||||||
if (result.isEmpty()) {
|
|
||||||
persistNewRecord(record, assembledRecord, thinned, dao);
|
persistNewRecord(record, assembledRecord, thinned, dao);
|
||||||
} else {
|
} else {
|
||||||
updateExistingRecord(record, assembledRecord, thinned, dao);
|
updateExistingRecord(record, assembledRecord, thinned, dao);
|
||||||
|
|
|
@ -85,6 +85,7 @@ import com.vividsolutions.jts.io.WKTWriter;
|
||||||
* 03/01/13 DR 13228 G. Zhang Add state for VGB query and related code
|
* 03/01/13 DR 13228 G. Zhang Add state for VGB query and related code
|
||||||
* 03/18/13 1817 D. Hladky Fixed issue with BOX where only 1 HUC was showing up.
|
* 03/18/13 1817 D. Hladky Fixed issue with BOX where only 1 HUC was showing up.
|
||||||
* 08/20/13 2250 mnash Fixed incorrect return types for database queries.
|
* 08/20/13 2250 mnash Fixed incorrect return types for database queries.
|
||||||
|
* Apr 21, 2014 2060 njensen Remove dependency on grid dataURI column
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author dhladky
|
* @author dhladky
|
||||||
|
@ -943,10 +944,8 @@ public class FFMPUtils {
|
||||||
*/
|
*/
|
||||||
public static String getFFGDataURI(String rfc, String parameter,
|
public static String getFFGDataURI(String rfc, String parameter,
|
||||||
String plugin) {
|
String plugin) {
|
||||||
|
|
||||||
DbQueryRequest request = new DbQueryRequest();
|
DbQueryRequest request = new DbQueryRequest();
|
||||||
request.setEntityClass(GridRecord.class.getName());
|
request.setEntityClass(GridRecord.class.getName());
|
||||||
request.addRequestField("dataURI");
|
|
||||||
request.addConstraint(GridConstants.PARAMETER_ABBREVIATION,
|
request.addConstraint(GridConstants.PARAMETER_ABBREVIATION,
|
||||||
new RequestConstraint(parameter));
|
new RequestConstraint(parameter));
|
||||||
request.addConstraint(GridConstants.DATASET_ID, new RequestConstraint(
|
request.addConstraint(GridConstants.DATASET_ID, new RequestConstraint(
|
||||||
|
@ -955,10 +954,7 @@ public class FFMPUtils {
|
||||||
try {
|
try {
|
||||||
DbQueryResponse response = (DbQueryResponse) RequestRouter
|
DbQueryResponse response = (DbQueryResponse) RequestRouter
|
||||||
.route(request);
|
.route(request);
|
||||||
|
return response.getEntityObjects(GridRecord.class)[0].getDataURI();
|
||||||
for (Map<String, Object> map : response.getResults()) {
|
|
||||||
return (String) map.get("dataURI");
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.PrimaryKeyJoinColumn;
|
import javax.persistence.PrimaryKeyJoinColumn;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.UniqueConstraint;
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
||||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||||
|
@ -53,6 +54,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* May 21, 2012 bsteffen Initial creation
|
* May 21, 2012 bsteffen Initial creation
|
||||||
* Nov 25, 2013 2574 bsteffen Add converter to location dataURI
|
* Nov 25, 2013 2574 bsteffen Add converter to location dataURI
|
||||||
* annotation.
|
* annotation.
|
||||||
|
* Apr 15, 2014 2060 njensen Added unique constraint annotation
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -60,7 +62,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "grid_info")
|
@Table(name = "grid_info", uniqueConstraints = { @UniqueConstraint(columnNames = {
|
||||||
|
"datasetid", "secondaryid", "ensembleid", "location_id",
|
||||||
|
"parameter_abbreviation", "level_id" }) })
|
||||||
@SequenceGenerator(name = "GRIDINFO_GENERATOR", sequenceName = "gridinfo_seq", allocationSize = 1)
|
@SequenceGenerator(name = "GRIDINFO_GENERATOR", sequenceName = "gridinfo_seq", allocationSize = 1)
|
||||||
@DynamicSerialize
|
@DynamicSerialize
|
||||||
public class GridInfoRecord extends PersistableDataObject<Integer> {
|
public class GridInfoRecord extends PersistableDataObject<Integer> {
|
||||||
|
|
|
@ -22,9 +22,6 @@ package com.raytheon.uf.common.dataplugin.grid;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.persistence.Access;
|
|
||||||
import javax.persistence.AccessType;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.PrimaryKeyJoinColumn;
|
import javax.persistence.PrimaryKeyJoinColumn;
|
||||||
|
@ -68,6 +65,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* PluginDataObject.
|
* PluginDataObject.
|
||||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||||
* Dec 16, 2013 2574 bsteffen Remove getDecoderGettable.
|
* Dec 16, 2013 2574 bsteffen Remove getDecoderGettable.
|
||||||
|
* Apr 15, 2014 2060 njensen Remove dataURI column
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -76,7 +74,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "gridseq")
|
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "gridseq")
|
||||||
@Table(name = "grid", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
|
@Table(name = "grid", uniqueConstraints = { @UniqueConstraint(columnNames = {
|
||||||
|
"refTime", "forecastTime", "rangestart", "rangeend", "info_id" }) })
|
||||||
/*
|
/*
|
||||||
* Both refTime and forecastTime are included in the refTimeIndex since
|
* Both refTime and forecastTime are included in the refTimeIndex since
|
||||||
* forecastTime is unlikely to be used.
|
* forecastTime is unlikely to be used.
|
||||||
|
@ -254,13 +253,6 @@ public class GridRecord extends PersistablePluginDataObject implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Column
|
|
||||||
@Access(AccessType.PROPERTY)
|
|
||||||
public String getDataURI() {
|
|
||||||
return super.getDataURI();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPluginName() {
|
public String getPluginName() {
|
||||||
return "grid";
|
return "grid";
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**
|
||||||
|
* 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.database.plugin;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||||
|
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||||
|
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
|
||||||
|
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||||
|
import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utilities related to dataURIs and their corresponding database tables.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Apr 21, 2014 2060 njensen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author njensen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DataURIDatabaseUtil {
|
||||||
|
|
||||||
|
private DataURIDatabaseUtil() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for the existence in the database of a PluginDataObject that
|
||||||
|
* matches the argument. The check for existence is based on if the dataURI
|
||||||
|
* of the PluginDataObject matches.
|
||||||
|
*
|
||||||
|
* @param pdo
|
||||||
|
* the PluginDataObject to check to see if its equivalent dataURI
|
||||||
|
* is in the database
|
||||||
|
* @return true if a matching dataURI was found, false otherwise
|
||||||
|
* @throws PluginException
|
||||||
|
*/
|
||||||
|
public static boolean existingDataURI(PluginDataObject pdo)
|
||||||
|
throws PluginException {
|
||||||
|
PluginDao dao = PluginFactory.getInstance().getPluginDao(
|
||||||
|
pdo.getPluginName());
|
||||||
|
DatabaseQuery dbQuery = new DatabaseQuery(pdo.getClass());
|
||||||
|
Map<String, Object> dataUriFields = DataURIUtil.createDataURIMap(pdo);
|
||||||
|
for (Map.Entry<String, Object> field : dataUriFields.entrySet()) {
|
||||||
|
String fieldName = field.getKey();
|
||||||
|
// ignore pluginName
|
||||||
|
if (!PluginDataObject.PLUGIN_NAME_ID.equals(fieldName)) {
|
||||||
|
dbQuery.addQueryParam(field.getKey(), field.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<?> list = dao.queryByCriteria(dbQuery);
|
||||||
|
return (list != null && !list.isEmpty());
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
throw new PluginException("Error querying database", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -35,8 +35,7 @@ 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.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
import com.raytheon.uf.edex.database.plugin.DataURIDatabaseUtil;
|
||||||
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
|
||||||
import com.raytheon.uf.edex.datadelivery.retrieval.handlers.RetrievalRequestWrapper;
|
import com.raytheon.uf.edex.datadelivery.retrieval.handlers.RetrievalRequestWrapper;
|
||||||
import com.raytheon.uf.edex.datadelivery.retrieval.handlers.SubscriptionRetrievalRequestWrapper;
|
import com.raytheon.uf.edex.datadelivery.retrieval.handlers.SubscriptionRetrievalRequestWrapper;
|
||||||
|
|
||||||
|
@ -54,6 +53,7 @@ import com.raytheon.uf.edex.datadelivery.retrieval.handlers.SubscriptionRetrieva
|
||||||
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
||||||
* Dec 11, 2013 2625 mpduff Remove creation of DataURI.
|
* Dec 11, 2013 2625 mpduff Remove creation of DataURI.
|
||||||
* Jan 30, 2014 2686 dhladky refactor of retrieval.
|
* Jan 30, 2014 2686 dhladky refactor of retrieval.
|
||||||
|
* Apr 21, 2014 2060 njensen Remove dependency on grid dataURI column
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -65,31 +65,6 @@ public class RetrievalGeneratorUtilities {
|
||||||
private static final IUFStatusHandler statusHandler = UFStatus
|
private static final IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(RetrievalGeneratorUtilities.class);
|
.getHandler(RetrievalGeneratorUtilities.class);
|
||||||
|
|
||||||
/**
|
|
||||||
* Find duplicate URI's
|
|
||||||
*
|
|
||||||
* @param dataURI
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean findDuplicateUri(String dataUri, String plugin) {
|
|
||||||
|
|
||||||
boolean isDuplicate = false;
|
|
||||||
try {
|
|
||||||
String sql = "select id from " + plugin + " where datauri = '"
|
|
||||||
+ dataUri + "'";
|
|
||||||
|
|
||||||
CoreDao dao = new CoreDao(DaoConfig.forDatabase("metadata"));
|
|
||||||
Object[] results = dao.executeSQLQuery(sql);
|
|
||||||
if (results.length > 0) {
|
|
||||||
isDuplicate = true;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
statusHandler.error("Couldn't determine duplicate status! ", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return isDuplicate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the duplicate URI's for grid
|
* Find the duplicate URI's for grid
|
||||||
*
|
*
|
||||||
|
@ -116,13 +91,12 @@ public class RetrievalGeneratorUtilities {
|
||||||
for (Level level : levels) {
|
for (Level level : levels) {
|
||||||
for (String ensembleMember : ensembleMembers) {
|
for (String ensembleMember : ensembleMembers) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
GridRecord rec = ResponseProcessingUtilities
|
GridRecord rec = ResponseProcessingUtilities
|
||||||
.getGridRecord(name, parm, level,
|
.getGridRecord(name, parm, level,
|
||||||
ensembleMember, cov);
|
ensembleMember, cov);
|
||||||
rec.setDataTime(time);
|
rec.setDataTime(time);
|
||||||
boolean isDup = findDuplicateUri(rec.getDataURI(),
|
boolean isDup = DataURIDatabaseUtil
|
||||||
"grid");
|
.existingDataURI(rec);
|
||||||
if (isDup) {
|
if (isDup) {
|
||||||
levDups.add(level);
|
levDups.add(level);
|
||||||
}
|
}
|
||||||
|
@ -140,7 +114,7 @@ public class RetrievalGeneratorUtilities {
|
||||||
|
|
||||||
return dups;
|
return dups;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Drops Retrievals by subscription into a common queue for processing
|
* Drops Retrievals by subscription into a common queue for processing
|
||||||
|
@ -151,7 +125,7 @@ public class RetrievalGeneratorUtilities {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static void sendToRetrieval(String destinationUri, Network network,
|
public static void sendToRetrieval(String destinationUri, Network network,
|
||||||
Object[] payload) throws Exception{
|
Object[] payload) throws Exception {
|
||||||
|
|
||||||
if (payload != null) {
|
if (payload != null) {
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,10 @@ 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.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
|
||||||
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
|
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
|
||||||
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
|
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
|
||||||
import com.raytheon.uf.edex.database.cluster.ClusterTask;
|
import com.raytheon.uf.edex.database.cluster.ClusterTask;
|
||||||
|
import com.raytheon.uf.edex.database.plugin.DataURIDatabaseUtil;
|
||||||
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
||||||
import com.raytheon.uf.edex.grid.staticdata.topo.StaticTopoData;
|
import com.raytheon.uf.edex.grid.staticdata.topo.StaticTopoData;
|
||||||
import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
||||||
|
@ -68,10 +68,11 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Dec 3, 2010 rjpeter Initial creation
|
* Dec 3, 2010 rjpeter Initial creation
|
||||||
* Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin
|
* Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin
|
||||||
* Mar 07, 2013 1587 bsteffen rewrite static data generation.
|
* Mar 07, 2013 1587 bsteffen rewrite static data generation.
|
||||||
* Mar 14, 2013 1587 bsteffen Fix persisting to datastore.
|
* Mar 14, 2013 1587 bsteffen Fix persisting to datastore.
|
||||||
|
* Apr 21, 2014 2060 njensen Remove dependency on grid dataURI column
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -383,19 +384,19 @@ public class StaticDataGenerator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a set with only records which are not already in the database
|
* Return a set with only records which are not already in the database
|
||||||
|
*
|
||||||
|
* @throws PluginException
|
||||||
*/
|
*/
|
||||||
private Set<GridRecord> checkDatabase(GridDao dao,
|
private Set<GridRecord> checkDatabase(GridDao dao,
|
||||||
Set<GridRecord> staticRecords) throws DataAccessLayerException {
|
Set<GridRecord> staticRecords) throws PluginException {
|
||||||
if (staticRecords.isEmpty()) {
|
if (staticRecords.isEmpty()) {
|
||||||
return staticRecords;
|
return staticRecords;
|
||||||
}
|
}
|
||||||
Set<GridRecord> missing = new HashSet<GridRecord>();
|
Set<GridRecord> missing = new HashSet<GridRecord>();
|
||||||
for (GridRecord staticRecord : staticRecords) {
|
for (GridRecord staticRecord : staticRecords) {
|
||||||
// a possible future optimization would be to do one bulk query for
|
// TODO a possible future optimization would be to do one bulk query
|
||||||
// all records.
|
// for all records.
|
||||||
List<?> list = dao.queryBySingleCriteria("dataURI",
|
if (!DataURIDatabaseUtil.existingDataURI(staticRecord)) {
|
||||||
staticRecord.getDataURI());
|
|
||||||
if (list.isEmpty()) {
|
|
||||||
missing.add(staticRecord);
|
missing.add(staticRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* Jan 26, 2011 snaples Initial creation
|
* Jan 26, 2011 snaples Initial creation
|
||||||
* Jan 10, 2013 1448 bgonzale Added app context check in processArealQpe().
|
* Jan 10, 2013 1448 bgonzale Added app context check in processArealQpe().
|
||||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||||
|
* Apr 21, 2014 2060 njensen Remove dependency on grid dataURI column
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -152,11 +153,6 @@ public class ArealQpeGenSrv {
|
||||||
|
|
||||||
private Rectangle wfoExtent;
|
private Rectangle wfoExtent;
|
||||||
|
|
||||||
/**
|
|
||||||
* The reference time
|
|
||||||
*/
|
|
||||||
private Date grReftime = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The previous Duration
|
* The previous Duration
|
||||||
*/
|
*/
|
||||||
|
@ -588,7 +584,7 @@ public class ArealQpeGenSrv {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data URI
|
* Get the grid record
|
||||||
*
|
*
|
||||||
* @param rfc
|
* @param rfc
|
||||||
* The RFC
|
* The RFC
|
||||||
|
@ -599,13 +595,12 @@ public class ArealQpeGenSrv {
|
||||||
* @return The database uri, or null if no data
|
* @return The database uri, or null if no data
|
||||||
* @throws DataAccessLayerException
|
* @throws DataAccessLayerException
|
||||||
*/
|
*/
|
||||||
private String getDataURI(String rfc, String duration, String today)
|
private GridRecord getGridRecord(String rfc, String duration, String today)
|
||||||
throws DataAccessLayerException {
|
throws DataAccessLayerException {
|
||||||
String uri = null;
|
GridRecord rec = null;
|
||||||
|
|
||||||
// Query for uri
|
// Query for uri
|
||||||
DatabaseQuery query = new DatabaseQuery(GridRecord.class);
|
DatabaseQuery query = new DatabaseQuery(GridRecord.class);
|
||||||
query.addReturnedField("dataURI");
|
|
||||||
query.addQueryParam(GridConstants.DATASET_ID, "QPE-" + rfc);
|
query.addQueryParam(GridConstants.DATASET_ID, "QPE-" + rfc);
|
||||||
query.addQueryParam(GridConstants.PARAMETER_ABBREVIATION, "QPE"
|
query.addQueryParam(GridConstants.PARAMETER_ABBREVIATION, "QPE"
|
||||||
+ duration + "%", "like");
|
+ duration + "%", "like");
|
||||||
|
@ -615,13 +610,12 @@ public class ArealQpeGenSrv {
|
||||||
dao = new CoreDao(DaoConfig.forDatabase("metadata"));
|
dao = new CoreDao(DaoConfig.forDatabase("metadata"));
|
||||||
List<?> rs = dao.queryByCriteria(query);
|
List<?> rs = dao.queryByCriteria(query);
|
||||||
if ((rs != null) && (!rs.isEmpty())) {
|
if ((rs != null) && (!rs.isEmpty())) {
|
||||||
if ((rs.get(0) != null) && (rs.get(0) instanceof String)) {
|
Object result = rs.get(0);
|
||||||
uri = (String) rs.get(0);
|
if (result != null && result instanceof GridRecord) {
|
||||||
|
rec = ((GridRecord) result);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
uri = null;
|
|
||||||
}
|
}
|
||||||
return uri;
|
return rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -656,19 +650,13 @@ public class ArealQpeGenSrv {
|
||||||
IDataStore dataStore = null;
|
IDataStore dataStore = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
uri = getDataURI(rfc, durString, today);
|
GridRecord gr = getGridRecord(rfc, durString, today);
|
||||||
if (uri == null) {
|
if (gr == null) {
|
||||||
grReftime = cal.getTime();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GridRecord gr = new GridRecord(uri);
|
|
||||||
PluginDao gd = null;
|
PluginDao gd = null;
|
||||||
|
|
||||||
gd = PluginFactory.getInstance().getPluginDao(gr.getPluginName());
|
gd = PluginFactory.getInstance().getPluginDao(gr.getPluginName());
|
||||||
gr = (GridRecord) gd.getMetadata(uri);
|
|
||||||
grReftime = gr.getDataTime().getRefTime();
|
|
||||||
|
|
||||||
dataStore = gd.getDataStore(gr);
|
dataStore = gd.getDataStore(gr);
|
||||||
|
|
||||||
int nx = gr.getSpatialObject().getNx();
|
int nx = gr.getSpatialObject().getNx();
|
||||||
|
|
|
@ -65,6 +65,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* Sep 5, 2013 16437 wkwock Fix the "HiRes" issue
|
* Sep 5, 2013 16437 wkwock Fix the "HiRes" issue
|
||||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||||
* Apr 10, 2014 2675 mpduff Modified to be called from quartz timer.
|
* Apr 10, 2014 2675 mpduff Modified to be called from quartz timer.
|
||||||
|
* Apr 21, 2014 2060 njensen Remove dependency on grid dataURI column
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -263,7 +264,6 @@ public class GAFF {
|
||||||
.buildThreadLocalSimpleDateFormat("yyyy-MM-dd HH:mm:ss",
|
.buildThreadLocalSimpleDateFormat("yyyy-MM-dd HH:mm:ss",
|
||||||
TimeZone.getTimeZone("GMT"));
|
TimeZone.getTimeZone("GMT"));
|
||||||
String today = sdf.get().format(cal.getTime());
|
String today = sdf.get().format(cal.getTime());
|
||||||
String uri = null;
|
|
||||||
IDataRecord dataRec;
|
IDataRecord dataRec;
|
||||||
Rectangle rfcExtent = null;
|
Rectangle rfcExtent = null;
|
||||||
|
|
||||||
|
@ -307,22 +307,18 @@ public class GAFF {
|
||||||
IDataStore dataStore = null;
|
IDataStore dataStore = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
uri = db.getDataURI(rfc, durString, today);
|
GridRecord gr = db.getGridRecord(rfc, durString, today);
|
||||||
if (uri == null) {
|
if (gr == null) {
|
||||||
uri = db.getDataURI(rfc + "-HiRes", durString, today);
|
gr = db.getGridRecord(rfc + "-HiRes", durString, today);
|
||||||
}
|
}
|
||||||
if (uri == null) {
|
if (gr == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GridRecord gr = new GridRecord(uri);
|
|
||||||
PluginDao gd = null;
|
PluginDao gd = null;
|
||||||
|
|
||||||
gd = PluginFactory.getInstance().getPluginDao(
|
gd = PluginFactory.getInstance().getPluginDao(
|
||||||
gr.getPluginName());
|
gr.getPluginName());
|
||||||
gr = (GridRecord) gd.getMetadata(uri);
|
|
||||||
grReftime = gr.getDataTime().getRefTime();
|
grReftime = gr.getDataTime().getRefTime();
|
||||||
|
|
||||||
dataStore = gd.getDataStore(gr);
|
dataStore = gd.getDataStore(gr);
|
||||||
|
|
||||||
int nx = gr.getSpatialObject().getNx();
|
int nx = gr.getSpatialObject().getNx();
|
||||||
|
@ -341,7 +337,8 @@ public class GAFF {
|
||||||
(int) ulRfcNationalScale.y - ny, nx, ny);
|
(int) ulRfcNationalScale.y - ny, nx, ny);
|
||||||
extentsMap.put(rfc, rfcExtent);
|
extentsMap.put(rfc, rfcExtent);
|
||||||
|
|
||||||
dataRec = dataStore.retrieve(uri, "Data", Request.ALL);
|
dataRec = dataStore.retrieve(gr.getDataURI(), "Data",
|
||||||
|
Request.ALL);
|
||||||
|
|
||||||
if (dataRec instanceof FloatDataRecord) {
|
if (dataRec instanceof FloatDataRecord) {
|
||||||
gridMap.put(rfc, ((FloatDataRecord) dataRec).getFloatData());
|
gridMap.put(rfc, ((FloatDataRecord) dataRec).getFloatData());
|
||||||
|
|
|
@ -46,6 +46,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jan 11, 2011 mpduff Initial creation
|
* Jan 11, 2011 mpduff Initial creation
|
||||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||||
|
* Apr 21, 2014 2060 njensen Remove dependency on grid dataURI column
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -152,7 +153,7 @@ public class GAFFDB {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the data URI
|
* Get the grid record
|
||||||
*
|
*
|
||||||
* @param rfc
|
* @param rfc
|
||||||
* The RFC
|
* The RFC
|
||||||
|
@ -163,13 +164,10 @@ public class GAFFDB {
|
||||||
* @return The database uri, or null if no data
|
* @return The database uri, or null if no data
|
||||||
* @throws DataAccessLayerException
|
* @throws DataAccessLayerException
|
||||||
*/
|
*/
|
||||||
public String getDataURI(String rfc, String duration, String today)
|
public GridRecord getGridRecord(String rfc, String duration, String today)
|
||||||
throws DataAccessLayerException {
|
throws DataAccessLayerException {
|
||||||
String uri = null;
|
GridRecord rec = null;
|
||||||
|
|
||||||
// Query for uri
|
|
||||||
DatabaseQuery query = new DatabaseQuery(GridRecord.class);
|
DatabaseQuery query = new DatabaseQuery(GridRecord.class);
|
||||||
query.addReturnedField("dataURI");
|
|
||||||
query.addQueryParam(GridConstants.DATASET_ID, "FFG-" + rfc);
|
query.addQueryParam(GridConstants.DATASET_ID, "FFG-" + rfc);
|
||||||
query.addQueryParam(GridConstants.PARAMETER_ABBREVIATION, "FFG"
|
query.addQueryParam(GridConstants.PARAMETER_ABBREVIATION, "FFG"
|
||||||
+ duration + "24hr");
|
+ duration + "24hr");
|
||||||
|
@ -180,14 +178,13 @@ public class GAFFDB {
|
||||||
dao = new CoreDao(DaoConfig.forDatabase("metadata"));
|
dao = new CoreDao(DaoConfig.forDatabase("metadata"));
|
||||||
List<?> rs = dao.queryByCriteria(query);
|
List<?> rs = dao.queryByCriteria(query);
|
||||||
if ((rs != null) && (!rs.isEmpty())) {
|
if ((rs != null) && (!rs.isEmpty())) {
|
||||||
if ((rs.get(0) != null) && (rs.get(0) instanceof String)) {
|
Object result = rs.get(0);
|
||||||
uri = (String) rs.get(0);
|
if (result != null && result instanceof GridRecord) {
|
||||||
|
rec = ((GridRecord) result);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
uri = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return uri;
|
return rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue