2 * ============LICENSE_START=======================================================
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
22 package org.onap.policy.aai;
24 import java.io.Serializable;
26 public class PnfInstance implements Serializable {
28 private static final long serialVersionUID = -3694152433472165034L;
30 private String pnfName;
31 private String pnfInstanceName;
32 private PnfType pnfType;
33 private String pnfSerial;
35 public PnfInstance() {
40 * Create an instance from a given instance.
42 * @param instance the instance
44 public PnfInstance(PnfInstance instance) {
45 if (instance == null) {
48 this.pnfName = instance.pnfName;
49 this.pnfInstanceName = instance.pnfInstanceName;
50 this.pnfType = instance.pnfType;
51 this.pnfSerial = instance.pnfSerial;
54 public String getPnfName() {
58 public void setPnfName(String pnfName) {
59 this.pnfName = pnfName;
62 public String getPnfInstanceName() {
63 return pnfInstanceName;
66 public void setPnfInstanceName(String pnfInstanceName) {
67 this.pnfInstanceName = pnfInstanceName;
70 public PnfType getPnfType() {
74 public void setPnfType(PnfType pnfType) {
75 this.pnfType = pnfType;
78 public String getPnfSerial() {
82 public void setPnfSerial(String pnfSerial) {
83 this.pnfSerial = pnfSerial;
87 public String toString() {
88 return "PNFInstance [PNFName=" + pnfName + ", PNFInstanceName=" + pnfInstanceName + ", PNFType=" + pnfType
89 + ", PNFSerial=" + pnfSerial + "]";
93 public int hashCode() {
96 result = prime * result + ((pnfInstanceName == null) ? 0 : pnfInstanceName.hashCode());
97 result = prime * result + ((pnfName == null) ? 0 : pnfName.hashCode());
98 result = prime * result + ((pnfSerial == null) ? 0 : pnfSerial.hashCode());
99 result = prime * result + ((pnfType == null) ? 0 : pnfType.hashCode());
104 public boolean equals(Object obj) {
111 if (getClass() != obj.getClass()) {
114 PnfInstance other = (PnfInstance) obj;
115 if (pnfInstanceName == null) {
116 if (other.pnfInstanceName != null) {
119 } else if (!pnfInstanceName.equals(other.pnfInstanceName)) {
122 if (pnfName == null) {
123 if (other.pnfName != null) {
126 } else if (!pnfName.equals(other.pnfName)) {
129 if (pnfSerial == null) {
130 if (other.pnfSerial != null) {
133 } else if (!pnfSerial.equals(other.pnfSerial)) {
136 return pnfType == other.pnfType;