From b67d61fa3ed22f967f00bb12ceab40ad83700e17 Mon Sep 17 00:00:00 2001 From: Srivahni Chivukula Date: Tue, 18 Sep 2018 08:32:49 -0700 Subject: Add homing to CreateGenericALaCarteService flow Created HomingBB.bpmn in so-bpmn-building-blocks and updated AssignVnfBB to use HomingBB.bpmn. HomingBB.bpmn is made capable of using Sniro/OOF Issue-ID: SO-927 Change-Id: I19c8ada96485f563c2756a22ad3bee4c9367953b Signed-off-by: Marcus G K Williams Signed-off-by: Srivahni Chivukula --- .../subprocess/BuildingBlock/AssignVnfBB.bpmn | 2 +- .../subprocess/BuildingBlock/HomingBB.bpmn | 208 +++++++ .../CreateGenericALaCarteServiceInstance.groovy | 666 +++++++++++---------- .../CreateGenericALaCarteServiceInstance.bpmn | 177 ++++-- 4 files changed, 698 insertions(+), 355 deletions(-) create mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn mode change 100644 => 100755 bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy mode change 100644 => 100755 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn (limited to 'bpmn') diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn index 8765bca20c..eaee5399e6 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn @@ -33,7 +33,7 @@ - + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn new file mode 100644 index 0000000000..67ee5d0f74 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn @@ -0,0 +1,208 @@ + + + + + SequenceFlow_1x9usa6 + + + SequenceFlow_1x9usa6 + SequenceFlow_0lc15i7 + import org.onap.so.bpmn.common.scripts.* +if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")).getVariable("homingService") == "oof"){ + OofHoming oofHoming = new OofHoming() + oofHoming.callOof(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) +}else{ + SniroHomingV2 sniroHoming = new SniroHomingV2() + SniroHoming.callSniro(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) +} + + + + + SequenceFlow_1rf4vs8 + + + + SequenceFlow_00nlh7l + + + + SequenceFlow_00nlh7l + SequenceFlow_1rf4vs8 + import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processSubflowsBPMNException(execution) + + + + + + + SequenceFlow_0kamg53 + SequenceFlow_1o7154s + import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution) + + + SequenceFlow_0kamg53 + + + + SequenceFlow_1o7154s + + + + + + + SequenceFlow_1fipbmk + SequenceFlow_01apjvo + import org.onap.so.bpmn.common.scripts.* +if(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")).getVariable("homingService") == "oof"){ + OofHoming oofHoming = new OofHoming() + oofHoming.processHomingSolution(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution"))) +}else{ + SniroHomingV2 sniroHoming = new SniroHomingV2 () + sniroHoming.processSolution(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), asyncResponse) +} + + + + + + + + + + + SequenceFlow_0lc15i7 + SequenceFlow_1fipbmk + + + + + SequenceFlow_01apjvo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy old mode 100644 new mode 100755 index 4405718c57..968612301d --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy @@ -18,7 +18,10 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts + +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.VnfResource; import static org.apache.commons.lang3.StringUtils.*; @@ -43,315 +46,358 @@ import groovy.json.* * */ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskProcessor { - String Prefix="CRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class); - - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - - try { - - String siRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(siRequest) - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - serviceInstanceId = UUID.randomUUID().toString() - msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId) - } else { - msoLogger.debug("Using provided Service Instance ID:" + serviceInstanceId) - } - - serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - //subscriberInfo - String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId' is null" - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //requestInfo - execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) - execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) - execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) - String productFamilyId = null; - try { - productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") - } catch (JSONException e) { - productFamilyId = null; - } - if (isBlank(productFamilyId)) - { - msg = "Input productFamilyId is null" - msoLogger.debug(msg) - //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("productFamilyId", productFamilyId) - } - - //modelInfo - String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") - if (isBlank(serviceModelInfo)) { - msg = "Input serviceModelInfo is null" - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else - { - execution.setVariable("serviceModelInfo", serviceModelInfo) - } - - msoLogger.debug("modelInfo" + serviceModelInfo) - - //requestParameters - String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") - if (isBlank(subscriptionServiceType)) { - msg = "Input subscriptionServiceType is null" - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - Map reqMap = jsonSlurper.parseText(siRequest) - - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map inputMap = [:] - if (userParams) { - userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value.toString()) - } - } - - msoLogger.debug("User Input Parameters map: " + userParams.toString()) - execution.setVariable("serviceInputParams", inputMap) - - //TODO - //execution.setVariable("failExists", true) - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit preProcessRequest") - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start sendSyncResponse") - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - // RESTResponse for API Handler (APIH) Reply Task - String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) - sendWorkflowResponse(execution, 202, createServiceRestRequest) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit sendSyncResopnse") - } - - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Start sendSyncError") - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${MsoUtils.xmlEscape(errorMessage)} - 7000 - """ - - msoLogger.debug(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) - } - - } - - // ******************************* - // - // ******************************* - public void prepareDecomposeService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ") - try { - String siRequest = execution.getVariable("bpmnRequest") - String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") - execution.setVariable("serviceModelInfo", serviceModelInfo) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance") - } - - - // ******************************* - // - // ******************************* - public void prepareCreateServiceInstance(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class); + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + + try { + + String siRequest = execution.getVariable("bpmnRequest") + msoLogger.debug(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId) + } else { + msoLogger.debug("Using provided Service Instance ID:" + serviceInstanceId) + } + + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = null; + try { + productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + } catch (JSONException e) { + productFamilyId = null; + } + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + msoLogger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + msoLogger.debug("modelInfo" + serviceModelInfo) + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map inputMap = [:] + if (userParams) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value.toString()) + } + } + + msoLogger.debug("User Input Parameters map: " + userParams.toString()) + execution.setVariable("serviceInputParams", inputMap) + + //TODO + //execution.setVariable("failExists", true) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit preProcessRequest") + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start sendSyncResponse") + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit sendSyncResopnse") + } + + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Start sendSyncError") + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${MsoUtils.xmlEscape(errorMessage)} + 7000 + """ + + msoLogger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + + } + + // ******************************* + // + // ******************************* + public void prepareDecomposeService(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ") + try { + String siRequest = execution.getVariable("bpmnRequest") + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance") + } + + public void processDecomposition(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + msoLogger.trace("Inside processDecomposition() of CreateGenericALaCarteServiceInstance ") + + try { + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + // VNFs + List vnfList = serviceDecomposition.getVnfResources() + filterVnfs(vnfList) + serviceDecomposition.setVnfResources(vnfList) + + execution.setVariable("vnfList", vnfList) + execution.setVariable("vnfListString", vnfList.toString()) + + String vnfModelInfoString = "" + if (vnfList != null && vnfList.size() > 0) { + execution.setVariable(Prefix + "VNFsCount", vnfList.size()) + msoLogger.debug("vnfs to create: " + vnfList.size()) + ModelInfo vnfModelInfo = vnfList[0].getModelInfo() + + vnfModelInfoString = vnfModelInfo.toString() + String vnfModelInfoWithRoot = vnfModelInfo.toString() + vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") + } else { + execution.setVariable(Prefix + "VNFsCount", 0) + msoLogger.debug("no vnfs to create based upon serviceDecomposition content") + } + + execution.setVariable("vnfModelInfo", vnfModelInfoString) + execution.setVariable("vnfModelInfoString", vnfModelInfoString) + msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + + msoLogger.trace("Completed processDecomposition() of CreateGenericALaCarteServiceInstance ") + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. processDecomposition() - " + ex.getMessage() + msoLogger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - try { - msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance") + try { + msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance") - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - def siRequest = execution.getVariable("bpmnRequest") - Map reqMap = jsonSlurper.parseText(siRequest) - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - Map inputMap = [:] - if (userParams != null) { - userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value) - } - } - - msoLogger.debug("User Input Parameters map: " + userParams.toString()) - execution.setVariable("serviceInputParams", inputMap) - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId) - - String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName") - serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName) - execution.setVariable("serviceInstanceName", serviceInstanceName) - execution.setVariable("serviceDecomposition", serviceDecomposition) - execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) - msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName()) - - msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ") - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - - public void prepareCompletionRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("prepareCompletion *** ") - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String source = execution.getVariable("source") - - String msoCompletionRequest = - """ - - ${MsoUtils.xmlEscape(requestId)} - CREATE - ${MsoUtils.xmlEscape(source)} - - Service Instance was created successfully. - ${MsoUtils.xmlEscape(serviceInstanceId)} - CreateGenericALaCarteServiceInstance - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - execution.setVariable("completionRequest", xmlMsoCompletionRequest) - msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit prepareCompletionRequest") - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("prepareFalloutRequest") - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = - """ - ${MsoUtils.xmlEscape(requestId)} - CREATE - ${MsoUtils.xmlEscape(source)} - """ - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) - String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = - """ - - ${MsoUtils.xmlEscape(requestId)} - CREATE - VID - - - ${MsoUtils.xmlEscape(errorException)} - 7000 - - """ - - execution.setVariable("falloutRequest", falloutRequest) - } - msoLogger.trace("Exit prepareFalloutRequest") - } + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + def siRequest = execution.getVariable("bpmnRequest") + Map reqMap = jsonSlurper.parseText(siRequest) + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + Map inputMap = [:] + if (userParams != null) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value) + } + } + + msoLogger.debug("User Input Parameters map: " + userParams.toString()) + execution.setVariable("serviceInputParams", inputMap) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId) + + String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName") + serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName) + execution.setVariable("serviceInstanceName", serviceInstanceName) + execution.setVariable("serviceDecomposition", serviceDecomposition) + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) + msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName()) + + msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ") + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + public void prepareCompletionRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("prepareCompletion *** ") + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + + Service Instance was created successfully. + ${MsoUtils.xmlEscape(serviceInstanceId)} + CreateGenericALaCarteServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit prepareCompletionRequest") + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.trace("prepareFalloutRequest") + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + msoLogger.debug(" Input Workflow Exception: " + wfex.toString()) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """ + ${MsoUtils.xmlEscape(requestId)} + CREATE + ${MsoUtils.xmlEscape(source)} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage()) + String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """ + + ${MsoUtils.xmlEscape(requestId)} + CREATE + VID + + + ${MsoUtils.xmlEscape(errorException)} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + msoLogger.trace("Exit prepareFalloutRequest") + } } \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn old mode 100644 new mode 100755 index 50e65dcaad..9e2049732a --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0lp2z7l @@ -39,7 +39,7 @@ ex.processJavaException(execution)]]> - SequenceFlow_1hjh5zy + SequenceFlow_1fv5tk6 SequenceFlow_1lj31zp @@ -174,17 +174,62 @@ csi.prepareDecomposeService(execution)]]> SequenceFlow_1o3ihrh - SequenceFlow_1o3ihrh - SequenceFlow_14ajbme + SequenceFlow_1hjh5zy + SequenceFlow_1fv5tk6 - + - - + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0bng27u + SequenceFlow_14ajbme + + + SequenceFlow_0vcumrm + SequenceFlow_0bng27u + + + + + + SequenceFlow_1o3ihrh + SequenceFlow_0vcumrm + SequenceFlow_0xrox26 + + + + + + SequenceFlow_0xrox26 + + + @@ -229,19 +274,19 @@ csi.prepareCreateServiceInstance(execution)]]> - + - + - + - - + + - + @@ -255,16 +300,16 @@ csi.prepareCreateServiceInstance(execution)]]> - + - + - - + + - + @@ -303,10 +348,10 @@ csi.prepareCreateServiceInstance(execution)]]> - - + + - + @@ -341,33 +386,31 @@ csi.prepareCreateServiceInstance(execution)]]> - + - + - + - + - - - - + + - + - - - - + + + + - + @@ -396,9 +439,9 @@ csi.prepareCreateServiceInstance(execution)]]> - + - + @@ -408,7 +451,7 @@ csi.prepareCreateServiceInstance(execution)]]> - + @@ -419,9 +462,9 @@ csi.prepareCreateServiceInstance(execution)]]> - + - + @@ -434,17 +477,63 @@ csi.prepareCreateServiceInstance(execution)]]> - - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg