Merge of new rebased code
[appc.git] / appc-oam / appc-oam-bundle / src / main / java / org / openecomp / appc / oam / messageadapter / 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.oam.messageadapter;
23
24 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
25 import com.fasterxml.jackson.annotation.JsonProperty;
26 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
27
28 /**
29  * This class represents a message being sent out to DMaaP by APPC as async response.
30  * note the structure of this class must be adapted to the sync message sent to DMaaP represented in org.openecomp.appc.listener.LCM.domainmodel.DmaapOutgoingMessage
31  *
32  */
33 @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
34 @JsonIgnoreProperties(ignoreUnknown = true)
35 public class DmaapOutgoingMessage {
36
37     @JsonProperty("type")
38     private String type;
39
40     @JsonProperty("correlation-id")
41     private String correlationID;
42
43     private final static String defaultCambriaPartition = "MSO";
44     @JsonProperty("cambria.partition")
45     private String cambriaPartition = defaultCambriaPartition;
46
47     @JsonProperty("rpc-name")
48     private String rpcName;
49
50     @JsonProperty("body")
51     private Body body;
52
53     public DmaapOutgoingMessage() {
54     }
55
56     public String getType() {
57         return type;
58     }
59
60     public void setType(String type) {
61         this.type = type;
62     }
63
64     public String getCorrelationID() {
65         return correlationID;
66     }
67
68     public void setCorrelationID(String correlationID) {
69         this.correlationID = correlationID;
70     }
71
72     public String getCambriaPartition() {
73         return cambriaPartition;
74     }
75
76     public void setCambriaPartition(String cambriaPartition) {
77         this.cambriaPartition = cambriaPartition;
78     }
79
80     public String getRpcName() {
81         return rpcName;
82     }
83
84     public void setRpcName(String rpcName) {
85         this.rpcName = rpcName;
86     }
87
88     public Body getBody() {
89         return body;
90     }
91
92     public void setBody(Body body) {
93         this.body = body;
94     }
95
96     @Override
97     public String toString() {
98         return "DmaapOutgoingMessage{" +
99                 "cambriaPartition='" + cambriaPartition + '\'' +
100                 ", rpcName='" + rpcName + '\'' +
101                 ", body=" + body +
102                 '}';
103     }
104
105     @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
106     @JsonIgnoreProperties(ignoreUnknown = true)
107     public static class Body {
108         public Body() {
109         }
110
111         public Body(Object output) {
112             this.output = output;
113         }
114
115         @JsonProperty("output")
116         private Object output;
117
118         public Object getOutput() {
119             return output;
120         }
121
122         public void setOutput(Object body) {
123             this.output = body;
124         }
125
126         @Override
127         public String toString() {
128             return "Body{" +
129                     "output=" + output +
130                     '}';
131         }
132     }
133 }
134