X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=dgbuilder%2Fpublic%2Futil%2Fjs%2FdgeToXml.js;fp=dgbuilder%2Fpublic%2Futil%2Fjs%2FdgeToXml.js;h=7582d27503fb17ef6a923dd39d6e0388b9a97475;hb=d1569975bb18f4359fac18aa98f55b69c248a3ad;hp=0000000000000000000000000000000000000000;hpb=a016ea661ff5767a3539734c4c07ef974a6e4614;p=ccsdk%2Fdistribution.git diff --git a/dgbuilder/public/util/js/dgeToXml.js b/dgbuilder/public/util/js/dgeToXml.js new file mode 100644 index 00000000..7582d275 --- /dev/null +++ b/dgbuilder/public/util/js/dgeToXml.js @@ -0,0 +1,1328 @@ +function getDgStartNode(nodeList){ + for(var i=0;i" + val] = ""; + } + }else{ + nodesInPath[dgStartNodeId + "->" + ""] = ""; + } + + //console.dir(nodesInPath); + var loopDetectedObj = {}; + /* the nodes will not be order so will need to loop thru again */ + for(var m=0;nodeSet != null && m" + link); + } + var lastIndex = keys[j].lastIndexOf("->"); + if(index != -1 && index == lastIndex){ + //delete nodesInPath[key]; + var previousNodeId = keys[j].substr(lastIndex +2); + var indexOfArrow = -1; + if(previousNodeId != ""){ + indexOfArrow = previousNodeId.indexOf("->"); + } + if(previousNodeId != null && indexOfArrow != -1){ + previousNodeId = previousNodeId.substr(0,indexOfArrow); + } + nodesInPath[keys[j] + "->" + val] = ""; + //console.log("keys[j]:" + keys[j]); + delKeys.push(keys[j]); + var prevNodeIdIndex = keys[j].indexOf("->" + previousNodeId); + var priorOccurence = keys[j].indexOf(val + "->"); + if(priorOccurence != -1 && priorOccurence" + n2.name] ="looped"; + //console.dir(loopDetectedObj); + isLoopDetected = true; + } + } + } + } + } + for(var l=0;delKeys != null && l
"; + } + } + if(msg != ""){ + isLoopDetected = true; + RED.notify(msg); + } + } +/* + for(var i=0;nodeSet != null && i1){ + console.log("Loop detected for node " + nodeName + "with node:" + node.name); + RED.notify("Flow error detected for node '" + nodeName + "' with node '" + node.name + "'"); + //RED.nodes.eachLink(function(d){ + // if(d.source.id == nodeSet[i] || d.target.id == nodeSet[j]){ + // d.selected = true; + // }else if(d.source.id == nodeSet[j] || d.target.id == nodeSet[i]){ + // d.selected = true; + // } + //}); + //RED.view.redraw(); + isLoopDetected = true; + return true; + } + } + } + + } + } +*/ + //console.log("isLoopDetected:" + isLoopDetected); + return isLoopDetected; +} + +function generateNodePath(nodeIdToNodeObj,nodeId,pathStr,nodesInPath,errList){ + var node = nodeIdToNodeObj[nodeId]; + var wires = node.wires; + if(wires != null && wires != undefined && wires[0] != undefined){ + for(var k=0;k") != -1){ + //console.log("pathStr:" + pathStr); + var n1= nodeIdToNodeObj[nodeId].name; + var n2= nodeIdToNodeObj[val].name; + errList.push("Loop detected between nodes '" + n1 + "' and " + "'" + n2 + "'"); + }else{ + pathStr += "->" + val ; + generateNodePath(nodeIdToNodeObj,val,pathStr,nodesInPath,errList); + } + } + }else{ + //pathStr += nodeId + "->" + ""; + nodesInPath.push(pathStr); + } +} + +function detectLoop(){ + var activeWorkspace=RED.view.getWorkspace(); + var nSet=[]; + var nodeIdToNodeObj = {}; + RED.nodes.eachNode(function(n) { + if (n.z == activeWorkspace) { + nSet.push({'n':n}); + } + }); + + var nodeSet = RED.nodes.createExportableNodeSet(nSet); + nodeIdToNodeObj = getNodeIdToNodeMap(nodeSet); + var isLoopDetected = false; + //var dgStartNode = getDgStartNode(nodeSet); + var dgStartNode = nodeIdToNodeObj["dgstart"]; + var errList = []; + var dgStartNodeId = dgStartNode.id; + var nodesInPathArr = []; + generateNodePath(nodeIdToNodeObj,dgStartNodeId,dgStartNodeId,nodesInPathArr,errList); + if(errList != null && errList != undefined && errList.length > 0){ + isLoopDetected = true; + var htmlStr="
"; + for(var j=0;errList != null && j"; + } + htmlStr += "
Error List
"; + + $("#loop-detection-dialog").dialog({ + autoOpen : false, + modal: true, + title: "DG Flow validation Error List ", + width: 500, + buttons: { + Close: function () { + $("#loop-detection-dialog").dialog("close"); + } + } + }).dialog("open").html(htmlStr); // end dialog div + } + nodesInPathArr=null; + nodeSet ={}; + nodeIdToNodeObj={}; + return isLoopDetected; +} + + +var xmlNumberCnt = 0; +function processForXmlNumbers(nodeSet,node){ + if( node != null && node.type != 'dgstart'){ + if(node.xmlnumber != null && node.xmlnumber){ + node.xmlnumber.push(++xmlNumberCnt); + }else{ + node.xmlnumber = [++xmlNumberCnt]; + } + } + + if(node != null && node.wires != null && node.wires.length>0){ + var wiredNodes=node.wires[0]; + var wiredNodesArr=[]; + for(var k=0;wiredNodes != undefined && wiredNodes != null && k0){ + nodeSet.forEach(function(n){ + if(n.xmlnumber){ + delete n.xmlnumber; + } + }); + } + var dgStartNode = getDgStartNode(nodeSet); + processForXmlNumbers(nodeSet,dgStartNode); + var activeWorkspace=RED.view.getWorkspace(); + RED.nodes.eachNode(function(n) { + //console.log("Node processed in eachNode"); + if (n.z == activeWorkspace) { + if(n != null){ + var updatedNode = getNode(nodeSet,n.id); + //console.log("updated Node processed in eachNode"); + //console.dir(updatedNode); + + if (n.id == updatedNode.id) { + n.xmlnumber = updatedNode.xmlnumber; + n.dirty = true; + } + } + } + }); +} + +function getOutcomeValue(node){ + var xmlStr = ""; + if(node != null && node.xml != undefined && node.xml !=""){ + xmlStr = node.xml + ""; + } + var xmlDoc; + if (window.DOMParser){ + try{ + var parser=new DOMParser(); + xmlDoc=parser.parseFromString(xmlStr,'text/xml'); + //console.log("Not IE"); + var n = xmlDoc.documentElement.nodeName; + if(n == "html"){ + resp=false; + console.log("Error parsing"); + return resp; + } + }catch(e){ + console.log("xmlStr:" + xmlStr); + console.log("Error parsing" +e); + return null; + } + }else{ + try{ + //console.log("IE"); + // code for IE + xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); + xmlDoc.async=false; + xmlDoc.loadXMLString(xmlStr); + }catch(e){ + console.log("xmlStr:" + xmlStr); + console.log("Error parsing" +e); + return null; + } + } + if(xmlDoc != null){ + var xmlNode = xmlDoc.documentElement; + //console.dir(xmlNode); + var processedNode = xmlNode.nodeName; + //console.log("processedNode:" + processedNode); + var attrs = xmlNode.attributes; + for(var i=0;i0){ + var wiredNodes=node.wires[0]; + var wiredNodesArr=[]; + for(var k=0;wiredNodes != undefined && wiredNodes != null && k val2 ){ + return 1; + }else{ + return 0; + } + }); + }else{ + //use this sort to sort by y position + wiredNodesArr.sort(function(a, b){ + return a.y-b.y; + }); + } + + */ + + for(var k=0;k0){ + nodeSet.forEach(function(n){ + if(n.dgnumber){ + delete n.dgnumber; + } + }); + } + var dgStartNode = getDgStartNode(nodeSet); + processForDgNumbers(nodeSet,dgStartNode); + var activeWorkspace=RED.view.getWorkspace(); + RED.nodes.eachNode(function(n) { + //console.log("Node processed in eachNode"); + if (n.z == activeWorkspace) { + if(n != null){ + var updatedNode = getNode(nodeSet,n.id); + //console.log("updated Node processed in eachNode"); + //console.dir(updatedNode); + + if (n.id == updatedNode.id) { + //console.log(n.type + ":" + updatedNode.dgnumber); + n.dgnumber = updatedNode.dgnumber; + n.dirty = true; + } + } + } + }); + return nodeSet; +} + +function customValidation(currNodeSet){ + //validation to make sure there a block node infront of mutiple dgelogic nodes + flowDesignErrors=[]; + var dgStartCnt=0; + var serviceLogicCnt=0; + var methodCnt=0; + for(var i=0;currNodeSet != null && i0){ + var wiredNodes=node.wires[0]; + var wiredNodesArr=[]; + for(var k=0;wiredNodes != undefined && wiredNodes != null && k -1 ||nodeType == 'set' || isOutcomeOrSetNode){ + //its a outcome or set node + }else{ + countChildLogicNodes++; + } + + //console.log("parentNodeType:" + parentNodeType); + if(countChildLogicNodes >1 && parentNodeType != 'block' && parentNodeType != 'for' ){ + if(node.dgnumber != undefined && node.dgnumber){ + flowDesignErrors.push("Warning:May need a block Node after Node.
Node Name:" + node.name + "
DG Number:" + node.dgnumber[0] ); + }else{ + flowDesignErrors.push("Warning:May need a block Node after Node
Node name:" + parentNodeName); + } + break; + } + } + } + } + if(dgStartCnt > 1){ + flowDesignErrors.push("Error:There should only be 1 dgstart Node in the current workspace."); + } + + if(serviceLogicCnt > 1){ + flowDesignErrors.push("Error:There should only be 1 service-logic Node in the current workspace."); + } + + if(methodCnt > 1){ + flowDesignErrors.push("Error:There should only be 1 method Node in the current workspace."); + } + + if(flowDesignErrors != null && flowDesignErrors.length >0){ + return false; + } + return true; +} + +var flowDesignErrors = []; +function showFlowDesignErrorBox(){ + if(flowDesignErrors != null && flowDesignErrors.length >0){ + var htmlStr="
"; + for(var j=0;flowDesignErrors != null && j"; + } + htmlStr += "
Error List
"; + + //$('
').dialog({ + + $('#flow-design-err-dialog').dialog({ + modal: true, + title: "Flow design Error List ", + width: 500, + /*open: function () { + $(this).html(htmlStr); + },*/ + buttons: { + Close: function () { + $(this).dialog("close"); + } + } + }).html(htmlStr); // end dialog div + } +} + + +function getCurrentFlowNodeSet(){ + var nodeSet=[]; + //console.dir(RED); + //RED.view.dirty(); + //RED.view.redraw(); + var activeWorkspace=RED.view.getWorkspace(); + RED.nodes.eachNode(function(n) { + if (n.z == activeWorkspace) { + nodeSet.push({'n':n}); + } + }); + + var exportableNodeSet = RED.nodes.createExportableNodeSet(nodeSet); + //console.dir(exportableNodeSet); + //console.log(JSON.stringify(exportableNodeSet)); + return exportableNodeSet; +} + +function getNode(nodeSet,id){ + for(var i=0;i remove them + comments=comments.replace("",""); + xmlStr=""; + } + xmlStr+=node.xml; + startTag = getStartTag(node); + fullXmlStr +=xmlStr; + /* + if(level > 0){ + var spacing = Array(level).join(" "); + xmlStr=xmlStr.replace(/\n/g,spacing); + fullXmlStr +=xmlStr; + + console.log(xmlStr); + }else{ + fullXmlStr +=xmlStr; + console.log(xmlStr); + } + */ + } + + //console.log("startTag:" + startTag); + + var wiredNodes = []; + var wiredNodesArr = []; + if(node != null && node.wires != null && node.wires[0] != null && node.wires[0] != undefined && node.wires[0].length >0 ){ + wiredNodes=node.wires[0]; + //console.log("Before sort"); + for(var k=0;wiredNodes != undefined && wiredNodes != null && k"; + /* + if(level >0){ + var spacing = Array(level).join(" "); + fullXmlStr += spacing + ""; + console.log(spacing + ""); + }else{ + fullXmlStr += ""; + console.log(""); + } + */ + } + + /*if(level>0){ + level=level-1; + } + */ + //console.log("endTag:" + startTag); + //console.log("xml:" + fullXmlStr); + } + //console.log("fullXmlStr:" + fullXmlStr); + return fullXmlStr; +} + +function showFlow(filePath){ +var jqxhr = $.post( "/getSharedFlow",{"filePath":filePath}) + .done(function(data) { + $( "#dgflow-browser-dialog").dialog("close"); + var migratedNodes = migrateNodes(data); + //RED.view.importNodes(data) + RED.view.importNodes(JSON.stringify(migratedNodes)); + //console.log( "import done"); + }) + .fail(function() { + RED.notify("Could not import user flow ."); + $( "#dgflow-browser-dialog").dialog("close"); + console.log( "error occured importing flow."); + }) + .always(function() { + //console.log( "complete" ); + }); +} + +function showFlowXml(filePath){ +var jqxhr = $.post( "/getSharedFlow",{"filePath":filePath}) + .done(function(data) { + //console.dir(data); + var xmlStr=getNodeToXml(data); + showImportedXml(xmlStr,this); + }) + .fail(function() { + RED.notify("Could not convert to XML."); + $( "#dgflow-browser-dialog").dialog("close"); + console.log( "error occured importing flow."); + }) + .always(function() { + //console.log( "complete" ); + }); +} + +function showFlowFiles(userName){ + //var divStyle="color:#07c; margin-bottom: 1.2em; font-size: 16px;"; + //var divStyle=""; + var divStyle=""; + + var htmlStr=divStyle + "
List of Flow files of User " + userName + "
    " ; + $.post( "/getFiles/" + userName) + .done(function( data ) { + //console.dir(data); + //console.log("found " + data.length + " files"); + if(data != null && data.length != undefined && data.length != 0){ + if(data != null && data.length>0){ + for(var k=0;k" + data[k].name + ""; + /* + //Use this code to display the View Xml Link + htmlStr += "
  • " + data[k].name + "[View Xml]
  • "; + */ + } + htmlStr+="
