ValidateStreamData.java [src/java/svap/utils] Revision: default  Date:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package svap.utils;

import csip.ServiceException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
 */
public class ValidateStreamData {

  Connection conn;


  ValidateStreamData(Connection conn) {
    this.conn = conn;
  }


  private boolean validateStreamId(int sId) throws ServiceException {
    try (PreparedStatement statement = conn.prepareStatement(DBQueries.SVAP7aQuery01())) {
      statement.setInt(1, sId);
      ResultSet resultSet = statement.executeQuery();
      if (!resultSet.next()) {
        return false;
      }
    } catch (SQLException ex) {
      throw new ServiceException("Unable to validate stream reference id.  Database error: " + ex.getMessage(), ex);
    }
    return true;
  }
}