aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2020-09-26 16:45:53 +0000
committerGerrit Code Review <gerrit@onap.org>2020-09-26 16:45:53 +0000
commitaf1efe8d52d325929e4e9231576a9a5f97e143ae (patch)
tree8b0bb6dfbb824d23a755800d43b78186a67dc5ac /bpmn/so-bpmn-tasks/src/main
parent38ba6377d605cce14275ccc3973d8abe7ffb3abc (diff)
parent2e66d01a3a75439ab077fe15b1830ba4bc2a1d6b (diff)
Merge "Sonar fixes"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index b55499473c..9ac3579957 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -85,6 +85,11 @@ public class AAICreateTasks {
private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
private static String HEAT_STACK_ID = "heatStackId";
private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
+ protected static final String EXCEPTION_NAME_EXISTS_WITH_DIFFERENT_ID =
+ "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)";
+ protected static final String EXCEPTION_NAME_AND_ID_ARE_NULL =
+ "Exception in AAICreateOwningEntity. OwningEntityId and Name are null.";
+
@Autowired
private AAIServiceInstanceResources aaiSIResources;
@Autowired
@@ -192,9 +197,8 @@ public class AAICreateTasks {
OwningEntity owningEntity = serviceInstance.getOwningEntity();
if (Strings.isNullOrEmpty(owningEntity.getOwningEntityId())
&& Strings.isNullOrEmpty(owningEntity.getOwningEntityName())) {
- String msg = "Exception in AAICreateOwningEntity. OwningEntityId and Name are null.";
- execution.setVariable("ErrorCreateOEAAI", msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ execution.setVariable("ErrorCreateOEAAI", EXCEPTION_NAME_AND_ID_ARE_NULL);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "EXCEPTION_NAME_AND_ID_ARE_NULL");
} else if (Strings.isNullOrEmpty(owningEntity.getOwningEntityId())
&& !Strings.isNullOrEmpty(owningEntity.getOwningEntityName())) {
if (aaiSIResources.existsOwningEntityName(owningEntity.getOwningEntityName())) {
@@ -219,11 +223,11 @@ public class AAICreateTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
} else {
if (aaiSIResources.existsOwningEntityName(owningEntity.getOwningEntityName())) {
- String msg =
- "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)";
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg,
- "BPMN", ErrorCode.UnknownError.getValue(), msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ EXCEPTION_NAME_EXISTS_WITH_DIFFERENT_ID, "BPMN", ErrorCode.UnknownError.getValue(),
+ EXCEPTION_NAME_EXISTS_WITH_DIFFERENT_ID);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+ EXCEPTION_NAME_EXISTS_WITH_DIFFERENT_ID);
} else {
aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance);
}