Merge "Update resource parameters node task"
authorSeshu Kumar M <seshu.kumar.m@huawei.com>
Wed, 14 Mar 2018 10:58:19 +0000 (10:58 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 14 Mar 2018 10:58:19 +0000 (10:58 +0000)
1  2 
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy

@@@ -32,6 -32,7 +32,7 @@@ import org.openecomp.mso.bpmn.core.doma
  import org.openecomp.mso.bpmn.core.domain.NetworkResource
  import org.openecomp.mso.bpmn.core.domain.VnfResource
  import org.openecomp.mso.bpmn.common.recipe.ResourceInput
+ import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder;
  import org.openecomp.mso.bpmn.common.recipe.BpmnRestClient
  import org.openecomp.mso.bpmn.core.json.JsonUtils
  import org.openecomp.mso.bpmn.common.scripts.AaiUtil
@@@ -51,7 -52,7 +52,7 @@@ import java.util.UUID
  import javax.mail.Quota.Resource;
  
  import org.camunda.bpm.engine.delegate.BpmnError
 -import org.camunda.bpm.engine.runtime.Execution
 +import org.camunda.bpm.engine.delegate.DelegateExecution
  import org.json.JSONObject;
  import org.json.JSONArray;
  import org.apache.commons.lang3.*
@@@ -90,7 -91,7 +91,7 @@@ public class DoCreateE2EServiceInstanc
        JsonUtils jsonUtil = new JsonUtils()
        CatalogDbUtils cutils = new CatalogDbUtils()
  
 -      public void preProcessRequest (Execution execution) {
 +      public void preProcessRequest (DelegateExecution execution) {
                def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
                String msg = ""
                utils.log("INFO"," ***** preProcessRequest *****",  isDebugEnabled)
                utils.log("INFO"," ***** Exit preProcessRequest *****",  isDebugEnabled)
        }
        
 -   public void prepareDecomposeService(Execution execution) {
 +   public void prepareDecomposeService(DelegateExecution execution) {
          def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
  
          try {
          }
       }
  
 -    public void processDecomposition (Execution execution) {
 +    public void processDecomposition(DelegateExecution execution) {
          def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
      
          utils.log("DEBUG", " ***** Inside processDecomposition() of  create generic e2e service flow ***** ", isDebugEnabled)    
          }
      }
      
 -    public void doServiceHoming(Execution execution) {
 +    public void doServiceHoming(DelegateExecution execution) {
          //Now Homing is not clear. So to be implemented.
      }
      
 -      public void postProcessAAIGET(Execution execution) {
 +      public void postProcessAAIGET(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled)
                String msg = ""
                utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
        }
  
 -      public void postProcessAAIPUT(Execution execution) {
 +      public void postProcessAAIPUT(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                utils.log("INFO"," ***** postProcessAAIPUT ***** ", isDebugEnabled)
                String msg = ""
                utils.log("INFO"," *** Exit postProcessAAIPUT *** ", isDebugEnabled)
        }
        
 -      public void postProcessAAIGET2(Execution execution) {
 +      public void postProcessAAIGET2(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                utils.log("INFO"," ***** postProcessAAIGET2 ***** ", isDebugEnabled)
                String msg = ""
                utils.log("INFO"," *** Exit postProcessAAIGET2 *** ", isDebugEnabled)
        }
  
 -      public void preProcessRollback (Execution execution) {
 +      public void preProcessRollback (DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                utils.log("INFO"," ***** preProcessRollback ***** ", isDebugEnabled)
                try {
                utils.log("INFO"," *** Exit preProcessRollback *** ", isDebugEnabled)
        }
  
 -      public void postProcessRollback (Execution execution) {
 +      public void postProcessRollback (DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
                utils.log("INFO"," ***** postProcessRollback ***** ", isDebugEnabled)
                String msg = ""
                utils.log("INFO"," *** Exit postProcessRollback *** ", isDebugEnabled)
        }
  
 -      public void preInitResourcesOperStatus(Execution execution){
 +      public void preInitResourcesOperStatus(DelegateExecution execution){
          def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
  
          utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
           resourceInput.setResourceUuid(resourceUuid)
           
           String incomingRequest = execution.getVariable("uuiRequest")
-          String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
-          String serviceRequestInputs = jsonUtil.getJsonValue(incomingRequest, "service.parameters.requestInputs")
-          String serviceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")  
-          resourceInput.setResourceInstanceDes(serviceDescription)
-          utils.log("INFO", "Prepare Resource Request:" + resourceInput.toString(), isDebugEnabled)
-          List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
-          String locationConstraints = ""
-          String resourceRequestInputs = ""
-          for(String resource : resourceList){
-              String resourceUuidTmp = jsonUtil.getJsonValue(resource, "resourceUuid")  
-              String resourceCustomizationUuidTmp = jsonUtil.getJsonValue(resource, "resourceCustomizationUuid")  
-              if(StringUtils.equals(resourceUuidTmp, resourceUuid) && StringUtils.equals(resourceCustomizationUuidTmp, resourceCustomizationUuid)){
-                  String resourceParameters = jsonUtil.getJsonValue(resource, "parameters")                
-                  locationConstraints =  jsonUtil.getJsonValue(resourceParameters, "locationConstraints")
-                  resourceRequestInputs =  jsonUtil.getJsonValue(resourceParameters, "requestInputs")
-              } 
-          }
           //set the requestInputs from tempalte  To Be Done
-          //String resourceParameters = ResourceRequestBuilder.buildRequestParameters()
-          String resourceParameters = ""
+          String serviceModelUuid = execution.getVariable("modelUuid")
+          String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
+          String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
           resourceInput.setResourceParameters(resourceParameters)
           execution.setVariable("resourceInput", resourceInput)
           utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled)