2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.so.client.sniro.beans;
25 import java.io.Serializable;
26 import com.fasterxml.jackson.annotation.JsonInclude;
27 import com.fasterxml.jackson.annotation.JsonProperty;
28 import com.fasterxml.jackson.annotation.JsonInclude.Include;
29 import com.fasterxml.jackson.databind.ObjectMapper;
30 import com.fasterxml.jackson.databind.ObjectWriter;
31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory;
35 public class SniroManagerRequest implements Serializable {
37 private static final long serialVersionUID = -1541132882892163132L;
38 private static final Logger logger = LoggerFactory.getLogger(SniroManagerRequest.class);
40 @JsonProperty("requestInfo")
41 private RequestInfo requestInformation;
42 @JsonProperty("serviceInfo")
43 private ServiceInfo serviceInformation;
44 @JsonProperty("placementInfo")
45 private PlacementInfo placementInformation;
46 @JsonProperty("licenseInfo")
47 private LicenseInfo licenseInformation;
50 public RequestInfo getRequestInformation() {
51 return requestInformation;
54 public void setRequestInformation(RequestInfo requestInformation) {
55 this.requestInformation = requestInformation;
58 public ServiceInfo getServiceInformation() {
59 return serviceInformation;
62 public void setServiceInformation(ServiceInfo serviceInformation) {
63 this.serviceInformation = serviceInformation;
66 public PlacementInfo getPlacementInformation() {
67 return placementInformation;
70 public void setPlacementInformation(PlacementInfo placementInformation) {
71 this.placementInformation = placementInformation;
74 public LicenseInfo getLicenseInformation() {
75 return licenseInformation;
78 public void setLicenseInformation(LicenseInfo licenseInformation) {
79 this.licenseInformation = licenseInformation;
83 @JsonInclude(Include.NON_NULL)
84 public String toJsonString() {
86 ObjectMapper mapper = new ObjectMapper();
87 mapper.setSerializationInclusion(Include.NON_NULL);
88 ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
90 json = ow.writeValueAsString(this);
91 } catch (Exception e) {
92 logger.error("Unable to convert SniroManagerRequest to string", e);
94 return json.replaceAll("\\\\", "");