re base code
[sdc.git] / common-be / src / main / java / org / openecomp / sdc / be / datatypes / elements / ProductMetadataDataDefinition.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 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.openecomp.sdc.be.datatypes.elements;
22
23 import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition {
29
30         private String fullName;
31
32         private List<String> contacts;
33
34         private Boolean isActive;
35
36         public ProductMetadataDataDefinition() {
37                 super();
38         }
39
40         public ProductMetadataDataDefinition(ProductMetadataDataDefinition other) {
41                 super(other);
42         }
43
44         public Boolean getIsActive() {
45                 return isActive;
46         }
47
48         public void setIsActive(Boolean active) {
49                 isActive = active;
50         }
51
52         public List<String> getContacts() {
53                 return contacts;
54         }
55
56         public void setContacts(List<String> contacts) {
57                 this.contacts = contacts;
58         }
59
60         public void addContact(String contact) {
61                 if (contact != null) {
62                         if (contacts == null) {
63                                 contacts = new ArrayList<>();
64                         }
65                         contacts.add(contact);
66                 }
67         }
68
69         public String getFullName() {
70                 return fullName;
71         }
72
73         public void setFullName(String fullName) {
74                 this.fullName = fullName;
75         }
76
77         @Override
78         public String toString() {
79                 return "ProductMetadataDataDefinition [fullName=" + fullName + ", contacts=" + contacts + ", isActive="
80                                 + isActive + "]";
81         }
82
83         @Override
84         public int hashCode() {
85                 final int prime = 31;
86                 int result = super.hashCode();
87
88                 result = prime * result + ((contacts == null) ? 0 : contacts.hashCode());
89                 result = prime * result + ((fullName == null) ? 0 : fullName.hashCode());
90                 result = prime * result + ((isActive == null) ? 0 : isActive.hashCode());
91                 return result;
92         }
93
94         @Override
95         public boolean equals(Object obj) {
96                 if (this == obj)
97                         return true;
98                 if (!super.equals(obj))
99                         return false;
100                 if (getClass() != obj.getClass())
101                         return false;
102                 ProductMetadataDataDefinition other = (ProductMetadataDataDefinition) obj;
103                 if (contacts == null) {
104                         if (other.contacts != null)
105                                 return false;
106                 } else if (!contacts.equals(other.contacts))
107                         return false;
108                 if (fullName == null) {
109                         if (other.fullName != null)
110                                 return false;
111                 } else if (!fullName.equals(other.fullName))
112                         return false;
113                 if (isActive == isActive) {
114                         if (other.isActive != null)
115                                 return false;
116                 } else if (!isActive.equals(other.isActive))
117                         return false;
118                 return super.equals(obj);
119         }
120
121         @Override
122         public String getActualComponentType() {
123                 return getComponentType() != null ? getComponentType().getValue() : null;
124         }
125 }