summaryrefslogtreecommitdiffstats
path: root/asdctool
diff options
context:
space:
mode:
Diffstat (limited to 'asdctool')
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzer.java25
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java37
2 files changed, 27 insertions, 35 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzer.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzer.java
index 863f920b47..e533c31082 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzer.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzer.java
@@ -53,30 +53,31 @@ public class GraphMLDataAnalyzer {
try {
String mlFileLocation = args[0];
result = _analyzeGraphMLData(mlFileLocation);
- System.out.println("Analyzed ML file=" + mlFileLocation + ", XLS result=" + result);
+ log.info("Analyzed ML file=" + mlFileLocation + ", XLS result=" + result);
} catch (Exception e) {
- log.info("analyze GraphML Data failed - {}" , e);
+ log.error("analyze GraphML Data failed - {}" , e);
return null;
}
return result;
}
private String _analyzeGraphMLData(String mlFileLocation) throws Exception {
-
// Parse ML file
SAXBuilder builder = new SAXBuilder();
File xmlFile = new File(mlFileLocation);
Document document = (Document) builder.build(xmlFile);
-
+
// XLS data file name
String outputFile = mlFileLocation.replace(".graphml", ".xls");
Workbook wb = new HSSFWorkbook();
- FileOutputStream fileOut = new FileOutputStream(outputFile);
- writeComponents(wb, document);
- writeComponentInstances(wb, document);
- wb.write(fileOut);
- fileOut.close();
- return outputFile;
+ try(FileOutputStream fileOut = new FileOutputStream(outputFile)){
+ writeComponents(wb, document);
+ writeComponentInstances(wb, document);
+ wb.write(fileOut);
+ }catch(Exception e){
+ log.error("analyze GraphML Data failed - {}" , e);
+ }
+ return outputFile;
}
private void writeComponents(Workbook wb, Document document) {
@@ -132,13 +133,11 @@ public class GraphMLDataAnalyzer {
IteratorIterable<Element> dataNodes = edge.getDescendants(filter);
for (Element data : dataNodes) {
String attributeValue = data.getAttributeValue("key");
- switch (attributeValue) {
- case "labelE":
+ if( attributeValue.equals("labelE")) {
String edgeLabel = data.getText();
if (edgeLabel.equals("REQUIREMENT") || edgeLabel.equals("CAPABILITY")) {
componentsHavingReqOrCap.add(edge.getAttributeValue("source"));
}
- break;
}
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
index 5546300740..4bc21b38ca 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
@@ -31,31 +31,24 @@ public class RemoveUtils {
if (args == null || args.length < 1) {
removeUsage();
- }
-
- String operation = args[0];
-
- switch (operation.toLowerCase()) {
-
- case "remove-products":
-
- boolean isValid = verifyParamsLength(args, 5);
- if (false == isValid) {
+ }else {
+ String operation = args[0];
+ if(operation.equalsIgnoreCase("remove-products")) {
+ boolean isValid = verifyParamsLength(args, 5);
+ if (!isValid) {
+ removeUsage();
+ System.exit(1);
+ }
+ ProductLogic productLogic = new ProductLogic();
+ boolean result = productLogic.deleteAllProducts(args[1], args[2], args[3], args[4]);
+
+ if (!result) {
+ System.exit(2);
+ }
+ }else {
removeUsage();
- System.exit(1);
}
-
- ProductLogic productLogic = new ProductLogic();
- boolean result = productLogic.deleteAllProducts(args[1], args[2], args[3], args[4]);
-
- if (result == false) {
- System.exit(2);
- }
- break;
- default:
- removeUsage();
}
-
}
private static void removeUsage() {