@Override public Object getNormalizedValue(Object obj) { Object ret = null; if (obj != null) { if (isValidValue(obj)) { if (obj instanceof AtlasEntity) { normalizeAttributeValues((AtlasEntity) obj); ret = obj; } else if (obj instanceof Map) { normalizeAttributeValues((Map) obj); ret = obj; } } } return ret; }
@Override public Object getNormalizedValue(Object obj) { Object ret = null; if (obj != null) { if (isValidValue(obj)) { if (obj instanceof AtlasEntity) { normalizeAttributeValues((AtlasEntity) obj); ret = obj; } else if (obj instanceof Map) { normalizeAttributeValues((Map) obj); ret = obj; } } } return ret; }
public void normalizeAttributeValues(AtlasEntity ent) { if (ent != null) { for (AtlasEntityType superType : superTypes) { superType.normalizeAttributeValues(ent); } super.normalizeAttributeValues(ent); } }
public void normalizeAttributeValues(AtlasEntity ent) { if (ent != null) { for (AtlasEntityType superType : superTypes) { superType.normalizeAttributeValues(ent); } normalizeValues(ent); } }
@Override public void normalizeAttributeValues(Map<String, Object> obj) { if (obj != null) { for (AtlasEntityType superType : superTypes) { superType.normalizeAttributeValues(obj); } normalizeValues(obj); } }
@Override public void normalizeAttributeValues(Map<String, Object> obj) { if (obj != null) { for (AtlasEntityType superType : superTypes) { superType.normalizeAttributeValues(obj); } super.normalizeAttributeValues(obj); } }
@Test public void testEntitySerDe() throws AtlasBaseException { AtlasEntityDef entityDef = ModelTestUtil.getEntityDef(); AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry(); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityDef.getName()); assertNotNull(entityType); AtlasEntity ent1 = entityType.createDefaultValue(); String jsonString = AtlasType.toJson(ent1); AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class); entityType.normalizeAttributeValues(ent2); assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity"); }
@Test public void testEntitySerDeWithSuperTypes() throws AtlasBaseException { AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperTypes(); AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry(); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityDef.getName()); assertNotNull(entityType); AtlasEntity ent1 = entityType.createDefaultValue(); String jsonString = AtlasType.toJson(ent1); AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class); entityType.normalizeAttributeValues(ent2); assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity with superTypes"); } }
@Test public void testEntitySerDe() throws AtlasBaseException { AtlasEntityDef entityDef = ModelTestUtil.getEntityDef(); AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry(); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityDef.getName()); assertNotNull(entityType); AtlasEntity ent1 = entityType.createDefaultValue(); String jsonString = AtlasType.toJson(ent1); AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class); entityType.normalizeAttributeValues(ent2); assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity"); }
@Test public void testEntitySerDeWithSuperType() throws AtlasBaseException { AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperType(); AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry(); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityDef.getName()); assertNotNull(entityType); AtlasEntity ent1 = entityType.createDefaultValue(); String jsonString = AtlasType.toJson(ent1); AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class); entityType.normalizeAttributeValues(ent2); assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity with superType"); }
@Test public void testEntitySerDeWithSuperType() throws AtlasBaseException { AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperType(); AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry(); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityDef.getName()); assertNotNull(entityType); AtlasEntity ent1 = entityType.createDefaultValue(); String jsonString = AtlasType.toJson(ent1); AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class); entityType.normalizeAttributeValues(ent2); assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity with superType"); }
@Test public void testEntitySerDeWithSuperTypes() throws AtlasBaseException { AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperTypes(); AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry(); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityDef.getName()); assertNotNull(entityType); AtlasEntity ent1 = entityType.createDefaultValue(); String jsonString = AtlasType.toJson(ent1); AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class); entityType.normalizeAttributeValues(ent2); assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity with superTypes"); } }