aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter
diff options
context:
space:
mode:
authorMunir Ahmad <munir.ahmad@bell.ca>2018-02-26 20:58:16 -0500
committerMunir Ahmad <munir.ahmad@bell.ca>2018-02-26 20:58:16 -0500
commit939caf126117d3d3338d38a76c2e67eabaff3bc0 (patch)
treea7a432c429d71dde1ef78f51824086962e9e107e /adapters/mso-catalog-db-adapter
parent250de788c5cf40cc8a73c7aad4dc2f482f821768 (diff)
Make use of getOrDefault
Change-Id: Ic73b58835a7964cb2fd88415f55b03ff79ad33ff Issue-ID: SO-437 Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
Diffstat (limited to 'adapters/mso-catalog-db-adapter')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java14
1 files changed, 7 insertions, 7 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();
}