in google-datacatalog-apache-atlas-connector/src/google/datacatalog_connectors/apache_atlas/prepare/datacatalog_tag_template_factory.py [0:0]
def __create_entity_type_tag_template(self, entity_type_dict,
entity_types_dict, enum_types_dict):
tag_template = datacatalog.TagTemplate()
entity_type_data = entity_type_dict['data']
name = entity_type_data['name']
formatted_name = attr_normalizer.DataCatalogAttributeNormalizer.\
format_name(name)
version = entity_type_data.get('version')
tag_template_id = attr_normalizer.DataCatalogAttributeNormalizer.\
create_tag_template_id(formatted_name,
constant.ENTITY_TYPE_PREFIX,
version)
tag_template.name = self.get_tag_template_path(tag_template_id)
tag_template.display_name = 'Type - {}'.format(name)
entity_super_types = entity_type_dict.get('superTypes')
attribute_defs = entity_type_data['attributeDefs']
if entity_super_types:
self.__add_fields_from_super_types(tag_template,
entity_super_types,
entity_types_dict,
enum_types_dict)
self.__add_fields_from_attribute_defs(tag_template, attribute_defs,
enum_types_dict)
self._add_primitive_type_field(tag_template, formatted_name,
self.__BOOL_TYPE, formatted_name)
self._add_primitive_type_field(tag_template, constant.ENTITY_GUID,
self.__STRING_TYPE, 'entity guid')
self._add_primitive_type_field(tag_template,
constant.INSTANCE_URL_FIELD,
self.__STRING_TYPE, 'instance url')
self.__create_custom_fields_for_entity_type(tag_template,
entity_type_data)
return {tag_template_id: tag_template}