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