private void collectTypeHierarchyInfo(AtlasTypeRegistry typeRegistry, Set<String> allSuperTypeNames, Map<String, AtlasAttribute> allAttributes, List<String> visitedTypes) throws AtlasBaseException { if (visitedTypes.contains(classificationDef.getName())) { throw new AtlasBaseException(AtlasErrorCode.CIRCULAR_REFERENCE, classificationDef.getName(), visitedTypes.toString()); } if (CollectionUtils.isNotEmpty(classificationDef.getSuperTypes())) { visitedTypes.add(classificationDef.getName()); for (String superTypeName : classificationDef.getSuperTypes()) { AtlasClassificationType superType = typeRegistry.getClassificationTypeByName(superTypeName); if (superType != null) { superType.collectTypeHierarchyInfo(typeRegistry, allSuperTypeNames, allAttributes, visitedTypes); } } visitedTypes.remove(classificationDef.getName()); allSuperTypeNames.addAll(classificationDef.getSuperTypes()); } if (CollectionUtils.isNotEmpty(classificationDef.getAttributeDefs())) { for (AtlasAttributeDef attributeDef : classificationDef.getAttributeDefs()) { AtlasType type = typeRegistry.getType(attributeDef.getTypeName()); allAttributes.put(attributeDef.getName(), new AtlasAttribute(this, attributeDef, type)); } } }
if (CollectionUtils.isNotEmpty(classificationDef.getAttributeDefs())) { for (AtlasAttributeDef attributeDef : classificationDef.getAttributeDefs()) { AtlasType type = typeRegistry.getType(attributeDef.getTypeName()); allAttributes.put(attributeDef.getName(), new AtlasAttribute(this, attributeDef, type));
private AtlasStructDef getStructDefFromClassificationDef(AtlasClassificationDef classificationDef) { String legacyTypeName = getLegacyTypeNameForStructDef(classificationDef.getName()); return new AtlasStructDef(legacyTypeName, classificationDef.getDescription(), classificationDef.getTypeVersion(), getDefaultAttributeDefsIfNecessary(classificationDef.getAttributeDefs())); }
assertTrue(createdTypesDef.getClassificationDefs().get(0).getAttributeDefs().get(0).getIsIndexable()); assertTrue(getBackFromCache.getAttributeDefs().get(0).getIsIndexable()); assertEquals(guid, getBackFromCache.getGuid()); assertNotNull(getBackFromCache.getCreatedBy()); testTypesDefFromJson.getClassificationDefs().get(0).getAttributeDefs().get(0).setIsIndexable(false); AtlasTypesDef updatedTypesDef = typeDefStore.updateTypesDef(testTypesDefFromJson); assertEquals("test_classification_11", updatedTypesDef.getClassificationDefs().get(0).getName()); assertFalse(updatedTypesDef.getClassificationDefs().get(0).getAttributeDefs().get(0).getIsIndexable()); assertEquals(guid, updatedTypesDef.getClassificationDefs().get(0).getGuid()); assertEquals(createdTime, updatedTypesDef.getClassificationDefs().get(0).getCreateTime()); assertFalse(getBackFromCache.getAttributeDefs().get(0).getIsIndexable()); assertEquals(guid, getBackFromCache.getGuid()); assertEquals(createdTime, getBackFromCache.getCreateTime()); getBackFromCache = typeDefStore.getClassificationDefByGuid(guid); assertEquals("test_classification_11", getBackFromCache.getName()); assertFalse(getBackFromCache.getAttributeDefs().get(0).getIsIndexable()); assertEquals(guid, getBackFromCache.getGuid()); assertEquals(createdTime, getBackFromCache.getCreateTime());