Coverage Report - net.sourceforge.addam.ddlrun.custom.IDSStartFolderRetriever
 
Classes in this File Line Coverage Branch Coverage Complexity
IDSStartFolderRetriever
0%
0/14
0%
0/1
3
 
 1  
 /*
 2  
  * Copyright (c) 2004 International Decision Systems, Inc.  All Rights Reserved.
 3  
  *
 4  
  * By using this Software, You acknowledge that the Software is a valuable asset
 5  
  * and trade secret of either International Decision Systems, Inc. ("IDSI") or a
 6  
  * third party supplier of IDSI and constitutes confidential and proprietary
 7  
  * information.
 8  
  *
 9  
  * NEITHER IDSI NOR ANY AGENT OR PERSON ACTING FOR OR WITH IDSI HAS MADE OR DOES
 10  
  * MAKE ANY STATEMENTS, AFFIRMATIONS, REPRESENTATIONS OR WARRANTIES WHATSOEVER
 11  
  * TO YOU, WHETHER EXPRESS OR IMPLIED, AS TO THE SOFTWARE, THE QUALITY OR
 12  
  * CONDITION OF THE SOFTWARE, OR THE OPERATING CHARACTERISTICS OR RELIABILITY OF
 13  
  * THE SOFTWARE, OR ITS SUITABILITY FOR ANY GENERAL OR PARTICULAR PURPOSE, OR AS
 14  
  * TO ANY OTHER MATTER WHATSOEVER; ANY AND ALL OTHER WARRANTIES INCLUDING
 15  
  * WITHOUT LIMITATION ANY WARRANTIES IMPLIED BY LAW, SUCH AS THE IMPLIED
 16  
  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND TITLE,
 17  
  * USE AND NON-INFRINGEMENT; ARE HEREBY EXPRESSLY DISCLAIMED AND EXCLUDED.
 18  
 */
 19  
 package net.sourceforge.addam.ddlrun.custom;
 20  
 
 21  
 
 22  
 import java.sql.Connection;
 23  
 import java.sql.PreparedStatement;
 24  
 import java.sql.ResultSet;
 25  
 import java.sql.SQLException;
 26  
 
 27  
 import net.sourceforge.addam.ddlrun.utils.StartFolderRetriever;
 28  
 
 29  
 /**
 30  
  * ENTER A DESCRIPTION HERE
 31  
  *
 32  
  * @author TIM3
 33  
  * @since Sep 16, 2005
 34  
  * @todo make folder SQL configurable
 35  
  */
 36  
 public class IDSStartFolderRetriever implements StartFolderRetriever {
 37  
 
 38  
     // todo make this configurable
 39  
     public static final String GET_START_FOLDER_SQL = "SELECT VRS_START_FOLDER FROM VERSION WHERE VRS_TYPE='PF'";
 40  
 
 41  0
     public IDSStartFolderRetriever(Connection conn) {
 42  0
         this.connection = conn;
 43  0
     }
 44  
 
 45  
     public String getStartFolder() {
 46  0
         PreparedStatement versionStatement = null;
 47  
         String version;
 48  
         try {
 49  0
             versionStatement = connection.prepareStatement(GET_START_FOLDER_SQL);
 50  0
             ResultSet results = versionStatement.executeQuery();
 51  0
             if (results.next()) {
 52  0
                 version = results.getString(1);
 53  0
             } else {
 54  0
                 throw new SQLException("no results returned for " + GET_START_FOLDER_SQL);
 55  
             }
 56  0
         } catch (SQLException e) {
 57  0
             throw new RuntimeException("unable to retrieve start folder", e);
 58  0
         }
 59  0
         return version;
 60  
     }
 61  
 
 62  
     private final Connection connection;
 63  
 }