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 File: HiveDropColumnGenerator.java    From liquibase-impala with 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 File: CreateSpatialIndexChange.java    From liquibase-spatial with 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 #3
Source File: AddGeometryColumnGeneratorGeoDB.java    From liquibase-spatial with 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 #4
Source File: SetGenerator.java    From liquibase-impala with 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 #5
Source File: CreateSpatialIndexGeneratorGeoDB.java    From liquibase-spatial with 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 #6
Source File: AbstractCreateSpatialIndexGenerator.java    From liquibase-spatial with 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 #7
Source File: SpatialSupportedPrecondition.java    From liquibase-spatial with 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 #8
Source File: DropSpatialIndexGeneratorOracle.java    From liquibase-spatial with 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 #9
Source File: CreateSpatialTableGeneratorGeoDB.java    From liquibase-spatial with 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 #10
Source File: InsertAsSelectGenerator.java    From liquibase-impala with 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 #11
Source File: RenameTableGenerator.java    From liquibase-impala with 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 #12
Source File: DropSpatialIndexGeneratorGeoDB.java    From liquibase-spatial with 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 #13
Source File: HiveMarkChangeSetRanGenerator.java    From liquibase-impala with 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 #14
Source File: HiveInsertGenerator.java    From liquibase-impala with 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 #15
Source File: AbstractSpatialUpdateGenerator.java    From liquibase-spatial with Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(final UpdateStatement statement, final Database database,
      final SqlGeneratorChain sqlGeneratorChain) {
   return sqlGeneratorChain.validate(statement, database);
}
 
Example #16
Source File: AddRealmCodeSecret.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(Database database) {
    return null;
}
 
Example #17
Source File: CustomInsertLockRecordGenerator.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(InitializeDatabaseChangeLogLockTableStatement initializeDatabaseChangeLogLockTableStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    return new ValidationErrors();
}
 
Example #18
Source File: CustomKeycloakTask.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(Database database) {
    return null;
}
 
Example #19
Source File: CertificateBlobToBase64.java    From aerogear-unifiedpush-server with Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(Database database) {
    return null;
}
 
Example #20
Source File: CategoriesMigration.java    From aerogear-unifiedpush-server with Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(Database database) {
    return null;
}
 
Example #21
Source File: GetRidOfApiKeysMigration.java    From aerogear-unifiedpush-server with Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(Database database) {
    return null;
}
 
Example #22
Source File: InsertGenerator.java    From liquibase-mssql with Apache License 2.0 4 votes vote down vote up
public ValidationErrors validate(InsertStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    return sqlGeneratorChain.validate(statement, database);
}
 
Example #23
Source File: DropSpatialTableGeneratorOracle.java    From liquibase-spatial with Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(final DropTableStatement statement, final Database database,
      final SqlGeneratorChain sqlGeneratorChain) {
   return sqlGeneratorChain.validate(statement, database);
}
 
Example #24
Source File: AbstractSpatialInsertGenerator.java    From liquibase-spatial with Apache License 2.0 4 votes vote down vote up
@Override
public ValidationErrors validate(final InsertStatement statement, final Database database,
      final SqlGeneratorChain sqlGeneratorChain) {
   return sqlGeneratorChain.validate(statement, database);
}
 
Example #25
Source File: DataManagerRoleCreation.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate (Database arg0)
{
   return null;
}
 
Example #26
Source File: ExtractProductDatesAndDownloadSize.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate (Database arg0)
{
   return null;
}
 
Example #27
Source File: CopyProductImages.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate (Database arg0)
{
   return null;
}
 
Example #28
Source File: GenerateUserUUIDs.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate (Database arg0)
{
   return null;
}
 
Example #29
Source File: TransformUserCountry.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate (Database arg0)
{
   return null;
}
 
Example #30
Source File: EncryptExistingUserPasswords.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ValidationErrors validate (Database arg0)
{
   return null;
}