All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openmetadata.service.migration.context.MigrationOps Maven / Gradle / Ivy

There is a newer version: 1.5.11
Show newest version
package org.openmetadata.service.migration.context;

import javax.validation.constraints.NotEmpty;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.jdbi.v3.core.Handle;

/*
Given a query - that should return a single column with a count, compute the validation and store its value.
*/
@Slf4j
public class MigrationOps {

  @NotEmpty @Getter private final String name;
  @NotEmpty @Getter private final String query;
  @Getter @Setter private Long result;

  public MigrationOps(String name, String query) {
    this.name = name;
    this.query = query;
  }

  public void compute(Handle handle) {
    try {
      this.result = handle.createQuery(query).mapTo(Long.class).one();
    } catch (Exception ex) {
      LOG.warn(String.format("Migration Op [%s] failed due to [%s]", name, ex));
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy