diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
4 files changed, 1244 insertions, 0 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy new file mode 100644 index 0000000000..aece07ee90 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy @@ -0,0 +1,442 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.common.scripts
+
+import static org.apache.commons.lang3.StringUtils.*
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.rest.APIResponse
+import org.springframework.web.util.UriUtils
+
+
+/**
+ * This class supports the GenericGetService Sub Flow.
+ * This Generic sub flow can be used by any flow for accomplishing
+ * the goal of getting a Service-Instance or Service-Subscription (from AAI).
+ * The calling flow must set the GENGS_type variable as "service-instance"
+ * or "service-subscription".
+ *
+ * When using to Get a Service-Instance:
+ * If the global-customer-id and service-type are not provided
+ * this flow executes a query to get the service- Url using the
+ * Service Id or Name (whichever is provided).
+ *
+ * When using to Get a Service-Subscription:
+ * The global-customer-id and service-type must be
+ * provided.
+ *
+ * Upon successful completion of this sub flow the
+ * GENGS_SuccessIndicator will be true and the query response payload
+ * will be set to GENGS_service. An MSOWorkflowException will
+ * be thrown upon unsuccessful completion or if an error occurs
+ * at any time during this sub flow. Please map variables
+ * to the corresponding variable names below.
+ *
+ * Note - If this sub flow receives a Not Found (404) response
+ * from AAI at any time this will be considered an acceptable
+ * successful response however the GENGS_FoundIndicator
+ * will be set to false. This variable will allow the calling flow
+ * to distinguish between the two Success scenarios,
+ * "Success where service- is found" and
+ * "Success where service- is NOT found".
+ *
+ *
+ * Variable Mapping Below:
+ *
+ * In Mapping Variables:
+ * For Allotted-Resource:
+ * @param - GENGS_allottedResourceId
+ * @param - GENGS_type
+ * @param (Optional) - GENGS_serviceInstanceId
+ * @param (Optional) - GENGS_serviceType
+ * @param (Optional) - GENGS_globalCustomerId
+ *
+ * For Service-Instance:
+ * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName
+ * @param - GENGS_type
+ * @param (Optional) - GENGS_serviceType
+ * @param (Optional) - GENGS_globalCustomerId
+ *
+ * For Service-Subscription:
+ * @param - GENGS_type
+ * @param - GENGS_serviceType
+ * @param - GENGS_globalCustomerId
+ *
+ *
+ * Out Mapping Variables:
+ * @param - GENGS_service
+ * @param - GENGS_FoundIndicator
+ * @param - WorkflowException
+ */
+class CustomE2EGetService extends AbstractServiceTaskProcessor{
+
+ String Prefix = "GENGS_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * This method validates the incoming variables and
+ * determines the subsequent event based on which
+ * variables the calling flow provided.
+ *
+ * @param - execution
+ *
+ */
+ public void preProcessRequest(Execution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericGetService PreProcessRequest Process*** ", isDebugEnabled)
+
+ execution.setVariable("GENGS_obtainObjectsUrl", false)
+ execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false)
+ execution.setVariable("GENGS_SuccessIndicator", false)
+ execution.setVariable("GENGS_FoundIndicator", false)
+ execution.setVariable("GENGS_resourceLink", null)
+ execution.setVariable("GENGS_siResourceLink", null)
+
+ try{
+ // Get Variables
+ String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName")
+ String serviceType = execution.getVariable("GENGS_serviceType")
+ String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
+ String type = execution.getVariable("GENGS_type")
+
+ if(type != null){
+ utils.log("DEBUG", "Incoming GENGS_type is: " + type, isDebugEnabled)
+ if(type.equalsIgnoreCase("allotted-resource")){
+ if(isBlank(allottedResourceId)){
+ utils.log("DEBUG", "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.")
+ }else{
+ utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled)
+ if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){
+ execution.setVariable("GENGS_obtainObjectsUrl", true)
+ }else{
+ utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+ }
+ }
+ }else if(type.equalsIgnoreCase("service-instance")){
+ if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){
+ utils.log("DEBUG", "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.")
+ }else{
+ utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled)
+ if(isBlank(globalCustomerId) || isBlank(serviceType)){
+ execution.setVariable("GENGS_obtainObjectsUrl", true)
+ if(isBlank(serviceInstanceId)){
+ execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true)
+ }
+ }else{
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
+ }
+ }
+ }else if(type.equalsIgnoreCase("service-subscription")){
+ if(isBlank(serviceType) || isBlank(globalCustomerId)){
+ utils.log("DEBUG", "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.")
+ }else{
+ utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+ }
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription")
+ }
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.")
+ }
+
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("DEBUG", "Internal Error encountered within GenericGetService PreProcessRequest method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest")
+
+ }
+ utils.log("DEBUG", "*** COMPLETED GenericGetService PreProcessRequest Process ***", isDebugEnabled)
+ }
+
+ /**
+ * This method obtains the Url to the provided service instance
+ * using the Service Instance Id.
+ *
+ * @param - execution
+ */
+ public void obtainServiceInstanceUrlById(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
+ try {
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+
+ String type = execution.getVariable("GENGS_type")
+ String path = ""
+ if(type.equalsIgnoreCase("service-instance")){
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId, isDebugEnabled)
+ path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}"
+ utils.logAudit("Service Instance Node Query Url is: " + path)
+ utils.log("DEBUG", "Service Instance Node Query Url is: " + path, isDebugEnabled)
+ }else if(type.equalsIgnoreCase("allotted-resource")){
+ String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
+ utils.log("DEBUG", " Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId, isDebugEnabled)
+ path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}"
+ utils.logAudit("Allotted Resource Node Query Url is: " + path)
+ utils.log("DEBUG", "Allotted Resource Node Query Url is: " + path, isDebugEnabled)
+ }
+
+ //String url = "${aai_endpoint}${path}" host name needs to be removed from property
+ String url = "${path}"
+ execution.setVariable("GENGS_genericQueryPath", url)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENGS_genericQueryResponseCode", responseCode)
+ utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
+ utils.logAudit("GenericGetService AAI GET Response Code: " + responseCode)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse)
+ utils.log("DEBUG", "GenericGetService AAI Response before unescaping: " + aaiResponse, isDebugEnabled)
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENGS_genericQueryResponse", aaiResponse)
+ utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
+ utils.log("DEBUG", "GenericGetService AAI Response: " + aaiResponse, isDebugEnabled)
+
+ //Process Response
+ if(responseCode == 200){
+ utils.log("DEBUG", "Generic Query Received a Good Response Code", isDebugEnabled)
+ execution.setVariable("GENGS_SuccessIndicator", true)
+ if(utils.nodeExists(aaiResponse, "result-data")){
+ utils.log("DEBUG", "Generic Query Response Does Contain Data" , isDebugEnabled)
+ execution.setVariable("GENGS_FoundIndicator", true)
+ String resourceLink = utils.getNodeText1(aaiResponse, "resource-link")
+ execution.setVariable("GENGS_resourceLink", resourceLink)
+ execution.setVariable("GENGS_siResourceLink", resourceLink)
+ }else{
+ utils.log("DEBUG", "Generic Query Response Does NOT Contains Data" , isDebugEnabled)
+ execution.setVariable("WorkflowResponse", " ") //for junits
+ }
+ }else if(responseCode == 404){
+ utils.log("DEBUG", "Generic Query Received a Not Found (404) Response", isDebugEnabled)
+ execution.setVariable("GENGS_SuccessIndicator", true)
+ execution.setVariable("WorkflowResponse", " ") //for junits
+ }else{
+ utils.log("DEBUG", "Generic Query Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
+ exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
+ }
+
+ /**
+ * This method obtains the Url to the provided service instance
+ * using the Service Instance Name.
+ *
+ * @param - execution
+ */
+ public void obtainServiceInstanceUrlByName(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled)
+ try {
+ String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName")
+ utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName, isDebugEnabled)
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}"
+
+ //String url = "${aai_endpoint}${path}" host name needs to be removed from property
+ String url = "${path}"
+ execution.setVariable("GENGS_obtainSIUrlPath", url)
+
+ utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint)
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode)
+ utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
+ utils.logAudit("GenericGetService AAI Response Code: " + responseCode)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse)
+ utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
+ //Process Response
+ if(responseCode == 200){
+ utils.log("DEBUG", " Query for Service Instance Url Received a Good Response Code", isDebugEnabled)
+ execution.setVariable("GENGS_SuccessIndicator", true)
+ if(utils.nodeExists(aaiResponse, "result-data")){
+ utils.log("DEBUG", "Query for Service Instance Url Response Does Contain Data" , isDebugEnabled)
+ execution.setVariable("GENGS_FoundIndicator", true)
+ String resourceLink = utils.getNodeText1(aaiResponse, "resource-link")
+ execution.setVariable("GENGS_resourceLink", resourceLink)
+ execution.setVariable("GENGS_siResourceLink", resourceLink)
+ }else{
+ utils.log("DEBUG", "Query for Service Instance Url Response Does NOT Contains Data" , isDebugEnabled)
+ execution.setVariable("WorkflowResponse", " ") //for junits
+ }
+ }else if(responseCode == 404){
+ utils.log("DEBUG", " Query for Service Instance Received a Not Found (404) Response", isDebugEnabled)
+ execution.setVariable("GENGS_SuccessIndicator", true)
+ execution.setVariable("WorkflowResponse", " ") //for junits
+ }else{
+ utils.log("DEBUG", "Query for Service Instance Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
+ exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled)
+ }
+
+
+ /**
+ * This method executes a GET call to AAI to obtain the
+ * service-instance or service-subscription
+ *
+ * @param - execution
+ */
+ public void getServiceObject(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
+ try {
+ String type = execution.getVariable("GENGS_type")
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ String serviceEndpoint = ""
+
+ utils.logAudit("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint)
+ if(type.equalsIgnoreCase("service-instance")){
+ String siResourceLink = execution.getVariable("GENGS_resourceLink")
+ if(isBlank(siResourceLink)){
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
+ String serviceType = execution.getVariable("GENGS_serviceType")
+ utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled)
+ String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+ serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8")
+ }else{
+ utils.log("DEBUG", "Incoming Service Instance Url is: " + siResourceLink, isDebugEnabled)
+ String[] split = siResourceLink.split("/aai/")
+ serviceEndpoint = "/aai/" + split[1]
+ }
+ }else if(type.equalsIgnoreCase("allotted-resource")){
+ String siResourceLink = execution.getVariable("GENGS_resourceLink")
+ if(isBlank(siResourceLink)){
+ String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
+ utils.log("DEBUG", " Incoming GENGS_allottedResourceId is: " + allottedResourceId, isDebugEnabled)
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
+ String serviceType = execution.getVariable("GENGS_serviceType")
+ utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled)
+ String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+ serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8")
+ }else{
+ utils.log("DEBUG", "Incoming Allotted-Resource Url is: " + siResourceLink, isDebugEnabled)
+ String[] split = siResourceLink.split("/aai/")
+ serviceEndpoint = "/aai/" + split[1]
+ }
+ }else if(type.equalsIgnoreCase("service-subscription")){
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
+ String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
+ String serviceType = execution.getVariable("GENGS_serviceType")
+ serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8")
+ }
+
+ String serviceUrl = "${aai_endpoint}" + serviceEndpoint
+
+ execution.setVariable("GENGS_getServiceUrl", serviceUrl)
+ utils.log("DEBUG", "GET Service AAI Path is: \n" + serviceUrl, isDebugEnabled)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENGS_getServiceResponseCode", responseCode)
+ utils.log("DEBUG", " GET Service response code is: " + responseCode, isDebugEnabled)
+ utils.logAudit("GenericGetService AAI Response Code: " + responseCode)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENGS_getServiceResponse", aaiResponse)
+ utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
+ //Process Response
+ if(responseCode == 200 || responseCode == 202){
+ utils.log("DEBUG", "GET Service Received a Good Response Code", isDebugEnabled)
+ if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){
+ utils.log("DEBUG", "GET Service Response Contains a service-instance" , isDebugEnabled)
+ execution.setVariable("GENGS_FoundIndicator", true)
+ execution.setVariable("GENGS_service", aaiResponse)
+ execution.setVariable("WorkflowResponse", aaiResponse)
+
+ }else{
+ utils.log("DEBUG", "GET Service Response Does NOT Contain Data" , isDebugEnabled)
+ }
+ }else if(responseCode == 404){
+ utils.log("DEBUG", "GET Service Received a Not Found (404) Response", isDebugEnabled)
+ execution.setVariable("WorkflowResponse", " ") //for junits
+ }
+ else{
+ utils.log("DEBUG", " GET Service Received a Bad Response: \n" + aaiResponse, isDebugEnabled)
+ exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("DEBUG", " Error encountered within GenericGetService GetServiceObject method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
+ }
+
+}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy new file mode 100644 index 0000000000..eaccdc0e27 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy @@ -0,0 +1,280 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.common.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution; +import org.apache.commons.codec.binary.Base64 +import org.apache.commons.lang3.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.net.URLEncoder; +import org.springframework.web.util.UriUtils + +/** + * This class supports the GenericPutService Sub Flow. + * This Generic sub flow can be used by any flow for the + * goal of creating a Service Instance or Service-Subscription in AAI. Upon successful completion of + * this sub flow the GENPS_SuccessIndicator will be true. + * The calling flow must set the GENPS_type variable as "service-instance" + * or "service-subscription". + * A MSOWorkflowException will be thrown Upon unsuccessful + * completion or if an error occurs within this flow. + * Please map variables to the corresponding variable names + * below. + * + * + * Incoming Required Variables: + * @param - GENPS_requestId + * @param - GENPS_type - Required field. This will be required field populated as service-instance or service-subscription + * @param - GENPS_globalSubscriberId - Required field + * @param - GENPS_serviceType - Required Field + * @param - GENPS_payload - Required Field This will be the payload that needs to be sent. + * + * @param - GENPS_serviceInstanceId - Conditional Field. Required for service-instance. + * @param - GENPS_allottedResourceId - Conditional Field. Required for allotted-resource. + * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. + * + * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows + * should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be + * obtained from aai and sent as an input parameter. + * + * Outgoing Variables: + * @param - GENPS_SuccessIndicator + * @param - WorkflowException + * + * + */ + + +class CustomE2EPutService extends AbstractServiceTaskProcessor{ + + String Prefix = "GENPS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + + public void preProcessRequest(Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + utils.log("DEBUG", " *** STARTED GenericPutService PreProcessRequest Process*** ", isDebugEnabled) + + execution.setVariable("GENPS_SuccessIndicator", false) + + try{ + // Get Variables + String requestId = execution.getVariable("GENPS_requestId") + utils.log("DEBUG", "Incoming GENPS_requestId is: " + requestId, isDebugEnabled) + + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + String serviceType = execution.getVariable("GENPS_serviceType") + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") + String type = execution.getVariable("GENPS_type") + + if(type != null){ + utils.log("DEBUG", "Incoming GENPS_type is: " + type, isDebugEnabled) + if(type.equalsIgnoreCase("service-instance")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ + utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + } + }else if(type.equalsIgnoreCase("service-subscription")){ + if(isBlank(serviceType) || isBlank(globalSubscriberId)){ + utils.log("DEBUG", "Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + }else{ + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + } + }else if(type.equalsIgnoreCase("allotted-resource")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + } + }else if(type.equalsIgnoreCase("tunnel-xconnect")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) + utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENPS_type is null. Variable is Required.") + } + + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("ERROR", " Error encountered within GenericPutService PreProcessRequest method!" + e, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") + + } + utils.log("DEBUG", "*** COMPLETED GenericPutService PreProcessRequest Process ***", isDebugEnabled) + + } + + + + /** + * This method executes a Put call to AAI for the provided + * service instance. + * + * @param - execution + * + */ + public void putServiceInstance(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + utils.log("DEBUG", " *** STARTED GenericPutService PutServiceInstance method*** ", isDebugEnabled) + try { + String type = execution.getVariable("GENPS_type") + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) + String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + logDebug('AAI namespace is: ' + namespace, isDebugEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = "" + String payload = execution.getVariable("GENPS_payload") + execution.setVariable("GENPS_payload", payload) + utils.log("DEBUG", "Incoming GENPS_payload is: " + payload, isDebugEnabled) + utils.logAudit(payload) + + String serviceType = execution.getVariable("GENPS_serviceType") + utils.log("DEBUG", " Incoming GENPS_serviceType is: " + serviceType, isDebugEnabled) + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + + // This IF clause is if we need to create a new Service Instance + if(type.equalsIgnoreCase("service-instance")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + + }else if(type.equalsIgnoreCase("service-subscription")){ + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + }else if(type.equalsIgnoreCase("allotted-resource")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + }else if(type.equalsIgnoreCase("tunnel-xconnect")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) + String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") + utils.log("DEBUG", " Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId, isDebugEnabled) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") + } + + String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") + utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled) + if(resourceVersion !=null){ + serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") + } + + execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) + utils.log("DEBUG", "PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) + int responseCode = response.getStatusCode() + execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) + utils.log("DEBUG", " Put Service Instance response code is: " + responseCode, isDebugEnabled) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) + + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + utils.log("DEBUG", "PUT Service Instance Received a Good Response", isDebugEnabled) + execution.setVariable("GENPS_SuccessIndicator", true) + } + + else{ + utils.log("DEBUG", "Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("ERROR", " Error encountered within GenericPutService PutServiceInstance method!" + e, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") + } + utils.log("DEBUG", " *** COMPLETED GenericPutService PutServiceInstance Process*** ", isDebugEnabled) + } + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn new file mode 100644 index 0000000000..28ba0363cb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn @@ -0,0 +1,321 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_D5VzAHElEeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="GenericGetService" name="GenericGetService" isExecutable="true"> + <bpmn2:scriptTask id="intialization" name="Initialization" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +CustomE2EGetService getService = new CustomE2EGetService() +getService.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="getUrl" /> + <bpmn2:exclusiveGateway id="getUrl" name="Need Object's Url?" default="getUrlNo"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>getUrlYes</bpmn2:outgoing> + <bpmn2:outgoing>getUrlNo</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="getUrlYes" name="Yes" sourceRef="getUrl" targetRef="obtain"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainObjectsUrl" ) == true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="getUrlNo" name="No" sourceRef="getUrl" targetRef="ExclusiveGateway_2" /> + <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> + <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + +ExceptionUtil ex = new ExceptionUtil() +ex.processSubflowsBPMNException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="processBPMNException" targetRef="EndEvent_2" /> + <bpmn2:startEvent id="StartEvent_2"> + <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="StartEvent_2" targetRef="processBPMNException" /> + <bpmn2:endEvent id="EndEvent_2"> + <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> + </bpmn2:endEvent> + </bpmn2:subProcess> + <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +CustomE2EGetService getService = new CustomE2EGetService() +getService.setSuccessIndicator(execution, true) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> + <bpmn2:scriptTask id="getServiceInstance" name="GET Object" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +CustomE2EGetService getService = new CustomE2EGetService() +getService.getServiceObject(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getServiceInstance" targetRef="toggleSuccess" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_2"> + <bpmn2:incoming>getUrlNo</bpmn2:incoming> + <bpmn2:incoming>foundYes</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_2" targetRef="getServiceInstance" /> + <bpmn2:scriptTask id="obtainServiceUrlById" name="Node Query Using Id " scriptFormat="groovy"> + <bpmn2:incoming>obtainById</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +CustomE2EGetService getService = new CustomE2EGetService() +getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="obtainServiceUrlById" targetRef="ExclusiveGateway_3" /> + <bpmn2:scriptTask id="obtainServiceUrlByName" name="Node Query Using Name" scriptFormat="groovy"> + <bpmn2:incoming>obtainByName</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +CustomE2EGetService getService = new CustomE2EGetService() +getService.obtainServiceInstanceUrlByName(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="obtainServiceUrlByName" targetRef="ExclusiveGateway_3" /> + <bpmn2:exclusiveGateway id="obtain" name="Query By?" default="obtainById"> + <bpmn2:incoming>getUrlYes</bpmn2:incoming> + <bpmn2:outgoing>obtainById</bpmn2:outgoing> + <bpmn2:outgoing>obtainByName</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="obtainById" name="Id" sourceRef="obtain" targetRef="obtainServiceUrlById" /> + <bpmn2:sequenceFlow id="obtainByName" name="Name" sourceRef="obtain" targetRef="obtainServiceUrlByName"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainServiceInstanceUrlByName" ) == true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:exclusiveGateway id="serviceFoundCheck" name="Service Exist?" default="notFound"> + <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> + <bpmn2:outgoing>foundYes</bpmn2:outgoing> + <bpmn2:outgoing>notFound</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="foundYes" name="Yes" sourceRef="serviceFoundCheck" targetRef="ExclusiveGateway_2"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_FoundIndicator" ) == true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="serviceFoundCheck" targetRef="EndEvent_3" /> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>notFound</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_29" /> + </bpmn2:endEvent> + <bpmn2:exclusiveGateway id="ExclusiveGateway_3"> + <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ExclusiveGateway_3" targetRef="serviceFoundCheck" /> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_26" /> + </bpmn2:endEvent> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_69" bpmnElement="StartEvent_1"> + <dc:Bounds x="108" y="264" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="126" y="305" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_288" bpmnElement="intialization"> + <dc:Bounds x="228" y="242" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_69" targetElement="_BPMNShape_ScriptTask_288"> + <di:waypoint xsi:type="dc:Point" x="144" y="282" /> + <di:waypoint xsi:type="dc:Point" x="228" y="282" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="177" y="282" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_227" bpmnElement="getUrl" isMarkerVisible="true"> + <dc:Bounds x="372" y="256" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="420" y="282" width="72" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_288" targetElement="_BPMNShape_ExclusiveGateway_227"> + <di:waypoint xsi:type="dc:Point" x="328" y="282" /> + <di:waypoint xsi:type="dc:Point" x="372" y="281" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="350" y="281" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_289" bpmnElement="obtainServiceUrlById"> + <dc:Bounds x="528" y="197" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_228" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> + <dc:Bounds x="738" y="256" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="763" y="311" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_290" bpmnElement="getServiceInstance"> + <dc:Bounds x="820" y="242" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="getUrlYes" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_233"> + <di:waypoint xsi:type="dc:Point" x="397" y="256" /> + <di:waypoint xsi:type="dc:Point" x="397" y="170" /> + <di:waypoint xsi:type="dc:Point" x="446" y="170" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="397" y="213" width="29" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_289" targetElement="_BPMNShape_ExclusiveGateway_234"> + <di:waypoint xsi:type="dc:Point" x="628" y="237" /> + <di:waypoint xsi:type="dc:Point" x="671" y="237" /> + <di:waypoint xsi:type="dc:Point" x="671" y="195" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="668" y="221" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_228" targetElement="_BPMNShape_ScriptTask_290"> + <di:waypoint xsi:type="dc:Point" x="788" y="281" /> + <di:waypoint xsi:type="dc:Point" x="820" y="282" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="798" y="281" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="getUrlNo" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_228"> + <di:waypoint xsi:type="dc:Point" x="397" y="306" /> + <di:waypoint xsi:type="dc:Point" x="397" y="370" /> + <di:waypoint xsi:type="dc:Point" x="763" y="370" /> + <di:waypoint xsi:type="dc:Point" x="763" y="306" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="400" y="324" width="22" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_291" bpmnElement="toggleSuccess"> + <dc:Bounds x="960" y="242" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_290" targetElement="_BPMNShape_ScriptTask_291"> + <di:waypoint xsi:type="dc:Point" x="920" y="282" /> + <di:waypoint xsi:type="dc:Point" x="960" y="282" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="937" y="282" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_223" bpmnElement="EndEvent_1"> + <dc:Bounds x="1133" y="264" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1151" y="305" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_291" targetElement="_BPMNShape_EndEvent_223"> + <di:waypoint xsi:type="dc:Point" x="1060" y="282" /> + <di:waypoint xsi:type="dc:Point" x="1133" y="282" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1100" y="282" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_25" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> + <dc:Bounds x="152" y="468" width="325" height="169" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_70" bpmnElement="StartEvent_2"> + <dc:Bounds x="176" y="535" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="194" y="576" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_224" bpmnElement="EndEvent_2"> + <dc:Bounds x="416" y="535" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="434" y="576" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_292" bpmnElement="processBPMNException"> + <dc:Bounds x="265" y="513" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_StartEvent_70" targetElement="_BPMNShape_ScriptTask_292"> + <di:waypoint xsi:type="dc:Point" x="212" y="553" /> + <di:waypoint xsi:type="dc:Point" x="265" y="553" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="233" y="553" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_292" targetElement="_BPMNShape_EndEvent_224"> + <di:waypoint xsi:type="dc:Point" x="365" y="553" /> + <di:waypoint xsi:type="dc:Point" x="416" y="553" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="385" y="553" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_301" bpmnElement="obtainServiceUrlByName"> + <dc:Bounds x="528" y="59" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_233" bpmnElement="obtain" isMarkerVisible="true"> + <dc:Bounds x="446" y="145" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="501" y="164" width="53" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_234" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true"> + <dc:Bounds x="646" y="145" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="671" y="200" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="obtainById" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_289"> + <di:waypoint xsi:type="dc:Point" x="471" y="195" /> + <di:waypoint xsi:type="dc:Point" x="471" y="236" /> + <di:waypoint xsi:type="dc:Point" x="528" y="237" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="476" y="207" width="16" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="obtainByName" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_301"> + <di:waypoint xsi:type="dc:Point" x="471" y="145" /> + <di:waypoint xsi:type="dc:Point" x="471" y="99" /> + <di:waypoint xsi:type="dc:Point" x="528" y="99" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="471" y="115" width="40" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ScriptTask_301" targetElement="_BPMNShape_ExclusiveGateway_234"> + <di:waypoint xsi:type="dc:Point" x="628" y="99" /> + <di:waypoint xsi:type="dc:Point" x="671" y="99" /> + <di:waypoint xsi:type="dc:Point" x="671" y="145" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="665" y="99" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_235" bpmnElement="serviceFoundCheck" isMarkerVisible="true"> + <dc:Bounds x="738" y="145" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="735" y="125" width="59" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ExclusiveGateway_234" targetElement="_BPMNShape_ExclusiveGateway_235"> + <di:waypoint xsi:type="dc:Point" x="696" y="170" /> + <di:waypoint xsi:type="dc:Point" x="738" y="170" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="704" y="170" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="foundYes" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_ExclusiveGateway_228"> + <di:waypoint xsi:type="dc:Point" x="763" y="195" /> + <di:waypoint xsi:type="dc:Point" x="763" y="256" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="762" y="205" width="29" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="notFound" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_EndEvent_229"> + <di:waypoint xsi:type="dc:Point" x="788" y="170" /> + <di:waypoint xsi:type="dc:Point" x="877" y="171" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="798" y="170" width="22" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_229" bpmnElement="EndEvent_3"> + <dc:Bounds x="877" y="153" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="895" y="194" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn new file mode 100644 index 0000000000..9d989d2aac --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_FatVcHn0EeaH6vX1RRdc_w" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="CustomE2EPutService" name="CustomE2EPutService" isExecutable="true"> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="Initialization" /> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="TerminateEventDefinition_1" /> + </bpmn2:endEvent> + <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + +def serviceInstance= new CustomE2EPutService() +serviceInstance.setSuccessIndicator(execution, true) + +execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> + <bpmn2:scriptTask id="putServiceInstance" name="Put Service Instance" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + +def serviceInstance= new CustomE2EPutService() +serviceInstance.putServiceInstance(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="putServiceInstance" targetRef="toggleSuccess" /> + <bpmn2:scriptTask id="Initialization" name="Initialization" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + +def serviceInstance= new CustomE2EPutService() +serviceInstance.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="Initialization" targetRef="putServiceInstance" /> + <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_2"> + <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="StartEvent_2" targetRef="processError" /> + <bpmn2:endEvent id="EndEvent_2"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:scriptTask id="processError" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+
+ExceptionUtil ex = new ExceptionUtil()
+ex.processSubflowsBPMNException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="processError" targetRef="EndEvent_2" /> + </bpmn2:subProcess> + <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Handling Sub Process" triggeredByEvent="true"> + <bpmn2:startEvent id="catchJavaExcep"> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_2" /> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="catchJavaExcep" targetRef="processJavaError" /> + <bpmn2:scriptTask id="processJavaError" name="Process Java Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="TerminateEventDefinition_2" /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="processJavaError" targetRef="EndEvent_3" /> + </bpmn2:subProcess> + </bpmn2:process> + <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmn2:error id="Error_2" name="Java Lang Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CustomE2EPutService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1"> + <dc:Bounds x="182" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="200" y="221" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="Initialization"> + <dc:Bounds x="324" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_302"> + <di:waypoint xsi:type="dc:Point" x="218" y="198" /> + <di:waypoint xsi:type="dc:Point" x="324" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="250" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_304" bpmnElement="putServiceInstance"> + <dc:Bounds x="528" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_ScriptTask_304"> + <di:waypoint xsi:type="dc:Point" x="424" y="198" /> + <di:waypoint xsi:type="dc:Point" x="528" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="446" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_305" bpmnElement="toggleSuccess"> + <dc:Bounds x="732" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_304" targetElement="_BPMNShape_ScriptTask_305"> + <di:waypoint xsi:type="dc:Point" x="628" y="198" /> + <di:waypoint xsi:type="dc:Point" x="732" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="650" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_230" bpmnElement="EndEvent_1"> + <dc:Bounds x="908" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="926" y="221" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_305" targetElement="_BPMNShape_EndEvent_230"> + <di:waypoint xsi:type="dc:Point" x="832" y="198" /> + <di:waypoint xsi:type="dc:Point" x="908" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="854" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_27" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> + <dc:Bounds x="324" y="312" width="418" height="150" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_72" bpmnElement="StartEvent_2"> + <dc:Bounds x="357" y="370" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="375" y="411" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_306" bpmnElement="processError"> + <dc:Bounds x="466" y="348" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_StartEvent_72" targetElement="_BPMNShape_ScriptTask_306"> + <di:waypoint xsi:type="dc:Point" x="393" y="388" /> + <di:waypoint xsi:type="dc:Point" x="466" y="388" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="415" y="388" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_2"> + <dc:Bounds x="615" y="370" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="633" y="411" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_306" targetElement="_BPMNShape_EndEvent_231"> + <di:waypoint xsi:type="dc:Point" x="566" y="388" /> + <di:waypoint xsi:type="dc:Point" x="615" y="388" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="588" y="388" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_28" bpmnElement="javaExceptionSubProcess" isExpanded="true"> + <dc:Bounds x="323" y="486" width="419" height="150" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_73" bpmnElement="catchJavaExcep"> + <dc:Bounds x="357" y="538" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="375" y="579" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_308" bpmnElement="processJavaError"> + <dc:Bounds x="465" y="516" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_73" targetElement="_BPMNShape_ScriptTask_308"> + <di:waypoint xsi:type="dc:Point" x="393" y="556" /> + <di:waypoint xsi:type="dc:Point" x="465" y="556" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="415" y="556" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_232" bpmnElement="EndEvent_3"> + <dc:Bounds x="615" y="538" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="633" y="579" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_308" targetElement="_BPMNShape_EndEvent_232"> + <di:waypoint xsi:type="dc:Point" x="565" y="556" /> + <di:waypoint xsi:type="dc:Point" x="615" y="556" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="587" y="556" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> |