Fix bugs and formatting issues
[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 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     @JsonProperty("Action")
51     private String action;
52     private String payload;
53
54     /**
55      * constructor.
56      */
57     public PolicyNotification() {
58
59     }
60
61     /**
62      * Constructor.
63      *
64      */
65     public PolicyNotification(String closedLoopControlName, String requestId, Long alarmStartTime, String pnfName, String action) {
66         this.closedLoopControlName = closedLoopControlName;
67         this.requestId = requestId;
68         this.closedLoopEventClient = "microservice.PCI";
69         this.closedLoopEventStatus = "ONSET";
70         this.closedLoopAlarmStart = alarmStartTime;
71         this.from = "PCIMS";
72         this.version = "1.0.2";
73         this.action = action;
74         this.target = "generic-vnf.vnf-id";
75         this.targetType = "VNF";
76         this.aai = new HashMap<>();
77         aai.put("generic-vnf.is-closed-loop-disabled", "false");
78         aai.put("generic-vnf.prov-status", "ACTIVE");
79         aai.put("generic-vnf.vnf-id", pnfName);
80     }
81
82     public long getClosedLoopAlarmStart() {
83         return closedLoopAlarmStart;
84     }
85
86     public void setClosedLoopAlarmStart(long closedLoopAlarmStart) {
87         this.closedLoopAlarmStart = closedLoopAlarmStart;
88     }
89
90     public String getClosedLoopEventClient() {
91         return closedLoopEventClient;
92     }
93
94     public void setClosedLoopEventClient(String closedLoopEventClient) {
95         this.closedLoopEventClient = closedLoopEventClient;
96     }
97
98     public String getClosedLoopEventStatus() {
99         return closedLoopEventStatus;
100     }
101
102     public void setClosedLoopEventStatus(String closedLoopEventStatus) {
103         this.closedLoopEventStatus = closedLoopEventStatus;
104     }
105
106     public String getRequestId() {
107         return requestId;
108     }
109
110     public void setRequestId(String requestId) {
111         this.requestId = requestId;
112     }
113
114     public String getFrom() {
115         return from;
116     }
117
118     public void setFrom(String from) {
119         this.from = from;
120     }
121
122     public String getVersion() {
123         return version;
124     }
125
126     public void setVersion(String version) {
127         this.version = version;
128     }
129
130     public String getAction() {
131         return action;
132     }
133
134     public void setAction(String action) {
135         this.action = action;
136     }
137
138     public String getClosedLoopControlName() {
139         return closedLoopControlName;
140     }
141
142     public void setClosedLoopControlName(String closedLoopControlName) {
143         this.closedLoopControlName = closedLoopControlName;
144     }
145
146     public String getPayload() {
147         return payload;
148     }
149
150     public void setPayload(String payload) {
151         this.payload = payload;
152     }
153
154     public String getTargetType() {
155         return targetType;
156     }
157
158     public void setTargetType(String targetType) {
159         this.targetType = targetType;
160     }
161
162     public String getTarget() {
163         return target;
164     }
165
166     public void setTarget(String target) {
167         this.target = target;
168     }
169
170     public Map<String, String> getAai() {
171         return aai;
172     }
173
174     public void setAai(Map<String, String> aai) {
175         this.aai = aai;
176     }
177
178     @Override
179     public String toString() {
180         return "PolicyNotification [closedLoopControlName=" + closedLoopControlName + ", closedLoopAlarmStart="
181                 + closedLoopAlarmStart + ", closedLoopEventClient=" + closedLoopEventClient + ", closedLoopEventStatus="
182                 + closedLoopEventStatus + ", targetType=" + targetType + ", target=" + target + ", requestId="
183                 + requestId + ", aai=" + aai + ", from=" + from + ", version=" + version + ", action=" + action
184                 + ", payload=" + payload + "]";
185     }
186
187     @Override
188     public int hashCode() {
189         final int prime = 31;
190         int result = 1;
191         result = prime * result + ((aai == null) ? 0 : aai.hashCode());
192         result = prime * result + ((action == null) ? 0 : action.hashCode());
193         result = prime * result + (int) (closedLoopAlarmStart ^ (closedLoopAlarmStart >>> 32));
194         result = prime * result + ((closedLoopControlName == null) ? 0 : closedLoopControlName.hashCode());
195         result = prime * result + ((closedLoopEventClient == null) ? 0 : closedLoopEventClient.hashCode());
196         result = prime * result + ((closedLoopEventStatus == null) ? 0 : closedLoopEventStatus.hashCode());
197         result = prime * result + ((from == null) ? 0 : from.hashCode());
198         result = prime * result + ((payload == null) ? 0 : payload.hashCode());
199         result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
200         result = prime * result + ((target == null) ? 0 : target.hashCode());
201         result = prime * result + ((targetType == null) ? 0 : targetType.hashCode());
202         result = prime * result + ((version == null) ? 0 : version.hashCode());
203         return result;
204     }
205
206     @Override
207     public boolean equals(Object obj) {
208         if (obj == null) {
209             return false;
210         }
211         return (this.hashCode() == obj.hashCode());
212     }
213     
214     
215
216 }