From: Muthuramalingam, Brinda Santh(bs2796) Date: Wed, 12 Dec 2018 15:03:26 +0000 (-0500) Subject: Decompose enhancer to multiple types. X-Git-Tag: 0.4.2~163^2~81 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=5955693557579edc0c936fe35cb060991f0ee77a;p=ccsdk%2Fcds.git Decompose enhancer to multiple types. Change-Id: I508ce5919680f6e7f994776e58404729b55eace8 Issue-ID: CCSDK-803 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt index 989617bd3..cb835d736 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt @@ -102,16 +102,29 @@ interface BluePrintTypeEnhancerService { doEnhancement(bluePrintContext, error, name, policyType, enhancers) } + fun enhancePropertyDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, properties: MutableMap) { + properties.forEach { propertyName, propertyDefinition -> + enhancePropertyDefinition(bluePrintContext, error, propertyName, propertyDefinition) + } + } + fun enhancePropertyDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) { val enhancers = getPropertyDefinitionEnhancers() doEnhancement(bluePrintContext, error, name, propertyDefinition, enhancers) } + fun enhanceAttributeDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, attributes: MutableMap) { + attributes.forEach { attributeName, attributeDefinition -> + enhanceAttributeDefinition(bluePrintContext, error, attributeName, attributeDefinition) + } + } + fun enhanceAttributeDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, attributeDefinition: AttributeDefinition) { val enhancers = getAttributeDefinitionEnhancers() doEnhancement(bluePrintContext, error, name, attributeDefinition, enhancers) } + @Suppress("UNCHECKED_CAST") private fun doEnhancement(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, definition: Any, enhancers: List>) { if (enhancers.isNotEmpty()) { enhancers.forEach {