Search in sources :

Example 1 with CompatibilityLevel

use of io.hops.hopsworks.common.dao.kafka.schemas.CompatibilityLevel in project hopsworks by logicalclocks.

the class SubjectsCompatibilityController method setSubjectCompatibility.

public Compatibility setSubjectCompatibility(Project project, String subject, SchemaCompatibility sc) throws SchemaException {
    if (sc == null) {
        throw new SchemaException(RESTCodes.SchemaRegistryErrorCode.INVALID_COMPATIBILITY, Level.WARNING, "Compatibility cannot be null");
    }
    if (subject == null || subject.equals(Settings.PROJECT_COMPATIBILITY_SUBJECT) || subjectsFacade.findSubjectByName(project, subject).isEmpty()) {
        throw new SchemaException(RESTCodes.SchemaRegistryErrorCode.SUBJECT_NOT_FOUND, Level.WARNING, "Incorrect subject");
    }
    subjectsCompatibilityFacade.updateSubjectCompatibility(project, subject, sc);
    CompatibilityLevel levelDto = getSubjectCompatibility(project, subject);
    return new Compatibility(levelDto.getCompatibilityLevel());
}
Also used : SchemaException(io.hops.hopsworks.exceptions.SchemaException) CompatibilityLevel(io.hops.hopsworks.common.dao.kafka.schemas.CompatibilityLevel) SchemaCompatibility(io.hops.hopsworks.persistence.entity.kafka.schemas.SchemaCompatibility) SubjectsCompatibility(io.hops.hopsworks.persistence.entity.kafka.schemas.SubjectsCompatibility) Compatibility(io.hops.hopsworks.common.dao.kafka.schemas.Compatibility)

Aggregations

Compatibility (io.hops.hopsworks.common.dao.kafka.schemas.Compatibility)1 CompatibilityLevel (io.hops.hopsworks.common.dao.kafka.schemas.CompatibilityLevel)1 SchemaException (io.hops.hopsworks.exceptions.SchemaException)1 SchemaCompatibility (io.hops.hopsworks.persistence.entity.kafka.schemas.SchemaCompatibility)1 SubjectsCompatibility (io.hops.hopsworks.persistence.entity.kafka.schemas.SubjectsCompatibility)1