1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.jdbc.convert;
17
18 import java.io.File;
19 import java.util.List;
20
21
22
23
24
25
26
27 public class ReplaceWithConvertedProcessor implements PostConversionProcessor {
28 @Override
29 public void process(List<ConversionResult> conversionResults) {
30 for (ConversionResult result : conversionResults) {
31 if (!result.getOldFile().delete()) {
32 throw new IllegalStateException("Unable to delete file " + result.getOldFile().getAbsolutePath());
33 }
34
35 String newFilePath = result.getNewFile().getAbsolutePath().replace(DirectoryConverter.CONVERTED_EXTENSION, "");
36
37 if (!result.getNewFile().renameTo(new File(newFilePath))) {
38 throw new IllegalStateException("Unable to rename file " + result.getNewFile().getAbsolutePath());
39 }
40 }
41 }
42 }