2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
20 package org.openecomp.mso.adapters.catalogdb.catalogrest;
\r
22 import java.util.HashMap;
\r
23 import java.util.Map;
\r
25 import org.openecomp.mso.db.catalog.beans.Recipe;
\r
28 * serivce csar query support
\r
34 * @version ONAP Beijing Release 2018-02-28
\r
36 public class QueryResourceRecipe extends CatalogQuery{
\r
38 private Recipe resourceRecipe;
\r
40 public QueryResourceRecipe(Recipe resourceRecipe){
\r
41 this.resourceRecipe =resourceRecipe;
\r
44 private final String template =
\r
46 "\t\t\"id\" : <ID>,\n"+
\r
47 "\t\t\"action\" : <ACTION>,\n"+
\r
48 "\t\t\"orchestrationUri\" : <ORCHESTRATION_URI>,\n"+
\r
49 "\t\t\"recipeTimeout\" : <RECIPE_TIMEOUT>,\n"+
\r
50 "\t\t\"paramXSD\" : <PARAM_XSD>,\n"+
\r
51 "\t\t\"description\" : <DESCRIPTION>\n"+
\r
55 public String toString() {
\r
57 return resourceRecipe.toString();
\r
61 public String JSON2(boolean isArray, boolean isEmbed) {
\r
62 Map<String, String> valueMap = new HashMap<>();
\r
63 put(valueMap, "ID", null == resourceRecipe ? null : resourceRecipe.getId());
\r
64 put(valueMap, "ACTION", null == resourceRecipe ? null : resourceRecipe.getAction());
\r
65 put(valueMap, "ORCHESTRATION_URI", null == resourceRecipe ? null : resourceRecipe.getOrchestrationUri());
\r
66 put(valueMap, "RECIPE_TIMEOUT", null == resourceRecipe ? null : resourceRecipe.getRecipeTimeout());
\r
67 put(valueMap, "PARAM_XSD", null == resourceRecipe ? null : resourceRecipe.getParamXSD());
\r
68 put(valueMap, "DESCRIPTION", null == resourceRecipe ? null : resourceRecipe.getDescription());
\r
69 return this.setTemplate(template, valueMap);
\r