Update license header in appc-dispatcher files
[appc.git] / appc-dispatcher / appc-dispatcher-common / domain-model-lib / src / main / java / org / onap / appc / domainmodel / lcm / ResponseContext.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.domainmodel.lcm;
25
26 import java.util.HashMap;
27 import java.util.Map;
28
29
30 public class ResponseContext {
31     private CommonHeader commonHeader;
32     private Status status;
33     private Map<String, String> additionalContext;
34     /** Carries json String response payload */
35     private String payload;
36     /** Carries non-String response payload, such as List or Map of object */
37     private Object payloadObject;
38
39     public CommonHeader getCommonHeader() {
40         return commonHeader;
41     }
42
43     public void setCommonHeader(CommonHeader commonHeader) {
44         this.commonHeader = commonHeader;
45     }
46
47     public Status getStatus() {
48         return status;
49     }
50
51     public void setStatus(Status status) {
52         this.status = status;
53     }
54
55     public String getPayload() {
56         return payload;
57     }
58
59     public void setPayload(String payload) {
60         this.payload = payload;
61     }
62
63     public Object getPayloadObject() {
64         return payloadObject;
65     }
66
67     public void setPayloadObject(Object payloadObject) {
68         this.payloadObject = payloadObject;
69     }
70
71     public Map<String, String> getAdditionalContext() {
72         return additionalContext;
73     }
74
75     public void setAdditionalContext(Map<String, String> additionalContext) {
76         this.additionalContext = additionalContext;
77     }
78
79     public void addKeyValueToAdditionalContext(String key, String value ){
80         if (this.additionalContext == null) {
81             this.additionalContext = new HashMap<>();
82         }
83         this.additionalContext.put(key, value);
84     }
85
86     @Override
87     public String toString() {
88         return "ResponseContext{" +
89                 "commonHeader=" + commonHeader +
90                 ", status=" + status +
91                 ", payload='" + payload + '\'' +
92                 ", additionalContext=" + additionalContext +
93                 '}';
94     }
95
96 }