"; + } + $( "#dgflow-browser-dialog").html(htmlStr); + }else{ + //console.log("no flow files found for user " + userName); + var noFlowFilesHtml = divStyle + "

No downloaded Flow files found in " + userName + " directory

Back to List.
"; + $( "#dgflow-browser-dialog").html(noFlowFilesHtml); + } + }) + .fail(function(err) { + console.log( "error" + err ); + }) + .always(function() { + //console.log("done"); + }); + +} + + function closeAndShowFlowShareUsers(){ + $("#dgflow-browser-dialog").dialog( "close" ); + var divStyle=""; + $.get( "/flowShareUsers") + .done(function( data ) { + + var header="
List of downloaded DG Flows
"; + var html= divStyle + header + "
"; + html+="
    "; + if(data != null){ + var users=data.flowShareUsers; + users.sort(function (a,b){ + if(a.name > b.name){ + return 1; + }else if(a.name < b.name){ + return -1; + }else{ + return 0; + } + }); + for(var i=0;users != null && i" + users[i].name + ""; + } + } + html+="
"; + html+="
"; + $( "#dgflow-browser-dialog" ).dialog({ + title: "Dowloaded DG Flow Browser", + modal: true, + autoOpen: true, + width: 530, + height: 530, + buttons: [ + { + text: "Close", + click: function() { + $( this ).dialog( "close" ); + } + } + ] + }).html(html); + $("#dgflow-browser-dialog").show(); + }) + .fail(function(err) { + RED.notify("Failed to get users."); + }) + .always(function() { + }); + } + +function showImportedXml(xmlStr,dialogBox){ + var formattedXml=vkbeautify.xml(xmlStr); + var that = dialogBox; + require(["orion/editor/edit"], function(edit) { + that.editor = edit({ + parent:document.getElementById('dgflow-browser-dialog'), + lang:"html", + readonly:true, + contents: formattedXml + }); + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:that.editor, // the field name the main text body goes to + fields:['name','outputs'] + }); + }); +} + +function getTag(xmlStr){ + var tag= null ; + if(xmlStr != null){ + xmlStr = xmlStr.trim(); + } + try{ + var regex = new RegExp("(<)([^ >]+)"); + var match = regex.exec(xmlStr); + if(match != null){ + if(match[1] != undefined && match[2] != undefined){ + tag = match[2]; + } + } + }catch(e){ + console.log(e); + } + return tag; + +} + +function getAttributeValue(xmlStr,attribute){ + + var attrVal=null; + try{ + var myRe = new RegExp(attribute + "[\s+]?=[\s+]?['\"]([^'\"]+)['\"]","m"); + var myArray = myRe.exec(xmlStr); + if(myArray != null && myArray[1] != null){ + attrVal=myArray[1]; + } + }catch(err){ + console.log(err); + } + return attrVal; +} + +function showOrHideTab(checkbox,idVal){ + + var activeWorkspace=RED.view.getWorkspace(); + var table = $("#ftab02"); + $('td input:checkbox',table).each(function(i){ + console.log(this.checked); + }); + //console.dir($('td input:checkbox',table).prop('checked',this.checked)); + + $(".red-ui-tabs li a").each(function(i){ + var id=$(this).attr("href").replace('#',''); + if(id == idVal){ + $(this).parent().toggle(); + var isVisible = $(this).parent().is(":visible"); + if(isVisible){ + checkbox.checked = true; + }else{ + checkbox.checked = false; + } + if(activeWorkspace == id){ + //$("#chart").hide(); + //var li = ul.find("a[href='#"+id+"']").parent(); + var li = $(this).parent(); + if (li.hasClass("active")) { + li.removeClass("active"); + if(li.parent().children().size() != 0){ + } + console.log("has Class active"); + var tab = li.prev(); + if (tab.size() === 0) { + console.log("li prev size 0"); + tab = li.next(); + } + if(tab.is(":visible")){ + console.log("added active"); + tab.addClass("active"); + tab.click(); + //tab.trigger("click"); + } + //console.dir(tab); + //tab.parent().addClass("active"); + //tab.click(); + } + }else{ + console.log("added active id" +id); + if(isVisible){ + var li = $(this).parent(); + li.addClass("active"); + li.click(); + //console.dir(li); + }else{ + var li = $(this).parent(); + li.removeClass("active"); + } + } + } + }); +/* + $(".red-ui-tabs li a").each(function(i){ + var id=$(this).attr("href").replace('#',''); + if(id != idVal){ + $(this).trigger("click"); + if(activeWorkspace == idVal){ + $("#chart").show(); + } + return false; + } + }); +*/ +} + +function performGitCheckout(){ + $("#responseId").text(""); + if(!event) event = window.event; + var target = $(event.target); + target.val("Processing"); + target.css({ "background-image": "url('images/page-loading.gif')" }); + target.css({ "background-repeat": "no-repeat" }); + target.css({ "background-size": "25px 25px" }); + + var branch = document.getElementById("branchId").value.trim(); + var statusObj = document.getElementById("responseId"); + if(branch == null || branch == ''){ + statusObj.innerText = "Branch is required."; + return; + } + var urlVal = "/gitcheckout?branch=" + branch; + $.get(urlVal) + .done(function( data ) { + var output = data.output; + if(output != null){ + output=output.replace(/\n/g,"
"); + statusObj.innerHTML = output; + } + }) + .fail(function(err) { + statusObj.innerText = "Failed to do git checkout."; + }) + .always(function() { + $("#responseId").show(); + target.val("Checkout"); + target.css({ "background-image": "none" }); + }); +} + +function performGitPull(){ + $("#responseId").text(""); + if(!event) event = window.event; + var target = $(event.target); + target.val("Processing"); + target.css({ "background-image": "url('images/page-loading.gif')" }); + target.css({ "background-repeat": "no-repeat" }); + target.css({ "background-size": "25px 25px" }); + + var statusObj = document.getElementById("responseId"); + var urlVal = "/gitpull"; + $.get(urlVal) + .done(function( data ) { + var output = data.output; + if(output != null){ + output=output.replace(/\n/g,"
"); + statusObj.innerHTML = output; + } + }) + .fail(function(err) { + statusObj.innerText = "Failed to do git pull."; + }) + .always(function() { + $("#responseId").show(); + target.val("Pull"); + target.css({ "background-image": "none" }); + }); +} + + +function activateClickedTab(idVal) { + + $("#filter-tabs-dialog").dialog( "close" ); + var ul = $("#workspace-tabs"); + ul.children().each(function(){ + var li = $(this); + var link =li.find("a"); + var href = link.prop("href"); + var hrefId = href.split("#"); + if(hrefId[1] == idVal){ + link.trigger("click"); + } + }); +} + +function deleteOrRenameTab(idVal) { + $("#filter-tabs-dialog").dialog( "close" ); + var ul = $("#workspace-tabs"); + ul.children().each(function(){ + var li = $(this); + var link =li.find("a"); + var href = link.prop("href"); + var hrefId = href.split("#"); + if(hrefId[1] == idVal){ + link.trigger("click"); + link.trigger("dblclick"); + } + }); +} + +function deleteSelectedTab(idVal,title,_module,rpc,version){ + var dgInfo = "
Tab TitleModuleRPCVersion
" + title + "" + _module +"" + rpc + "" +version + "

