UNPKG

@sap/dwf-generator

Version:

SAP HANA Data Warehousing Foundation - Generator

42 lines (37 loc) 1.23 kB
'use strict'; const coGlobalNodes = require('./global_nodes'); const coRuntime = require('./runtime'); function lfnGetConnections(ioGenerator) { let loDlmProfile = ioGenerator.dlmProfile; let loGlobalNodes = new coGlobalNodes(loDlmProfile); let laConn = loDlmProfile.get('global.conn'); let laConnections = JSON.parse(JSON.stringify(loGlobalNodes.getRuleNodes())); // assign source and target let laAllNodes = loGlobalNodes.getNodes(); for (let i in laConn) { let loSource = _getNodeById(laAllNodes, laConn[i].source); let loTarget = _getNodeById(laAllNodes, laConn[i].target); if (loSource.type == 'rule') { _getNodeById(laConnections, laConn[i].source).target = loTarget; } else { _getNodeById(laConnections, laConn[i].target).source = loSource; } } for (let i in laConnections) { // assign procedures coRuntime.assignProcedures(ioGenerator, laConnections[i]); // assign views coRuntime.assignViews(ioGenerator, laConnections[i]); } return laConnections; } function _getNodeById(iaNodes, isId) { for (let i in iaNodes) { if (iaNodes[i].id == isId) { return iaNodes[i]; } } } module.exports = { getConnections: lfnGetConnections };