(identifier)
| 475 | } |
| 476 | |
| 477 | getTreeNodeHierarchy(identifier) { |
| 478 | let idx = 0; |
| 479 | let node_cnt = 0; |
| 480 | let result = {}; |
| 481 | if (!identifier) return; |
| 482 | let item; |
| 483 | try { |
| 484 | item = TreeNode.prototype.isPrototypeOf(identifier) ? identifier : this.findNode(identifier.path); |
| 485 | } catch { |
| 486 | // It is possible that the requested path is not present in the tree anymore |
| 487 | item = null; |
| 488 | } |
| 489 | if (!item) return; |
| 490 | do { |
| 491 | const currentNodeData = item.getData(); |
| 492 | if (currentNodeData._type in this.Nodes && this.Nodes[currentNodeData._type].hasId) { |
| 493 | const nodeType = mapType(currentNodeData._type, node_cnt); |
| 494 | if (result[nodeType] === undefined) { |
| 495 | result[nodeType] = _.extend({}, currentNodeData, { |
| 496 | 'priority': idx, |
| 497 | }); |
| 498 | idx -= 1; |
| 499 | } |
| 500 | } |
| 501 | node_cnt += 1; |
| 502 | item = item.hasParent() ? item.parent() : null; |
| 503 | } while (item); |
| 504 | |
| 505 | return result; |
| 506 | } |
| 507 | |
| 508 | /* |
| 509 | * |
no test coverage detected