dc5d057256a30a416b25040979c8d4a0613f65eb
[appc.git] / appc-event-listener / appc-event-listener-bundle / src / main / java / org / openecomp / appc / listener / LCM / model / InputBody.java
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.listener.LCM.model;
24
25 import org.openecomp.appc.listener.LCM.operation.OperationStatus;
26
27 import com.fasterxml.jackson.annotation.JsonIgnore;
28 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
29 import com.fasterxml.jackson.annotation.JsonProperty;
30 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
31
32
33 @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
34 @JsonIgnoreProperties(ignoreUnknown = true)
35 public class InputBody {
36
37     @JsonProperty("common-header")
38     private CommonHeader commonHeader;
39
40     @JsonProperty("action-identifiers")
41     private ActionIdentifiers actionIdentifiers;
42
43     @JsonProperty("action")
44     private String action;
45
46     @JsonProperty("payload")
47     private Object payload;
48
49
50     public Object getPayload() {
51         return payload;
52     }
53
54     public void setPayload(Object payload) {
55         this.payload = payload;
56     }
57     @JsonIgnore
58     public void setPayloadAsString(String payload) {
59         this.payload = payload;
60     }
61
62     public String getAction() {
63         return action;
64     }
65
66     public void setAction(String action) {
67         this.action = action;
68     }
69
70     public ActionIdentifiers getActionIdentifiers() {
71         return actionIdentifiers;
72     }
73
74     public void setActionIdentifiers(ActionIdentifiers actionIdentifiers) {
75         this.actionIdentifiers = actionIdentifiers;
76     }
77
78     public CommonHeader getCommonHeader() {
79         return commonHeader;
80     }
81
82     public void setCommonHeader(CommonHeader commonHeader) {
83         this.commonHeader = commonHeader;
84     }
85
86 //    public String toOutgoing(OperationStatus operationStatus) {
87 //        OutputBody out = new OutputBody(this);
88 //        out.setStatus(new ResponseStatus(operationStatus.getCode(), operationStatus.getValue()));
89 //        return out.toResponse().toString();
90 //    }
91
92 //    public String toOutgoing(OperationStatus operationStatus,String islocked) {
93 //        OutputBody out = new OutputBody(this);
94 //        out.setStatus(new ResponseStatus(operationStatus.getCode(), operationStatus.getValue()));
95 //        out.setLocked(islocked);
96 //        return out.toResponse().toString();
97 //    }
98
99     @JsonIgnore
100     public boolean isValid() {
101         return getCommonHeader() != null;
102     }
103 }