Search in sources :

Example 6 with CommandResult

use of liquibase.command.CommandResult in project liquibase by liquibase.

the class GenerateChangeLogCommand method run.

@Override
protected CommandResult run() throws Exception {
    DiffResult diffResult = createDiffResult();
    DiffToChangeLog changeLogWriter = new DiffToChangeLog(diffResult, getDiffOutputControl());
    changeLogWriter.setChangeSetAuthor(author);
    changeLogWriter.setChangeSetContext(context);
    changeLogWriter.setChangeSetPath(getChangeLogFile());
    if (StringUtils.trimToNull(getChangeLogFile()) != null) {
        changeLogWriter.print(getChangeLogFile());
    } else {
        PrintStream outputStream = getOutputStream();
        if (outputStream == null) {
            outputStream = System.out;
        }
        changeLogWriter.print(outputStream);
    }
    return new CommandResult("OK");
}
Also used : PrintStream(java.io.PrintStream) DiffToChangeLog(liquibase.diff.output.changelog.DiffToChangeLog) DiffResult(liquibase.diff.DiffResult) CommandResult(liquibase.command.CommandResult)

Aggregations

CommandResult (liquibase.command.CommandResult)6 DiffResult (liquibase.diff.DiffResult)3 File (java.io.File)2 PrintStream (java.io.PrintStream)2 LiquibaseException (liquibase.exception.LiquibaseException)2 FileOutputStream (java.io.FileOutputStream)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 CatalogAndSchema (liquibase.CatalogAndSchema)1 Contexts (liquibase.Contexts)1 LabelExpression (liquibase.LabelExpression)1 ChangeLogParameters (liquibase.changelog.ChangeLogParameters)1 DatabaseChangeLog (liquibase.changelog.DatabaseChangeLog)1 DiffToChangeLog (liquibase.diff.output.changelog.DiffToChangeLog)1 DiffToReport (liquibase.diff.output.report.DiffToReport)1 DatabaseException (liquibase.exception.DatabaseException)1 Executor (liquibase.executor.Executor)1 ChangeLogParser (liquibase.parser.ChangeLogParser)1 ClassLoaderResourceAccessor (liquibase.resource.ClassLoaderResourceAccessor)1