"; + var alertMsg = dgInfo + "

Are you sure you want to Delete this Tab ?

"; + +$( "#tabAlertDialog" ).dialog({ + dialogClass: "no-close", + modal:true, + draggable : true, + /*dialogClass: "alert",*/ + title: "Confirm Tab sheet Delete", + width: 600, + buttons: [ + { + text: "Delete", + class:"alertDialogButton", + click: function() { + var ws = RED.nodes.workspace(idVal); + RED.view.removeWorkspace(ws); + var historyEvent = RED.nodes.removeWorkspace(idVal); + historyEvent.t = 'delete'; + historyEvent.dirty = true; + historyEvent.workspaces = [ws]; + RED.history.push(historyEvent); + RED.view.dirty(true); + $( this ).dialog( "close" ); + $("#filter-tabs-dialog").dialog( "close" ); + $("#btn-manage-tabs").trigger("click"); + } + }, + { + text: "Cancel", + class:"alertDialogButton", + click: function() { + $( this ).dialog( "close" ); + } + } + ] +}).html(alertMsg); +} + +function renameSelectedTab(idVal,title,_module,rpc,version){ + var dgInfo = "
Tab TitleModuleRPCVersion
" + _module +"" + rpc + "" +version + "

"; + var alertMsg = dgInfo + "

