diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2020-06-18 09:54:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-06-18 09:54:58 +0000 |
commit | 16045be8d6fa7c6b55d3d9dd216e72d22add0d61 (patch) | |
tree | 12a9d6ddba32877e5fc966fab9836e0cfc5d4af7 /bpmn/so-bpmn-tasks/src/main/java | |
parent | ac1fe27ad4d7301f886d1755ea9eb8d1cb10be74 (diff) | |
parent | 1622bbc20d2d55e1881e87de83ab6ae6d579d859 (diff) |
Merge "WorkflowAction, traverseNetworkCollection refactoring stage 1"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java | 41 |
1 files changed, 27 insertions, 14 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 b4eb97a187..fe45e1385e 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 @@ -338,8 +338,7 @@ public class WorkflowAction { } flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceList, requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, vnfReplace); - if (!resourceList.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()) - .collect(Collectors.toList()).isEmpty()) { + if (isNetworkCollectionInTheResourceList(resourceList)) { logger.info("Sorting for Vlan Tagging"); flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction); } @@ -799,7 +798,7 @@ public class WorkflowAction { protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceList, org.onap.so.db.catalog.beans.Service service) { - if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) { + if (isVnfCustomizationsEmpty(service)) { List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations(); if (customizations.isEmpty()) { logger.debug("No Collections found. CollectionResourceCustomization list is empty."); @@ -866,23 +865,37 @@ public class WorkflowAction { logger.debug("No Network Collection Customization found"); } } - if (resourceList.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()) - .collect(Collectors.toList()).isEmpty()) { - if (service.getNetworkCustomizations() == null) { - logger.debug("No networks were found on this service model"); - } else { - for (int i = 0; i < service.getNetworkCustomizations().size(); i++) { - resourceList.add(new Resource(WorkflowType.NETWORK, - service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false)); - } - } - } + traverseNetworkCollectionCustomization(resourceList, service); } else { buildAndThrowException(execution, "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows"); } } + private void traverseNetworkCollectionCustomization(List<Resource> resourceList, + org.onap.so.db.catalog.beans.Service service) { + if (isNetworkCollectionInTheResourceList(resourceList)) { + return; + } + if (service.getNetworkCustomizations() == null) { + logger.debug("No networks were found on this service model"); + return; + } + for (int i = 0; i < service.getNetworkCustomizations().size(); i++) { + resourceList.add(new Resource(WorkflowType.NETWORK, + service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false)); + } + } + + private boolean isNetworkCollectionInTheResourceList(List<Resource> resourceList) { + return !(resourceList.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()) + .collect(Collectors.toList()).isEmpty()); + } + + private boolean isVnfCustomizationsEmpty(org.onap.so.db.catalog.beans.Service service) { + return service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty(); + } + protected void traverseAAIService(DelegateExecution execution, List<Resource> resourceList, String resourceId, List<Pair<WorkflowType, String>> aaiResourceIds) { try { |