summaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/main')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java28
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java30
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java28
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java24
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java10
6 files changed, 67 insertions, 67 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java
index a74cf07b89..4a8233bb03 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java
@@ -46,21 +46,21 @@ public abstract class CatalogQuery {
}
protected String setTemplate(String template, Map<String, String> valueMap) {
- LOGGER.debug ("CatalogQuery setTemplate");
+ LOGGER.debug("CatalogQuery setTemplate");
StringBuffer result = new StringBuffer();
String pattern = "<.*>";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(template);
- LOGGER.debug ("CatalogQuery template:"+ template);
- while(m.find()) {
- String key = template.substring(m.start()+1, m.end()-1);
- LOGGER.debug ("CatalogQuery key:"+ key+ " contains key? "+ valueMap.containsKey(key));
- m.appendReplacement(result, valueMap.containsKey(key)? valueMap.get(key): "\"TBD\"");
+ LOGGER.debug("CatalogQuery template:" + template);
+ while (m.find()) {
+ String key = template.substring(m.start() + 1, m.end() - 1);
+ LOGGER.debug("CatalogQuery key:" + key + " contains key? " + valueMap.containsKey(key));
+ m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\""));
}
m.appendTail(result);
- LOGGER.debug ("CatalogQuery return:"+ result.toString());
+ LOGGER.debug("CatalogQuery return:" + result.toString());
return result.toString();
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
index 9a82ed2c6e..f7758c315c 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
@@ -62,30 +62,30 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
@Override
public String toString () {
- StringBuilder buf = new StringBuilder();
+ StringBuilder sb = new StringBuilder();
boolean first = true;
int i = 1;
for (AllottedResourceCustomization o : allottedResourceCustomization) {
- buf.append(i+"\t");
- if (!first) buf.append("\n"); first = false;
- buf.append(o);
+ sb.append(i).append("\t");
+ if (!first) sb.append("\n"); first = false;
+ sb.append(o);
}
- return buf.toString();
+ return sb.toString();
}
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuilder buf = new StringBuilder();
- if (!isEmbed && isArray) buf.append("{ ");
- if (isArray) buf.append("\"serviceAllottedResources\": [");
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray) sb.append("{ ");
+ if (isArray) sb.append("\"serviceAllottedResources\": [");
Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
if (this.allottedResourceCustomization != null) {
for (AllottedResourceCustomization o : allottedResourceCustomization) {
- if (first) buf.append("\n"); first = false;
+ if (first) sb.append("\n"); first = false;
boolean arNull = o.getAllottedResource() == null ? true : false;
@@ -104,14 +104,14 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
put(valueMap, "PROVIDING_SERVICE_MODEL_INVARIANT_UUID", o.getProvidingServiceModelInvariantUuid());
- buf.append(sep+ this.setTemplate(template, valueMap));
+ sb.append(sep).append(this.setTemplate(template, valueMap));
sep = ",\n";
}
}
- if (!first) buf.append("\n");
- if (isArray) buf.append("]");
- if (!isEmbed && isArray) buf.append("}");
- return buf.toString();
+ if (!first) sb.append("\n");
+ if (isArray) sb.append("]");
+ if (!isEmbed && isArray) sb.append("}");
+ return sb.toString();
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index 59c601ef19..c04068d680 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -67,30 +67,30 @@ public class QueryServiceNetworks extends CatalogQuery {
@Override
public String toString () {
- StringBuilder buf = new StringBuilder();
+ StringBuilder sb = new StringBuilder();
boolean first = true;
int i = 1;
for (NetworkResourceCustomization o : serviceNetworks) {
- buf.append(i+"\t");
- if (!first) buf.append("\n"); first = false;
- buf.append(o);
+ sb.append(i).append("\t");
+ if (!first) sb.append("\n"); first = false;
+ sb.append(o);
}
- return buf.toString();
+ return sb.toString();
}
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuilder buf = new StringBuilder();
- if (!isEmbed && isArray) buf.append("{ ");
- if (isArray) buf.append("\"serviceNetworks\": [");
- //if (isArray) buf.append("[");
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray) sb.append("{ ");
+ if (isArray) sb.append("\"serviceNetworks\": [");
+
Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
for (NetworkResourceCustomization o : serviceNetworks) {
- if (first) buf.append("\n"); first = false;
+ if (first) sb.append("\n"); first = false;
boolean nrNull = o.getNetworkResource() == null ? true : false;
put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName());
put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID());
@@ -104,12 +104,12 @@ public class QueryServiceNetworks extends CatalogQuery {
put(valueMap, "NETWORK_SCOPE", o.getNetworkScope());
put(valueMap, "NETWORK_TECHNOLOGY", o.getNetworkTechnology());
- buf.append(sep+ this.setTemplate(template, valueMap));
+ sb.append(sep).append(this.setTemplate(template, valueMap));
sep = ",\n";
}
- if (!first) buf.append("\n");
- if (isArray) buf.append("]");
- if (!isEmbed && isArray) buf.append("}");
- return buf.toString();
+ if (!first) sb.append("\n");
+ if (isArray) sb.append("]");
+ if (!isEmbed && isArray) sb.append("}");
+ return sb.toString();
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index cfbb781ae8..f0d4327950 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -72,29 +72,29 @@ public class QueryServiceVnfs extends CatalogQuery {
@Override
public String toString () {
- StringBuilder buf = new StringBuilder();
+ StringBuilder sb = new StringBuilder();
boolean first = true;
int i = 1;
for (VnfResourceCustomization o : serviceVnfs) {
- buf.append(i+"\t");
- if (!first) buf.append("\n"); first = false;
- buf.append(o);
+ sb.append(i).append("\t");
+ if (!first) sb.append("\n"); first = false;
+ sb.append(o);
}
- return buf.toString();
+ return sb.toString();
}
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuilder buf = new StringBuilder();
- if (!isEmbed && isArray) buf.append("{ ");
- if (isArray) buf.append("\"serviceVnfs\": [");
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray) sb.append("{ ");
+ if (isArray) sb.append("\"serviceVnfs\": [");
Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
for (VnfResourceCustomization o : serviceVnfs) {
- if (first) buf.append("\n"); first = false;
+ if (first) sb.append("\n"); first = false;
boolean vrNull = o.getVnfResource() == null ? true : false;
@@ -113,12 +113,12 @@ public class QueryServiceVnfs extends CatalogQuery {
String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true);
valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t"));
- buf.append(sep+ this.setTemplate(template, valueMap));
+ sb.append(sep).append(this.setTemplate(template, valueMap));
sep = ",\n";
}
- if (!first) buf.append("\n");
- if (isArray) buf.append("]");
- if (!isEmbed && isArray) buf.append("}");
- return buf.toString();
+ if (!first) sb.append("\n");
+ if (isArray) sb.append("]");
+ if (!isEmbed && isArray) sb.append("}");
+ return sb.toString();
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java
index b2caa99a39..fe0f0cbc17 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java
@@ -69,28 +69,28 @@ public class QueryVfModule extends CatalogQuery {
@Override
public String toString () {
- StringBuilder buf = new StringBuilder();
+ StringBuilder sb = new StringBuilder();
boolean first = true;
int i = 1;
for (VfModuleCustomization o : vfModules) {
- buf.append(i+"\t");
- if (!first) buf.append("\n"); first = false;
- buf.append(o);
+ sb.append(i).append("\t");
+ if (!first) sb.append("\n"); first = false;
+ sb.append(o);
}
- return buf.toString();
+ return sb.toString();
}
@Override
public String JSON2(boolean isArray, boolean x) {
- StringBuilder buf = new StringBuilder();
- if (isArray) buf.append("\"vfModules\": [");
+ StringBuilder sb = new StringBuilder();
+ if (isArray) sb.append("\"vfModules\": [");
Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
for (VfModuleCustomization o : vfModules) {
- if (first) buf.append("\n"); first = false;
+ if (first) sb.append("\n"); first = false;
boolean vfNull = o.getVfModule() == null ? true : false;
boolean hasVolumeGroup = false;
@@ -109,11 +109,11 @@ public class QueryVfModule extends CatalogQuery {
put(valueMap, "INITIAL_COUNT", o.getInitialCount());
put(valueMap, "HAS_VOLUME_GROUP", hasVolumeGroup);
- buf.append(sep+ this.setTemplate(template, valueMap));
+ sb.append(sep).append(this.setTemplate(template, valueMap));
sep = ",\n";
}
- if (!first) buf.append("\n");
- if (isArray) buf.append("]");
- return buf.toString();
+ if (!first) sb.append("\n");
+ if (isArray) sb.append("]");
+ return sb.toString();
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java
index ff713991f9..00a5cafb29 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java
@@ -58,17 +58,17 @@ public class QueryVfModules {
@Override
public String toString () {
- StringBuilder buf = new StringBuilder();
+ StringBuilder sb = new StringBuilder();
boolean first = true;
int i = 1;
for (VfModule o : vfModules) {
- buf.append(i+"\t");
- if (!first) buf.append("\n");
+ sb.append(i).append("\t");
+ if (!first) sb.append("\n");
first = false;
- buf.append(o);
+ sb.append(o);
}
- return buf.toString();
+ return sb.toString();
}
public String toJsonString() {