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 | |
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')
4 files changed, 19 insertions, 68 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 {
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModelContent.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModelContent.java index 4c55e7534..cba2570ea 100644 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModelContent.java +++ b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModelContent.java @@ -28,7 +28,7 @@ public class ConfigModelContent { private String description;
private String content;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- private Date createdDate = new Date();
+ private Date creationDate = new Date();
@Override
public String toString() {
@@ -80,12 +80,12 @@ public class ConfigModelContent { this.content = content;
}
- public Date getCreatedDate() {
- return createdDate;
+ public Date getCreationDate() {
+ return creationDate;
}
- public void setCreatedDate(Date createdDate) {
- this.createdDate = createdDate;
+ public void setCreationDate(Date creationDate) {
+ this.creationDate = creationDate;
}
}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ResourceDictionary.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ResourceDictionary.java index c62bf69b2..d97d3a395 100644 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ResourceDictionary.java +++ b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ResourceDictionary.java @@ -17,21 +17,17 @@ package org.onap.ccsdk.features.model.domain;
+import com.fasterxml.jackson.databind.JsonNode;
import java.io.Serializable;
import java.util.Date;
public class ResourceDictionary implements Serializable {
private static final long serialVersionUID = 1L;
-
private Long id;
private String name;
- private String resourcePath;
- private String resourceType;
private String dataType;
private String entrySchema;
- private String validValues;
- private String sampleValue;
- private String definition;
+ private JsonNode definition;
private String description;
private String tags;
private Date creationDate;
@@ -40,16 +36,9 @@ public class ResourceDictionary implements Serializable { @Override
public String toString() {
StringBuilder buffer = new StringBuilder("[");
- buffer.append("id = " + id);
- buffer.append(", name = " + name);
- buffer.append(", resourcePath = " + resourcePath);
- buffer.append(", resourceType = " + resourceType);
+ buffer.append("name = " + name);
buffer.append(", dataType = " + dataType);
buffer.append(", entrySchema = " + entrySchema);
- buffer.append(", validValues = " + validValues);
- buffer.append(", definition =" + definition);
- buffer.append(", description = " + description);
- buffer.append(", tags = " + tags);
buffer.append(", creationDate = " + creationDate);
buffer.append("]");
return buffer.toString();
@@ -71,22 +60,6 @@ public class ResourceDictionary implements Serializable { this.name = name;
}
- public String getResourcePath() {
- return resourcePath;
- }
-
- public void setResourcePath(String resourcePath) {
- this.resourcePath = resourcePath;
- }
-
- public String getResourceType() {
- return resourceType;
- }
-
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
- }
-
public String getDataType() {
return dataType;
}
@@ -103,27 +76,11 @@ public class ResourceDictionary implements Serializable { this.entrySchema = entrySchema;
}
- public String getValidValues() {
- return validValues;
- }
-
- public void setValidValues(String validValues) {
- this.validValues = validValues;
- }
-
- public String getSampleValue() {
- return sampleValue;
- }
-
- public void setSampleValue(String sampleValue) {
- this.sampleValue = sampleValue;
- }
-
- public String getDefinition() {
+ public JsonNode getDefinition() {
return definition;
}
- public void setDefinition(String definition) {
+ public void setDefinition(JsonNode definition) {
this.definition = definition;
}
|