From 2ede5f09c9601d543f20d466a21e9e85c29eacc7 Mon Sep 17 00:00:00 2001 From: "Plummer, Brittany" Date: Tue, 10 Sep 2019 11:29:42 -0400 Subject: Integrate Logging Library Updated SO to use ONAP provided filters and constants to meet logging standards. Removed redundant classes Updated constant references Issue-ID: SO-2301 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Ia4e3c2b1a4dcb3881aa34d39885c8b2782880d64 --- .../org/onap/so/bpmn/common/scripts/AaiUtil.groovy | 4 +- .../so/bpmn/common/scripts/CatalogDbUtils.groovy | 4 +- .../so/bpmn/common/scripts/ExceptionUtil.groovy | 4 +- .../so/bpmn/common/scripts/ExternalAPIUtil.groovy | 6 +-- .../common/scripts/GenerateVfModuleName.groovy | 4 +- .../onap/so/bpmn/common/scripts/OofHoming.groovy | 4 +- .../onap/so/bpmn/common/scripts/OofUtils.groovy | 2 +- .../bpmn/common/scripts/SDNCAdapterRestV1.groovy | 4 +- .../so/bpmn/common/scripts/SniroHomingV1.groovy | 4 +- .../so/bpmn/common/scripts/VnfAdapterRestV1.groovy | 47 +++++++++++----------- .../common/resource/ResourceRequestBuilder.java | 4 +- .../tasks/ExecuteBuildingBlockRainyDay.java | 10 ++--- .../onap/so/client/exception/ExceptionBuilder.java | 16 ++++---- 13 files changed, 57 insertions(+), 56 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/main') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index f14e3dcc42..ee70dcc89c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -44,7 +44,7 @@ import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.openpojo.rules.HasToStringRule -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; @Deprecated class AaiUtil { @@ -96,7 +96,7 @@ class AaiUtil { String regionId = "" try{ URL Url = new URL(url) - HttpClient client = new HttpClientFactory().newXmlClient(Url, TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(Url, ONAPComponents.AAI) client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution)) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader("X-TransactionId", utils.getRequestID()) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index 2bf7298584..83784e1960 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -37,7 +37,7 @@ import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.web.util.UriUtils import javax.ws.rs.core.MediaType @@ -442,7 +442,7 @@ class CatalogDbUtils { String catalogDbEndpoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint",execution) String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint def responseData = '' - HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB) + HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB) client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', "BPMN") client.addAdditionalHeader('Accept', MediaType.APPLICATION_JSON) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index c23150384e..195b1fc0d6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -34,7 +34,7 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum -import org.onap.so.utils.TargetEntities +import org.onap.logging.filter.base.ONAPComponentsList import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -285,7 +285,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { logger.debug("Outgoing WorkflowException is " + exception) } - public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, TargetEntities extSystemErrorSource) { + public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, ONAPComponentsList extSystemErrorSource) { MsoUtils utils = new MsoUtils() String processKey = getProcessKey(execution); logger.debug("Building a WorkflowException for " + processKey) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 5525c2642b..a5111a62d3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -29,7 +29,7 @@ import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response @@ -145,7 +145,7 @@ class ExternalAPIUtil { logger.debug( "URL to be used is: " + url) logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl")) - HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL) + HttpClient client = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.EXTERNAL) client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, uuid) @@ -183,7 +183,7 @@ class ExternalAPIUtil { logger.debug( "URL to be used is: " + url) logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl")) - HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI) + HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.AAI) httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) httpClient.addAdditionalHeader("X-FromAppId", "MSO") httpClient.addAdditionalHeader("X-TransactionId", uuid) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index 3008f77b62..6d4b50f690 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -42,7 +42,7 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -92,7 +92,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ logger.debug("AAI endPoint: " + endPoint) try { - HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 6583ded413..b082c1830e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -41,7 +41,7 @@ import org.onap.so.db.catalog.beans.CloudIdentity import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.db.catalog.beans.ServerType -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -165,7 +165,7 @@ class OofHoming extends AbstractServiceTaskProcessor { URL url = new URL(urlString) - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.OOF) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) httpClient.addAdditionalHeader("Authorization", authHeader) Response httpResponse = httpClient.post(oofRequest) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 4bfb29bc45..606b97bec2 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -40,7 +40,7 @@ import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.db.catalog.beans.HomingInstance -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.http.HttpEntity import org.springframework.http.HttpHeaders import org.springframework.http.HttpMethod diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index c30d807bf3..52d6758b2b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -47,7 +47,7 @@ import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; @@ -223,7 +223,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { URL url = new URL(sdncAdapterUrl) - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SDNC_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SDNC_ADAPTER) httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString()) httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-SDNCAdapter") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy index 8c2da2c112..08c032fba3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy @@ -37,7 +37,7 @@ import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.json.JSONArray @@ -136,7 +136,7 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{ logger.debug("Sniro Url is: " + urlString) URL url = new URL(urlString); - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SNIRO) httpClient.addAdditionalHeader("Authorization", authHeader) Response httpResponse = httpClient.post(sniroRequest) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index 866229f6b8..803a3f71de 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -35,8 +35,9 @@ import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import java.util.UUID +import org.onap.so.utils.Components @@ -80,7 +81,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no messageId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable('VNFAResponse_CORRELATOR', messageId) @@ -94,7 +95,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable(prefix + 'notificationUrl', notificationUrl) @@ -108,7 +109,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } while (vnfAdapterEndpoint.endsWith('/')) { @@ -126,7 +127,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'POST' @@ -139,7 +140,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vfModuleId = getChildText(root, 'vfModuleId') @@ -148,7 +149,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'PUT' @@ -162,7 +163,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vfModuleId = getChildText(root, 'vfModuleId') @@ -171,7 +172,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -185,7 +186,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vnfId = getChildText(vfModuleRollbackNode, 'vnfId') @@ -194,7 +195,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId') @@ -203,7 +204,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -224,7 +225,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'PUT' @@ -240,7 +241,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -256,7 +257,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -269,7 +270,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod) @@ -306,7 +307,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } } @@ -337,7 +338,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { URL url = new URL(vnfAdapterUrl); - HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue")) httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) @@ -357,7 +358,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus()) @@ -370,7 +371,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } } @@ -399,7 +400,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } } catch (Exception e) { logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e) - exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", ONAPComponents.SO) } } @@ -418,10 +419,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String rolledBack = getChildText(root, "rolledBack") rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'" exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() + - " from VnfAdapter:" + category + message + rolledBack, TargetEntity.OPENSTACK); + " from VnfAdapter:" + category + message + rolledBack, Components.OPENSTACK); } catch (Exception e) { response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response - exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, TargetEntity.OPENSTACK) + exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, Components.OPENSTACK) } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index 2c1d36273d..8efb6a3e1c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -44,7 +44,7 @@ import org.onap.so.bpmn.core.domain.VnfResource; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -383,7 +383,7 @@ public class ResourceRequestBuilder { HttpClient client = new HttpClientFactory().newJsonClient(UriBuilder.fromUri(catalogEndPoint) .path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(), - TargetEntity.CATALOG_DB); + ONAPComponents.CATALOG_DB); client.addAdditionalHeader("Accept", "application/json"); client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth")); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index be53e505ac..7684627825 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -25,6 +25,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import java.util.Map; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.logging.filter.base.ONAPComponentsList; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; @@ -35,8 +36,7 @@ import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.utils.TargetEntities; -import org.onap.so.utils.TargetEntity; +import org.onap.so.utils.Components; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -223,7 +223,7 @@ public class ExecuteBuildingBlockRainyDay { try { String requestId = (String) execution.getVariable("mso-request-id"); WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException"); - TargetEntities extSystemErrorSource = exception.getExtSystemErrorSource(); + ONAPComponentsList extSystemErrorSource = exception.getExtSystemErrorSource(); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback"); if (isRollbackFailure == null) { @@ -244,10 +244,10 @@ public class ExecuteBuildingBlockRainyDay { } else if (isRollbackFailure) { logger.debug( "rollbackExtSystemErrorSource is null for isRollbackFailure. Setting rollbackExtSystemErrorSource to UNKNOWN"); - request.setRollbackExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setRollbackExtSystemErrorSource(Components.UNKNOWN.toString()); } else { logger.debug("extSystemErrorSource is null. Setting extSystemErrorSource to UNKNOWN"); - request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setExtSystemErrorSource(Components.UNKNOWN.toString()); } request.setLastModifiedBy("CamundaBPMN"); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 729f5c95c4..c26a1cfecc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -43,8 +43,8 @@ import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvide import org.onap.so.logger.MessageEnum; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; -import org.onap.so.utils.TargetEntities; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponentsList; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -92,7 +92,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { String msg = "Exception in %s.%s "; try { logger.error("Exception occurred", exception); @@ -156,7 +156,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { String msg = "Exception in %s.%s "; try { logger.error("Exception occurred", exception); @@ -195,7 +195,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { if (execution instanceof DelegateExecutionImpl) { buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode, errorMessage, extSystemErrorSource); @@ -215,7 +215,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { String processKey = getProcessKey(execution); logger.info("Building a WorkflowException for Subflow"); @@ -293,7 +293,7 @@ public class ExceptionBuilder { execution.setVariable("StatusMessage", errorMessage.toString()); } else { WorkflowException exception = - new WorkflowException(processKey, 400, errorMessage.toString(), TargetEntity.SO); + new WorkflowException(processKey, 400, errorMessage.toString(), ONAPComponents.SO); execution.setVariable("WorkflowException", exception); execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString()); logger.info("Outgoing WorkflowException is {}", exception); @@ -303,7 +303,7 @@ public class ExceptionBuilder { } else { String errorMessage = "Unable to process audit results due to auditInventoryResult being null"; - WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, TargetEntity.SO); + WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, ONAPComponents.SO); execution.setVariable("WorkflowException", exception); execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); logger.info("Outgoing WorkflowException is {}", exception); -- cgit 1.2.3-korg