|
2 | 2 |
|
3 | 3 | from stix2.datastore.relational_db.add_method import add_method |
4 | 4 | from stix2.datastore.relational_db.utils import ( |
5 | | - SCO_COMMON_PROPERTIES, SDO_COMMON_PROPERTIES, canonicalize_table_name, |
| 5 | + SCO_COMMON_PROPERTIES, SDO_COMMON_PROPERTIES, canonicalize_table_name, shorten_extension_definition_id |
6 | 6 | ) |
7 | 7 | from stix2.properties import ( |
8 | 8 | BinaryProperty, BooleanProperty, DictionaryProperty, |
@@ -153,9 +153,10 @@ def generate_insert_information(self, name, stix_object, data_sink=None, table_n |
153 | 153 | for ex_name, ex in stix_object["extensions"].items(): |
154 | 154 | # ignore new extensions - they have no properties |
155 | 155 | if ex.extension_type is None or not ex.extension_type.startswith("new"): |
156 | | - if ex_name.startswith("extension-definition"): |
157 | | - ex_name = ex_name[0:30] |
158 | | - ex_name = ex_name.replace("extension-definition-", "ext_def") |
| 156 | + if ex_name.startswith("extension-definition--"): |
| 157 | + # ex_name = ex_name[0:30] |
| 158 | + # ex_name = ex_name.replace("extension-definition-", "ext_def") |
| 159 | + ex_name = shorten_extension_definition_id(ex_name) |
159 | 160 | bindings = { |
160 | 161 | "id": stix_object["id"], |
161 | 162 | "ext_table_name": canonicalize_table_name(ex_name, schema_name), |
@@ -510,9 +511,10 @@ def generate_insert_for_sub_object( |
510 | 511 | bindings["id"] = foreign_key_value |
511 | 512 | if parent_table_name and (not is_extension or level > 0): |
512 | 513 | type_name = parent_table_name + "_" + type_name |
513 | | - if type_name.startswith("extension-definition"): |
514 | | - type_name = type_name[0:30] |
515 | | - type_name = type_name.replace("extension-definition-", "ext_def") |
| 514 | + if type_name.startswith("extension-definition--"): |
| 515 | + # type_name = type_name[0:30] |
| 516 | + # type_name = type_name.replace("extension-definition-", "ext_def") |
| 517 | + type_name = shorten_extension_definition_id(type_name) |
516 | 518 | sub_insert_statements = list() |
517 | 519 | for name, prop in stix_object._properties.items(): |
518 | 520 | if name in stix_object: |
|
0 commit comments