944bef75478107fc275c215b8ab0f1a6e786088f
[policy/drools-applications.git] / controlloop / common / model-impl / events / src / main / java / org / onap / policy / controlloop / ControlLoopEvent.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * controlloop
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.controlloop;
22
23 import com.google.gson.annotations.SerializedName;
24 import java.io.Serializable;
25 import java.util.UUID;
26
27 public abstract class ControlLoopEvent implements Serializable {
28
29     private static final long serialVersionUID = 2391252138583119195L;
30     
31     @SerializedName("closedLoopControlName")
32     private String closedLoopControlName;
33     
34     @SerializedName("version")
35     private String version = "1.0.2";
36     
37     @SerializedName("requestID")
38     private UUID requestId;
39     
40     @SerializedName("closedLoopEventClient")
41     private String closedLoopEventClient;
42     
43     @SerializedName("target_type")
44     private ControlLoopTargetType targetType;
45     
46     @SerializedName("target")
47     private String target;
48     
49     @SerializedName("from")
50     private String from;
51     
52     @SerializedName("policyScope")
53     private String policyScope;
54     
55     @SerializedName("policyName")
56     private String policyName;
57     
58     @SerializedName("policyVersion")
59     private String policyVersion;
60     
61     @SerializedName("closedLoopEventStatus")
62     private ControlLoopEventStatus closedLoopEventStatus;
63
64     @SerializedName("payload")
65     private String payload;
66     
67     public ControlLoopEvent() {
68
69     }
70
71     /**
72      * Construct an instace from an existing instance.
73      * 
74      * @param event the existing instance
75      */
76     public ControlLoopEvent(ControlLoopEvent event) {
77         if (event == null) {
78             return;
79         }
80         this.closedLoopControlName = event.closedLoopControlName;
81         this.requestId = event.requestId;
82         this.closedLoopEventClient = event.closedLoopEventClient;
83         this.targetType = event.targetType;
84         this.target = event.target;
85         this.from = event.from;
86         this.policyScope = event.policyScope;
87         this.policyName = event.policyName;
88         this.policyVersion = event.policyVersion;
89         this.closedLoopEventStatus = event.closedLoopEventStatus;
90         this.payload = event.payload;
91     }
92
93     public boolean isEventStatusValid() {
94         return this.closedLoopEventStatus != null;
95     }
96
97     public String getClosedLoopControlName() {
98         return closedLoopControlName;
99     }
100
101     public void setClosedLoopControlName(String closedLoopControlName) {
102         this.closedLoopControlName = closedLoopControlName;
103     }
104
105     public String getVersion() {
106         return version;
107     }
108
109     public void setVersion(String version) {
110         this.version = version;
111     }
112
113     public UUID getRequestId() {
114         return requestId;
115     }
116
117     public void setRequestId(UUID requestId) {
118         this.requestId = requestId;
119     }
120
121     public String getClosedLoopEventClient() {
122         return closedLoopEventClient;
123     }
124
125     public void setClosedLoopEventClient(String closedLoopEventClient) {
126         this.closedLoopEventClient = closedLoopEventClient;
127     }
128
129     public ControlLoopTargetType getTargetType() {
130         return targetType;
131     }
132
133     public void setTargetType(ControlLoopTargetType targetType) {
134         this.targetType = targetType;
135     }
136
137     public String getTarget() {
138         return target;
139     }
140
141     public void setTarget(String target) {
142         this.target = target;
143     }
144
145     public String getFrom() {
146         return from;
147     }
148
149     public void setFrom(String from) {
150         this.from = from;
151     }
152
153     public String getPolicyScope() {
154         return policyScope;
155     }
156
157     public void setPolicyScope(String policyScope) {
158         this.policyScope = policyScope;
159     }
160
161     public String getPolicyName() {
162         return policyName;
163     }
164
165     public void setPolicyName(String policyName) {
166         this.policyName = policyName;
167     }
168
169     public String getPolicyVersion() {
170         return policyVersion;
171     }
172
173     public void setPolicyVersion(String policyVersion) {
174         this.policyVersion = policyVersion;
175     }
176
177     public ControlLoopEventStatus getClosedLoopEventStatus() {
178         return closedLoopEventStatus;
179     }
180
181     public void setClosedLoopEventStatus(ControlLoopEventStatus closedLoopEventStatus) {
182         this.closedLoopEventStatus = closedLoopEventStatus;
183     }
184
185     public String getPayload() {
186         return payload;
187     }
188
189     public void setPayload(String payload) {
190         this.payload = payload;
191     }
192 }