public Object getFieldValue(_Fields field) { switch (field) { case SCHEMA_TYPE: return getSchemaType(); case NAME: return getName(); case CAT_NAME: return getCatName(); case DB_NAME: return getDbName(); case COMPATIBILITY: return getCompatibility(); case VALIDATION_LEVEL: return getValidationLevel(); case CAN_EVOLVE: return isCanEvolve(); case SCHEMA_GROUP: return getSchemaGroup(); case DESCRIPTION: return getDescription(); } throw new IllegalStateException(); }
private MISchema convertToMISchema(ISchema schema) throws NoSuchObjectException { return new MISchema(schema.getSchemaType().getValue(), normalizeIdentifier(schema.getName()), getMDatabase(schema.getCatName(), schema.getDbName()), schema.getCompatibility().getValue(), schema.getValidationLevel().getValue(), schema.isCanEvolve(), schema.isSetSchemaGroup() ? schema.getSchemaGroup() : null, schema.isSetDescription() ? schema.getDescription() : null); }
@Override public void alterISchema(ISchemaName schemaName, ISchema newSchema) throws NoSuchObjectException, MetaException { boolean committed = false; try { openTransaction(); MISchema oldMSchema = getMISchema(schemaName.getCatName(), schemaName.getDbName(), schemaName.getSchemaName()); if (oldMSchema == null) { throw new NoSuchObjectException("Schema " + schemaName + " does not exist"); } // Don't support changing name or type oldMSchema.setCompatibility(newSchema.getCompatibility().getValue()); oldMSchema.setValidationLevel(newSchema.getValidationLevel().getValue()); oldMSchema.setCanEvolve(newSchema.isCanEvolve()); if (newSchema.isSetSchemaGroup()) { oldMSchema.setSchemaGroup(newSchema.getSchemaGroup()); } if (newSchema.isSetDescription()) { oldMSchema.setDescription(newSchema.getDescription()); } committed = commitTransaction(); } finally { if (!committed) { rollbackTransaction(); } } }
Assert.assertEquals(SchemaValidation.LATEST, schema.getValidationLevel()); Assert.assertFalse(schema.isCanEvolve()); Assert.assertEquals(schemaGroup, schema.getSchemaGroup()); Assert.assertEquals(description, schema.getDescription()); Assert.assertEquals(SchemaValidation.ALL, schema.getValidationLevel()); Assert.assertTrue(schema.isCanEvolve()); Assert.assertEquals(schemaGroup, schema.getSchemaGroup()); Assert.assertEquals(description, schema.getDescription());
Assert.assertEquals(SchemaValidation.LATEST, schema.getValidationLevel()); Assert.assertFalse(schema.isCanEvolve()); Assert.assertEquals(schemaGroup, schema.getSchemaGroup()); Assert.assertEquals(description, schema.getDescription()); Assert.assertEquals(SchemaValidation.ALL, schema.getValidationLevel()); Assert.assertTrue(schema.isCanEvolve()); Assert.assertEquals(schemaGroup, schema.getSchemaGroup()); Assert.assertEquals(description, schema.getDescription());
Assert.assertEquals(SchemaValidation.LATEST, schema.getValidationLevel()); Assert.assertFalse(schema.isCanEvolve()); Assert.assertEquals(schemaGroup, schema.getSchemaGroup()); Assert.assertEquals(description, schema.getDescription()); Assert.assertEquals(SchemaValidation.ALL, schema.getValidationLevel()); Assert.assertTrue(schema.isCanEvolve()); Assert.assertEquals(schemaGroup, schema.getSchemaGroup()); Assert.assertEquals(description, schema.getDescription());
private MISchema convertToMISchema(ISchema schema) throws NoSuchObjectException { return new MISchema(schema.getSchemaType().getValue(), normalizeIdentifier(schema.getName()), getMDatabase(schema.getCatName(), schema.getDbName()), schema.getCompatibility().getValue(), schema.getValidationLevel().getValue(), schema.isCanEvolve(), schema.isSetSchemaGroup() ? schema.getSchemaGroup() : null, schema.isSetDescription() ? schema.getDescription() : null); }
@Override public void alterISchema(ISchemaName schemaName, ISchema newSchema) throws NoSuchObjectException, MetaException { boolean committed = false; try { openTransaction(); MISchema oldMSchema = getMISchema(schemaName.getCatName(), schemaName.getDbName(), schemaName.getSchemaName()); if (oldMSchema == null) { throw new NoSuchObjectException("Schema " + schemaName + " does not exist"); } // Don't support changing name or type oldMSchema.setCompatibility(newSchema.getCompatibility().getValue()); oldMSchema.setValidationLevel(newSchema.getValidationLevel().getValue()); oldMSchema.setCanEvolve(newSchema.isCanEvolve()); if (newSchema.isSetSchemaGroup()) { oldMSchema.setSchemaGroup(newSchema.getSchemaGroup()); } if (newSchema.isSetDescription()) { oldMSchema.setDescription(newSchema.getDescription()); } committed = commitTransaction(); } finally { if (!committed) { rollbackTransaction(); } } }