1a9d75efa57c61488039fd5604ee9a55ed7716ba
[policy/models.git] / models-interactions / model-impl / aai / src / main / java / org / onap / policy / aai / PnfInstance.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * aai
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
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
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=========================================================
20  */
21
22 package org.onap.policy.aai;
23
24 import java.io.Serializable;
25
26 public class PnfInstance implements Serializable {
27
28     private static final long serialVersionUID = -3694152433472165034L;
29
30     private String pnfName;
31     private String pnfInstanceName;
32     private PnfType pnfType;
33     private String pnfSerial;
34
35     public PnfInstance() {
36
37     }
38
39     /**
40      * Create an instance from a given instance.
41      * 
42      * @param instance the instance
43      */
44     public PnfInstance(PnfInstance instance) {
45         if (instance == null) {
46             return;
47         }
48         this.pnfName = instance.pnfName;
49         this.pnfInstanceName = instance.pnfInstanceName;
50         this.pnfType = instance.pnfType;
51         this.pnfSerial = instance.pnfSerial;
52     }
53
54     public String getPnfName() {
55         return pnfName;
56     }
57
58     public void setPnfName(String pnfName) {
59         this.pnfName = pnfName;
60     }
61
62     public String getPnfInstanceName() {
63         return pnfInstanceName;
64     }
65
66     public void setPnfInstanceName(String pnfInstanceName) {
67         this.pnfInstanceName = pnfInstanceName;
68     }
69
70     public PnfType getPnfType() {
71         return pnfType;
72     }
73
74     public void setPnfType(PnfType pnfType) {
75         this.pnfType = pnfType;
76     }
77
78     public String getPnfSerial() {
79         return pnfSerial;
80     }
81
82     public void setPnfSerial(String pnfSerial) {
83         this.pnfSerial = pnfSerial;
84     }
85
86     @Override
87     public String toString() {
88         return "PNFInstance [PNFName=" + pnfName + ", PNFInstanceName=" + pnfInstanceName + ", PNFType=" + pnfType
89                 + ", PNFSerial=" + pnfSerial + "]";
90     }
91
92     @Override
93     public int hashCode() {
94         final int prime = 31;
95         int result = 1;
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());
100         return result;
101     }
102
103     @Override
104     public boolean equals(Object obj) {
105         if (this == obj) {
106             return true;
107         }
108         if (obj == null) {
109             return false;
110         }
111         if (getClass() != obj.getClass()) {
112             return false;
113         }
114         PnfInstance other = (PnfInstance) obj;
115         if (pnfInstanceName == null) {
116             if (other.pnfInstanceName != null) {
117                 return false;
118             }
119         } else if (!pnfInstanceName.equals(other.pnfInstanceName)) {
120             return false;
121         }
122         if (pnfName == null) {
123             if (other.pnfName != null) {
124                 return false;
125             }
126         } else if (!pnfName.equals(other.pnfName)) {
127             return false;
128         }
129         if (pnfSerial == null) {
130             if (other.pnfSerial != null) {
131                 return false;
132             }
133         } else if (!pnfSerial.equals(other.pnfSerial)) {
134             return false;
135         }
136         return pnfType == other.pnfType;
137     }
138 }