diff options
Diffstat (limited to 'bpmn')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java | 54 |
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); } |