2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.adapters.catalogdb.catalogrest;
23 import java.util.ArrayList;
24 import java.util.List;
26 import javax.xml.bind.annotation.XmlRootElement;
28 import org.openecomp.mso.db.catalog.beans.VfModule;
29 import org.openecomp.mso.logger.MsoLogger;
31 import com.fasterxml.jackson.databind.ObjectMapper;
33 @XmlRootElement(name = "vfModules")
34 public class QueryVfModules {
35 private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
36 private List<VfModule> vfModules;
38 public QueryVfModules() {
40 vfModules = new ArrayList<>();
42 public QueryVfModules(List<VfModule> vlist) {
43 LOGGER.debug ("QueryVfModules:");
44 vfModules = new ArrayList<>();
45 for (VfModule o : vlist) {
46 LOGGER.debug ("-- o is a vfModules ----");
47 LOGGER.debug (o.toString());
49 LOGGER.debug ("-------------------");
53 public List<VfModule> getVfModules(){ return this.vfModules; }
55 public void setVfModules(List<VfModule> v) { this.vfModules = v; }
58 public String toString () {
59 StringBuilder sb = new StringBuilder();
63 for (VfModule o : vfModules) {
64 sb.append(i).append("\t");
65 if (!first) sb.append("\n");
72 public String toJsonString() {
73 String jsonString = null;
75 ObjectMapper mapper = new ObjectMapper();
76 jsonString = mapper.writeValueAsString(this);
77 LOGGER.debug ("QueryVfModules jsonString: "+jsonString);
80 LOGGER.debug ("Exception:", e);
81 LOGGER.debug ("QueryVfModules jsonString exception:"+e.getMessage());