From 7f535078ef80a7b7efa3e3325bfccb994fbd00e8 Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Thu, 31 Aug 2017 15:16:38 -0400 Subject: Rename packages to org.onap in 1.4.0-SNAPSHOT 19 - remove openecomp 72 - remediate Sonar scan issues 79 - removed unwanted left menu under Report 90 - apply approved license text Issue: PORTAL-19, PORTAL-72, PORTAL-79, PORTAL-90 Change-Id: I41a0ef5fba623d2242574bd15f2d9fb8029a496c Signed-off-by: Christopher Lott (cl778h) --- .../portalsdk/core/service/ElementLinkService.java | 290 --------------------- 1 file changed, 290 deletions(-) delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java (limited to 'ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java') diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java deleted file mode 100644 index 0cd90dc7..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java +++ /dev/null @@ -1,290 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalsdk.core.service; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.util.YamlUtils; - -public class ElementLinkService { - - /** - * Builds renderable model of element links in the network map. Parses YAML - * files with metadata and builds input for JoinJS to render in the browser - * as SVG. - * - * @param args - * arg 0 - realPath; arg 1 - callFlowName; arg 2 - callFlowStep. - * @return Renderable model of element links - * @throws Exception - */ - public String buildElementLinkYaml(String[] args) throws Exception { - String relFilePath; - if (args[1].startsWith("custom")) - relFilePath = SystemProperties.getProperty("customCallFlow_path"); - else - relFilePath = SystemProperties.getProperty("element_map_file_path"); - final String yamlDirPath = new File(args[0], relFilePath).getPath(); - - String callFlowBusinessYml = ""; - String callFlowStep = ""; - - if (args != null && args.length > 0) { - if (args[1] != null) - callFlowBusinessYml = args[1] + ".yml"; - if (args[2] != null) - callFlowStep = args[2]; - } - - ElementLinkService mapper = new ElementLinkService(); - String linkYaml = mapper.createLinkFile(yamlDirPath, callFlowBusinessYml, callFlowStep); - return linkYaml; - } - - /* - * public String main2(String[] args) throws Exception { - * - * String filePath = SystemProperties.getProperty("element_map_file_path") + - * File.separator; String callFlowBusinessYml = ""; String callFlowStep = - * ""; - * - * if (args != null && args.length > 0) { - * - * if (args[0] != null) { callFlowBusinessYml = args[0] + "-Override.yml"; } - * - * if (args[1] != null) { callFlowStep = args[1]; } } - * - * ElementLinkService mapper = new ElementLinkService(); - * - * return mapper.createLinkFileAdditional(filePath, callFlowBusinessYml, - * callFlowStep); } - */ - - public static void main(String[] args) throws Exception { - - String filePath = "\\D2Platform\\war\\WEB-INF\\resources\\trisim_files"; - String callFlowBusinessYml = "call_flow_hc-origination-termination-to-volteue-3.3.16-Override.yml"; - - ElementLinkService mapper = new ElementLinkService(); - - // System.out.print(mapper.createLinkFile(filePath, networkToscaYml, - // networkToscaUeYml, networkLayoutYml, callFlowBusinessYml,"Step_1")); - System.out.print(mapper.createLinkFileAdditional(filePath, callFlowBusinessYml, "Step_2")); - } - - @SuppressWarnings("unchecked") - protected String createLinkFile(String resourceFilePath, String callFLowBsFileName, String callFlowStep) - throws Exception { - - Map callFlowBs = YamlUtils.readYamlFile(resourceFilePath, callFLowBsFileName); - - List> callSteps = (List>) callFlowBs.get("callSequenceSteps"); - String callFlowName = (String) callFlowBs.get("shortName"); - return addLinks(resourceFilePath, callFlowName, callSteps, callFlowStep); - - } - - @SuppressWarnings("unchecked") - protected String createLinkFileAdditional(String resourceFilePath, String callFLowBsFileName, String callFlowStep) - throws Exception { - - // Map callFlowBs = - // YamlUtils.readYamlFile(resourceFilePath, callFLowBsFileName); - - // return YamlUtils.returnYaml(callFlowBs); - - Map callFlowBs; - - try { - callFlowBs = YamlUtils.readYamlFile(resourceFilePath, callFLowBsFileName); - - List> callSteps = (List>) callFlowBs.get("callSequenceSteps"); - String callFlowName = (String) callFlowBs.get("shortName"); - return addLinksAdditional(resourceFilePath, callFlowName, callSteps, callFlowStep); - - } catch (Exception e) { - - return ""; - } - - } - - @SuppressWarnings("unchecked") - protected String addLinks(String filePath, String callFlowName, List> callSteps, - String callFlowStep) throws IOException { - - Map> checkDuplicateMap = new HashMap>(); - - for (Map callStep : callSteps) { - - if (((String) callStep.get("name")).split(":")[0].trim().replace(" ", "_").equals(callFlowStep)) { - - // String callFlowStepName = callFlowName + "_" + - // ((String)callStep.get("name")).split("-")[0].trim().replace(" - // ", "_")+".yml"; - - List> links = new ArrayList>(); - - List> subSteps = (List>) callStep.get("subSteps"); - - for (Map subStep : subSteps) { - Map link = new HashMap(); - - String source = (String) subStep.get("source_tosca_id"); - String destination = (String) subStep.get("destination_tosca_id"); - - if ((checkDuplicateMap.get(source) == null || checkDuplicateMap.get(source).isEmpty() - || !checkDuplicateMap.get(source).contains(destination)) && !source.equals(destination)) { - if (checkDuplicateMap.get(destination) == null) { - List toscaList = new ArrayList(); - checkDuplicateMap.put(destination, toscaList); - } - - if (checkDuplicateMap.get(source) == null) { - List toscaList = new ArrayList(); - checkDuplicateMap.put(source, toscaList); - } - - List toscaSourceList = checkDuplicateMap.get(destination); - toscaSourceList.add(source); - - List toscaDestinationList = checkDuplicateMap.get(source); - toscaDestinationList.add(destination); - - link.put("s", source); - link.put("d", destination); - links.add(link); - - /* - * may be needed in future but nnot currently - * - * if((String) subStep.get("link_visibility")!=null){ - * if(((String) - * subStep.get("link_visibility")).equals("No")){ - * - * } }else{ - * - * links.add(link); } - */ - - } - - } - - Map callFlowUI = new HashMap(); - callFlowUI.put("linkList", links); - - return YamlUtils.returnYaml(callFlowUI); - - // YamlUtils.writeYamlFile(filePath, callFlowStepName, - // callFlowUI); - } - - } - return ""; - } - - protected String addLinksAdditional(String filePath, String callFlowName, List> callSteps, - String callFlowStep) throws IOException { - - for (Map callStep : callSteps) { - - if (((String) callStep.get("name")).split(":")[0].trim().replace(" ", "_").equals(callFlowStep)) { - - // String callFlowStepName = callFlowName + "_" + - // ((String)callStep.get("name")).split("-")[0].trim().replace(" - // ", "_")+".yml"; - - Map callFlowUI = new HashMap(); - try { - List> links = addLinkVertices(callStep); - callFlowUI.put("linkList", links); - } catch (Exception e) { - } - try { - List activeIds = addActiveNodes(callStep); - callFlowUI.put("activeIds", activeIds); - } catch (Exception e) { - } - try { - List> disconnectLinks = addDisconnectLinks(callStep); - callFlowUI.put("disconnectLinks", disconnectLinks); - } catch (Exception e) { - } - - return YamlUtils.returnYaml(callFlowUI); - } - } - - return ""; - } - - @SuppressWarnings("unchecked") - List addActiveNodes(Map callStep) { - List activeIds = (List) callStep.get("activeIds"); - return activeIds; - } - - @SuppressWarnings("unchecked") - List> addDisconnectLinks(Map callStep) { - List> disconnectLinks = (List>) callStep.get("disconnectLinks"); - return disconnectLinks; - } - - @SuppressWarnings("unchecked") - List> addLinkVertices(Map callStep) { - List> links = new ArrayList>(); - - List> vertices = (List>) callStep.get("vertices"); - - for (int i = 0; i < vertices.size() - 1; i++) { - Map vertex = (Map) vertices.get(i); - Map vertexNext = (Map) vertices.get(i + 1); - - Integer sourceX = (Integer) vertex.get("x"); - Integer sourceY = (Integer) vertex.get("y"); - String sourceD = (String) vertex.get("D"); - String sourceL = (vertex.get("L") != null) ? (String) vertex.get("L") : "-"; - - if (sourceX == -999) // there is a break in the linkage - continue; - - Integer destinationX = (Integer) vertexNext.get("x"); - Integer destinationY = (Integer) vertexNext.get("y"); - String destinationD = (String) vertexNext.get("D"); - - if (destinationX == -999) // there is a break in the linkage - continue; - - Map link = new HashMap(); - - link.put("s", sourceX + "," + sourceY + "," + sourceD + "," + sourceL); - link.put("d", destinationX + "," + destinationY + "," + destinationD); - links.add(link); - } - return links; - } -} -- cgit 1.2.3-korg