summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java
index 417380b5d9..e0bf727408 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java
@@ -23,6 +23,7 @@
package org.openecomp.sdc.be.components.impl;
import fj.data.Either;
+import java.util.Vector;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.FilenameUtils;
@@ -1181,12 +1182,20 @@ public class GroupBusinessLogic extends BaseBusinessLogic {
}
}
- private void addCalculatedCapabilitiesWithPropertiesToComponent(Component component, final List<GroupDefinition> groupDefinitions, boolean fromCsar) {
- groupDefinitions.forEach(GroupDefinition::updateEmptyCapabilitiesOwnerFields);
- StorageOperationStatus status = groupsOperation.addCalculatedCapabilitiesWithProperties(component.getUniqueId(),
- extractCapabilitiesFromGroups(groupDefinitions), extractCapabilityPropertiesFromGroups(groupDefinitions, fromCsar));
- if(status != StorageOperationStatus.OK){
- log.error("#addCalculatedCapabilitiesWithPropertiesToComponent - failed to add the groups' calculated capabilities with the properties to the component {}. ", component.getUniqueId());
+ private void addCalculatedCapabilitiesWithPropertiesToComponent(Component component,
+ final List<GroupDefinition> groupDefinitions, boolean fromCsar) {
+ final List<GroupDefinition> nonNullGroupDefinitions =
+ (groupDefinitions == null) ? Collections.emptyList() : groupDefinitions;
+
+ nonNullGroupDefinitions.forEach(GroupDefinition::updateEmptyCapabilitiesOwnerFields);
+ StorageOperationStatus status = groupsOperation.addCalculatedCapabilitiesWithProperties(
+ component.getUniqueId(),
+ extractCapabilitiesFromGroups(nonNullGroupDefinitions),
+ extractCapabilityPropertiesFromGroups(nonNullGroupDefinitions, fromCsar));
+ if (status != StorageOperationStatus.OK) {
+ log.error(
+ "#addCalculatedCapabilitiesWithPropertiesToComponent - failed to add the groups' calculated capabilities with the properties to the component {}. ",
+ component.getUniqueId());
rollbackWithException(componentsUtils.convertFromStorageResponse(status));
}
}