[SDC] rebase 1710 code
[sdc.git] / common-be / src / main / java / org / openecomp / sdc / be / datatypes / components / ServiceMetadataDataDefinition.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.components;
22
23 import java.io.Serializable;
24
25 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
26
27 public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable {
28
29         /**
30          * 
31          */
32         private static final long serialVersionUID = -7661001892509435120L;
33         public static final String EMPTY_STR = "";
34
35         private String distributionStatus;
36         private String serviceType;
37         private String serviceRole;
38
39         private Boolean ecompGeneratedNaming = true;
40
41         private String namingPolicy = EMPTY_STR;
42
43         public ServiceMetadataDataDefinition() {
44                 super();
45                 serviceType = "";
46                 serviceRole = "";
47         }
48
49         public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) {
50                 super(other);
51                 serviceType = other.getServiceType();
52                 serviceRole = other.getServiceRole();
53         }
54
55         public String getDistributionStatus() {
56                 return distributionStatus;
57         }
58
59         public void setDistributionStatus(String distributionStatus) {
60                 this.distributionStatus = distributionStatus;
61         }
62         
63         public String getServiceType(){
64                 return serviceType;
65         }
66         
67         public void setServiceType(String serviceType){
68                 this.serviceType = serviceType;
69         }
70
71         public String getServiceRole(){
72                 return serviceRole;
73         }
74
75         public void setServiceRole(String serviceRole){
76                 this.serviceRole = serviceRole;
77         }
78
79         public Boolean isEcompGeneratedNaming() {
80                 return ecompGeneratedNaming;
81         }
82
83         public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
84                 this.ecompGeneratedNaming = ecompGeneratedNaming;
85         }
86
87         public String getNamingPolicy() {
88                 return namingPolicy;
89         }
90
91         public void setNamingPolicy(String namingPolicy) {
92                 this.namingPolicy = namingPolicy;
93         }
94
95         @Override
96         public String toString() {
97                 return "ServiceMetadataDataDefinition [ distributionStatus=" + distributionStatus
98                                 + ", serviceType=" + serviceType + ", serviceRole=" + serviceRole + ", ecompGeneratedNaming="
99                                 + ecompGeneratedNaming + ", namingPolicy=" + namingPolicy + ", parent=" + super.toString() + "]";
100         }
101
102         @Override
103         public int hashCode() {
104                 final int prime = 31;
105                 int result = super.hashCode();
106                 result = prime * result + ((distributionStatus == null) ? 0 : distributionStatus.hashCode());
107                 result = prime * result + ((ecompGeneratedNaming == null) ? 0 : ecompGeneratedNaming.hashCode());
108                 result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode());
109                 result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
110                 result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode());
111                 return result;
112         }
113
114         @Override
115         public boolean equals(Object obj) {
116                 if (this == obj)
117                         return true;
118                 if (obj == null)
119                         return false;
120                 if (!(obj instanceof ComponentMetadataDataDefinition)) {
121                         return false;
122                 }
123                 if (!super.equals(obj)) {
124                         return false;
125                 }
126                 if (getClass() != obj.getClass())
127                         return false;
128                 ServiceMetadataDataDefinition other = (ServiceMetadataDataDefinition) obj;
129                 if (distributionStatus == null) {
130                         if (other.distributionStatus != null)
131                                 return false;
132                 } else if (!distributionStatus.equals(other.distributionStatus))
133                         return false;
134                 if (ecompGeneratedNaming == null) {
135                         if (other.ecompGeneratedNaming != null)
136                                 return false;
137                 } else if (!ecompGeneratedNaming.equals(other.ecompGeneratedNaming))
138                         return false;
139                 if (namingPolicy == null) {
140                         if (other.namingPolicy != null)
141                                 return false;
142                 } else if (!namingPolicy.equals(other.namingPolicy))
143                         return false;
144                 if (serviceType == null){
145                         if (other.serviceType != null)
146                                 return false;
147                 } else if (!serviceType.equals(other.serviceType))
148                         return false;
149                 if (serviceRole == null){
150                         if (other.serviceRole != null)
151                                 return false;
152                 } else if (!serviceRole.equals(other.serviceRole))
153                         return false;
154                 return super.equals(obj);
155         }
156
157 }