0ef10d4c9582372a05aaec9752c305e7b8da962b
[sdc.git] /
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 public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition {
24     private static final String EMPTY_STR = "";
25
26     private String distributionStatus;
27     private String serviceType;
28     private String serviceRole;
29     private String instantiationType = EMPTY_STR;
30
31     private Boolean ecompGeneratedNaming = true;
32
33     private String namingPolicy = EMPTY_STR;
34
35     private String environmentContext;
36
37     public ServiceMetadataDataDefinition() {
38         super();
39         serviceType = "";
40         serviceRole = "";
41     }
42
43     public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) {
44         super(other);
45         serviceType = other.getServiceType();
46         serviceRole = other.getServiceRole();
47     }
48
49     public String getDistributionStatus() {
50         return distributionStatus;
51     }
52
53     public void setDistributionStatus(String distributionStatus) {
54         this.distributionStatus = distributionStatus;
55     }
56
57     public String getServiceType() {
58         return serviceType;
59     }
60
61     public void setServiceType(String serviceType) {
62         this.serviceType = serviceType;
63     }
64
65     public String getServiceRole() {
66         return serviceRole;
67     }
68
69     public String getInstantiationType() {
70         return instantiationType;
71     }
72
73     public void setInstantiationType(String instantiationType) {
74         this.instantiationType = instantiationType;
75     }
76
77     public void setServiceRole(String serviceRole) {
78         this.serviceRole = serviceRole;
79     }
80
81     public Boolean isEcompGeneratedNaming() {
82         return ecompGeneratedNaming;
83     }
84
85     public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
86         this.ecompGeneratedNaming = ecompGeneratedNaming;
87     }
88
89     public String getNamingPolicy() {
90         return namingPolicy;
91     }
92
93     public void setNamingPolicy(String namingPolicy) {
94         this.namingPolicy = namingPolicy;
95     }
96
97     public String getEnvironmentContext() {
98         return environmentContext;
99     }
100
101     public void setEnvironmentContext(String environmentContext) {
102         this.environmentContext = environmentContext;
103     }
104
105     @Override
106     public String toString() {
107         return "ServiceMetadataDataDefinition{"
108                 + "distributionStatus='" + distributionStatus + '\''
109                 + ", serviceType='" + serviceType + '\''
110                 + ", serviceRole='" + serviceRole + '\''
111                 + ", ecompGeneratedNaming=" + ecompGeneratedNaming
112                 + ", namingPolicy='" + namingPolicy + '\''
113                 + ", environmentContext='" + environmentContext + '\''
114                 + ", instantiationType='" + instantiationType + '\''
115                 + '}';
116     }
117
118     @Override
119     public int hashCode() {
120         final int prime = 31;
121         int result = super.hashCode();
122         result = prime * result + ((distributionStatus == null) ? 0 : distributionStatus.hashCode());
123         result = prime * result + ((ecompGeneratedNaming == null) ? 0 : ecompGeneratedNaming.hashCode());
124         result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode());
125         result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
126         result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode());
127         result = prime * result + ((environmentContext == null) ? 0 : environmentContext.hashCode());
128         result = prime * result + ((instantiationType == null) ? 0 : instantiationType.hashCode());
129         return result;
130     }
131
132     @Override
133     public boolean equals(Object obj) {
134         if (this == obj) {
135             return true;
136         }
137         if (obj == null) {
138             return false;
139         }
140         if (!(obj instanceof ComponentMetadataDataDefinition)) {
141             return false;
142         }
143         if (!super.equals(obj)) {
144             return false;
145         }
146         if (getClass() != obj.getClass()) {
147             return false;
148         }
149         ServiceMetadataDataDefinition other = (ServiceMetadataDataDefinition) obj;
150         if (distributionStatus == null) {
151             if (other.distributionStatus != null) {
152                 return false;
153             }
154         } else if (!distributionStatus.equals(other.distributionStatus)) {
155             return false;
156         }
157         if (ecompGeneratedNaming == null) {
158             if (other.ecompGeneratedNaming != null) {
159                 return false;
160             }
161         } else if (!ecompGeneratedNaming.equals(other.ecompGeneratedNaming)) {
162             return false;
163         }
164         if (namingPolicy == null) {
165             if (other.namingPolicy != null) {
166                 return false;
167             }
168         } else if (!namingPolicy.equals(other.namingPolicy)) {
169             return false;
170         }
171         if (serviceType == null) {
172             if (other.serviceType != null) {
173                 return false;
174             }
175         } else if (!serviceType.equals(other.serviceType)) {
176             return false;
177         }
178         if (serviceRole == null) {
179             if (other.serviceRole != null) {
180                 return false;
181             }
182         } else if (!serviceRole.equals(other.serviceRole)) {
183             return false;
184         }
185         if (environmentContext == null) {
186             if (other.environmentContext != null) {
187                 return false;
188             }
189         } else if (!environmentContext.equals(other.environmentContext)) {
190             return false;
191         }
192         if (instantiationType == null) {
193             if (other.instantiationType != null) {
194                 return false;
195             }
196         } else if (!instantiationType.equals(other.instantiationType)) {
197             return false;
198         }
199         return super.equals(obj);
200     }
201
202     @Override
203     public String getActualComponentType() {
204
205         return componentType != null ? componentType.getValue() : "";
206     }
207
208 }