diff options
author | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2019-01-23 16:42:13 +0530 |
---|---|---|
committer | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2019-01-23 16:46:27 +0530 |
commit | 402f8dc916e938a55dd54f721b3ce3928a7409a0 (patch) | |
tree | 663b7ec91d2d8c489a3181a7fb0830c11b4385fe /adapters/mso-catalog-db-adapter/src/main/java | |
parent | 89994c89aac5004bc892c8f8ca666bcb32ea4fb9 (diff) |
Fix get of operationType
OperationType should return empty from db request instead of "null".
Change-Id: I5df3df5aead6008c4e14961ee385cafe64c37959
Issue-ID: SO-1417
Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/main/java')
-rw-r--r-- | adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java index 8670b78e15..58a2e852f0 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java @@ -22,6 +22,7 @@ package org.onap.so.adapters.catalogdb.catalogrest; import java.util.HashMap; import java.util.Map; +import org.apache.commons.lang3.StringUtils; import org.onap.so.db.catalog.beans.Recipe; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,12 +57,18 @@ public class QueryResourceRecipe extends CatalogQuery{ @Override public String JSON2(boolean isArray, boolean isEmbed) { Map<String, String> valueMap = new HashMap<>(); - valueMap.put("id", null == resourceRecipe ? null :String.valueOf(resourceRecipe.getId())); - valueMap.put("action", null == resourceRecipe ? null :resourceRecipe.getAction()); - valueMap.put("orchestrationUri", null == resourceRecipe ? null : resourceRecipe.getOrchestrationUri()); - valueMap.put("recipeTimeout", null == resourceRecipe ? null : String.valueOf(resourceRecipe.getRecipeTimeout())); - valueMap.put("paramXSD", null == resourceRecipe ? null : resourceRecipe.getParamXsd()); - valueMap.put("description", null == resourceRecipe ? null : resourceRecipe.getDescription()); + valueMap.put("id", null == resourceRecipe || null == resourceRecipe.getId() + ? StringUtils.EMPTY :String.valueOf(resourceRecipe.getId())); + valueMap.put("action", null == resourceRecipe || null == resourceRecipe.getAction() + ? StringUtils.EMPTY :resourceRecipe.getAction()); + valueMap.put("orchestrationUri", null == resourceRecipe || null == resourceRecipe.getOrchestrationUri() + ? StringUtils.EMPTY : resourceRecipe.getOrchestrationUri()); + valueMap.put("recipeTimeout", null == resourceRecipe || null == resourceRecipe.getRecipeTimeout() + ? StringUtils.EMPTY : String.valueOf(resourceRecipe.getRecipeTimeout())); + valueMap.put("paramXSD", null == resourceRecipe || null == resourceRecipe.getParamXsd() + ? StringUtils.EMPTY : resourceRecipe.getParamXsd()); + valueMap.put("description", null == resourceRecipe || null == resourceRecipe.getDescription() + ? StringUtils.EMPTY : resourceRecipe.getDescription()); ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); String jsonStr = ""; |