diff options
author | Marcus Williams <marcus.williams@intel.com> | 2019-07-09 19:36:38 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-07-09 19:36:38 +0000 |
commit | 44caab6e00aabad304b8e3b35d88af402be918dd (patch) | |
tree | e009d26053dfb62d86b83e5032f34ce981666093 /adapters/mso-openstack-adapters | |
parent | b521f501783fbe05bf8c5e08e7d42e8b3605d950 (diff) | |
parent | 878dcb36a30e0f90d6d11bd68a98b9bfb02ca9ee (diff) |
Merge "Sonar fix in CreateInventoryTask.java"
Diffstat (limited to 'adapters/mso-openstack-adapters')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java index 74cf7c38c9..c106591b25 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java @@ -3,6 +3,8 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * + * Copyright (C) 2019 IBM * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +41,8 @@ public class CreateInventoryTask { private static final Logger logger = LoggerFactory.getLogger(CreateInventoryTask.class); + private static final String AAI_INVENTORY_FAILURE = "AAIInventoryFailure"; + @Autowired CreateAAIInventory createInventory; @@ -75,7 +79,7 @@ public class CreateInventoryTask { logger.debug("The External Task Id: {} Successful", externalTask.getId()); } else if (inventoryException) { logger.debug("The External Task Id: {} Failed, Retry not needed", externalTask.getId()); - externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure"); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } else { if (externalTask.getRetries() == null) { logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", @@ -84,7 +88,7 @@ public class CreateInventoryTask { UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000); } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId()); - externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure"); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } else { logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(), externalTask.getRetries() - 1, @@ -97,13 +101,13 @@ public class CreateInventoryTask { } } else { logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTask.getId()); - externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure"); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } } private void setupMDC(ExternalTask externalTask) { try { - String msoRequestId = (String) externalTask.getVariable("mso-request-id"); + String msoRequestId = externalTask.getVariable("mso-request-id"); if (msoRequestId != null && !msoRequestId.isEmpty()) MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId); } catch (Exception e) { |