Modify policy-notification to align with policy.
[dcaegen2/services/son-handler.git] / src / main / java / org / onap / dcaegen2 / services / sonhms / model / PolicyNotification.java
1 /*******************************************************************************
2  *  ============LICENSE_START=======================================================
3  *  son-handler
4  *  ================================================================================
5  *   Copyright (C) 2019-2020 Wipro Limited.
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
22 package org.onap.dcaegen2.services.sonhms.model;
23
24 import com.fasterxml.jackson.annotation.JsonProperty;
25
26 import java.util.HashMap;
27 import java.util.Map;
28
29 public class PolicyNotification {
30
31     private String closedLoopControlName;
32     private long closedLoopAlarmStart;
33     private String closedLoopEventClient;
34     private String closedLoopEventStatus;
35     
36     @JsonProperty("target_type")
37     private String targetType;
38
39     private String target;
40
41     @JsonProperty("requestID")
42     private String requestId;
43
44     @JsonProperty("AAI")
45     private Map<String, String> aai;
46
47     private String from;
48     private String version;
49     
50     private String policyName;
51     private String policyVersion;
52
53     @JsonProperty("Action")
54     private String action;
55     private String payload;
56
57     /**
58      * constructor.
59      */
60     public PolicyNotification() {
61
62     }
63
64     /**
65      * Constructor.
66      */
67     public PolicyNotification(String closedLoopControlName, String requestId, Long alarmStartTime, String pnfName,
68             String action) {
69         this.closedLoopControlName = closedLoopControlName;
70         this.requestId = requestId;
71         this.closedLoopEventClient = "microservice.PCI";
72         this.closedLoopEventStatus = "ONSET";
73         this.closedLoopAlarmStart = alarmStartTime;
74         this.from = "PCIMS";
75         this.version = "1.0.2";
76         this.action = action;
77         this.target = "pnf.pnf-name";
78         this.targetType = "PNF";
79         this.aai = new HashMap<>();
80         aai.put("generic-vnf.is-closed-loop-disabled", "false");
81         aai.put("generic-vnf.prov-status", "ACTIVE");
82         aai.put("pnf.pnf-name", pnfName);
83         this.policyName = "PCI";
84         this.policyVersion = "1.0.2";
85     }
86
87     public long getClosedLoopAlarmStart() {
88         return closedLoopAlarmStart;
89     }
90
91     public void setClosedLoopAlarmStart(long closedLoopAlarmStart) {
92         this.closedLoopAlarmStart = closedLoopAlarmStart;
93     }
94
95     public String getClosedLoopEventClient() {
96         return closedLoopEventClient;
97     }
98
99     public void setClosedLoopEventClient(String closedLoopEventClient) {
100         this.closedLoopEventClient = closedLoopEventClient;
101     }
102
103     public String getClosedLoopEventStatus() {
104         return closedLoopEventStatus;
105     }
106
107     public void setClosedLoopEventStatus(String closedLoopEventStatus) {
108         this.closedLoopEventStatus = closedLoopEventStatus;
109     }
110
111     public String getRequestId() {
112         return requestId;
113     }
114
115     public void setRequestId(String requestId) {
116         this.requestId = requestId;
117     }
118
119     public String getFrom() {
120         return from;
121     }
122
123     public void setFrom(String from) {
124         this.from = from;
125     }
126
127     public String getVersion() {
128         return version;
129     }
130
131     public void setVersion(String version) {
132         this.version = version;
133     }
134
135     public String getAction() {
136         return action;
137     }
138
139     public void setAction(String action) {
140         this.action = action;
141     }
142
143     public String getClosedLoopControlName() {
144         return closedLoopControlName;
145     }
146
147     public void setClosedLoopControlName(String closedLoopControlName) {
148         this.closedLoopControlName = closedLoopControlName;
149     }
150
151     public String getPayload() {
152         return payload;
153     }
154
155     public void setPayload(String payload) {
156         this.payload = payload;
157     }
158
159     public String getTargetType() {
160         return targetType;
161     }
162
163     public void setTargetType(String targetType) {
164         this.targetType = targetType;
165     }
166
167     public String getTarget() {
168         return target;
169     }
170
171     public void setTarget(String target) {
172         this.target = target;
173     }
174
175     public Map<String, String> getAai() {
176         return aai;
177     }
178
179     public void setAai(Map<String, String> aai) {
180         this.aai = aai;
181     }
182
183     @Override
184     public String toString() {
185         return "PolicyNotification [closedLoopControlName=" + closedLoopControlName + ", closedLoopAlarmStart="
186                 + closedLoopAlarmStart + ", closedLoopEventClient=" + closedLoopEventClient + ", closedLoopEventStatus="
187                 + closedLoopEventStatus + ", targetType=" + targetType + ", target=" + target + ", requestId="
188                 + requestId + ", aai=" + aai + ", from=" + from + ", version=" + version + ", action=" + action
189                 + ", payload=" + payload + "]";
190     }
191
192     @Override
193     public int hashCode() {
194         final int prime = 31;
195         int result = 1;
196         result = prime * result + ((aai == null) ? 0 : aai.hashCode());
197         result = prime * result + ((action == null) ? 0 : action.hashCode());
198         result = prime * result + (int) (closedLoopAlarmStart ^ (closedLoopAlarmStart >>> 32));
199         result = prime * result + ((closedLoopControlName == null) ? 0 : closedLoopControlName.hashCode());
200         result = prime * result + ((closedLoopEventClient == null) ? 0 : closedLoopEventClient.hashCode());
201         result = prime * result + ((closedLoopEventStatus == null) ? 0 : closedLoopEventStatus.hashCode());
202         result = prime * result + ((from == null) ? 0 : from.hashCode());
203         result = prime * result + ((payload == null) ? 0 : payload.hashCode());
204         result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
205         result = prime * result + ((target == null) ? 0 : target.hashCode());
206         result = prime * result + ((targetType == null) ? 0 : targetType.hashCode());
207         result = prime * result + ((version == null) ? 0 : version.hashCode());
208         return result;
209     }
210
211     @Override
212     public boolean equals(Object obj) {
213         if (obj == null) {
214             return false;
215         }
216         return (this.hashCode() == obj.hashCode());
217     }
218
219     public String getPolicyName() {
220         return policyName;
221     }
222
223     public void setPolicyName(String policyName) {
224         this.policyName = policyName;
225     }
226
227     public String getPolicyVersion() {
228         return policyVersion;
229     }
230
231     public void setPolicyVersion(String policyVersion) {
232         this.policyVersion = policyVersion;
233     }
234     
235     
236
237 }