19db361f88c7464e7773c47bacadc8a1f81e3a67
[appc.git] / appc-dispatcher / appc-request-handler / appc-request-handler-core / src / main / java / org / onap / appc / requesthandler / impl / DmaapOutgoingMessage.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
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  * 
21  * ============LICENSE_END=========================================================
22  */
23
24 package org.onap.appc.requesthandler.impl;
25
26
27
28 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
29 import com.fasterxml.jackson.annotation.JsonInclude;
30 import com.fasterxml.jackson.annotation.JsonProperty;
31 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
32
33 /**
34  * This class represents a message being sent out to DMaaP by APPC as async response.
35  * note the structure of this class must be adapted to the sync message sent to DMaaP represened in org.onap.appc.listener.LCM.domainmodel.DmaapOutgoingMessage
36  *
37  */
38 @JsonInclude(JsonInclude.Include.NON_NULL)
39 @JsonIgnoreProperties(ignoreUnknown = true)
40 public class DmaapOutgoingMessage {
41
42     @JsonProperty("version")
43     private String version;
44
45     @JsonProperty("type")
46     private String type;
47
48     @JsonProperty("correlation-id")
49     private String correlationID;
50
51     private final static String defaultCambriaPartition = "MSO";
52     @JsonProperty("cambria.partition")
53     private String cambriaPartition = defaultCambriaPartition;
54
55     @JsonProperty("rpc-name")
56     private String rpcName;
57
58     @JsonProperty("body")
59     private Body body;
60
61     public DmaapOutgoingMessage() {
62     }
63
64     public String getVersion() {
65         return version;
66     }
67
68     public void setVersion(String version) {
69         this.version = version;
70     }
71
72     public String getType() {
73         return type;
74     }
75
76     public void setType(String type) {
77         this.type = type;
78     }
79
80     public String getCorrelationID() {
81         return correlationID;
82     }
83
84     public void setCorrelationID(String correlationID) {
85         this.correlationID = correlationID;
86     }
87
88     public String getCambriaPartition() {
89         return cambriaPartition;
90     }
91
92     public void setCambriaPartition(String cambriaPartition) {
93         this.cambriaPartition = cambriaPartition;
94     }
95
96     public String getRpcName() {
97         return rpcName;
98     }
99
100     public void setRpcName(String rpcName) {
101         this.rpcName = rpcName;
102     }
103
104     public Body getBody() {
105         return body;
106     }
107
108     public void setBody(Body body) {
109         this.body = body;
110     }
111
112     @Override
113     public String toString() {
114         return "DmaapOutgoingMessage{" +
115                 "cambriaPartition='" + cambriaPartition + '\'' +
116                 ", rpcName='" + rpcName + '\'' +
117                 ", body=" + body +
118                 '}';
119     }
120
121     @JsonInclude(JsonInclude.Include.NON_NULL)
122     @JsonIgnoreProperties(ignoreUnknown = true)
123     public static class Body {
124         public Body() {
125         }
126
127         public Body(Object output) {
128             this.output = output;
129         }
130
131         @JsonProperty("output")
132         private Object output;
133
134         public Object getOutput() {
135             return output;
136         }
137
138         public void setOutput(Object body) {
139             this.output = body;
140         }
141
142         @Override
143         public String toString() {
144             return "Body{" +
145                     "output=" + output +
146                     '}';
147         }
148     }
149 }
150