コード例 #1
0
    @Override
    public Collection<Long> extractData(ResultSet rs) throws SQLException, DataAccessException {
      List<Long> goodIds = new ArrayList<>(rs.getFetchSize());

      while (rs.next()) {
        incGoodCount(/* article id */ rs.getLong(2), /* timestamp */ rs.getTimestamp(3).getTime());
        goodIds.add(/* good id*/ rs.getLong(1));
      }

      return goodIds;
    }
コード例 #2
0
  /**
   * This method queries the database to validate the passed in FRN for the selected Funding Year
   * has been invoiced or not
   *
   * @exception SQLException, if query fails
   * @author
   */
  public boolean checkFRNinv(String frn, String year) {
    String query;
    boolean validfrn = false;
    Statement stmt = null;
    ResultSet rs = null;

    USFEnv.getLog().writeCrit("RhccDinvview: FRN  Invoiced" + frn, this, null);
    USFEnv.getLog().writeCrit("RhccDinvview: FRN  Invoiced" + year, this, null);

    query = " SELECT DISTINCT rhcc_inv_id_fk ";
    query = query + " FROM wrk_ordr, wrk_ordr_dets, wo_det_hsties ";
    query = query + " WHERE wo_id = wo_id_fk ";
    query = query + " AND wod_id = wod_id_fk ";
    query = query + " AND wdh_stat = 'P' ";
    query = query + " AND inv_stat = 'I' ";
    query = query + " AND wrk_ordr_no ='" + frn + "' ";
    query = query + " AND wrk_ordr.yr_fk =" + year;

    USFEnv.getLog().writeCrit("RhccDinvview: FRN  Invoiced" + query, this, null);

    try {
      stmt = conn.createStatement();
      rs = stmt.executeQuery(query);
      USFEnv.getLog().writeCrit("RhccDinvview: FRN  Invoiced" + rs.getFetchSize(), this, null);
      if (rs.next()) {
        USFEnv.getLog()
            .writeCrit("RhccDinvview: FRN  Invoiced" + rs.getString("rhcc_inv_id_fk"), this, null);
        validfrn = true;
        if (rs != null) rs.close();
        if (stmt != null) stmt.close();
        return true;
      }
    } catch (SQLException ex) {
      USFEnv.getLog().writeCrit("RhccDinvview: FRN not Invoiced", this, ex);
      try {
        if (rs != null) rs.close();
        if (stmt != null) stmt.close();
      } catch (SQLException e) {
        USFEnv.getLog().writeCrit("Unable to close the resultset/statement", this, e);
      }
    }
    return false;
  }