awips2/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/SfcObsDao.java
2022-05-05 12:34:50 -05:00

111 lines
3.2 KiB
Java

/**
* 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.edex.plugin.sfcobs;
import java.util.List;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.sfcobs.ObsCommon;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
/**
* Set of DAO methods for Surface Observation data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20071102 391 jkorman Initial Coding.
* 20071107 391 jkorman Added queryDataUriColumn to query on
* dataURI column only.
* 20091001 3131 jkorman Conversion to use PointData repository.
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class SfcObsDao extends PointDataPluginDao<ObsCommon> {
/**
* Creates a new ObsStationDao
* @throws PluginException
*/
public SfcObsDao(String pluginName) throws PluginException {
super(pluginName);
}
/**
* Retrieves an sfcobs report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public ObsCommon queryByDataURI(String dataURI) {
ObsCommon report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if ((obs != null) && (obs.size() > 0)) {
report = (ObsCommon) obs.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the sfcobs table.
*
* @param dataUri
* The DataURI to find.
* @return An array of objects. If not null, there should only be a single
* element.
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.sfcobs where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
return results;
}
@Override
public String[] getKeysRequiredForFileName() {
return new String[] { "dataTime.refTime","reportType" };
}
@Override
public String getPointDataFileName(ObsCommon p) {
return "sfcobs.h5";
}
@Override
public ObsCommon newObject() {
return new ObsCommon();
}
}