private static TypesDef entityToTypesDef(AtlasEntityType entityType, AtlasTypeRegistry registry) throws AtlasBaseException { String typeName = entityType.getEntityDef().getName(); String typeDesc = entityType.getEntityDef().getDescription(); String typeVersion = entityType.getEntityDef().getTypeVersion(); ImmutableSet superTypes = ImmutableSet.copyOf(entityType.getEntityDef().getSuperTypes()); AttributeDefinition[] attributes = getAttributes(entityType, registry); HierarchicalTypeDefinition<ClassType> classType = TypesUtil.createClassTypeDef(typeName, typeDesc, typeVersion, superTypes, attributes); TypesDef ret = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(), ImmutableList.of(classType)); return ret; }
private static TypesDef classificationToTypesDef(AtlasClassificationType classificationType, AtlasTypeRegistry registry) { String typeName = classificationType.getClassificationDef().getName(); String typeDesc = classificationType.getClassificationDef().getDescription(); String typeVersion = classificationType.getClassificationDef().getTypeVersion(); Set<String> superTypes = new HashSet<>(classificationType.getClassificationDef().getSuperTypes()); List<AttributeDefinition> attributes = getAttributes(classificationType, registry); TraitTypeDefinition traitTypeDef = new TraitTypeDefinition(typeName, typeDesc, typeVersion, attributes, superTypes); TypesDef ret = new TypesDef(null, null, Arrays.asList(traitTypeDef), null); return ret; }
private AtlasStructDef getStructDefFromClassificationDef(AtlasClassificationDef classificationDef) { String legacyTypeName = getLegacyTypeNameForStructDef(classificationDef.getName()); return new AtlasStructDef(legacyTypeName, classificationDef.getDescription(), classificationDef.getTypeVersion(), getDefaultAttributeDefsIfNecessary(classificationDef.getAttributeDefs())); }