Merge of new rebased code
[appc.git] / appc-dispatcher / appc-request-handler / appc-request-handler-core / src / main / java / org / openecomp / appc / requesthandler / impl / DmaapOutgoingMessage.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * openECOMP : APP-C
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
6  *                                              reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.openecomp.appc.requesthandler.impl;
23
24
25
26 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
27 import com.fasterxml.jackson.annotation.JsonProperty;
28 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
29
30 /**
31  * This class represents a message being sent out to DMaaP by APPC as async response.
32  * note the structure of this class must be adapted to the sync message sent to DMaaP represened in org.openecomp.appc.listener.LCM.domainmodel.DmaapOutgoingMessage
33  *
34  */
35 @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
36 @JsonIgnoreProperties(ignoreUnknown = true)
37 public class DmaapOutgoingMessage {
38
39     @JsonProperty("version")
40     private String version;
41
42     @JsonProperty("type")
43     private String type;
44
45     @JsonProperty("correlation-id")
46     private String correlationID;
47
48     private final static String defaultCambriaPartition = "MSO";
49     @JsonProperty("cambria.partition")
50     private String cambriaPartition = defaultCambriaPartition;
51
52     @JsonProperty("rpc-name")
53     private String rpcName;
54
55     @JsonProperty("body")
56     private Body body;
57
58     public DmaapOutgoingMessage() {
59     }
60
61     public String getVersion() {
62         return version;
63     }
64
65     public void setVersion(String version) {
66         this.version = version;
67     }
68
69     public String getType() {
70         return type;
71     }
72
73     public void setType(String type) {
74         this.type = type;
75     }
76
77     public String getCorrelationID() {
78         return correlationID;
79     }
80
81     public void setCorrelationID(String correlationID) {
82         this.correlationID = correlationID;
83     }
84
85     public String getCambriaPartition() {
86         return cambriaPartition;
87     }
88
89     public void setCambriaPartition(String cambriaPartition) {
90         this.cambriaPartition = cambriaPartition;
91     }
92
93     public String getRpcName() {
94         return rpcName;
95     }
96
97     public void setRpcName(String rpcName) {
98         this.rpcName = rpcName;
99     }
100
101     public Body getBody() {
102         return body;
103     }
104
105     public void setBody(Body body) {
106         this.body = body;
107     }
108
109     @Override
110     public String toString() {
111         return "DmaapOutgoingMessage{" +
112                 "cambriaPartition='" + cambriaPartition + '\'' +
113                 ", rpcName='" + rpcName + '\'' +
114                 ", body=" + body +
115                 '}';
116     }
117
118     @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
119     @JsonIgnoreProperties(ignoreUnknown = true)
120     public static class Body {
121         public Body() {
122         }
123
124         public Body(Object output) {
125             this.output = output;
126         }
127
128         @JsonProperty("output")
129         private Object output;
130
131         public Object getOutput() {
132             return output;
133         }
134
135         public void setOutput(Object body) {
136             this.output = body;
137         }
138
139         @Override
140         public String toString() {
141             return "Body{" +
142                     "output=" + output +
143                     '}';
144         }
145     }
146 }
147