AAI Distribution delay is now set during the flow

Change-Id: I2afbe144608925fc8aef6bf200daef85151b5899
Issue-ID: SO-1099
Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml
index 92e8f58..0959173 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml
@@ -3,6 +3,7 @@
   dme2:
     timeout: '30000'
   endpoint: http://localhost:8443
+  workflowAaiDistributionDelay: PT30S
 camunda:
   bpm:
     admin-user:
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
index dd135f3..c5f712c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
@@ -21,7 +21,6 @@
 
 import static org.apache.commons.lang3.StringUtils.*
 
-import org.apache.commons.lang3.*
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -32,6 +31,7 @@
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.domain.*
 import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.logger.MessageEnum
 import org.onap.so.logger.MsoLogger
 import org.springframework.web.util.UriUtils;
@@ -61,7 +61,7 @@
      * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
      * @param execution
      */
-    public InitializeProcessVariables(DelegateExecution execution) {
+    private InitializeProcessVariables(DelegateExecution execution) {
         /* Initialize all the process variables in this block */
 
         execution.setVariable("createVcpeServiceRequest", "")
@@ -99,9 +99,9 @@
             InitializeProcessVariables(execution)
 
             //Config Inputs
-            String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay')
+            String aaiDistDelay = UrnPropertiesReader.getVariable("aai.workflowAaiDistributionDelay")
             if (isBlank(aaiDistDelay)) {
-                msg = "URN_mso_workflow_aai_distribution_delay is null"
+                String msg = "workflowAaiDistributionDelay is null"
                 msoLogger.debug(msg)
                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
             }
@@ -191,7 +191,6 @@
             * Extracting User Parameters from incoming Request and converting into a Map
             */
             def jsonSlurper = new JsonSlurper()
-            def jsonOutput = new JsonOutput()
 
             Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest)
 
@@ -270,7 +269,6 @@
     }
 
     public void sendSyncResponse(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
 
         msoLogger.trace("Inside sendSyncResponse of CreateVcpeResCustService ")
 
@@ -296,7 +294,6 @@
     //
     // *******************************
     public void prepareDecomposeService(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
 
         try {
             msoLogger.trace("Inside prepareDecomposeService of CreateVcpeResCustService ")
@@ -319,7 +316,6 @@
     //
     // *******************************
     public void prepareCreateServiceInstance(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
 
         try {
             msoLogger.trace("Inside prepareCreateServiceInstance of CreateVcpeResCustService ")
@@ -351,7 +347,6 @@
 
     public void postProcessServiceInstanceCreate(DelegateExecution execution) {
         def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + 'execution=' + execution.getId() + ')'
-        def isDebugLogEnabled = execution.getVariable(DebugFlag)
         msoLogger.trace('Entered ' + method)
 
         String requestId = execution.getVariable("mso-request-id")
@@ -387,7 +382,6 @@
 
 
     public void processDecomposition(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
 
         msoLogger.trace("Inside processDecomposition() of CreateVcpeResCustService ")
 
@@ -450,7 +444,6 @@
 
 
     public void prepareCreateAllottedResourceTXC(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
 
         try {
             msoLogger.trace("Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ")
@@ -461,7 +454,6 @@
              *      ModelInfo modelInfo = serviceDecomposition.getModelInfo()
              *
              */
-            String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
             ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
 
             //allottedResourceModelInfo
@@ -504,7 +496,6 @@
     }
 
     public void prepareCreateAllottedResourceBRG(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
 
         try {
             msoLogger.trace("Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ")
@@ -515,7 +506,6 @@
              *      ModelInfo modelInfo = serviceDecomposition.getModelInfo()
              *
              */
-            String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
             ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
 
             //allottedResourceModelInfo
@@ -561,7 +551,6 @@
     //     Generate Network request Section
     // *******************************
     public void prepareVnfAndModulesCreate(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
 
         try {
             msoLogger.trace("Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ")
@@ -630,7 +619,6 @@
     //     Validate Vnf request Section -> increment count
     // *******************************
     public void validateVnfCreate(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
 
         try {
             msoLogger.trace("Inside validateVnfCreate of CreateVcpeResCustService ")
@@ -652,7 +640,6 @@
     //     Prepare Completion request Section
     // *****************************************
     public void postProcessResponse(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
 
         msoLogger.trace("Inside postProcessResponse of CreateVcpeResCustService ")
 
@@ -691,7 +678,6 @@
     }
 
     public void preProcessRollback(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
         msoLogger.trace("preProcessRollback of CreateVcpeResCustService ")
         try {
 
@@ -712,7 +698,6 @@
     }
 
     public void postProcessRollback(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
         msoLogger.trace("postProcessRollback of CreateVcpeResCustService ")
         String msg = ""
         try {
@@ -732,7 +717,6 @@
     }
 
     public void prepareFalloutRequest(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
 
         msoLogger.trace("STARTED CreateVcpeResCustService prepareFalloutRequest Process ")
 
@@ -764,7 +748,6 @@
 
 
     public void sendSyncError(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
         execution.setVariable("prefix", Prefix)
 
         msoLogger.trace("Inside sendSyncError() of CreateVcpeResCustService ")
@@ -792,7 +775,6 @@
     }
 
     public void processJavaException(DelegateExecution execution) {
-        def isDebugEnabled = execution.getVariable(DebugFlag)
         execution.setVariable("prefix", Prefix)
         try {
             msoLogger.debug("Caught a Java Exception")