diff options
author | Krzysztof Gajewski <krzysztof.gajewski@nokia.com> | 2020-06-17 15:02:47 +0200 |
---|---|---|
committer | Krzysztof Gajewski <krzysztof.gajewski@nokia.com> | 2020-07-01 17:35:59 +0200 |
commit | 7181f7af86798e732da8edee06ea61e9be26a850 (patch) | |
tree | bcd4002b9a7b4df86dcf43e132c51595c912e705 /bpmn/so-bpmn-tasks/src | |
parent | 69607bdb19821409e8e12b2e44ad4eaed67bf75c (diff) |
WorkflowAction, traverseAAIService refactoring stage 1
- Extract methods
- invert if
Issue-ID: SO-2634
Signed-off-by: Krzysztof Gajewski <krzysztof.gajewski@nokia.com>
Change-Id: I769cb38ba65d8094bac2a71d70df2e7ef267efeb
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 8a4058bf01..fc8a54bc63 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -938,28 +938,7 @@ public class WorkflowAction { org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = bbInputSetup.getExistingServiceInstance(serviceInstanceAAI); resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false)); - if (serviceInstanceMSO.getVnfs() != null) { - for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) { - aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId())); - resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false)); - if (vnf.getVfModules() != null) { - for (VfModule vfModule : vnf.getVfModules()) { - aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId())); - Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false); - resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean()); - resourceList.add(resource); - } - } - if (vnf.getVolumeGroups() != null) { - for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf - .getVolumeGroups()) { - aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId())); - resourceList - .add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false)); - } - } - } - } + traverseServiceInstanceMSOVnfs(resourceList, aaiResourceIds, serviceInstanceMSO); if (serviceInstanceMSO.getNetworks() != null) { for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO .getNetworks()) { @@ -998,6 +977,38 @@ public class WorkflowAction { } } + private void traverseServiceInstanceMSOVnfs(List<Resource> resourceList, + List<Pair<WorkflowType, String>> aaiResourceIds, + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) { + if (serviceInstanceMSO.getVnfs() == null) { + return; + } + for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) { + aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId())); + resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false)); + traverseVnfModules(resourceList, aaiResourceIds, vnf); + if (vnf.getVolumeGroups() != null) { + for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf.getVolumeGroups()) { + aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId())); + resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false)); + } + } + } + } + + private void traverseVnfModules(List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds, + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf) { + if (vnf.getVfModules() == null) { + return; + } + for (VfModule vfModule : vnf.getVfModules()) { + aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId())); + Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false); + resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean()); + resourceList.add(resource); + } + } + private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceList, String serviceId, String vnfId, List<Pair<WorkflowType, String>> aaiResourceIds) { try { |