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