Remove dead code
[clamp.git] / src / main / java / org / onap / clamp / clds / model / actions / ActionsHandler.java
index bafe48d..9aed447 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -68,68 +68,69 @@ public interface ActionsHandler {
         List<String> permittedActions;
         String actionCd = getCurrentActionCd(event);
         switch (actionCd) {
-        case CldsEvent.ACTION_CREATE:
-            permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
-            if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
-                permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY,
-                    CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
-            }
-            break;
-        case CldsEvent.ACTION_SUBMIT:
-        case CldsEvent.ACTION_RESUBMIT:
-        case CldsEvent.ACTION_DISTRIBUTE:
-            permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT,
-                CldsEvent.ACTION_DELETE);
-            if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
-                permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_SUBMITDCAE,
-                    CldsEvent.ACTION_DELETE);
-            }
-            break;
-        case CldsEvent.ACTION_SUBMITDCAE:
-            permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
-            break;
-        case CldsEvent.ACTION_SUBMITPOLICY:
-            permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
-            break;
-        case CldsEvent.ACTION_UNDEPLOY:
-            permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
-                CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE);
-            if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
-                permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
-                    CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
-            }
-            break;
-        case CldsEvent.ACTION_DEPLOY:
-            permittedActions = Arrays.asList(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
-            break;
-        case CldsEvent.ACTION_RESTART:
-        case CldsEvent.ACTION_UPDATE:
-            permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP,
-                CldsEvent.ACTION_UNDEPLOY);
-            if (isTypeModel(propText, ModelType.POLICY_MODEL)) {
+            case CldsEvent.ACTION_CREATE:
+                permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST,
+                        CldsEvent.ACTION_DELETE);
+                if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
+                    permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY,
+                            CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE);
+                }
+                break;
+            case CldsEvent.ACTION_SUBMIT:
+            case CldsEvent.ACTION_RESUBMIT:
+            case CldsEvent.ACTION_DISTRIBUTE:
+                permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT,
+                        CldsEvent.ACTION_DELETE);
+                if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
+                    permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_SUBMITDCAE,
+                            CldsEvent.ACTION_DELETE);
+                }
+                break;
+            case CldsEvent.ACTION_SUBMITDCAE:
+                permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
+                break;
+            case CldsEvent.ACTION_SUBMITPOLICY:
                 permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
-            }
-            break;
-        case CldsEvent.ACTION_STOP:
-            permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
-                CldsEvent.ACTION_UNDEPLOY);
-            if (isTypeModel(propText, ModelType.POLICY_MODEL)) {
+                break;
+            case CldsEvent.ACTION_UNDEPLOY:
+                permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
+                        CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE);
+                if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) {
+                    permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY,
+                            CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE);
+                }
+                break;
+            case CldsEvent.ACTION_DEPLOY:
+                permittedActions = Arrays.asList(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_UPDATE,
+                        CldsEvent.ACTION_STOP);
+                break;
+            case CldsEvent.ACTION_RESTART:
+            case CldsEvent.ACTION_UPDATE:
+                permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE,
+                        CldsEvent.ACTION_STOP, CldsEvent.ACTION_UNDEPLOY);
+                if (isTypeModel(propText, ModelType.POLICY_MODEL)) {
+                    permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP);
+                }
+                break;
+            case CldsEvent.ACTION_STOP:
                 permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
-                    CldsEvent.ACTION_DELETE);
-            }
-            break;
-        default:
-            getLogger().warn("Invalid current actionCd: " + actionCd);
-            permittedActions = Arrays.asList();
+                        CldsEvent.ACTION_UNDEPLOY);
+                if (isTypeModel(propText, ModelType.POLICY_MODEL)) {
+                    permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART,
+                            CldsEvent.ACTION_DELETE);
+                }
+                break;
+            default:
+                getLogger().warn("Invalid current actionCd: " + actionCd);
+                permittedActions = Arrays.asList();
         }
         return permittedActions;
     }
 
     /**
-     * This method returns the action of the event or a default one if not found.
+     * This returns the action of the event or a default one if not found.
      *
-     * @param event
-     *        The last event
+     * @param event The last event
      * @return The action
      */
     default String getCurrentActionCd(CldsEvent event) {
@@ -157,8 +158,8 @@ public interface ActionsHandler {
                 JsonObject modelJson = JsonUtils.GSON.fromJson(propText, JsonObject.class);
                 JsonElement modelJsonOfType = modelJson.get(key.getType());
                 if (modelJsonOfType != null
-                    && modelJsonOfType.isJsonPrimitive()
-                    && modelJsonOfType.getAsJsonPrimitive().getAsBoolean()) {
+                        && modelJsonOfType.isJsonPrimitive()
+                        && modelJsonOfType.getAsJsonPrimitive().getAsBoolean()) {
                     result = true;
                 }
             }