import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.CapabilityDefinition;
import org.openecomp.sdc.be.model.ComponentInstInputsMap;
return result;
}
- Either<Map<String, List<ComponentInstanceInput>>, StorageOperationStatus> addciInputsEither = toscaOperationFacade.addComponentInstanceInputsToComponent(inputsValueToCreateMap, component.getUniqueId());
+ Either<Map<String, List<ComponentInstanceInput>>, StorageOperationStatus> addciInputsEither = toscaOperationFacade.addComponentInstanceInputsToComponent(component, inputsValueToCreateMap);
if(addciInputsEither.isRight()){
log.debug("Failed to add inputs values under component {}. Status is {}", component.getUniqueId(), assotiateInputsEither.right().value());
result = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(assotiateInputsEither.right().value())));
input.setImmutable(oldInput.isImmutable());
input.setDefinition(oldInput.isDefinition());
input.setRequired(oldInput.isRequired());
+ input.setOwnerId(null);
+ input.setParentUniqueId(null);
inputsToCreate.put(input.getName(), input);
}
if (resourceProperties != null) {
Map<String, InputDefinition> generatedInputs = resourceProperties.stream().collect(Collectors.toMap(i -> i.getName(), i -> i));
- Either<Map<String, InputDefinition>, String> mergeEither = PropertyDataDefinition.mergeProperties(generatedInputs, inputs, false);
+ Either<Map<String, InputDefinition>, String> mergeEither = ToscaDataDefinition.mergeDataMaps(generatedInputs, inputs);
if(mergeEither.isRight()){
return Either.right(componentsUtils.getResponseFormat(ActionStatus.PROPERTY_ALREADY_EXIST, mergeEither.right().value()));
}
if (!optionalInput.isPresent()) {
return Either.right(componentsUtils.getResponseFormat(ActionStatus.INPUT_IS_NOT_CHILD_OF_COMPONENT, inputId, componentId));
}
+
+ InputDefinition inputForDelete = optionalInput.get();
// Lock component
Either<Boolean, ResponseFormat> lockResultEither = lockComponent(componentId, component, "deleteInput");
}
// Delete input operations
-
- InputDefinition inputForDelete = optionalInput.get();
try {
StorageOperationStatus status = toscaOperationFacade.deleteInputOfResource(component, inputForDelete.getName());
if(status != StorageOperationStatus.OK){
resetInputName(mappedToscaTemplate, inputForDelete.getName());
- value = gson.toJson(mappedToscaTemplate);
+ value = "";
+ if(!mappedToscaTemplate.isEmpty())
+ value = gson.toJson(mappedToscaTemplate);
propertyValue.setValue(value);
String compInstId = propertyValue.getComponentInstanceId();
propertyValue.setRules(null);
if (properties != null && !properties.isEmpty()) {
for (ComponentInstancePropInput propInput : properties) {
+ propInput.setOwnerId(null);
+ propInput.setParentUniqueId(null);
Either<InputDefinition, StorageOperationStatus> createInputRes = createInputForComponentInstance(component, origComponent,ci, inputsToCreate, propertiesToCreate, dataTypes, inputName, propInput);
if (createInputRes.isRight()) {
inputsToCreate.put(input.getName(), input);
+ List<ComponentInstanceProperty> propertiesList = new ArrayList<>(); // adding the property with the new value for UI
+ propertiesList.add(prop);
+ input.setProperties(propertiesList);
+
return Either.left(input);
}