\r
VidUtils vidUtils = new VidUtils()\r
\r
+ /**\r
+ * Pre Process the BPMN Flow Request\r
+ * Inclouds:\r
+ * Deal with the parameters\r
+ * generate the service instance id\r
+ * generate the operation id\r
+ */\r
public void preProcessRequest (Execution execution) {\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
String msg = ""\r
utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled)\r
serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")\r
execution.setVariable("serviceInstanceId", serviceInstanceId)\r
-\r
+ \r
+ String operationId = execution.getVariable("operationId")\r
+ if (isBlank(operationId)) {\r
+ operationId = UUID.randomUUID().toString()\r
+ }\r
+ utils.log("DEBUG", "Generated new Service Instance Operation:" + operationId, isDebugEnabled)\r
+ serviceInstanceId = UriUtils.encode(operationId,"UTF-8")\r
+ execution.setVariable("operationId", operationId)\r
//subscriberInfo, TBD , there is no globalSubscriberId in R1 for E2E Service.\r
//requestInfo TBD , there is no requestDetails for R1 E2E service\r
\r
+ //TBD need to insert operationInfo to RequestDb\r
+ \r
//set service Instance Name\r
execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "service.name"))\r
execution.setVariable("serviceDescription", jsonUtil.getJsonValue(siRequest, "service.description"))\r
utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled)\r
}\r
\r
+ /**\r
+ * send the sync response\r
+ * the response incloudes the instance id and the operation id\r
+ */\r
public void sendSyncResponse(Execution execution) {\r
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+ utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)\r
+\r
+ try {\r
+ String requestId = execution.getVariable("msoRequestId")\r
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
+ String operationId = execution.getVariable("operationId")\r
+ // RESTResponse for API Handler (APIH) Reply Task\r
+ String createServiceRestResponse = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim()\r
+ utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createServiceRestResponse, isDebugEnabled)\r
+ sendWorkflowResponse(execution, 202, createServiceRestResponse)\r
+ execution.setVariable("sentSyncResponse", true)\r
+\r
+ } catch (Exception ex) {\r
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()\r
+ utils.log("DEBUG", msg, isDebugEnabled)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)\r
+ }\r
+ utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)\r
}\r
\r
public void preCreateRequest(Execution execution) {\r