migrate model-impl from drools-applications
[policy/models.git] / models-interactions / model-impl / events / src / main / java / org / onap / policy / controlloop / ControlLoopEvent.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * controlloop
4  * ================================================================================
5  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2019 Nordix Foundation.
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  */
21
22 package org.onap.policy.controlloop;
23
24 import com.google.gson.annotations.SerializedName;
25 import java.io.Serializable;
26 import java.util.UUID;
27
28 public abstract class ControlLoopEvent implements Serializable {
29
30     private static final long serialVersionUID = 2391252138583119195L;
31     
32     @SerializedName("closedLoopControlName")
33     private String closedLoopControlName;
34     
35     @SerializedName("version")
36     private String version = "1.0.2";
37     
38     @SerializedName("requestID")
39     private UUID requestId;
40     
41     @SerializedName("closedLoopEventClient")
42     private String closedLoopEventClient;
43     
44     @SerializedName("target_type")
45     private ControlLoopTargetType targetType;
46     
47     @SerializedName("target")
48     private String target;
49     
50     @SerializedName("from")
51     private String from;
52     
53     @SerializedName("policyScope")
54     private String policyScope;
55     
56     @SerializedName("policyName")
57     private String policyName;
58     
59     @SerializedName("policyVersion")
60     private String policyVersion;
61     
62     @SerializedName("closedLoopEventStatus")
63     private ControlLoopEventStatus closedLoopEventStatus;
64
65     @SerializedName("payload")
66     private String payload;
67     
68     public ControlLoopEvent() {
69
70     }
71
72     /**
73      * Construct an instace from an existing instance.
74      * 
75      * @param event the existing instance
76      */
77     public ControlLoopEvent(ControlLoopEvent event) {
78         if (event == null) {
79             return;
80         }
81         this.closedLoopControlName = event.closedLoopControlName;
82         this.requestId = event.requestId;
83         this.closedLoopEventClient = event.closedLoopEventClient;
84         this.targetType = event.targetType;
85         this.target = event.target;
86         this.from = event.from;
87         this.policyScope = event.policyScope;
88         this.policyName = event.policyName;
89         this.policyVersion = event.policyVersion;
90         this.closedLoopEventStatus = event.closedLoopEventStatus;
91         this.payload = event.payload;
92     }
93
94     public boolean isEventStatusValid() {
95         return this.closedLoopEventStatus != null;
96     }
97
98     public String getClosedLoopControlName() {
99         return closedLoopControlName;
100     }
101
102     public void setClosedLoopControlName(String closedLoopControlName) {
103         this.closedLoopControlName = closedLoopControlName;
104     }
105
106     public String getVersion() {
107         return version;
108     }
109
110     public void setVersion(String version) {
111         this.version = version;
112     }
113
114     public UUID getRequestId() {
115         return requestId;
116     }
117
118     public void setRequestId(UUID requestId) {
119         this.requestId = requestId;
120     }
121
122     public String getClosedLoopEventClient() {
123         return closedLoopEventClient;
124     }
125
126     public void setClosedLoopEventClient(String closedLoopEventClient) {
127         this.closedLoopEventClient = closedLoopEventClient;
128     }
129
130     public ControlLoopTargetType getTargetType() {
131         return targetType;
132     }
133
134     public void setTargetType(ControlLoopTargetType targetType) {
135         this.targetType = targetType;
136     }
137
138     public String getTarget() {
139         return target;
140     }
141
142     public void setTarget(String target) {
143         this.target = target;
144     }
145
146     public String getFrom() {
147         return from;
148     }
149
150     public void setFrom(String from) {
151         this.from = from;
152     }
153
154     public String getPolicyScope() {
155         return policyScope;
156     }
157
158     public void setPolicyScope(String policyScope) {
159         this.policyScope = policyScope;
160     }
161
162     public String getPolicyName() {
163         return policyName;
164     }
165
166     public void setPolicyName(String policyName) {
167         this.policyName = policyName;
168     }
169
170     public String getPolicyVersion() {
171         return policyVersion;
172     }
173
174     public void setPolicyVersion(String policyVersion) {
175         this.policyVersion = policyVersion;
176     }
177
178     public ControlLoopEventStatus getClosedLoopEventStatus() {
179         return closedLoopEventStatus;
180     }
181
182     public void setClosedLoopEventStatus(ControlLoopEventStatus closedLoopEventStatus) {
183         this.closedLoopEventStatus = closedLoopEventStatus;
184     }
185
186     public String getPayload() {
187         return payload;
188     }
189
190     public void setPayload(String payload) {
191         this.payload = payload;
192     }
193 }