diff options
Diffstat (limited to 'ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt')
-rw-r--r-- | ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt index 91d01c6a0..63aa7e537 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt @@ -18,15 +18,15 @@ package org.onap.ccsdk.cds.controllerblueprints.validation.utils import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.format -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintExpressionService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintExpressionService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueprintContext) { +open class PropertyAssignmentValidationUtils(private val bluePrintContext: BluePrintContext) { // Property Definition holds both Definitons and Expression in same construct open fun validatePropertyDefinitionNAssignments(propertyDefinitions: MutableMap<String, PropertyDefinition>) { @@ -39,10 +39,10 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: Bluep open fun validatePropertyDefinitionNAssignment(propertyName: String, propertyDefinition: PropertyDefinition) { // Check and Validate if Expression Node checkNotNull(propertyDefinition.value) { - throw BlueprintException("couldn't get 'value' property from PropertyDefinition($propertyName)") + throw BluePrintException("couldn't get 'value' property from PropertyDefinition($propertyName)") } val propertyAssignment = propertyDefinition.value!! - val expressionData = BlueprintExpressionService.getExpressionData(propertyAssignment) + val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment) if (!expressionData.isExpression) { checkPropertyValue(propertyName, propertyDefinition, propertyAssignment) } @@ -54,7 +54,7 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: Bluep ) { properties.forEach { propertyName, propertyAssignment -> val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName] - ?: throw BlueprintException("validatePropertyAssignments failed to get definition for the property ($propertyName)") + ?: throw BluePrintException("validatePropertyAssignments failed to get definition for the property ($propertyName)") validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment) } @@ -66,7 +66,7 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: Bluep propertyAssignment: JsonNode ) { // Check and Validate if Expression Node - val expressionData = BlueprintExpressionService.getExpressionData(propertyAssignment) + val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment) if (!expressionData.isExpression) { checkPropertyValue(propertyName, propertyDefinition, propertyAssignment) } @@ -76,16 +76,16 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: Bluep val propertyType = propertyDefinition.type val isValid: Boolean - if (BlueprintTypes.validPrimitiveTypes().contains(propertyType)) { + if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) { isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment) - } else if (BlueprintTypes.validComplexTypes().contains(propertyType)) { + } else if (BluePrintTypes.validComplexTypes().contains(propertyType)) { isValid = true - } else if (BlueprintTypes.validCollectionTypes().contains(propertyType)) { + } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) { val entrySchemaType = propertyDefinition.entrySchema?.type - ?: throw BlueprintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName)) + ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName)) - if (!BlueprintTypes.validPropertyTypes().contains(entrySchemaType)) { + if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) { checkPropertyDataType(entrySchemaType, propertyName) } isValid = JacksonUtils.checkJsonNodeValueOfCollectionType(propertyType, propertyAssignment) @@ -95,21 +95,21 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: Bluep } check(isValid) { - throw BlueprintException("property($propertyName) defined of type($propertyType) is not compatible with the value ($propertyAssignment)") + throw BluePrintException("property($propertyName) defined of type($propertyType) is not compatible with the value ($propertyAssignment)") } } open fun checkPropertyDataType(dataTypeName: String, propertyName: String) { val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName) - ?: throw BlueprintException("DataType ($dataTypeName) for the property ($propertyName) not found") + ?: throw BluePrintException("DataType ($dataTypeName) for the property ($propertyName) not found") checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom) } open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) { - check(BlueprintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { - throw BlueprintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ") + check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { + throw BluePrintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ") } } } |