本文整理汇总了Java中liquibase.exception.ValidationErrors类的典型用法代码示例。如果您正苦于以下问题:Java ValidationErrors类的具体用法?Java ValidationErrors怎么用?Java ValidationErrors使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValidationErrors类属于liquibase.exception包,在下文中一共展示了ValidationErrors类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
@Override
public ValidationErrors validate(DropColumnStatement dropColumnStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
if (dropColumnStatement.isMultiple()) {
ValidationErrors validationErrors = new ValidationErrors();
DropColumnStatement firstColumn = dropColumnStatement.getColumns().get(0);
for (DropColumnStatement drop : dropColumnStatement.getColumns()) {
validationErrors.addAll(validateSingleColumn(drop));
if (drop.getTableName() != null && !drop.getTableName().equals(firstColumn.getTableName())) {
validationErrors.addError("All columns must be targeted at the same table");
}
if (drop.isMultiple()) {
validationErrors.addError("Nested multiple drop column statements are not supported");
}
}
return validationErrors;
} else {
return validateSingleColumn(dropColumnStatement);
}
}
示例2: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
public ValidationErrors validate(SetNullableStatement setNullableStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("tableName", setNullableStatement.getTableName());
validationErrors.checkRequiredField("columnName", setNullableStatement.getColumnName());
if (database instanceof MSSQLDatabase || database instanceof MySQLDatabase || database instanceof InformixDatabase || database instanceof H2Database) {
validationErrors.checkRequiredField("columnDataType", setNullableStatement.getColumnDataType());
}
try {
if ((database instanceof DB2Database) && (database.getDatabaseMajorVersion() < 9)) {
validationErrors.addError("DB2 versions less than 9 do not support modifying null constraints");
}
} catch (DatabaseException ignore) {
//cannot check
}
return validationErrors;
}
示例3: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
@Override
public ValidationErrors validate(final AddColumnStatement statement,
final Database database, final SqlGeneratorChain sqlGeneratorChain) {
final ValidationErrors errors = new ValidationErrors();
final LiquibaseDataType dataType = DataTypeFactory.getInstance()
.fromDescription(statement.getColumnType(), database);
// Ensure that the SRID parameter is provided.
if (dataType instanceof GeometryType) {
final GeometryType geometryType = (GeometryType) dataType;
if (geometryType.getSRID() == null) {
errors.addError("The SRID parameter is required on the geometry type");
}
}
final ValidationErrors chainErrors = sqlGeneratorChain.validate(
statement, database);
if (chainErrors != null) {
errors.addAll(chainErrors);
}
return errors;
}
示例4: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
public ValidationErrors validate(Database database) {
ValidationErrors changeValidationErrors = new ValidationErrors();
for (SqlStatement statement : generateStatements(database)) {
boolean supported = SqlGeneratorFactory.getInstance().supports(statement, database);
if (!supported) {
if (statement.skipOnUnsupported()) {
LogFactory.getLogger().info(getChangeMetaData().getName()+" is not supported on "+database.getTypeName()+" but will continue");
} else {
changeValidationErrors.addError(getChangeMetaData().getName()+" is not supported on "+database.getTypeName());
}
} else {
changeValidationErrors.addAll(SqlGeneratorFactory.getInstance().validate(statement, database));
}
}
return changeValidationErrors;
}
示例5: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
@Override
public ValidationErrors validate(HiveInsertStatement insertStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("tableName", insertStatement.getTableName());
validationErrors.checkRequiredField("columns", insertStatement.getColumnValues());
return validationErrors;
}
示例6: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
@Override
public ValidationErrors validate(MarkChangeSetRanStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("changeSet", statement.getChangeSet());
return validationErrors;
}
示例7: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
@Override
public ValidationErrors validate(RenameTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors errors = new ValidationErrors();
errors.checkRequiredField("newTableName", statement.getNewTableName());
errors.checkRequiredField("oldTableName", statement.getOldTableName());
return errors;
}
示例8: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
@Override
public ValidationErrors validate(SetStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors errors = new ValidationErrors();
errors.checkRequiredField("queryOption", statement.getQueryOption());
errors.checkRequiredField("optionValue", statement.getOptionValue());
return errors;
}
示例9: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
@Override
public ValidationErrors validate(InsertAsSelectStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors errors = new ValidationErrors();
errors.checkRequiredField("tableName", statement.getTableName());
errors.checkRequiredField("dstTableName", statement.getDestTableName());
return errors;
}
示例10: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
public ValidationErrors validate(SqlStatement statement, Database database) {
if (sqlGenerators == null || !sqlGenerators.hasNext()) {
return new ValidationErrors();
}
return sqlGenerators.next().validate(statement, database, this);
}
示例11: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
public ValidationErrors validate(final SetSequenceStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("sequenceName", statement.getSequenceName());
if (statement.getValue() == null) {
validationErrors.checkRequiredField("tables", statement.getTables());
} else {
if (statement.getTables().size() > 0) {
LogFactory.getLogger().warning("You have set the sequence to a specific value, but have also provided tables to use for inferring the value. Using the specific value.");
}
}
return validationErrors;
}
示例12: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
@Override
public ValidationErrors validate(final Database database) {
final ValidationErrors errors = new ValidationErrors();
if (!(database instanceof DerbyDatabase || database instanceof H2Database
|| database instanceof MySQLDatabase || database instanceof OracleDatabase || database instanceof PostgresDatabase)) {
errors.addError(database.getDatabaseProductName() + " is not supported by this extension");
}
return errors;
}
示例13: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
public ValidationErrors validate(CreateViewStatement createViewStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("viewName", createViewStatement.getViewName());
validationErrors.checkRequiredField("selectQuery", createViewStatement.getSelectQuery());
if (createViewStatement.isReplaceIfExists()) {
validationErrors.checkDisallowedField("replaceIfExists", createViewStatement.isReplaceIfExists(), database, HsqlDatabase.class, H2Database.class, DB2Database.class, CacheDatabase.class, MSSQLDatabase.class, DerbyDatabase.class, SybaseASADatabase.class, InformixDatabase.class);
}
return validationErrors;
}
示例14: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
public ValidationErrors validate(InsertOrUpdateStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
validationErrors.checkRequiredField("tableName", statement.getTableName());
validationErrors.checkRequiredField("columns", statement.getColumnValues());
validationErrors.checkRequiredField("primaryKey", statement.getPrimaryKey());
return validationErrors;
}
示例15: validate
import liquibase.exception.ValidationErrors; //导入依赖的package包/类
public ValidationErrors validate(AddForeignKeyConstraintStatement addForeignKeyConstraintStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ValidationErrors validationErrors = new ValidationErrors();
if ((addForeignKeyConstraintStatement.isInitiallyDeferred() || addForeignKeyConstraintStatement.isDeferrable()) && !database.supportsInitiallyDeferrableColumns()) {
validationErrors.checkDisallowedField("initiallyDeferred", addForeignKeyConstraintStatement.isInitiallyDeferred(), database);
validationErrors.checkDisallowedField("deferrable", addForeignKeyConstraintStatement.isDeferrable(), database);
}
validationErrors.checkRequiredField("baseColumnNames", addForeignKeyConstraintStatement.getBaseColumnNames());
validationErrors.checkRequiredField("baseTableNames", addForeignKeyConstraintStatement.getBaseTableName());
validationErrors.checkRequiredField("referencedColumnNames", addForeignKeyConstraintStatement.getReferencedColumnNames());
validationErrors.checkRequiredField("referencedTableName", addForeignKeyConstraintStatement.getReferencedTableName());
return validationErrors;
}