Fix Service/VF set value to list/map properties
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / servlets / ComponentPropertyServlet.java
index 9ff155f..b411a97 100644 (file)
@@ -24,9 +24,7 @@ import io.swagger.v3.oas.annotations.media.Content;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
 import io.swagger.v3.oas.annotations.servers.Server;
-import io.swagger.v3.oas.annotations.servers.Servers;
 import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.tags.Tags;
 import java.util.List;
 import java.util.Map;
 import javax.inject.Inject;
@@ -66,8 +64,8 @@ import org.slf4j.LoggerFactory;
 
 @Loggable(prepend = true, value = Loggable.DEBUG, trim = false)
 @Path("/v1/catalog")
-@Tags({@Tag(name = "SDC Internal APIs")})
-@Servers({@Server(url = "/sdc2/rest")})
+@Tag(name = "SDCE-2 APIs")
+@Server(url = "/sdc2/rest")
 @Singleton
 public class ComponentPropertyServlet extends BeGenericServlet {
 
@@ -315,9 +313,10 @@ public class ComponentPropertyServlet extends BeGenericServlet {
                 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT);
                 return buildErrorResponse(responseFormat);
             }
-            //Validate value and Constraint of property
-            Either<Boolean, ResponseFormat> constraintValidatorResponse = PropertyValueConstraintValidationUtil.getInstance()
-                .validatePropertyConstraints(properties.values(), applicationDataTypeCache);
+            //Validate value and Constraint of property and Fetch all data types from cache
+            Either<Boolean, ResponseFormat> constraintValidatorResponse = new PropertyValueConstraintValidationUtil()
+                .validatePropertyConstraints(properties.values(), applicationDataTypeCache,
+                    propertyBusinessLogic.getComponentModelByComponentId(componentId));
             if (constraintValidatorResponse.isRight()) {
                 log.error("Failed validation value and constraint of property: {}", constraintValidatorResponse.right().value());
                 return buildErrorResponse(constraintValidatorResponse.right().value());
@@ -327,7 +326,7 @@ public class ComponentPropertyServlet extends BeGenericServlet {
                 Either<EntryData<String, PropertyDefinition>, ResponseFormat> status = propertyBusinessLogic
                     .updateComponentProperty(componentId, propertyDefinition.getUniqueId(), propertyDefinition, userId);
                 if (status.isRight()) {
-                    log.info("Failed to update Property. Reason - ", status.right().value());
+                    log.info("Failed to update Property. Reason - {}", status.right().value());
                     return buildErrorResponse(status.right().value());
                 }
                 EntryData<String, PropertyDefinition> property = status.left().value();