import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
List<String> uniqueKeys = new ArrayList<>(i.getValue().getMapToscaDataDefinition().keySet());
List<String> pathKeys = new ArrayList<>();
pathKeys.add(i.getKey());
- StorageOperationStatus status = deleteToscaDataDeepElements(nodeTypeVertex, EdgeLabelEnum.INST_INPUTS, VertexTypeEnum.INST_INPUTS,
- uniqueKeys, pathKeys, JsonPresentationFields.NAME);
+ StorageOperationStatus status = deleteToscaDataDeepElements(nodeTypeVertex, EdgeLabelEnum.INST_INPUTS,
+ uniqueKeys, pathKeys);
if (status != StorageOperationStatus.OK) {
return;
}
category.setUniqueId(categoryV.getUniqueId());
category.setNormalizedName((String) metadataProperties.get(GraphPropertyEnum.NORMALIZED_NAME));
category.setName((String) metadataProperties.get(GraphPropertyEnum.NAME));
- final Boolean useServiceSubstitutionForNestedServices = (Boolean) metadataProperties
- .get(GraphPropertyEnum.USE_SUBSTITUTION_FOR_NESTED_SERVICES);
+ final Object useServiceSubstitutionForNestedServices = metadataProperties.get(GraphPropertyEnum.USE_SUBSTITUTION_FOR_NESTED_SERVICES);
category.setUseServiceSubstitutionForNestedServices(
- useServiceSubstitutionForNestedServices == null ? false : useServiceSubstitutionForNestedServices);
+ useServiceSubstitutionForNestedServices != null && (boolean) useServiceSubstitutionForNestedServices);
Type listTypeCat = new TypeToken<List<String>>() {
}.getType();
- List<String> iconsfromJsonCat = getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.ICONS.getProperty()), listTypeCat);
- category.setIcons(iconsfromJsonCat);
+ category.setNotApplicableMetadataKeys(
+ (getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.NOT_APPLICABLE_METADATA_KEYS.getProperty()), listTypeCat)));
+ List<String> iconsFromJsonCat = getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.ICONS.getProperty()), listTypeCat);
+ category.setIcons(iconsFromJsonCat);
category.setModels((getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.MODEL.getProperty()), listTypeCat)));
final Type metadataKeysTypeCat = new TypeToken<List<MetadataKeyDataDefinition>>() {
}.getType();
}
public StorageOperationStatus removePolicyFromToscaElement(GraphVertex componentV, String policyId) {
- return deleteToscaDataElement(componentV, EdgeLabelEnum.POLICIES, VertexTypeEnum.POLICIES, policyId, JsonPresentationFields.UNIQUE_ID);
+ return deleteToscaDataElement(componentV, EdgeLabelEnum.POLICIES, policyId);
}
public StorageOperationStatus updateGroupOfToscaElement(GraphVertex componentV, GroupDefinition groupDefinition) {
}
private void fillPolicyDefinition(GraphVertex componentV, PolicyDefinition policyDefinition, int counter) {
- String policyName = buildSubComponentName((String) componentV.getJsonMetadataField(JsonPresentationFields.NAME),
- policyDefinition.getPolicyTypeName(), counter);
- policyDefinition.setName(policyName);
+ String policyName = policyDefinition.getName();
+ if (StringUtils.isBlank(policyName)) {
+ policyName = buildSubComponentName((String) componentV.getJsonMetadataField(JsonPresentationFields.NAME),
+ policyDefinition.getPolicyTypeName(), counter);
+ policyDefinition.setName(policyName);
+ }
policyDefinition.setInvariantName(policyName);
policyDefinition.setComponentName((String) componentV.getJsonMetadataField(JsonPresentationFields.NAME));
policyDefinition.setUniqueId(UniqueIdBuilder.buildPolicyUniqueId(componentV.getUniqueId(), policyName));