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