Sync Integ to Master
[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.io.Serializable;
26 import java.util.ArrayList;
27 import java.util.List;
28
29 public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable {
30
31         /**
32          * 
33          */
34         private static final long serialVersionUID = -1877577227290771160L;
35
36         private String fullName;
37
38         private List<String> contacts;
39
40         private Boolean isActive;
41
42         public ProductMetadataDataDefinition() {
43                 super();
44         }
45
46         public ProductMetadataDataDefinition(ProductMetadataDataDefinition other) {
47                 super(other);
48         }
49
50         public Boolean getIsActive() {
51                 return isActive;
52         }
53
54         public void setIsActive(Boolean active) {
55                 isActive = active;
56         }
57
58         public List<String> getContacts() {
59                 return contacts;
60         }
61
62         public void setContacts(List<String> contacts) {
63                 this.contacts = contacts;
64         }
65
66         public void addContact(String contact) {
67                 if (contact != null) {
68                         if (contacts == null) {
69                                 contacts = new ArrayList<>();
70                         }
71                         contacts.add(contact);
72                 }
73         }
74
75         public String getFullName() {
76                 return fullName;
77         }
78
79         public void setFullName(String fullName) {
80                 this.fullName = fullName;
81         }
82
83         @Override
84         public String toString() {
85                 return "ProductMetadataDataDefinition [fullName=" + fullName + ", contacts=" + contacts + ", isActive="
86                                 + isActive + "]";
87         }
88
89         @Override
90         public int hashCode() {
91                 final int prime = 31;
92                 int result = super.hashCode();
93
94                 result = prime * result + ((contacts == null) ? 0 : contacts.hashCode());
95                 result = prime * result + ((fullName == null) ? 0 : fullName.hashCode());
96                 result = prime * result + ((isActive == null) ? 0 : isActive.hashCode());
97                 return result;
98         }
99
100         @Override
101         public boolean equals(Object obj) {
102                 if (this == obj)
103                         return true;
104                 if (!super.equals(obj))
105                         return false;
106                 if (getClass() != obj.getClass())
107                         return false;
108                 ProductMetadataDataDefinition other = (ProductMetadataDataDefinition) obj;
109                 if (contacts == null) {
110                         if (other.contacts != null)
111                                 return false;
112                 } else if (!contacts.equals(other.contacts))
113                         return false;
114                 if (fullName == null) {
115                         if (other.fullName != null)
116                                 return false;
117                 } else if (!fullName.equals(other.fullName))
118                         return false;
119                 if (isActive == isActive) {
120                         if (other.isActive != null)
121                                 return false;
122                 } else if (!isActive.equals(other.isActive))
123                         return false;
124                 return super.equals(obj);
125         }
126
127         @Override
128         public String getActualComponentType() {
129                 return getComponentType().getValue();
130         }
131 }