Changes in preparation for the m2 model
[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 import lombok.Getter;
28 import lombok.Setter;
29
30 @Getter
31 @Setter
32 public abstract class ControlLoopEvent implements Serializable {
33
34     private static final long serialVersionUID = 2391252138583119195L;
35
36     @SerializedName("closedLoopControlName")
37     private String closedLoopControlName;
38
39     @SerializedName("version")
40     private String version = "1.0.2";
41
42     @SerializedName("requestID")
43     private UUID requestId;
44
45     @SerializedName("closedLoopEventClient")
46     private String closedLoopEventClient;
47
48     @SerializedName("target_type")
49     private String targetType;
50
51     @SerializedName("target")
52     private String target;
53
54     @SerializedName("from")
55     private String from;
56
57     @SerializedName("policyScope")
58     private String policyScope;
59
60     @SerializedName("policyName")
61     private String policyName;
62
63     @SerializedName("policyVersion")
64     private String policyVersion;
65
66     @SerializedName("closedLoopEventStatus")
67     private ControlLoopEventStatus closedLoopEventStatus;
68
69     public ControlLoopEvent() {
70
71     }
72
73     /**
74      * Construct an instace from an existing instance.
75      *
76      * @param event the existing instance
77      */
78     public ControlLoopEvent(ControlLoopEvent event) {
79         if (event == null) {
80             return;
81         }
82         this.closedLoopControlName = event.closedLoopControlName;
83         this.requestId = event.requestId;
84         this.closedLoopEventClient = event.closedLoopEventClient;
85         this.targetType = event.targetType;
86         this.target = event.target;
87         this.from = event.from;
88         this.policyScope = event.policyScope;
89         this.policyName = event.policyName;
90         this.policyVersion = event.policyVersion;
91         this.closedLoopEventStatus = event.closedLoopEventStatus;
92     }
93
94     public boolean isEventStatusValid() {
95         return this.closedLoopEventStatus != null;
96     }
97 }