liquibase.change.core
Class LoadDataChange

java.lang.Object
  extended by liquibase.change.AbstractChange
      extended by liquibase.change.core.LoadDataChange
All Implemented Interfaces:
Change, ChangeWithColumns<LoadDataColumnConfig>, LiquibaseSerializable
Direct Known Subclasses:
LoadUpdateDataChange

public class LoadDataChange
extends AbstractChange
implements ChangeWithColumns<LoadDataColumnConfig>


Nested Class Summary
 
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType
 
Field Summary
 
Fields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
 
Constructor Summary
LoadDataChange()
           
 
Method Summary
 void addColumn(LoadDataColumnConfig column)
          Add a column configuration to the Change.
 ChangeStatus checkStatus(Database database)
          Validate that this change executed successfully against the given database.
protected  InsertStatement createStatement(String catalogName, String schemaName, String tableName)
           
 CheckSum generateCheckSum()
          Implementation generates checksum by serializing the change with StringChangeLogSerializer
 boolean generateRollbackStatementsVolatile(Database database)
          Implementation delegates logic to the SqlGenerator.generateRollbackStatementsIsVolatile(Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database) If no or null SqlStatements are returned by generateRollbackStatements then this method returns false.
 SqlStatement[] generateStatements(Database database)
          Generates the SqlStatement objects required to run the change for the given database.
 boolean generateStatementsVolatile(Database database)
          Implementation delegates logic to the SqlGenerator.generateStatementsIsVolatile(Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database).
 String getCatalogName()
           
protected  ColumnConfig getColumnConfig(int index, String header)
           
 List<LoadDataColumnConfig> getColumns()
          Return all the ColumnConfig objects defined for this Change
 String getConfirmationMessage()
          Confirmation message to be displayed after the change is executed.
 CSVReader getCSVReader()
           
 String getEncoding()
           
 String getFile()
           
 String getQuotchar()
           
 String getSchemaName()
           
 String getSeparator()
           
 String getSerializedObjectNamespace()
           
 String getTableName()
           
 Boolean isRelativeToChangelogFile()
           
 void setCatalogName(String catalogName)
           
 void setColumns(List<LoadDataColumnConfig> columns)
           
 void setEncoding(String encoding)
           
 void setFile(String file)
           
 void setQuotchar(String quotchar)
           
 void setRelativeToChangelogFile(Boolean relativeToChangelogFile)
           
 void setSchemaName(String schemaName)
           
 void setSeparator(String separator)
           
 void setTableName(String tableName)
           
 boolean supports(Database database)
          Implementation delegates logic to the SqlGenerator.supports(liquibase.statement.SqlStatement, liquibase.database.Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database).
 Warnings warn(Database database)
          Implementation delegates logic to the SqlGenerator.warn(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database).
 
Methods inherited from class liquibase.change.AbstractChange
createChangeMetaData, createChangeParameterMetadata, createDescriptionMetaData, createExampleValueMetaData, createInverses, createMustEqualExistingMetaData, createRequiredDatabasesMetaData, createSerializationTypeMetaData, createSinceMetaData, createSupportedDatabasesMetaData, customLoadLogic, finishInitialization, generateRollbackStatements, getAffectedDatabaseObjects, getChangeSet, getResourceAccessor, getSerializableFieldNamespace, getSerializableFields, getSerializableFieldType, getSerializableFieldValue, getSerializedObjectName, isInvalidProperty, load, serialize, serializeValue, setChangeSet, setResourceAccessor, supportsRollback, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoadDataChange

public LoadDataChange()
Method Detail

supports

public boolean supports(Database database)
Description copied from class: AbstractChange
Implementation delegates logic to the SqlGenerator.supports(liquibase.statement.SqlStatement, liquibase.database.Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database). If no or null SqlStatements are returned by generateStatements then this method returns true. If AbstractChange.generateStatementsVolatile(liquibase.database.Database) returns true, we cannot call generateStatements and so assume true.

Specified by:
supports in interface Change
Overrides:
supports in class AbstractChange

generateRollbackStatementsVolatile

public boolean generateRollbackStatementsVolatile(Database database)
Description copied from class: AbstractChange
Implementation delegates logic to the SqlGenerator.generateRollbackStatementsIsVolatile(Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database) If no or null SqlStatements are returned by generateRollbackStatements then this method returns false.

