Coverage Report - uk.ac.ebi.intenz.mapper.AuditPackageMapper
 
Classes in this File Line Coverage Branch Coverage Complexity
AuditPackageMapper
100%
12/12
100%
2/2
1.333
 
 1  
 package uk.ac.ebi.intenz.mapper;
 2  
 
 3  
 import java.sql.CallableStatement;
 4  
 import java.sql.Connection;
 5  
 import java.sql.SQLException;
 6  
 import java.sql.Types;
 7  
 
 8  
 /**
 9  
  * Provides methods for audit package access.
 10  
  *
 11  
  * @author Michael Darsow
 12  
  * @version $Revision: 1.2 $ $Date: 2008/01/28 12:33:07 $
 13  
  */
 14  
 public class AuditPackageMapper {
 15  
 
 16  
   public static final String STANDARD_REMARK = "Update by web application.";
 17  
 
 18  1
   public AuditPackageMapper() {
 19  1
   }
 20  
 
 21  
   private String callStatement() {
 22  2
     return "{CALL enzyme.auditpackage.setremark(?)}";
 23  
   }
 24  
 
 25  
   /**
 26  
    * Sets a remark in the audit tables.
 27  
    *
 28  
    * @param remark Remark to be stored in the audit tables.
 29  
    * @param con    The connection.
 30  
    * @throws SQLException
 31  
    */
 32  
   public void setRemark(String remark, Connection con) throws SQLException {
 33  2
     CallableStatement cStmt = null;
 34  
 
 35  
     try {
 36  2
       cStmt = con.prepareCall(callStatement());
 37  2
       if (remark == null){
 38  1
               cStmt.setNull(1, Types.VARCHAR);
 39  
       } else {
 40  1
               cStmt.setString(1, remark);
 41  
       }
 42  2
       cStmt.executeUpdate();
 43  
     } finally {
 44  2
       cStmt.close();
 45  2
     }
 46  2
   }
 47  
 
 48  
 }