01: /*
02: * Copyright 2007 The Kuali Foundation
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License"); you may not use this file except in
05: * compliance with the License. You may obtain a copy of the License at
06: *
07: * http://www.opensource.org/licenses/ecl1.php
08: *
09: * 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.core.dao.jdbc;
14:
15: import org.apache.log4j.Logger;
16: import org.kuali.core.dao.PostDataLoadEncryptionDao;
17:
18: public class PostDataLoadEncryptionDaoJdbc extends
19: PlatformAwareDaoBaseJdbc implements PostDataLoadEncryptionDao {
20: private static final Logger LOG = Logger
21: .getLogger(PostDataLoadEncryptionDaoJdbc.class);
22:
23: private void executeSql(String sql) {
24: LOG.info("Executing sql: " + sql);
25: getJdbcTemplate().execute(sql);
26: }
27:
28: public void createBackupTable(String tableName) {
29: executeSql(getDbPlatform().getCreateTableFromTableSql(
30: tableName + "_bak", tableName));
31: }
32:
33: public void truncateTable(String tableName) {
34: executeSql(getDbPlatform().getTruncateTableSql(tableName));
35: }
36:
37: public void restoreTableFromBackup(String tableName) {
38: truncateTable(tableName);
39: executeSql(getDbPlatform().getInsertDataFromTableSql(tableName,
40: tableName + "_bak"));
41: }
42:
43: public void dropBackupTable(String tableName) {
44: executeSql(getDbPlatform().getDropTableSql(tableName + "_bak"));
45: }
46: }
|