AT&T 1712 and 1802 release code
[so.git] / bpmn / MSOCommonBPMN / src / main / groovy / org / openecomp / mso / bpmn / common / scripts / VnfAdapterRestV1.groovy
index dbcab28..5f2a845 100644 (file)
@@ -22,7 +22,7 @@ package org.openecomp.mso.bpmn.common.scripts
 \r
 import org.apache.commons.lang3.*\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.rest.APIResponse\r
 import org.openecomp.mso.rest.RESTClient\r
 import org.openecomp.mso.rest.RESTConfig\r
@@ -32,7 +32,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
        ExceptionUtil exceptionUtil = new ExceptionUtil()\r
 \r
        // VNF Response Processing\r
-       public void preProcessRequest (Execution execution) {\r
+       public void preProcessRequest (DelegateExecution execution) {\r
                def method = getClass().getSimpleName() + '.preProcessRequest(' +\r
                        'execution=' + execution.getId() +\r
                        ')'\r
@@ -58,6 +58,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 \r
                        String messageId = getChildText(root, 'messageId')\r
 \r
+                       if ('rollbackVolumeGroupRequest'.equals(requestType)) {\r
+                               messageId = getMessageIdForVolumeGroupRollback(root)\r
+                       }\r
+                       \r
                        if (messageId == null || messageId.isEmpty()) {\r
                                String msg = getProcessKey(execution) + ': no messageId in ' + requestType\r
                                logError(msg)\r
@@ -219,7 +223,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                                vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')\r
 \r
                        } else if ('rollbackVolumeGroupRequest'.equals(requestType)) {\r
-                               String volumeGroupId = getChildText(root, 'volumeGroupId')\r
+                               String volumeGroupId = root.'volumeGroupRollback'.'volumeGroupId'.text()\r
 \r
                                if (volumeGroupId == null || volumeGroupId.isEmpty()) {\r
                                        String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType\r
@@ -274,11 +278,15 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                }\r
        }\r
 \r
+       public String getMessageIdForVolumeGroupRollback(Node root) {\r
+               return root.'volumeGroupRollback'.'messageId'.text()\r
+       }\r
+       \r
        /**\r
         * This method is used instead of an HTTP Connector task because the\r
         * connector does not allow DELETE with a body.\r
         */\r
-       public void sendRequestToVnfAdapter(Execution execution) {\r
+       public void sendRequestToVnfAdapter(DelegateExecution execution) {\r
                def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +\r
                        'execution=' + execution.getId() +\r
                        ')'\r
@@ -324,7 +332,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                }\r
        }\r
 \r
-       public void processCallback(Execution execution){\r
+       public void processCallback(DelegateExecution execution){\r
                def method = getClass().getSimpleName() + '.processCallback(' +\r
                        'execution=' + execution.getId() +\r
                        ')'\r
@@ -360,7 +368,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
         * a WorkflowException.  If the response cannot be parsed, a more generic\r
         * WorkflowException is created.\r
         */\r
-       public void vnfAdapterWorkflowException(Execution execution, Object response) {\r
+       public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) {\r
                try {\r
                        Node root = new XmlParser().parseText(response)\r
                        String category = getChildText(root, "category")\r