liquibase.dbdoc.HTMLListWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
package liquibase.dbdoc;
import liquibase.GlobalConfiguration;
import liquibase.util.StringUtil;
import java.io.*;
import java.util.SortedSet;
public class HTMLListWriter {
private File outputDir;
private String directory;
private String filename;
private String title;
public HTMLListWriter(String title, String filename, String subdir, File outputDir) {
this.title = title;
this.outputDir = outputDir;
this.filename = filename;
if (!outputDir.exists()) {
outputDir.mkdir();
}
this.directory = subdir;
}
public void writeHTML(SortedSet objects) throws IOException {
Writer fileWriter = new OutputStreamWriter(new FileOutputStream(new File(outputDir, filename)), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue());
try {
fileWriter.append("\n" + "\n" + "\n");
fileWriter.append(title);
fileWriter.append("\n" + " \n" + "\n" + "\n" + "\n" + "\n" + "");
fileWriter.append(title);
fileWriter.append("\n" + "
\n" + "" + "\n" + "");
for (Object object : objects) {
fileWriter.append("");
fileWriter.append(StringUtil.escapeHtml(object.toString()));
fileWriter.append("
\n");
}
fileWriter.append(" \n" +
" \n" +
"
\n" +
"\n" +
"\n" +
"");
} finally {
fileWriter.close();
}
}
public String getTargetExtension() {
return ".html";
}
}