Specified by:
generateRollbackStatementsVolatile in interface Change
Overrides:
generateRollbackStatementsVolatile in class AbstractChange

getCatalogName

public String getCatalogName()

setCatalogName

public void setCatalogName(String catalogName)

getSchemaName

public String getSchemaName()

setSchemaName

public void setSchemaName(String schemaName)

getTableName

public String getTableName()

setTableName

public void setTableName(String tableName)

getFile

public String getFile()

setFile

public void setFile(String file)

isRelativeToChangelogFile

public Boolean isRelativeToChangelogFile()

setRelativeToChangelogFile

public void setRelativeToChangelogFile(Boolean relativeToChangelogFile)

getEncoding

public String getEncoding()

setEncoding

public void setEncoding(String encoding)

getSeparator

public String getSeparator()

setSeparator

public void setSeparator(String separator)

getQuotchar

public String getQuotchar()

setQuotchar

public void setQuotchar(String quotchar)

addColumn

public void addColumn(LoadDataColumnConfig column)
Description copied from interface: ChangeWithColumns
Add a column configuration to the Change.

Specified by:
addColumn in interface ChangeWithColumns<LoadDataColumnConfig>

getColumns

public List<LoadDataColumnConfig> getColumns()
Description copied from interface: ChangeWithColumns
Return all the ColumnConfig objects defined for this Change

Specified by:
getColumns in interface ChangeWithColumns<LoadDataColumnConfig>

setColumns

public void setColumns(List<LoadDataColumnConfig> columns)
Specified by:
setColumns in interface ChangeWithColumns<LoadDataColumnConfig>

generateStatements

public SqlStatement[] generateStatements(Database database)
Description copied from interface: Change
Generates the SqlStatement objects required to run the change for the given database.

NOTE: This method may be called multiple times throughout the changelog execution process and may be called in documentation generation and other integration points as well.

If this method reads from the current database state or uses any other logic that will be affected by whether previous changeSets have ran or not, you must return true from Change.generateStatementsVolatile(liquibase.database.Database).

Specified by:
generateStatements in interface Change

generateStatementsVolatile

public boolean generateStatementsVolatile(Database database)
Description copied from class: AbstractChange
Implementation delegates logic to the SqlGenerator.generateStatementsIsVolatile(Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database). If zero or null SqlStatements are returned by generateStatements then this method returns false.

Specified by:
generateStatementsVolatile in interface Change
Overrides:
generateStatementsVolatile in class AbstractChange

getCSVReader

public CSVReader getCSVReader()
                       throws IOException
Throws:
IOException

createStatement

protected InsertStatement createStatement(String catalogName,
                                          String schemaName,
                                          String tableName)

getColumnConfig

protected ColumnConfig getColumnConfig(int index,
                                       String header)

checkStatus

public ChangeStatus checkStatus(Database database)
Description copied from interface: Change
Validate that this change executed successfully against the given database. This will check that the update completed at a high level plus check details of the change. For example, a change to add a column will check that the column exists plus data type, default values, etc.

Specified by:
checkStatus in interface Change
Overrides:
checkStatus in class AbstractChange

getConfirmationMessage

public String getConfirmationMessage()
Description copied from interface: Change
Confirmation message to be displayed after the change is executed. Should include relevant configuration settings to make it as helpful as possible. This method may be called outside the changelog execution process, such as in documentation generation.

Specified by:
getConfirmationMessage in interface Change

generateCheckSum

public CheckSum generateCheckSum()
Description copied from class: AbstractChange
Implementation generates checksum by serializing the change with StringChangeLogSerializer

Specified by:
generateCheckSum in interface Change
Overrides:
generateCheckSum in class AbstractChange

warn

public Warnings warn(Database database)
Description copied from class: AbstractChange
Implementation delegates logic to the SqlGenerator.warn(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database). If a generated statement is not supported for the given database, no warning will be added since that is a validation error. If no or null SqlStatements are returned by generateStatements then this method returns no warnings.

Specified by:
warn in interface Change
Overrides:
warn in class AbstractChange

getSerializedObjectNamespace

public String getSerializedObjectNamespace()
Specified by:
getSerializedObjectNamespace in interface LiquibaseSerializable
Overrides:
getSerializedObjectNamespace in class AbstractChange


Copyright © 2014 Liquibase.org. All rights reserved.