Merge "Add correlationId to ServiceInstancesRequest"
[so.git] / mso-api-handlers / mso-api-handler-infra / src / main / java / org / openecomp / mso / apihandlerinfra / ServiceInstances.java
index 2070b22..581ad34 100644 (file)
@@ -782,7 +782,7 @@ public class ServiceInstances {
 
                // BPEL accepted the request, the request is in progress
                if (bpelStatus == HttpStatus.SC_ACCEPTED) {
-                       String camundaJSONResponseBody = respHandler.getResponseBody ();
+                       String camundaJSONResponseBody = respHandler.getContent();
                        msoLogger.debug ("Received from Camunda: " + camundaJSONResponseBody);
                        msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS);
                        (RequestsDatabase.getInstance()).updateInfraStatus (msoRequest.getRequestId (),
@@ -795,7 +795,7 @@ public class ServiceInstances {
                } else {
                        List<String> variables = new ArrayList<>();
                        variables.add(bpelStatus + "");
-                       String camundaJSONResponseBody = respHandler.getResponseBody ();
+                       String camundaJSONResponseBody = respHandler.getContent();
                        if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) {
                                msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
                                Response resp =  msoRequest.buildServiceErrorResponse(bpelStatus,
@@ -968,15 +968,15 @@ public class ServiceInstances {
                RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters();
                if(reqParam!=null && reqParam.isaLaCarte()!=null && reqParam.isaLaCarte() && recipe==null){
                        return null;
+               } else if (recipe==null) {
+                       //aLaCarte wasn't sent, so we'll try the default
+                       serviceRecord = db.getServiceByModelName(defaultSourceServiceModelName);
+                       if (serviceRecord == null) {
+                               serviceRecord = db.getServiceByModelName(defaultServiceModelName);
+                       }
+                       recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
                }
 
-               //aLaCarte wasn't sent, so we'll try the default
-               serviceRecord = db.getServiceByModelName(defaultSourceServiceModelName);
-               if (serviceRecord == null) {
-                       serviceRecord = db.getServiceByModelName(defaultServiceModelName);
-               }
-
-               recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
                if(modelInfo.getModelVersionId() == null) {
                        modelInfo.setModelVersionId(serviceRecord.getModelUUID());
                }