summaryrefslogtreecommitdiffstats
path: root/asdctool/src
diff options
context:
space:
mode:
Diffstat (limited to 'asdctool/src')
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java68
1 files changed, 25 insertions, 43 deletions
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 236f819063..cad059cd01 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
@@ -7,9 +7,9 @@
* 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.
@@ -27,45 +27,27 @@ import org.openecomp.sdc.asdctool.impl.ProductLogic;
*/
public class RemoveUtils {
- public static void main(String[] args) {
-
- if (args == null || args.length < 1) {
- removeUsage();
- }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();
- }
- }
- }
-
- private static void removeUsage() {
- System.out.println("Usage: remove-products <janusgraph.properties> <BE host> <BE port> <admin user>");
- }
-
- private static boolean verifyParamsLength(String[] args, int i) {
- if (args == null) {
- if (i > 0) {
- return false;
- }
- return true;
- }
-
- if (args.length >= i) {
- return true;
- }
- return false;
- }
+ public static void main(String[] args) {
+ if (args == null || args.length == 0) {
+ showRemoveUsage();
+ System.exit(1);
+ } else if (args[0].equalsIgnoreCase("remove-products") && verifyParamsLength(args, 5)) {
+ if (!new ProductLogic().deleteAllProducts(args[1], args[2], args[3], args[4])) {
+ System.exit(2);
+ }
+ } else {
+ showRemoveUsage();
+ }
+ }
+
+ private static void showRemoveUsage() {
+ System.out.println("Usage: remove-products <janusgraph.properties> <BE host> <BE port> <admin user>");
+ }
+
+ private static boolean verifyParamsLength(String[] args, int nbOfArgumentsMin) {
+ if (args == null) {
+ return nbOfArgumentsMin == 0;
+ }
+ return args.length >= nbOfArgumentsMin;
+ }
}