2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Intel Corp. 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=========================================================
21 package org.onap.so.client.oof.beans;
23 import com.fasterxml.jackson.annotation.JsonInclude;
24 import com.fasterxml.jackson.annotation.JsonInclude.Include;
25 import com.fasterxml.jackson.annotation.JsonProperty;
26 import com.fasterxml.jackson.databind.ObjectMapper;
27 import com.fasterxml.jackson.databind.ObjectWriter;
28 import org.slf4j.Logger;
29 import org.slf4j.LoggerFactory;
31 import java.io.Serializable;
34 public class OofRequest implements Serializable{
36 private static final long serialVersionUID = -1541132882892163132L;
37 private static final Logger logger = LoggerFactory.getLogger(OofRequest.class);
40 @JsonProperty("requestInfo")
41 private RequestInfo requestInformation;
43 @JsonProperty("serviceInfo")
44 private ServiceInfo serviceInformation;
46 @JsonProperty("placementInfo")
47 private PlacementInfo placementInformation;
49 @JsonProperty("licenseInfo")
50 private String licenseInformation;
53 public RequestInfo getRequestInformation() {
54 return requestInformation;
56 public void setRequestInformation(RequestInfo requestInformation) {
57 this.requestInformation = requestInformation;
59 public ServiceInfo getServiceInformation() {
60 return serviceInformation;
62 public void setServiceInformation(ServiceInfo serviceInformation) {
63 this.serviceInformation = serviceInformation;
65 public PlacementInfo getPlacementInformation() {
66 return placementInformation;
68 public void setPlacementInformation(PlacementInfo placementInformation) {
69 this.placementInformation = placementInformation;
71 public String getLicenseInformation() {
72 return licenseInformation;
74 public void setLicenseInformation(String licenseInformation) {
75 this.licenseInformation = licenseInformation;
79 @JsonInclude(Include.NON_NULL)
80 public String toJsonString(){
82 ObjectMapper mapper = new ObjectMapper();
83 mapper.setSerializationInclusion(Include.NON_NULL);
84 ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
86 json = ow.writeValueAsString(this);
88 logger.error("Unable to convert oofRequest to string", e);
90 return json.replaceAll("\\\\", "");