liquibase.exception.ValidationErrors Java Examples

The following examples show how to use liquibase.exception.ValidationErrors. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: liquibase-impala   Author: eselyavka   File: HiveDropColumnGenerator.java    License: Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example #2
Source Project: liquibase-spatial   Author: lonnyj   File: AddGeometryColumnGeneratorGeoDB.java    License: Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #3
Source Project: liquibase-spatial   Author: lonnyj   File: CreateSpatialIndexChange.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @see liquibase.change.AbstractChange#validate(liquibase.database.Database)
 */
@Override
public ValidationErrors validate(final Database database) {
   final ValidationErrors validationErrors = new ValidationErrors();
   if (this.srid != null) {
      if (!this.srid.matches("[0-9]+")) {
         validationErrors.addError("The SRID must be numeric");
      }
   }

   if (!validationErrors.hasErrors()) {
      validationErrors.addAll(super.validate(database));
   }

   return validationErrors;
}
 
Example #4
Source Project: liquibase-impala   Author: eselyavka   File: HiveInsertGenerator.java    License: Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #5
Source Project: liquibase-impala   Author: eselyavka   File: HiveMarkChangeSetRanGenerator.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ValidationErrors validate(MarkChangeSetRanStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("changeSet", statement.getChangeSet());

    return validationErrors;
}
 
Example #6
Source Project: liquibase-impala   Author: eselyavka   File: RenameTableGenerator.java    License: Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #7
Source Project: liquibase-impala   Author: eselyavka   File: SetGenerator.java    License: Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #8
Source Project: liquibase-impala   Author: eselyavka   File: InsertAsSelectGenerator.java    License: Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #9
Source Project: liquibase-spatial   Author: lonnyj   File: DropSpatialIndexGeneratorGeoDB.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Ensures that the table name is populated.
 */
@Override
public ValidationErrors validate(final DropSpatialIndexStatement statement,
      final Database database, final SqlGeneratorChain sqlGeneratorChain) {
   final ValidationErrors validationErrors = new ValidationErrors();
   validationErrors.checkRequiredField("tableName", statement.getTableName());
   return validationErrors;
}
 
Example #10
Source Project: liquibase-spatial   Author: lonnyj   File: CreateSpatialTableGeneratorGeoDB.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ValidationErrors validate(final CreateTableStatement statement, final Database database,
      final SqlGeneratorChain sqlGeneratorChain) {
   final ValidationErrors validationErrors = new ValidationErrors();
   for (final Entry<String, LiquibaseDataType> entry : statement.getColumnTypes().entrySet()) {
      if (entry.getValue() instanceof GeometryType) {
         final GeometryType geometryType = (GeometryType) entry.getValue();
         if (geometryType.getSRID() == null) {
            validationErrors.addError("The SRID parameter is required on the geometry type");
         }
      }
   }
   validationErrors.addAll(sqlGeneratorChain.validate(statement, database));
   return validationErrors;
}
 
Example #11
Source Project: liquibase-spatial   Author: lonnyj   File: DropSpatialIndexGeneratorOracle.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Ensures that the index name is populated.
 */
@Override
public ValidationErrors validate(final DropSpatialIndexStatement statement,
      final Database database, final SqlGeneratorChain sqlGeneratorChain) {
   final ValidationErrors validationErrors = new ValidationErrors();
   validationErrors.checkRequiredField("indexName", statement.getIndexName());
   return validationErrors;
}
 
Example #12
Source Project: liquibase-spatial   Author: lonnyj   File: CreateSpatialIndexGeneratorGeoDB.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc} Also ensures that the SRID is populated.
 */
@Override
public ValidationErrors validate(final CreateSpatialIndexStatement statement,
      final Database database, final SqlGeneratorChain sqlGeneratorChain) {
   final ValidationErrors validationErrors = super.validate(statement, database,
         sqlGeneratorChain);
   validationErrors.checkRequiredField("srid", statement.getSrid());
   return validationErrors;
}
 
Example #13
Source Project: liquibase-spatial   Author: lonnyj   File: AbstractCreateSpatialIndexGenerator.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Ensures that the table name and columns are populated.
 * 
 * @see SqlGenerator#validate(liquibase.statement.SqlStatement, Database, SqlGeneratorChain)
 */
