1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 *******************************************************************************/
22 package org.onap.dcaegen2.services.sonhms.model;
24 import com.fasterxml.jackson.annotation.JsonProperty;
26 import java.util.HashMap;
29 public class PolicyNotification {
31 private String closedLoopControlName;
32 private long closedLoopAlarmStart;
33 private String closedLoopEventClient;
34 private String closedLoopEventStatus;
36 @JsonProperty("target_type")
37 private String targetType;
39 private String target;
41 @JsonProperty("requestID")
42 private String requestId;
45 private Map<String, String> aai;
48 private String version;
50 private String policyName;
51 private String policyVersion;
53 @JsonProperty("Action")
54 private String action;
55 private String payload;
60 public PolicyNotification() {
67 public PolicyNotification(String closedLoopControlName, String requestId, Long alarmStartTime, String pnfName,
69 this.closedLoopControlName = closedLoopControlName;
70 this.requestId = requestId;
71 this.closedLoopEventClient = "microservice.PCI";
72 this.closedLoopEventStatus = "ONSET";
73 this.closedLoopAlarmStart = alarmStartTime;
75 this.version = "1.0.2";
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";
87 public long getClosedLoopAlarmStart() {
88 return closedLoopAlarmStart;
91 public void setClosedLoopAlarmStart(long closedLoopAlarmStart) {
92 this.closedLoopAlarmStart = closedLoopAlarmStart;
95 public String getClosedLoopEventClient() {
96 return closedLoopEventClient;
99 public void setClosedLoopEventClient(String closedLoopEventClient) {
100 this.closedLoopEventClient = closedLoopEventClient;
103 public String getClosedLoopEventStatus() {
104 return closedLoopEventStatus;
107 public void setClosedLoopEventStatus(String closedLoopEventStatus) {
108 this.closedLoopEventStatus = closedLoopEventStatus;
111 public String getRequestId() {
115 public void setRequestId(String requestId) {
116 this.requestId = requestId;
119 public String getFrom() {
123 public void setFrom(String from) {
127 public String getVersion() {
131 public void setVersion(String version) {
132 this.version = version;
135 public String getAction() {
139 public void setAction(String action) {
140 this.action = action;
143 public String getClosedLoopControlName() {
144 return closedLoopControlName;
147 public void setClosedLoopControlName(String closedLoopControlName) {
148 this.closedLoopControlName = closedLoopControlName;
151 public String getPayload() {
155 public void setPayload(String payload) {
156 this.payload = payload;
159 public String getTargetType() {
163 public void setTargetType(String targetType) {
164 this.targetType = targetType;
167 public String getTarget() {
171 public void setTarget(String target) {
172 this.target = target;
175 public Map<String, String> getAai() {
179 public void setAai(Map<String, String> aai) {
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 + "]";
193 public int hashCode() {
194 final int prime = 31;
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());
212 public boolean equals(Object obj) {
216 return (this.hashCode() == obj.hashCode());
219 public String getPolicyName() {
223 public void setPolicyName(String policyName) {
224 this.policyName = policyName;
227 public String getPolicyVersion() {
228 return policyVersion;
231 public void setPolicyVersion(String policyVersion) {
232 this.policyVersion = policyVersion;