diff options
author | Singal, Kapil (ks220y) <ks220y@att.com> | 2018-09-27 14:10:11 -0400 |
---|---|---|
committer | Singal, Kapil (ks220y) <ks220y@att.com> | 2018-09-27 16:55:32 -0400 |
commit | 8e71778ccee6195c48d8f59eaffc8067cbb5f1ee (patch) | |
tree | b62576f61636277bcb9fda0ad726379b80cda43c /blueprints-processor/plugin/assignment-provider/src | |
parent | 2d4e12553c315077ebeb4e12c72bf354f4880615 (diff) |
SDN Controller Blueprints Processor
Changing Resource Dictionary Definition data-type from String to JsonNode and other implementation to consume Resource Definitions List from Blueprints Artifacts
Change-Id: Ic3d7a2c919f9306f2e74d8d527365c85c2b777f5
Issue-ID: CCSDK-598
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Diffstat (limited to 'blueprints-processor/plugin/assignment-provider/src')
2 files changed, 9 insertions, 15 deletions
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentUtils.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentUtils.java index 1d7df6b58..15221ae64 100644 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentUtils.java +++ b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ConfigAssignmentUtils.java @@ -56,14 +56,10 @@ public class ConfigAssignmentUtils { public static synchronized Object getContextKeyValue(SvcLogicContext context, String key) {
Object value = null;
- if (context != null && key != null) {
- if (context.getAttributeKeySet().contains(key)) {
- String strValue = context.getAttribute(key);
- if (StringUtils.isNotBlank(strValue)) {
- value = strValue;
- }
- } else {
- // Do Nothing
+ if (context != null && key != null && context.getAttributeKeySet().contains(key)) {
+ String strValue = context.getAttribute(key);
+ if (StringUtils.isNotBlank(strValue)) {
+ value = strValue;
}
}
return value;
@@ -135,9 +131,9 @@ public class ConfigAssignmentUtils { ResourceDefinition resourceDefinition = null;
if (dictionaries != null && StringUtils.isNotBlank(dictionaryName)) {
ResourceDictionary resourceDictionary = dictionaries.get(dictionaryName);
- if (resourceDictionary != null && StringUtils.isNotBlank(resourceDictionary.getDefinition())) {
+ if (resourceDictionary != null && resourceDictionary.getDefinition() != null) {
resourceDefinition =
- TransformationUtils.readValue(resourceDictionary.getDefinition(), ResourceDefinition.class);
+ TransformationUtils.treeToValue(resourceDictionary.getDefinition(), ResourceDefinition.class);
}
}
return resourceDefinition;
diff --git a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ResourceDictionaryService.java b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ResourceDictionaryService.java index ec586f493..d8692c4c7 100644 --- a/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ResourceDictionaryService.java +++ b/blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/features/assignment/service/ResourceDictionaryService.java @@ -51,11 +51,9 @@ public class ResourceDictionaryService { List<String> names = new ArrayList<>();
for (ResourceAssignment resourceAssignment : resourceAssignments) {
if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getDictionaryName())) {
-
if (!names.contains(resourceAssignment.getDictionaryName())) {
names.add(resourceAssignment.getDictionaryName());
}
-
if (resourceAssignment.getDependencies() != null
&& !resourceAssignment.getDependencies().isEmpty()) {
List<String> dependencieNames = resourceAssignment.getDependencies();
@@ -83,7 +81,7 @@ public class ResourceDictionaryService { if (!names.isEmpty()) {
String dictionaryContents = configRestAdaptorService.postResource(
- ConfigRestAdaptorConstants.SELECTOR_MODEL_SERVICE, "dictionarybynames", names, String.class);
+ ConfigRestAdaptorConstants.SELECTOR_MODEL_SERVICE, "dictionary/by-names", names, String.class);
if (StringUtils.isNotBlank(dictionaryContents)) {
List<ResourceDictionary> dataDictionaries =
@@ -91,9 +89,9 @@ public class ResourceDictionaryService { if (dataDictionaries != null) {
for (ResourceDictionary dataDictionary : dataDictionaries) {
if (dataDictionary != null && StringUtils.isNotBlank(dataDictionary.getName())
- && StringUtils.isNotBlank(dataDictionary.getDefinition())) {
+ && dataDictionary.getDefinition() != null) {
ResourceDefinition resourceDefinition = TransformationUtils
- .readValue(dataDictionary.getDefinition(), ResourceDefinition.class);
+ .treeToValue(dataDictionary.getDefinition(), ResourceDefinition.class);
if (resourceDefinition != null && StringUtils.isNotBlank(resourceDefinition.getName())) {
dictionaries.put(resourceDefinition.getName(), resourceDefinition);
} else {
|