c1e376814f21442da20aa0fe0d03d90f2b6cd8f4
[so.git] / bpmn / so-bpmn-tasks / src / main / java / org / onap / so / client / sniro / beans / SniroManagerRequest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
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=========================================================
21  */
22
23 package org.onap.so.client.sniro.beans;
24
25 import java.io.Serializable;
26
27 import com.fasterxml.jackson.annotation.JsonInclude;
28 import com.fasterxml.jackson.annotation.JsonProperty;
29 import com.fasterxml.jackson.annotation.JsonInclude.Include;
30 import com.fasterxml.jackson.databind.ObjectMapper;
31 import com.fasterxml.jackson.databind.ObjectWriter;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
34
35
36 public class SniroManagerRequest implements Serializable{
37
38         private static final long serialVersionUID = -1541132882892163132L;
39         private static final Logger logger = LoggerFactory.getLogger(SniroManagerRequest.class);
40
41         @JsonProperty("requestInfo")
42         private RequestInfo requestInformation;
43         @JsonProperty("serviceInfo")
44         private ServiceInfo serviceInformation;
45         @JsonProperty("placementInfo")
46         private PlacementInfo placementInformation;
47         @JsonProperty("licenseInfo")
48         private LicenseInfo licenseInformation;
49
50
51         public RequestInfo getRequestInformation() {
52                 return requestInformation;
53         }
54         public void setRequestInformation(RequestInfo requestInformation) {
55                 this.requestInformation = requestInformation;
56         }
57         public ServiceInfo getServiceInformation() {
58                 return serviceInformation;
59         }
60         public void setServiceInformation(ServiceInfo serviceInformation) {
61                 this.serviceInformation = serviceInformation;
62         }
63         public PlacementInfo getPlacementInformation() {
64                 return placementInformation;
65         }
66         public void setPlacementInformation(PlacementInfo placementInformation) {
67                 this.placementInformation = placementInformation;
68         }
69         public LicenseInfo getLicenseInformation() {
70                 return licenseInformation;
71         }
72         public void setLicenseInformation(LicenseInfo licenseInformation) {
73                 this.licenseInformation = licenseInformation;
74         }
75
76
77         @JsonInclude(Include.NON_NULL)
78         public String toJsonString(){
79                 String json = "";
80                 ObjectMapper mapper = new ObjectMapper();
81                 mapper.setSerializationInclusion(Include.NON_NULL);
82                 ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
83                 try{
84                         json = ow.writeValueAsString(this);
85                 }catch (Exception e){
86                         logger.error("Unable to convert SniroManagerRequest to string", e);
87                 }
88                 return json.replaceAll("\\\\", "");
89         }
90
91
92 }