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());
}
Aggregations