2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.datatypes.components;
23 public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition {
24 private static final String EMPTY_STR = "";
26 private String distributionStatus;
27 private String serviceType;
28 private String serviceRole;
29 private String instantiationType = EMPTY_STR;
31 private Boolean ecompGeneratedNaming = true;
33 private String namingPolicy = EMPTY_STR;
35 private String environmentContext;
37 public ServiceMetadataDataDefinition() {
43 public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) {
45 serviceType = other.getServiceType();
46 serviceRole = other.getServiceRole();
49 public String getDistributionStatus() {
50 return distributionStatus;
53 public void setDistributionStatus(String distributionStatus) {
54 this.distributionStatus = distributionStatus;
57 public String getServiceType() {
61 public void setServiceType(String serviceType) {
62 this.serviceType = serviceType;
65 public String getServiceRole() {
69 public String getInstantiationType() {
70 return instantiationType;
73 public void setInstantiationType(String instantiationType) {
74 this.instantiationType = instantiationType;
77 public void setServiceRole(String serviceRole) {
78 this.serviceRole = serviceRole;
81 public Boolean isEcompGeneratedNaming() {
82 return ecompGeneratedNaming;
85 public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
86 this.ecompGeneratedNaming = ecompGeneratedNaming;
89 public String getNamingPolicy() {
93 public void setNamingPolicy(String namingPolicy) {
94 this.namingPolicy = namingPolicy;
97 public String getEnvironmentContext() {
98 return environmentContext;
101 public void setEnvironmentContext(String environmentContext) {
102 this.environmentContext = environmentContext;
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 + '\''
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());
133 public boolean equals(Object obj) {
140 if (!(obj instanceof ComponentMetadataDataDefinition)) {
143 if (!super.equals(obj)) {
146 if (getClass() != obj.getClass()) {
149 ServiceMetadataDataDefinition other = (ServiceMetadataDataDefinition) obj;
150 if (distributionStatus == null) {
151 if (other.distributionStatus != null) {
154 } else if (!distributionStatus.equals(other.distributionStatus)) {
157 if (ecompGeneratedNaming == null) {
158 if (other.ecompGeneratedNaming != null) {
161 } else if (!ecompGeneratedNaming.equals(other.ecompGeneratedNaming)) {
164 if (namingPolicy == null) {
165 if (other.namingPolicy != null) {
168 } else if (!namingPolicy.equals(other.namingPolicy)) {
171 if (serviceType == null) {
172 if (other.serviceType != null) {
175 } else if (!serviceType.equals(other.serviceType)) {
178 if (serviceRole == null) {
179 if (other.serviceRole != null) {
182 } else if (!serviceRole.equals(other.serviceRole)) {
185 if (environmentContext == null) {
186 if (other.environmentContext != null) {
189 } else if (!environmentContext.equals(other.environmentContext)) {
192 if (instantiationType == null) {
193 if (other.instantiationType != null) {
196 } else if (!instantiationType.equals(other.instantiationType)) {
199 return super.equals(obj);
203 public String getActualComponentType() {
205 return componentType != null ? componentType.getValue() : "";