X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=bpmn%2Fso-bpmn-infrastructure-common%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fonap%2Fso%2Fbpmn%2Finfrastructure%2Fscripts%2FCompareModelofE2EServiceInstance.groovy;h=df11549ff45d40b66b990be06144c4a054b41be1;hb=92567d26641f3a0f127c289e0dad9d86e3b2443c;hp=880a44c1b2ee8c664dc812a47b55347ad26ede42;hpb=539776c6a387e25f0c428be1f8c6912d94c50e88;p=so.git diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy index 880a44c1b2..df11549ff4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy @@ -4,7 +4,9 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * 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 * @@ -17,9 +19,9 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.* import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError @@ -31,7 +33,8 @@ import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.CompareModelsResult import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -52,7 +55,7 @@ import groovy.json.* * @param - WorkflowException */ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CompareModelofE2EServiceInstance.class); + private static final Logger logger = LoggerFactory.getLogger( CompareModelofE2EServiceInstance.class) String Prefix="CMPMDSI_" private static final String DebugFlag = "isDebugEnabled" @@ -61,21 +64,21 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils() - public void preProcessRequest (DelegateExecution execution) { + void preProcessRequest (DelegateExecution execution) { execution.setVariable("prefix",Prefix) String msg = "" - msoLogger.trace("preProcessRequest Request ") + logger.trace("preProcessRequest Request ") try { // check for incoming json message/input String siRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(siRequest) + logger.debug(siRequest) String requestId = execution.getVariable("mso-request-id") execution.setVariable("msoRequestId", requestId) - msoLogger.info("Input Request:" + siRequest + " reqId:" + requestId) + logger.info("Input Request:" + siRequest + " reqId:" + requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)) { @@ -87,7 +90,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId' is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) } else { execution.setVariable("globalSubscriberId", globalSubscriberId) } @@ -96,7 +99,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType") if (isBlank(subscriptionServiceType)) { msg = "Input subscriptionServiceType is null" - utils.log("DEBUG", msg, isDebugEnabled) + logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("serviceType", subscriptionServiceType) @@ -106,7 +109,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String modelInvariantIdTarget = jsonUtil.getJsonValue(siRequest, "modelInvariantIdTarget") if (isBlank(modelInvariantIdTarget)) { msg = "Input modelInvariantIdTarget' is null" - utils.log("INFO", msg, isDebugEnabled) + logger.info( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("modelInvariantIdTarget", modelInvariantIdTarget) @@ -116,7 +119,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String modelVersionIdTarget = jsonUtil.getJsonValue(siRequest, "modelVersionIdTarget") if (isBlank(modelVersionIdTarget)) { msg = "Input modelVersionIdTarget is null" - utils.log("DEBUG", msg, isDebugEnabled) + logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { execution.setVariable("modelVersionIdTarget", modelVersionIdTarget) @@ -125,35 +128,35 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess execution.setVariable("operationType", "CompareModel") } catch (BpmnError e) { - throw e; + throw e } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit preProcessRequest ") + logger.trace("Exit preProcessRequest ") } - public void sendSyncResponse (DelegateExecution execution) { - msoLogger.trace("sendSyncResponse ") + void sendSyncResponse (DelegateExecution execution) { + logger.trace("sendSyncResponse ") try { CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult") // RESTResponse (for API Handler(APIH) Reply Task) String syncResponse = compareModelsResult.toJsonStringNoRootName() - msoLogger.info(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + logger.info(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) sendWorkflowResponse(execution, 202, syncResponse) } catch (Exception ex) { String msg = "Exception in sendSyncResponse: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit sendSyncResopnse ") + logger.trace("Exit sendSyncResopnse ") } - public void sendSyncError (DelegateExecution execution) { - msoLogger.trace("sendSyncError ") + void sendSyncError (DelegateExecution execution) { + logger.trace("sendSyncError ") try { String errorMessage = "" @@ -170,17 +173,17 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess 7000 """ - msoLogger.debug(buildworkflowException) + logger.debug(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - msoLogger.info(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + logger.info(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } } - public void prepareCompletionRequest (DelegateExecution execution) { - msoLogger.trace("prepareCompletion ") + void prepareCompletionRequest (DelegateExecution execution) { + logger.trace("prepareCompletion ") try { String requestId = execution.getVariable("msoRequestId") @@ -201,22 +204,22 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) execution.setVariable("completionRequest", xmlMsoCompletionRequest) - msoLogger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (Exception ex) { String msg = " Exception in prepareCompletion:" + ex.getMessage() - msoLogger.info(msg) + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit prepareCompletionRequest ") + logger.trace("Exit prepareCompletionRequest ") } - public void prepareFalloutRequest(DelegateExecution execution){ - msoLogger.trace("prepareFalloutRequest ") + void prepareFalloutRequest(DelegateExecution execution){ + logger.trace("prepareFalloutRequest ") try { WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.info(" Input Workflow Exception: " + wfex.toString()) + logger.info(" Input Workflow Exception: " + wfex.toString()) String requestId = execution.getVariable("msoRequestId") String source = execution.getVariable("source") String requestInfo = @@ -229,7 +232,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) execution.setVariable("falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.info("Exception prepareFalloutRequest:" + ex.getMessage()) + logger.info("Exception prepareFalloutRequest:" + ex.getMessage()) String errorException = " Bpmn error encountered in CompareModelofE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() String requestId = execution.getVariable("msoRequestId") String falloutRequest = @@ -249,7 +252,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess execution.setVariable("falloutRequest", falloutRequest) } - msoLogger.trace("Exit prepareFalloutRequest ") + logger.trace("Exit prepareFalloutRequest ") } }