Merge "Reorder modifiers"
[so.git] / bpmn / MSOCommonBPMN / src / main / groovy / org / openecomp / mso / bpmn / common / scripts / UpdateAAIVfModule.groovy
index 7283a3e..b3a9423 100644 (file)
@@ -1,6 +1,6 @@
 /*-\r
  * ============LICENSE_START=======================================================\r
- * OPENECOMP - MSO\r
+ * ONAP - SO\r
  * ================================================================================\r
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
  * ================================================================================\r
@@ -21,7 +21,7 @@
 package org.openecomp.mso.bpmn.common.scripts\r
 \r
 import org.camunda.bpm.engine.delegate.BpmnError\r
-import org.camunda.bpm.engine.runtime.Execution\r
+import org.camunda.bpm.engine.delegate.DelegateExecution\r
 import org.openecomp.mso.bpmn.core.WorkflowException\r
 import org.openecomp.mso.rest.APIResponse\r
 import org.springframework.web.util.UriUtils\r
@@ -37,7 +37,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
         *\r
         * @param execution The flow's execution instance.\r
         */\r
-       public void initProcessVariables(Execution execution) {\r
+       public void initProcessVariables(DelegateExecution execution) {\r
                execution.setVariable('prefix', 'UAAIVfMod_')\r
                execution.setVariable('UAAIVfMod_vnfId', null)\r
                execution.setVariable('UAAIVfMod_vfModuleId', null)\r
@@ -55,7 +55,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
         *\r
         * @param execution The flow's execution instance.\r
         */\r
-       public void preProcessRequest(Execution execution) {\r
+       public void preProcessRequest(DelegateExecution execution) {\r
                def method = getClass().getSimpleName() + '.preProcessRequest(' +\r
                        'execution=' + execution.getId() +\r
                        ')'\r
@@ -89,7 +89,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
         *\r
         * @param execution The flow's execution instance.\r
         */\r
-       public void getVfModule(Execution execution) {\r
+       public void getVfModule(DelegateExecution execution) {\r
                def method = getClass().getSimpleName() + '.getVfModule(' +\r
                        'execution=' + execution.getId() +\r
                        ')'\r
@@ -133,11 +133,11 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
        }\r
 \r
        /**\r
-        * Construct and send a PUT request to AAI to update the VF Module.\r
+        * Construct and send a PATCH request to AAI to update the VF Module.\r
         *\r
         * @param execution The flow's execution instance.\r
         */\r
-       public void updateVfModule(Execution execution) {\r
+       public void updateVfModule(DelegateExecution execution) {\r
                def method = getClass().getSimpleName() + '.updateVfModule(' +\r
                        'execution=' + execution.getId() +\r
                        ')'\r
@@ -176,7 +176,11 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
                                doPersonaModelVersion = false\r
                        } else {\r
                                // Confirm "new" persona-model-id is same as "current" persona-model-id\r
-                               def String currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'persona-model-id')\r
+                               def String currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'model-invariant-id')\r
+                               if (currPersonaModelId == null) {\r
+                                       // check the old attribute name\r
+                                       currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'model-version-id')\r
+                               }\r
                                if (currPersonaModelId == null) {\r
                                        currPersonaModelId = ''\r
                                }\r
@@ -334,7 +338,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
         *\r
         * @param execution The flow's execution instance.\r
         */\r
-       public void handleAAIQueryFailure(Execution execution) {\r
+       public void handleAAIQueryFailure(DelegateExecution execution) {\r
                def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +\r
                        'execution=' + execution.getId() +\r
                        ')'\r
@@ -357,7 +361,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
         *\r
         * @param execution The flow's execution instance.\r
         */\r
-       public void handleUpdateVfModuleFailure(Execution execution) {\r
+       public void handleUpdateVfModuleFailure(DelegateExecution execution) {\r
                def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +\r
                        'execution=' + execution.getId() +\r
                        ')'\r