migrate model-impl from drools-applications
[policy/models.git] / models-interactions / model-impl / events / src / main / java / org / onap / policy / controlloop / ControlLoopNotification.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 java.io.Serializable;
25 import java.time.ZoneOffset;
26 import java.time.ZonedDateTime;
27 import java.util.LinkedList;
28 import java.util.List;
29 import java.util.UUID;
30
31 public abstract class ControlLoopNotification implements Serializable {
32
33     private static final long serialVersionUID = 7538596984567127915L;
34
35     private String closedLoopControlName;
36     private String version = "1.0.2";
37     private UUID requestId;
38     private String closedLoopEventClient;
39     private ControlLoopTargetType targetType;
40     private String target;
41     private String from;
42     private String policyScope;
43     private String policyName;
44     private String policyVersion;
45     private ControlLoopNotificationType notification;
46     private String message;
47     private ZonedDateTime notificationTime = ZonedDateTime.now(ZoneOffset.UTC);
48     private Integer opsClTimer;
49     private List<ControlLoopOperation> history = new LinkedList<>();
50
51     public ControlLoopNotification() {
52
53     }
54
55     /**
56      * Construct an instance.
57      * 
58      * @param event the event
59      */
60     public ControlLoopNotification(ControlLoopEvent event) {
61         if (event == null) {
62             return;
63         }
64
65         this.setClosedLoopControlName(event.getClosedLoopControlName());
66         this.setRequestId(event.getRequestId());
67         this.setClosedLoopEventClient(event.getClosedLoopEventClient());
68         this.setTargetType(event.getTargetType());
69         this.setTarget(event.getTarget());
70     }
71
72     public String getClosedLoopControlName() {
73         return closedLoopControlName;
74     }
75
76     public void setClosedLoopControlName(String closedLoopControlName) {
77         this.closedLoopControlName = closedLoopControlName;
78     }
79
80     public String getVersion() {
81         return version;
82     }
83
84     public void setVersion(String version) {
85         this.version = version;
86     }
87
88     public UUID getRequestId() {
89         return requestId;
90     }
91
92     public void setRequestId(UUID requestId) {
93         this.requestId = requestId;
94     }
95
96     public String getClosedLoopEventClient() {
97         return closedLoopEventClient;
98     }
99
100     public void setClosedLoopEventClient(String closedLoopEventClient) {
101         this.closedLoopEventClient = closedLoopEventClient;
102     }
103
104     public ControlLoopTargetType getTargetType() {
105         return targetType;
106     }
107
108     public void setTargetType(ControlLoopTargetType targetType) {
109         this.targetType = targetType;
110     }
111
112     public String getTarget() {
113         return target;
114     }
115
116     public void setTarget(String target) {
117         this.target = target;
118     }
119
120     public String getFrom() {
121         return from;
122     }
123
124     public void setFrom(String from) {
125         this.from = from;
126     }
127
128     public String getPolicyScope() {
129         return policyScope;
130     }
131
132     public void setPolicyScope(String policyScope) {
133         this.policyScope = policyScope;
134     }
135
136     public String getPolicyName() {
137         return policyName;
138     }
139
140     public void setPolicyName(String policyName) {
141         this.policyName = policyName;
142     }
143
144     public String getPolicyVersion() {
145         return policyVersion;
146     }
147
148     public void setPolicyVersion(String policyVersion) {
149         this.policyVersion = policyVersion;
150     }
151
152     public ControlLoopNotificationType getNotification() {
153         return notification;
154     }
155
156     public void setNotification(ControlLoopNotificationType notification) {
157         this.notification = notification;
158     }
159
160     public String getMessage() {
161         return message;
162     }
163
164     public void setMessage(String message) {
165         this.message = message;
166     }
167
168     public ZonedDateTime getNotificationTime() {
169         return notificationTime;
170     }
171
172     public void setNotificationTime(ZonedDateTime notificationTime) {
173         this.notificationTime = notificationTime;
174     }
175
176     public Integer getOpsClTimer() {
177         return opsClTimer;
178     }
179
180     public void setOpsClTimer(Integer opsClTimer) {
181         this.opsClTimer = opsClTimer;
182     }
183
184     public List<ControlLoopOperation> getHistory() {
185         return history;
186     }
187
188     public void setHistory(List<ControlLoopOperation> history) {
189         this.history = history;
190     }
191 }