@Override
public ValidationErrors validate(final CreateSpatialIndexStatement statement,
      final Database database, final SqlGeneratorChain sqlGeneratorChain) {
   final ValidationErrors validationErrors = new ValidationErrors();
   validationErrors.checkRequiredField("tableName", statement.getTableName());
   validationErrors.checkRequiredField("columns", statement.getColumns());
   return validationErrors;
}
 
Example #14
Source Project: liquibase-spatial   Author: lonnyj   File: SpatialSupportedPrecondition.java    License: Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #15
Source Project: airsonic-advanced   Author: airsonic-advanced   File: UserSettingsJsonTablePopulation.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate(Database database) {
    return new ValidationErrors();
}
 
Example #16
Source Project: airsonic-advanced   Author: airsonic-advanced   File: UserRolesJsonColumnPopulation.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate(Database database) {
    return new ValidationErrors();
}
 
Example #17
Source Project: jweb-cms   Author: chifei   File: AbstractJdbcDatabase.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate() {
    return new ValidationErrors();
}
 
Example #18
Source Project: multiapps-controller   Author: cloudfoundry-incubator   File: AbstractChange.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(Database database) {
    return null;
}
 
Example #19
Source Project: liquibase-impala   Author: eselyavka   File: HiveDropColumnGenerator.java    License: Apache License 2.0 4 votes vote down vote up
private ValidationErrors validateSingleColumn(DropColumnStatement dropColumnStatement) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tableName", dropColumnStatement.getTableName());
    validationErrors.checkRequiredField("columnName", dropColumnStatement.getColumnName());
    return validationErrors;
}
 
Example #20
Source Project: liquibase-impala   Author: eselyavka   File: HiveTagDatabaseGenerator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(TagDatabaseStatement tagDatabaseStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tag", tagDatabaseStatement.getTag());
    return validationErrors;
}
 
Example #21
Source Project: liquibase-impala   Author: eselyavka   File: TruncateGenerator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(TruncateTableStatement truncateStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    final ValidationErrors errors = new ValidationErrors();
    errors.checkRequiredField("tableName", truncateStatement.getTableName());
    return errors;
}
 
Example #22
Source Project: liquibase-impala   Author: eselyavka   File: CreateTableAsSelectGenerator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(CreateTableAsSelectStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors errors = new ValidationErrors();
    errors.checkRequiredField("tableName", statement.getTableName());
    return errors;
}
 
Example #23
Source Project: liquibase-impala   Author: eselyavka   File: ImpalaMarkChangeSetRanGenerator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(MarkChangeSetRanStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors errors = new ValidationErrors();
    errors.checkRequiredField("changeSet", statement.getChangeSet());
    return errors;
}
 
Example #24
Source Project: liquibase-impala   Author: eselyavka   File: ImpalaTagDatabaseGenerator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(TagDatabaseStatement tagDatabaseStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tag", tagDatabaseStatement.getTag());
    return validationErrors;
}
 
Example #25
Source Project: liquibase-impala   Author: eselyavka   File: ImpalaInvalidateMetadataGenerator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(InvalidateMetadataStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors errors = new ValidationErrors();
    errors.checkRequiredField("tableName", statement.getTableName());
    return errors;
}
 
Example #26
Source Project: liquibase-impala   Author: eselyavka   File: ImpalaCreateTableAsSelectGenerator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(CreateTableAsSelectStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors errors = new ValidationErrors();
    errors.checkRequiredField("tableName", statement.getTableName());
    return errors;
}
 
Example #27
Source Project: liquibase-impala   Author: eselyavka   File: ImpalaRefreshTableGenerator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(RefreshTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors errors = new ValidationErrors();
    errors.checkRequiredField("tableName", statement.getTableName());
    return errors;
}
 
Example #28
Source Project: DataHubSystem   Author: SentinelDataHub   File: MoveOwnerInProduct.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate (Database arg0)
{
   return null;
}
 
Example #29
Source Project: DataHubSystem   Author: SentinelDataHub   File: RemoveLFUStrategy.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate (Database arg0)
{
   return null;
}
 
Example #30
Source Project: DataHubSystem   Author: SentinelDataHub   File: ReplaceSystemByConfigurationObject.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate (Database arg0)
{
   return null;
}