All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.dbdoc.HTMLListWriter Maven / Gradle / Ivy

There is a newer version: 3.6.2.5.inovus
Show newest version
package liquibase.dbdoc;

import liquibase.configuration.GlobalConfiguration;
import liquibase.configuration.LiquibaseConfiguration;
import liquibase.util.StringUtils;

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)), LiquibaseConfiguration.getInstance().getConfiguration(GlobalConfiguration.class).getOutputEncoding());

        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" + "\n" + "\n" + "
"); for (Object object : objects) { fileWriter.append(""); fileWriter.append(StringUtils.escapeHtml(object.toString())); fileWriter.append("
\n"); } fileWriter.append("
\n" + "\n" + "\n" + ""); } finally { fileWriter.close(); } } public String getTargetExtension() { return ".html"; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy