public SchemaIdVersion addSchemaVersion(String schemaBranchName,
SchemaMetadataInfo schemaMetadataInfo,
SchemaVersion schemaVersion)
throws SchemaNotFoundException, IncompatibleSchemaException, InvalidSchemaException, SchemaBranchNotFoundException {
Preconditions.checkNotNull(schemaBranchName, "Schema branch name can't be null");
checkSchemaText(schemaVersion.getSchemaText());
SchemaVersionInfo schemaVersionInfo;
SchemaMetadata schemaMetadata = schemaMetadataInfo.getSchemaMetadata();
schemaVersionInfo = findSchemaVersion(schemaBranchName, schemaMetadata.getType(), schemaVersion.getSchemaText(), schemaMetadataInfo
.getSchemaMetadata().getName());
if (schemaVersionInfo == null) {
schemaVersionInfo = createSchemaVersion(schemaBranchName,
schemaMetadata,
schemaMetadataInfo.getId(),
schemaVersion);
}
return new SchemaIdVersion(schemaMetadataInfo.getId(), schemaVersionInfo.getVersion(), schemaVersionInfo.getId());
}