public class LiquibaseStatementsWriter extends AbstractStatementsWriter
AbstractStatementsWriter.AbstractTableStatement, AbstractStatementsWriter.InsertStatement, AbstractStatementsWriter.PlainStatement, AbstractStatementsWriter.UpdateStatement| Modifier and Type | Field and Description |
|---|---|
static String |
OUTPUT_FILE_KEY
Settings key for the generated XML file, if not given in the constructor. |
static String |
VERSION_KEY
Settings key for the generated liquibase version, if not given in the
constructor. |
| Constructor and Description |
|---|
LiquibaseStatementsWriter(GeneratorContext context)
Creates a new writer which generates an XML file with "UTF-8" encoding.
|
LiquibaseStatementsWriter(OutputStream outputStream,
String version)
Creates a new writer which generates an XML file with "UTF-8" encoding.
|
LiquibaseStatementsWriter(XMLStreamWriter writer,
String version)
Creates a new instance of
LiquibaseStatementsWriter. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Writes the remaining elements.
|
void |
flush()
Flushes any open statements.
|
String |
getChangeSetAuthour()
The author of the next created change set.
|
String |
getChangeSetComment()
The comment of the next created change set.
|
String |
getChangeSetId()
The ID of the next created change set.
|
XMLStreamWriter |
getWriter()
The receiver of our XML elements.
|
boolean |
isChangeSetStarted()
Indicates if we are currently in a changeSet.
|
boolean |
isRelativeDatesSupported()
Indicates if our liquibase version supports relative dates.
|
void |
startNextChangeSet(String id,
String author,
String comment)
Closes the current change set (if any was started) and sets the infos of the next change set.
|
void |
writeComment(String comment)
Writes a SQL comment to the target.
|
void |
writePlainStatement(GeneratorDialect dialect,
String sql)
Writes a plain SQL statement.
|
void |
writeSectionSeparator()
Writes a new line to the target file to separate different sections in the SQL file.
|
void |
writeStatement(EntityStatement statement)
Writes the given statement to a file or database.
|
createInsertStatement, createPlainStatement, createUpdateStatementclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittruncateTablespublic static final String OUTPUT_FILE_KEY
Settings key for the generated XML file, if not given in the constructor.public static final String VERSION_KEY
Settings key for the generated liquibase version, if not given in the
constructor.public LiquibaseStatementsWriter(GeneratorContext context) throws XMLStreamException, FileNotFoundException
context - contains all the settings that we need to build the fileXMLStreamException - if already the root element could not be createdFileNotFoundException - if the parent directory does not existpublic LiquibaseStatementsWriter(OutputStream outputStream, String version) throws XMLStreamException
outputStream - the target stream, will be close when this wirter is closedversion - the liquibase version - this is only for the referenced schema and won't change anything elseXMLStreamException - if already the root element could not be createdpublic LiquibaseStatementsWriter(XMLStreamWriter writer, String version) throws XMLStreamException
LiquibaseStatementsWriter.writer - the stream writer for generating the XMLversion - the liquibase version - this is only for the referenced schema and won't change anything elseXMLStreamException - if already the root element could not be createdpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class AbstractStatementsWriterIOExceptionpublic void flush()
throws IOException
StatementsWriterflush in interface StatementsWriterflush in class AbstractStatementsWriterIOException - if the target throws an exceptionpublic void startNextChangeSet(String id, String author, String comment) throws XMLStreamException
id - the ID of the next change setauthor - the author of the next change setcomment - the (optional) comment of the next change setXMLStreamException - if there is an error during closing the current change setpublic void writeComment(String comment) throws IOException
StatementsWriterwriteComment in interface StatementsWriterwriteComment in class AbstractStatementsWritercomment - the comment to writeIOException - if the target throws an exceptionpublic void writePlainStatement(GeneratorDialect dialect, String sql) throws IOException
StatementsWriterwriteStatement(createPlainStatement(sql), dialect).dialect - the current database dialectsql - the content of the SQL statementIOException - if the file or database throws an exceptionpublic void writeSectionSeparator()
throws IOException
StatementsWriterwriteSectionSeparator in interface StatementsWriterwriteSectionSeparator in class AbstractStatementsWriterIOException - if the target throws such an exceptionpublic void writeStatement(EntityStatement statement) throws IOException
StatementsWriterstatement - contains the values to writeIOException - if the file or database throws an exception@Generated(value="lombok") public XMLStreamWriter getWriter()
@Generated(value="lombok") public boolean isRelativeDatesSupported()
@Generated(value="lombok") public String getChangeSetId()
@Generated(value="lombok") public String getChangeSetAuthour()
@Generated(value="lombok") public String getChangeSetComment()
@Generated(value="lombok") public boolean isChangeSetStarted()
Copyright © 2020 fastnate.org. All rights reserved.