summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2020-02-26 12:42:37 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-26 12:42:37 +0000
commitc1dc4f359b6738fc7d8c9ae7f926dea0130e9a43 (patch)
tree2e7a1c10656a926794d567caa6c9f0c377756e08 /bpmn/so-bpmn-tasks/src
parent5f9eb004d38baa32597d164f9c2f40ed189ae69e (diff)
parentfdbce4a47b0431fa077899ae73685ce562327181 (diff)
Merge "remove duplicated code"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java95
1 files changed, 40 insertions, 55 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 8a6c4c2796..33b60a9ed3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -6,6 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* Modifications Copyright (c) 2019 Bell Canada.
+ * Modifications Copyright (c) 2020 Nokia
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,43 +71,21 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update the status of Service to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance,
- OrchestrationStatus.ASSIGNED);
- execution.setVariable("aaiServiceInstanceRollback", true);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedService", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForService(execution, OrchestrationStatus.ASSIGNED);
+ execution.setVariable("aaiServiceInstanceRollback", true);
}
/**
* BPMN access method to update status of Service to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance,
- OrchestrationStatus.ACTIVE);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveService", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForService(execution, OrchestrationStatus.ACTIVE);
}
/**
* BPMN access method to update status of Pnf to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedPnf(BuildingBlockExecution execution) {
updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ASSIGNED);
@@ -114,8 +93,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of Pnf to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActivePnf(BuildingBlockExecution execution) {
updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ACTIVE);
@@ -135,44 +112,18 @@ public class AAIUpdateTasks {
updateOrchestrationStatusForPnf(execution, OrchestrationStatus.REGISTERED);
}
- private void updateOrchestrationStatusForPnf(BuildingBlockExecution execution, OrchestrationStatus status) {
- try {
- Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
- aaiPnfResources.updateOrchestrationStatusPnf(pnf, status);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks during update Orchestration Status to {}", status, ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
/**
* BPMN access method to update status of Vnf to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ASSIGNED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVnf", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.ASSIGNED);
}
/**
* BPMN access method to update status of Vnf to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ACTIVE);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVnf", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.ACTIVE);
}
/**
@@ -839,4 +790,38 @@ public class AAIUpdateTasks {
throw new IllegalArgumentException("Invalid action to set Orchestration status: " + action);
}
}
+
+ private void updateOrchestrationStatusForService(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for service",
+ status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private void updateOrchestrationStatusForPnf(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
+ aaiPnfResources.updateOrchestrationStatusPnf(pnf, status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update Orchestration Status to {}", status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private void updateOrchestrationStatusForVnf(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for vnf",
+ status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
}