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.ToscaCsar;
\r
28 * serivce csar query support
\r
34 * @version ONAP Beijing Release 2018-02-28
\r
36 public class QueryServiceCsar extends CatalogQuery{
\r
38 private ToscaCsar toscaCsar;
\r
40 public QueryServiceCsar(ToscaCsar toscaCsar){
\r
41 this.toscaCsar = toscaCsar;
\r
44 private final String template =
\r
46 "\t\t\"artifactUUID\" : <ARTIFACT_UUID>,\n"+
\r
47 "\t\t\"name\" : <NAME>,\n"+
\r
48 "\t\t\"version\" : <VERSION>,\n"+
\r
49 "\t\t\"artifactChecksum\" : <ARTIFACT_CHECK_SUM>,\n"+
\r
50 "\t\t\"url\" : <URL>,\n"+
\r
51 "\t\t\"description\" : <DESCRIPTION>\n"+
\r
55 public String toString() {
\r
57 return toscaCsar.toString();
\r
61 public String JSON2(boolean isArray, boolean isEmbed) {
\r
62 Map<String, String> valueMap = new HashMap<>();
\r
63 put(valueMap, "ARTIFACT_UUID", null == toscaCsar ? null : toscaCsar.getArtifactUUID());
\r
64 put(valueMap, "NAME", null == toscaCsar ? null : toscaCsar.getName());
\r
65 put(valueMap, "VERSION", null == toscaCsar ? null : toscaCsar.getVersion());
\r
66 put(valueMap, "ARTIFACT_CHECK_SUM", null == toscaCsar ? null : toscaCsar.getArtifactChecksum());
\r
67 put(valueMap, "URL", null == toscaCsar ? null : toscaCsar.getUrl());
\r
68 put(valueMap, "DESCRIPTION", null == toscaCsar ? null : toscaCsar.getDescription());
\r
69 return this.setTemplate(template, valueMap);
\r