View Javadoc

1   /*
2    * Copyright 2007 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in
5    * compliance with the License. You may obtain a copy of the License at
6    * 
7    * http://www.opensource.org/licenses/ecl2.php
8    * 
9    * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS
10   * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
11   * language governing permissions and limitations under the License.
12   */
13  package org.kuali.rice.kns.dao.jdbc;
14  
15  import org.apache.log4j.Logger;
16  import org.kuali.rice.kns.dao.PostDataLoadEncryptionDao;
17  
18  public class PostDataLoadEncryptionDaoJdbc extends PlatformAwareDaoBaseJdbc implements PostDataLoadEncryptionDao {
19      private static final Logger LOG = Logger.getLogger(PostDataLoadEncryptionDaoJdbc.class);
20  
21      private void executeSql(String sql) {
22  	LOG.info("Executing sql: " + sql);
23  	getJdbcTemplate().execute(sql);
24      }
25  
26      public void createBackupTable(String tableName) {
27  	executeSql(getDbPlatform().getCreateTableFromTableSql(tableName + "_bak", tableName));
28      }
29  
30      public void truncateTable(String tableName) {
31  	executeSql(getDbPlatform().getTruncateTableSql(tableName));
32      }
33  
34      public void restoreTableFromBackup(String tableName) {
35  	truncateTable(tableName);
36  	executeSql(getDbPlatform().getInsertDataFromTableSql(tableName, tableName + "_bak"));
37      }
38  
39      public void dropBackupTable(String tableName) {
40  	executeSql(getDbPlatform().getDropTableSql(tableName + "_bak"));
41      }
42  }