@@ -117,10 +117,21 @@ def parse_links(obj: dict) -> list:
117117 # DPI are ignored since they are handled differently
118118 if "DataProcessingItem" in obj ["typePath" ]:
119119 return []
120+ # ReferenceDataValue have to be ignored (at least for now)
121+ if "ReferenceDataValue" in obj ["typePath" ]:
122+ return []
120123 for key in obj ["links" ]:
121124 for dest in obj ["links" ][key ]:
122125 if "DataProcessingItem" in dest ["typePath" ]:
123126 continue
127+ if "ReferenceDataValue" in dest ["typePath" ]:
128+ logging .warning ('The following link cannot be created with the API, please create it manually:' )
129+ logging .warning (obj ["path" ])
130+ logging .warning (obj ["typePath" ])
131+ logging .warning (key )
132+ logging .warning (dest ["path" ])
133+ logging .warning (dest ["typePath" ])
134+ continue
124135 link = {
125136 'fromPath' : obj ["path" ],
126137 'fromType' : obj ["typePath" ],
@@ -132,6 +143,24 @@ def parse_links(obj: dict) -> list:
132143 return links
133144
134145
146+ # This is a WIP and not used yet in the codebase
147+ def handle_reference_data_value (source_glossary : list ) -> str :
148+ for page in source_glossary :
149+ page_index = source_glossary .index (page )
150+ for glossary_object in page :
151+ go_index = page .index (glossary_object )
152+ if glossary_object ['type' ] == 'ReferenceDataValue' and glossary_object ['links' ]:
153+ if 'attributes' in glossary_object and 'code' in glossary_object ['attributes' ]:
154+ new_path = glossary_object ['path' ] + '\\ ' + glossary_object ['attributes' ]['code' ]
155+ new_type_path = glossary_object ['typePath' ].replace ('\\ ReferenceDataValue' , '\\ Value\\ ValueCode' )
156+ page [go_index ]['path' ] = new_path
157+ page [go_index ]['typePath' ] = new_type_path
158+ else :
159+ logging .warning (f'Links of Reference Data Value { glossary_object ["technicalName" ]} cannot be imported without editor attribute Code' )
160+ logging .warning ('Please add it to your DataGalaxy screen for Reference Data Value objects' )
161+ source_glossary [page_index ] = page
162+
163+
135164def copy_links_parse (subparsers ):
136165 # create the parser for the "copy_links" command
137166 copy_links_parse = subparsers .add_parser ('copy-links' , help = 'copy-links help' )
0 commit comments