aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2018-08-28 22:46:02 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2018-08-28 22:52:52 -0400
commit382e72538c5df057328b3cf790daaa873849c362 (patch)
tree5564c87b8719f3b9557ac01333d7738929b0b90e /ms/controllerblueprints
parentc0e77765214b94cc493b181bcc1d58165ac8b09f (diff)
Controller Blueprints Microservice
Add resource assignment json data to input property convertor utlity and their test cases. Change-Id: Ie4557048e85df38c75ac3d31ff62d4fce0662d9f Issue-ID: CCSDK-488 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints')
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt143
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java30
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt32
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt (renamed from ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationService.kt)15
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt15
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java (renamed from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationServiceTest.java)10
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java15
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json10
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDefinitionValidationService.java (renamed from ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryValidationService.java)8
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java67
10 files changed, 187 insertions, 158 deletions
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index b03fdf92..5a8d5428 100644
--- a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -26,6 +26,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.slf4j.Logger
import org.slf4j.LoggerFactory
/**
@@ -33,14 +34,14 @@ import org.slf4j.LoggerFactory
*
* @author Brinda Santh
*/
-class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var context: MutableMap<String, Any> = hashMapOf()) {
+open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var context: MutableMap<String, Any> = hashMapOf()) {
private val logger: Logger = LoggerFactory.getLogger(this::class.toString())
/*
Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
*/
- fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, Any?> {
+ open fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, Any?> {
logger.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName)
val propertyAssignmentValue: MutableMap<String, Any?> = hashMapOf()
@@ -76,7 +77,7 @@ class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var contex
return propertyAssignmentValue
}
- fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,
+ open fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,
interfaceName: String, operationName: String): MutableMap<String, Any?> {
logger.info("nodeTemplateInterfaceOperationInputsResolvedExpression for node template ({}),interface name ({}), " +
"operationName({})", nodeTemplateName, interfaceName, operationName)
@@ -105,7 +106,7 @@ class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var contex
var resolvedValue: JsonNode = NullNode.getInstance()
if (propertyAssignment != null) {
// Resolve the Expressing
- val propertyAssignmentExpression = PropertyAssignmentService( context, this)
+ val propertyAssignmentExpression = PropertyAssignmentService(context, this)
resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName, nodeTypePropertyName, propertyAssignment)
} else {
// Assign default value to the Operation
@@ -122,8 +123,8 @@ class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var contex
}
- fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String,
- interfaceName: String, operationName: String, componentContext: MutableMap<String, Any?>): Unit {
+ open fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String,
+ interfaceName: String, operationName: String, componentContext: MutableMap<String, Any?>) {
logger.info("nodeTemplateInterfaceOperationInputsResolvedExpression for node template ({}),interface name ({}), " +
"operationName({})", nodeTemplateName, interfaceName, operationName)
@@ -150,125 +151,127 @@ class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var contex
}
}
- fun resolveNodeTemplateArtifact(nodeTemplateName: String,
+ open fun resolveNodeTemplateArtifact(nodeTemplateName: String,
artifactName: String): String {
val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
val artifactDefinition: ArtifactDefinition = nodeTemplate.artifacts?.get(artifactName)
?: throw BluePrintProcessorException(String.format("failed to get artifat definition {} from the node template"
, artifactName))
- val propertyAssignmentExpression = PropertyAssignmentService( context, this)
+ val propertyAssignmentExpression = PropertyAssignmentService(context, this)
return propertyAssignmentExpression.artifactContent(artifactDefinition)
}
- fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode): Unit {
- val path = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INPUTS)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ open fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode) {
+ val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
logger.trace("setting input path ({}), values ({})", path, value)
context[path] = value
}
- fun setWorkflowInputValue(workflowName: String, propertyName: String, value: JsonNode): Unit {
- val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_WORKFLOWS).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(workflowName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INPUTS)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ open fun setWorkflowInputValue(workflowName: String, propertyName: String, value: JsonNode) {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS).append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
context[path] = value
}
- fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode): Unit {
+ open fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode) {
- val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
context[path] = value
}
- fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
- value: JsonNode): Unit {
- val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INTERFACES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_OPERATIONS).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ open fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ value: JsonNode) {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
logger.trace("setting operation property path ({}), values ({})", path, value)
context[path] = value
}
- fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
- value: JsonNode): Unit {
- val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INTERFACES).append(interfaceName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_OPERATIONS).append(operationName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INPUTS)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ open fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ value: JsonNode) {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
context[path] = value
}
- fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
- value: JsonNode): Unit {
- val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INTERFACES).append(interfaceName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_OPERATIONS).append(operationName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_OUTPUTS)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ open fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ value: JsonNode) {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
context[path] = value
}
- fun getInputValue(propertyName: String): JsonNode {
- val path = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INPUTS)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ open fun getInputValue(propertyName: String): JsonNode {
+ val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return context[path] as? JsonNode ?: NullNode.instance
}
- fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String): JsonNode {
- val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_INTERFACES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_OPERATIONS).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ open fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String): JsonNode {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return context[path] as JsonNode
}
- fun getPropertyValue(nodeTemplateName: String, propertyName: String): JsonNode? {
- val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ open fun getPropertyValue(nodeTemplateName: String, propertyName: String): JsonNode? {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return context[path] as JsonNode
}
- fun getRequirementPropertyValue(nodeTemplateName: String, requirementName: String, propertyName: String): JsonNode? {
- val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_REQUIREMENTS).append(requirementName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ open fun getRequirementPropertyValue(nodeTemplateName: String, requirementName: String, propertyName: String): JsonNode? {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_REQUIREMENTS).append(requirementName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return context[path] as JsonNode
}
- fun getCapabilityPropertyValue(nodeTemplateName: String, capabilityName: String, propertyName: String): JsonNode? {
- val path: String = StringBuilder(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_NODE_TEMPLATES).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_CAPABILITIES).append(capabilityName)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_PROPERTIES)
- .append(org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ open fun getCapabilityPropertyValue(nodeTemplateName: String, capabilityName: String, propertyName: String): JsonNode? {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_CAPABILITIES).append(capabilityName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return context[path] as JsonNode
}
- fun assignInputs(jsonNode: JsonNode): Unit {
+ open fun assignInputs(jsonNode: JsonNode) {
logger.info("assignInputs from input JSON ({})", jsonNode.toString())
bluePrintContext.inputs?.forEach { propertyName, property ->
- val valueNode: JsonNode = jsonNode.at("/" + propertyName) ?: NullNode.getInstance()
+ val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
+ ?: NullNode.getInstance()
setInputValue(propertyName, property, valueNode)
}
}
- fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode): Unit {
+ open fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode) {
logger.info("assign workflow {} input value ({})", workflowName, jsonNode.toString())
bluePrintContext.workflowByName(workflowName)?.inputs?.forEach { propertyName, property ->
- val valueNode: JsonNode = jsonNode.at("/" + propertyName) ?: NullNode.getInstance()
+ val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
+ ?: NullNode.getInstance()
setWorkflowInputValue(workflowName, propertyName, valueNode)
}
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java
deleted file mode 100644
index 48b89bd6..00000000
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict;
-
-public class ResourceDictionaryConstants {
- public static final String SOURCE_INPUT= "input";
- public static final String SOURCE_DEFAULT = "default";
- public static final String SOURCE_DB = "db";
- public static final String SOURCE_MDSAL = "mdsal";
-
- public static final String PROPERTY_TYPE = "type";
- public static final String PROPERTY_INPUT_KEY_MAPPING = "input-key-mapping";
- public static final String PROPERTY_OUTPUT_KEY_MAPPING = "output-key-mapping";
- public static final String PROPERTY_KEY_DEPENDENCIES = "key-dependencies";
-}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
new file mode 100644
index 00000000..9b89f6f4
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict
+/**
+ * ResourceDictionaryConstants
+ *
+ * @author Brinda Santh
+ */
+object ResourceDictionaryConstants {
+ const val SOURCE_INPUT = "input"
+ const val SOURCE_DEFAULT = "default"
+ const val SOURCE_DB = "db"
+
+ const val PROPERTY_TYPE = "type"
+ const val PROPERTY_INPUT_KEY_MAPPING = "input-key-mapping"
+ const val PROPERTY_OUTPUT_KEY_MAPPING = "output-key-mapping"
+ const val PROPERTY_KEY_DEPENDENCIES = "key-dependencies"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationService.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt
index e4835a06..1defa538 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationService.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt
@@ -32,24 +32,24 @@ import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
import org.slf4j.LoggerFactory
import java.io.Serializable
/**
- * ResourceDictionaryValidationService.
+ * ResourceDefinitionValidationService.
*
* @author Brinda Santh
*/
-interface ResourceDictionaryValidationService : Serializable {
+interface ResourceDefinitionValidationService : Serializable {
@Throws(BluePrintException::class)
fun validate(resourceDefinition: ResourceDefinition)
}
/**
- * ResourceDictionaryDefaultValidationService.
+ * ResourceDefinitionValidationService.
*
* @author Brinda Santh
*/
-open class ResourceDictionaryDefaultValidationService(private val bluePrintRepoService: BluePrintRepoService) : ResourceDictionaryValidationService {
+open class ResourceDefinitionDefaultValidationService(private val bluePrintRepoService: BluePrintRepoService) : ResourceDefinitionValidationService {
- private val log = LoggerFactory.getLogger(ResourceDictionaryDefaultValidationService::class.java)
+ private val log = LoggerFactory.getLogger(ResourceDefinitionValidationService::class.java)
override fun validate(resourceDefinition: ResourceDefinition) {
Preconditions.checkNotNull(resourceDefinition, "Failed to get Resource Definition")
@@ -90,7 +90,7 @@ open class ResourceDictionaryDefaultValidationService(private val bluePrintRepoS
open fun checkPropertyValue(propertyDefinition: PropertyDefinition, propertyName: String, propertyAssignment: JsonNode) {
val propertyType = propertyDefinition.type
- var isValid = false
+ val isValid : Boolean
if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment)
@@ -102,8 +102,7 @@ open class ResourceDictionaryDefaultValidationService(private val bluePrintRepoS
bluePrintRepoService.getDataType(propertyType)
?: throw BluePrintException(format("property({}) defined of data type({}) is not in repository",
propertyName, propertyType))
-
- isValid = true;
+ isValid = true
}
check(isValid) {
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
index e08c09c8..733a443f 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
@@ -16,8 +16,11 @@
package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.NullNode
import org.apache.commons.collections.MapUtils
import org.apache.commons.lang3.StringUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
@@ -59,4 +62,16 @@ object ResourceDictionaryUtils {
}
return source
}
+
+ @JvmStatic
+ fun assignInputs(data: JsonNode, context: MutableMap<String, Any>) {
+ log.trace("assignInputs from input JSON ({})", data.toString())
+ data.fields().forEach { field ->
+ val valueNode: JsonNode = data.at("/".plus(field.key)) ?: NullNode.getInstance()
+
+ val path = BluePrintConstants.PATH_INPUTS.plus(BluePrintConstants.PATH_DIVIDER).plus(field.key)
+ log.trace("setting path ({}), values ({})", path, valueNode)
+ context[path] = valueNode
+ }
+ }
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationServiceTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java
index b50c0e44..ef305627 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationServiceTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java
@@ -22,10 +22,10 @@ import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoFileSe
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
-public class ResourceDictionaryValidationServiceTest {
+public class ResourceDefinitionValidationServiceTest {
private String basePath = "load/model_type";
- String dictionaryPath = "load/resource_dictionary";
- BluePrintRepoFileService bluePrintRepoFileService = new BluePrintRepoFileService(basePath);
+ private String dictionaryPath = "load/resource_dictionary";
+ private BluePrintRepoFileService bluePrintRepoFileService = new BluePrintRepoFileService(basePath);
@Test
public void testValidateSource() throws Exception {
@@ -48,8 +48,8 @@ public class ResourceDictionaryValidationServiceTest {
ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
Assert.assertNotNull("Failed to populate dictionaryDefinition for type", resourceDefinition);
- ResourceDictionaryValidationService resourceDictionaryValidationService =
- new ResourceDictionaryDefaultValidationService(bluePrintRepoFileService);
+ ResourceDefinitionValidationService resourceDictionaryValidationService =
+ new ResourceDefinitionDefaultValidationService(bluePrintRepoFileService);
resourceDictionaryValidationService.validate(resourceDefinition);
Assert.assertNotNull(String.format("Failed to populate dictionaryDefinition for : %s", fileName), resourceDefinition);
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
index 2a207e09..5c22f654 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
@@ -18,9 +18,12 @@
package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils;
+import com.fasterxml.jackson.databind.JsonNode;
import org.junit.Assert;
import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;
@@ -76,4 +79,16 @@ public class ResourceDictionaryUtilsTest {
}
+ @Test
+ public void testAssignInputs() {
+ JsonNode data = JacksonUtils.jsonNodeFromClassPathFile("data/resource-assignment-input.json");
+ Map<String, Object> context = new HashMap<>();
+ ResourceDictionaryUtils.assignInputs(data, context);
+ String path = BluePrintConstants.PATH_INPUTS.concat(BluePrintConstants.PATH_DIVIDER).concat("mapValue");
+ log.info("populated context {}", context);
+ Assert.assertTrue(String.format("failed to get variable : %s",path),context.containsKey(path));
+
+ }
+
+
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json
new file mode 100644
index 00000000..d79c9068
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json
@@ -0,0 +1,10 @@
+{
+ "intValue" : 1,
+ "floatValue" : 1.34,
+ "booleanValue" : true,
+ "stringValue" : "sample-String",
+ "timeValue" : "2018-09-29",
+ "arrayStringValue" : ["one", "two"],
+ "mapValue" : {"profile_name1":"profile_name1",
+ "profile_name2":"profile_name2"}
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryValidationService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDefinitionValidationService.java
index 7de7fc4c..d3bf4230 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryValidationService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDefinitionValidationService.java
@@ -17,15 +17,13 @@
package org.onap.ccsdk.apps.controllerblueprints.service;
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDictionaryDefaultValidationService;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionDefaultValidationService;
import org.springframework.stereotype.Service;
@Service
-public class ResourceDictionaryValidationService extends ResourceDictionaryDefaultValidationService {
+public class ResourceDefinitionValidationService extends ResourceDefinitionDefaultValidationService {
- private BluePrintRepoService bluePrintRepoService;
-
- public ResourceDictionaryValidationService(BluePrintRepoService bluePrintRepoService) {
+ public ResourceDefinitionValidationService(BluePrintRepoService bluePrintRepoService) {
super(bluePrintRepoService);
}
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
index 85e701b4..ccf4ffcc 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
@@ -18,6 +18,7 @@
package org.onap.ccsdk.apps.controllerblueprints.service;
import com.google.common.base.Preconditions;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;
@@ -43,16 +44,16 @@ public class ResourceDictionaryService {
private ResourceDictionaryRepository resourceDictionaryRepository;
- private ResourceDictionaryValidationService resourceDictionaryValidationService;
+ private ResourceDefinitionValidationService resourceDictionaryValidationService;
/**
* This is a DataDictionaryService, used to save and get the Resource Mapping stored in database
*
- * @param dataDictionaryRepository
- * @param resourceDictionaryValidationService
+ * @param dataDictionaryRepository dataDictionaryRepository
+ * @param resourceDictionaryValidationService resourceDictionaryValidationService
*/
public ResourceDictionaryService(ResourceDictionaryRepository dataDictionaryRepository,
- ResourceDictionaryValidationService resourceDictionaryValidationService) {
+ ResourceDefinitionValidationService resourceDictionaryValidationService) {
this.resourceDictionaryRepository = dataDictionaryRepository;
this.resourceDictionaryValidationService = resourceDictionaryValidationService;
}
@@ -60,58 +61,49 @@ public class ResourceDictionaryService {
/**
* This is a getDataDictionaryByName service
*
- * @param name
+ * @param name name
* @return DataDictionary
- * @throws BluePrintException
+ * @throws BluePrintException BluePrintException
*/
public ResourceDictionary getResourceDictionaryByName(String name) throws BluePrintException {
- if (StringUtils.isNotBlank(name)) {
- return resourceDictionaryRepository.findByName(name).get();
+ Preconditions.checkArgument(StringUtils.isNotBlank(name), "Resource dictionary Name Information is missing.");
+ Optional<ResourceDictionary> resourceDictionaryDb = resourceDictionaryRepository.findByName(name);
+ if (resourceDictionaryDb.isPresent()) {
+ return resourceDictionaryDb.get();
} else {
- throw new BluePrintException("Resource Mapping Name Information is missing.");
+ throw new BluePrintException(String.format("couldn't get resource dictionary for name (%s)", name));
}
}
/**
* This is a searchResourceDictionaryByNames service
*
- * @param names
+ * @param names names
* @return List<ResourceDictionary>
- * @throws BluePrintException
*/
- public List<ResourceDictionary> searchResourceDictionaryByNames(List<String> names)
- throws BluePrintException {
- if (names != null && !names.isEmpty()) {
- return resourceDictionaryRepository.findByNameIn(names);
- } else {
- throw new BluePrintException("No Search Information provide");
- }
+ public List<ResourceDictionary> searchResourceDictionaryByNames(List<String> names) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(names), "No Search Information provide");
+ return resourceDictionaryRepository.findByNameIn(names);
}
/**
* This is a searchResourceDictionaryByTags service
*
- * @param tags
+ * @param tags tags
* @return List<ResourceDictionary>
- * @throws BluePrintException
*/
- public List<ResourceDictionary> searchResourceDictionaryByTags(String tags) throws BluePrintException {
- if (StringUtils.isNotBlank(tags)) {
- return resourceDictionaryRepository.findByTagsContainingIgnoreCase(tags);
- } else {
- throw new BluePrintException("No Search Information provide");
- }
+ public List<ResourceDictionary> searchResourceDictionaryByTags(String tags) {
+ Preconditions.checkArgument(StringUtils.isNotBlank(tags), "No search tag information provide");
+ return resourceDictionaryRepository.findByTagsContainingIgnoreCase(tags);
}
/**
* This is a saveDataDictionary service
*
- * @param resourceDictionary
+ * @param resourceDictionary resourceDictionary
* @return DataDictionary
- * @throws BluePrintException
*/
- public ResourceDictionary saveResourceDictionary(ResourceDictionary resourceDictionary)
- throws BluePrintException {
+ public ResourceDictionary saveResourceDictionary(ResourceDictionary resourceDictionary) {
Preconditions.checkNotNull(resourceDictionary, "Resource Dictionary information is missing");
Preconditions.checkArgument(StringUtils.isNotBlank(resourceDictionary.getDefinition()),
"Resource Dictionary definition information is missing");
@@ -130,7 +122,7 @@ public class ResourceDictionaryService {
PropertyDefinition propertyDefinition = resourceDefinition.getProperty();
resourceDictionary.setDescription(propertyDefinition.getDescription());
resourceDictionary.setDataType(propertyDefinition.getType());
- if(propertyDefinition.getEntrySchema() != null){
+ if (propertyDefinition.getEntrySchema() != null) {
resourceDictionary.setEntrySchema(propertyDefinition.getEntrySchema().getType());
}
@@ -164,15 +156,10 @@ public class ResourceDictionaryService {
/**
* This is a deleteResourceDictionary service
*
- * @param name
- * @throws BluePrintException
+ * @param name name
*/
- public void deleteResourceDictionary(String name) throws BluePrintException {
- if (name != null) {
- resourceDictionaryRepository.deleteByName(name);
- } else {
- throw new BluePrintException("Resource Mapping Id Information is missing.");
- }
-
+ public void deleteResourceDictionary(String name) {
+ Preconditions.checkArgument(StringUtils.isNotBlank(name), "Resource dictionary Name Information is missing.");
+ resourceDictionaryRepository.deleteByName(name);
}
}