2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.openecomp.mso.adapters.catalogrest;
21 /* should be called QueryVnfResource.java */
23 import org.openecomp.mso.db.catalog.beans.VnfResource;
24 import org.openecomp.mso.logger.MsoLogger;
25 import org.codehaus.jackson.map.ObjectMapper;
26 import org.jboss.resteasy.annotations.providers.NoJackson;
28 import javax.xml.bind.annotation.XmlRootElement;
29 import java.util.ArrayList;
30 import java.util.List;
32 @XmlRootElement(name = "serviceVnfs")
34 public class QueryServiceVnfs {
35 private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
36 private List<VnfResource> serviceVnfs;
38 public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList<VnfResource>(); }
39 public QueryServiceVnfs(List<VnfResource> vlist) {
40 LOGGER.debug ("QueryServiceVnfs:");
41 serviceVnfs = new ArrayList<VnfResource>();
42 for (VnfResource o : vlist) {
43 LOGGER.debug ("-- o is a serviceVnfs ----");
44 LOGGER.debug (o.toString());
46 LOGGER.debug ("-------------------");
50 public List<VnfResource> getServiceVnfs(){ return this.serviceVnfs; }
51 public void setServiceVnfs(List<VnfResource> v) { this.serviceVnfs = v; }
54 public String toString () {
55 StringBuffer buf = new StringBuffer();
59 for (VnfResource o : serviceVnfs) {
61 if (!first) buf.append("\n"); first = false;
64 return buf.toString();
67 public String toJsonString() {
68 String jsonString = null;
70 ObjectMapper mapper = new ObjectMapper();
71 jsonString = mapper.writeValueAsString(this);
72 LOGGER.debug ("QuerySrviceVnfs jsonString: "+jsonString);
75 LOGGER.debug ("QuerySrviceVnfs jsonString exception:"+e.getMessage());