aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorKrzysztof Gajewski <krzysztof.gajewski@nokia.com>2020-06-15 18:11:28 +0200
committerKrzysztof Gajewski <krzysztof.gajewski@nokia.com>2020-06-18 10:24:27 +0200
commit1622bbc20d2d55e1881e87de83ab6ae6d579d859 (patch)
treec24f156e2d9b4c8cd96c8f02ba7cf2573e994701 /bpmn
parent515be95fb12dcecf7cffb9f8fac6db853907d329 (diff)
WorkflowAction, traverseNetworkCollection refactoring stage 1
- extract one function; if logic refactor - two boolean "ifs" function created Issue-ID: SO-2634 Signed-off-by: Krzysztof Gajewski <krzysztof.gajewski@nokia.com> Change-Id: Ia139d0a6f1b470c8e7fab77afc76937dac9f5364 Signed-off-by: Krzysztof Gajewski <krzysztof.gajewski@nokia.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java41
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 {