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