def __set_tag_template_field()

in google-datacatalog-apache-atlas-connector/src/google/datacatalog_connectors/apache_atlas/prepare/datacatalog_tag_template_factory.py [0:0]


    def __set_tag_template_field(self, attribute_def, enum_types_dict, name,
                                 tag_template):
        formatted_name = attr_normalizer.DataCatalogAttributeNormalizer.\
            format_name(name)
        type_name = attribute_def['typeName']
        enum_type = enum_types_dict.get(type_name)

        field = datacatalog.TagTemplateField()
        field.display_name = name

        if type_name in constant.DATACATALOG_TARGET_PRIMITIVE_TYPES:
            if type_name in constant.DATACATALOG_TARGET_DOUBLE_TYPE:
                target_type = self.__DOUBLE_TYPE
            elif type_name in constant.DATACATALOG_TARGET_BOOLEAN_TYPE:
                target_type = self.__BOOL_TYPE
            else:
                target_type = self.__STRING_TYPE

            field.type.primitive_type = target_type
        elif enum_type:
            enum_element_defs = enum_type['data']['elementDefs']
            for enum_element_def in enum_element_defs:
                enum_value = datacatalog.FieldType.EnumType.EnumValue()
                enum_value.display_name = enum_element_def['value']
                field.type.enum_type.allowed_values.append(enum_value)
        else:
            # String is the default type.
            field.type.primitive_type = self.__STRING_TYPE

        tag_template.fields[formatted_name] = field