Change the title and click Rename.

"; + +$( "#tabAlertDialog" ).dialog({ + dialogClass: "no-close", + modal:true, + draggable : true, + /*dialogClass: "alert",*/ + title: "Rename Tab sheet", + width: 600, + buttons: [ + { + text: "Rename", + class:"alertDialogButton", + click: function() { + var ws = RED.nodes.workspace(idVal); + var label = document.getElementById("tab-name-" + idVal).value; + //console.log("label:" +label); + //console.log("ws.label:" + ws.label); + if (ws.label != label) { + ws.label = label; + var link = $("#workspace-tabs a[href='#"+idVal+"']"); + link.attr("title",label); + link.text(label); + RED.view.dirty(true); + } + $("#tabAlertDialog").dialog('destroy').remove(); + //$(this).dialog( "close" ); + $("#filter-tabs-dialog").dialog( "close" ); + $("#btn-manage-tabs").trigger("click"); + } + }, + { + text: "Cancel", + class:"alertDialogButton", + click: function() { + $( this ).dialog( "close" ); + } + } + ] +}).html(alertMsg); +} + +function performGitStatus(){ + $("#responseId").text(""); + if(!event) event = window.event; + var target = $(event.target); + target.val("Processing"); + target.css({ "background-image": "url('images/page-loading.gif')" }); + target.css({ "background-repeat": "no-repeat" }); + target.css({ "background-size": "25px 25px" }); + + var statusObj = document.getElementById("responseId"); + var urlVal = "/gitstatus"; + $.get(urlVal) + .done(function( data ) { + var output = data.output; + if(output != null){ + output=output.replace(/\n/g,"
"); + statusObj.innerHTML = output; + } + //statusObj.innerText = data.output; + }) + .fail(function(err) { + statusObj.innerText = "Failed to do git status."; + }) + .always(function() { + $("#responseId").show(); + target.val("Status"); + target.css({ "background-image": "none" }); + }); +} + +function migrateNodes(jsonStr){ + var nodes = JSON.parse(jsonStr); + nodes.forEach( function(node) { + if( node.xml != undefined && node.xml != null && node.xml.indexOf("", "m"); + myArray = myRe.exec(node.xml); + if(myArray != null && myArray[1] != null){ + version=myArray[1]; + //console.dir(myArray); + } + */ + version=getAttributeValue(node.xml,"version"); + node.type="service-logic"; + //node.category="DGEmain"; + node.module=module; + node.version=version; + if(module != null && version != null){ + node.name=module+ " " + version; + } + console.log("module=" + module); + console.log("version=" + version); + }else if( node.xml != undefined && node.xml != null && node.xml.indexOf("