2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
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=========================================================
21 package org.onap.policy.aai;
23 import java.io.Serializable;
25 public class PnfInstance implements Serializable {
27 private static final long serialVersionUID = -3694152433472165034L;
29 private String pnfName;
30 private String pnfInstanceName;
31 private PnfType pnfType;
32 private String pnfSerial;
34 public PnfInstance() {
39 * Create an instance from a given instance.
41 * @param instance the instance
43 public PnfInstance(PnfInstance instance) {
44 if (instance == null) {
47 this.pnfName = instance.pnfName;
48 this.pnfInstanceName = instance.pnfInstanceName;
49 this.pnfType = instance.pnfType;
50 this.pnfSerial = instance.pnfSerial;
53 public String getPnfName() {
57 public void setPnfName(String pnfName) {
58 this.pnfName = pnfName;
61 public String getPnfInstanceName() {
62 return pnfInstanceName;
65 public void setPnfInstanceName(String pnfInstanceName) {
66 this.pnfInstanceName = pnfInstanceName;
69 public PnfType getPnfType() {
73 public void setPnfType(PnfType pnfType) {
74 this.pnfType = pnfType;
77 public String getPnfSerial() {
81 public void setPnfSerial(String pnfSerial) {
82 this.pnfSerial = pnfSerial;
86 public String toString() {
87 return "PNFInstance [PNFName=" + pnfName + ", PNFInstanceName=" + pnfInstanceName + ", PNFType=" + pnfType
88 + ", PNFSerial=" + pnfSerial + "]";
92 public int hashCode() {
95 result = prime * result + ((pnfInstanceName == null) ? 0 : pnfInstanceName.hashCode());
96 result = prime * result + ((pnfName == null) ? 0 : pnfName.hashCode());
97 result = prime * result + ((pnfSerial == null) ? 0 : pnfSerial.hashCode());
98 result = prime * result + ((pnfType == null) ? 0 : pnfType.hashCode());
103 public boolean equals(Object obj) {
110 if (getClass() != obj.getClass()) {
113 PnfInstance other = (PnfInstance) obj;
114 if (pnfInstanceName == null) {
115 if (other.pnfInstanceName != null) {
118 } else if (!pnfInstanceName.equals(other.pnfInstanceName)) {
121 if (pnfName == null) {
122 if (other.pnfName != null) {
125 } else if (!pnfName.equals(other.pnfName)) {
128 if (pnfSerial == null) {
129 if (other.pnfSerial != null) {
132 } else if (!pnfSerial.equals(other.pnfSerial)) {
135 return pnfType == other.pnfType;