aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN
diff options
context:
space:
mode:
authorc00149107 <chenchuanyu@huawei.com>2017-09-18 11:45:40 +0800
committerc00149107 <chenchuanyu@huawei.com>2017-09-18 11:45:40 +0800
commitd969d13a4041a26535edcbaa5b5b9efbfb5329ee (patch)
tree524678333f09fbb0fb52f239bdfb53fd6a2812d6 /bpmn/MSOInfrastructureBPMN
parent82280d1d3e9789ccd25dd4dc131a9f86647c6b2f (diff)
Add sync response task
Add sync response task for e2e service flow Change-Id: I3b17e0103fb3e7cb4ba41d076bc6014acc1d295c Issue-ID:SO-57 Signed-off-by: c00149107 <chenchuanyu@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericE2EServiceInstance.groovy41
1 files changed, 40 insertions, 1 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericE2EServiceInstance.groovy
index ab96c0b65b..3302210416 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericE2EServiceInstance.groovy
@@ -50,6 +50,13 @@ public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcesso
VidUtils vidUtils = new VidUtils()
+ /**
+ * Pre Process the BPMN Flow Request
+ * Inclouds:
+ * Deal with the parameters
+ * generate the service instance id
+ * generate the operation id
+ */
public void preProcessRequest (Execution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
String msg = ""
@@ -70,10 +77,19 @@ public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcesso
utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled)
serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceInstanceId)
-
+
+ String operationId = execution.getVariable("operationId")
+ if (isBlank(operationId)) {
+ operationId = UUID.randomUUID().toString()
+ }
+ utils.log("DEBUG", "Generated new Service Instance Operation:" + operationId, isDebugEnabled)
+ serviceInstanceId = UriUtils.encode(operationId,"UTF-8")
+ execution.setVariable("operationId", operationId)
//subscriberInfo, TBD , there is no globalSubscriberId in R1 for E2E Service.
//requestInfo TBD , there is no requestDetails for R1 E2E service
+ //TBD need to insert operationInfo to RequestDb
+
//set service Instance Name
execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "service.name"))
execution.setVariable("serviceDescription", jsonUtil.getJsonValue(siRequest, "service.description"))
@@ -101,7 +117,30 @@ public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcesso
utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled)
}
+ /**
+ * send the sync response
+ * the response incloudes the instance id and the operation id
+ */
public void sendSyncResponse(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+
+ try {
+ String requestId = execution.getVariable("msoRequestId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ // RESTResponse for API Handler (APIH) Reply Task
+ String createServiceRestResponse = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim()
+ utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createServiceRestResponse, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, createServiceRestResponse)
+ execution.setVariable("sentSyncResponse", true)
+
+ } catch (Exception ex) {
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
}
public void preCreateRequest(Execution execution) {