summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
authorKrzysztof Gajewski <krzysztof.gajewski@nokia.com>2020-06-19 17:07:02 +0200
committerKrzysztof Gajewski <krzysztof.gajewski@nokia.com>2020-06-29 11:58:54 +0200
commit5f47e57c8096910d23ab8621600f47add5c99ac2 (patch)
tree754ebe8e1f3a99f33dd9b1390942077dcf5a6e19 /bpmn/so-bpmn-tasks
parentd99ac569a32064d4b61475c73c9ff41aa93596a6 (diff)
WorkflowAction, traverseNetworkCollection refactoring stage 4
- extract if's to method - extract one logical function; Issue-ID: SO-2634 Signed-off-by: Krzysztof Gajewski <krzysztof.gajewski@nokia.com> Change-Id: Ia31184383814a408d91d7e951e7df944647454ca
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java54
1 files changed, 33 insertions, 21 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 99a825006e..b64f62a8a3 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
@@ -848,27 +848,8 @@ public class WorkflowAction {
private void traverseNetworkCollectionResourceCustomization(List<Resource> resourceList,
CollectionResourceCustomization collectionResourceCustomization) {
- if (collectionResourceCustomization == null) {
- logger.debug("No Network Collection Customization found");
- return;
- }
- resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
- collectionResourceCustomization.getModelCustomizationUUID(), false));
- logger.debug("Found a network collection");
- if (collectionResourceCustomization.getCollectionResource() == null) {
- logger.debug("No Network Collection found. collectionResource is null");
- return;
- }
- if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() == null) {
- logger.debug("No Instance Group found for network collection.");
+ if (collectionResourceCustomizationShouldNotBeProcessed(resourceList, collectionResourceCustomization))
return;
- }
- String toscaNodeType =
- collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
- if (!toscaNodeTypeHasNetworkCollection(toscaNodeType)) {
- logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}", toscaNodeType);
- return;
- }
int minNetworks = 0;
org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
collectionResourceCustomization.getCollectionResource().getInstanceGroup();
@@ -882,7 +863,7 @@ public class WorkflowAction {
break;
}
}
- if (collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
+ if (interfaceNetworkQuantityIsAvailableInCollection(collectionInstCust)) {
minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
}
}
@@ -906,6 +887,37 @@ public class WorkflowAction {
}
}
+ private boolean collectionResourceCustomizationShouldNotBeProcessed(List<Resource> resourceList,
+ CollectionResourceCustomization collectionResourceCustomization) {
+ if (collectionResourceCustomization == null) {
+ logger.debug("No Network Collection Customization found");
+ return true;
+ }
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ collectionResourceCustomization.getModelCustomizationUUID(), false));
+ logger.debug("Found a network collection");
+ if (collectionResourceCustomization.getCollectionResource() == null) {
+ logger.debug("No Network Collection found. collectionResource is null");
+ return true;
+ }
+ if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() == null) {
+ logger.debug("No Instance Group found for network collection.");
+ return true;
+ }
+ String toscaNodeType =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
+ if (!toscaNodeTypeHasNetworkCollection(toscaNodeType)) {
+ logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}", toscaNodeType);
+ return true;
+ }
+ return false;
+ }
+
+ private boolean interfaceNetworkQuantityIsAvailableInCollection(
+ CollectionResourceInstanceGroupCustomization collectionInstCust) {
+ return collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null;
+ }
+
private boolean toscaNodeTypeHasNetworkCollection(String toscaNodeType) {
return toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION);
}