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 import java.io.Serializable;
24 import java.util.ArrayList;
25 import java.util.HashMap;
26 import java.util.LinkedList;
27 import java.util.List;
30 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
31 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
35 public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition implements Serializable {
40 private static final long serialVersionUID = -9114770126086263552L;
41 private static final Logger log = LoggerFactory.getLogger(ComponentMetadataDataDefinition.class.getName());
43 private String uniqueId;
45 private String name; // archiveName
47 private String version; // archiveVersion
49 private Boolean isHighestVersion;
51 private Long creationDate;
53 private Long lastUpdateDate;
55 private String description;
59 private List<String> tags;
61 private String conformanceLevel;
67 private String normalizedName;
69 private String systemName;
71 private String contactId;
73 private Map<String, String> allVersions;
75 private Boolean isDeleted;
77 private String projectCode;
79 private String csarUUID;
81 private String csarVersion;
83 private String importedToscaChecksum;
85 private String invariantUUID;
87 protected ComponentTypeEnum componentType;
90 private String creatorUserId;
92 private String creatorFullName;
94 private String lastUpdaterUserId;
96 private String lastUpdaterFullName;
98 public Boolean getIsHighestVersion() {
99 return isHighestVersion;
102 public void setIsHighestVersion(Boolean isHighestVersion) {
103 this.isHighestVersion = isHighestVersion;
106 public ComponentTypeEnum getComponentType() {
107 return componentType;
110 public void setComponentType(ComponentTypeEnum componentType) {
111 this.componentType = componentType;
114 public String getCreatorUserId() {
115 return creatorUserId;
118 public void setCreatorUserId(String creatorUserId) {
119 this.creatorUserId = creatorUserId;
122 public String getCreatorFullName() {
123 return creatorFullName;
126 public void setCreatorFullName(String creatorFullName) {
127 this.creatorFullName = creatorFullName;
130 public String getLastUpdaterUserId() {
131 return lastUpdaterUserId;
134 public void setLastUpdaterUserId(String lastUpdaterUserId) {
135 this.lastUpdaterUserId = lastUpdaterUserId;
138 public String getLastUpdaterFullName() {
139 return lastUpdaterFullName;
142 public void setLastUpdaterFullName(String lastUpdaterFullName) {
143 this.lastUpdaterFullName = lastUpdaterFullName;
146 public Boolean getIsDeleted() {
150 public ComponentMetadataDataDefinition() {
154 public ComponentMetadataDataDefinition(ComponentMetadataDataDefinition other) {
155 this.uniqueId = other.getUniqueId();
156 this.name = other.getName();
157 this.version = other.getVersion();
158 this.isHighestVersion = other.isHighestVersion();
159 this.creationDate = other.getCreationDate();
160 this.lastUpdateDate = other.getLastUpdateDate();
161 this.description = other.getDescription();
162 this.state = other.getState();
163 this.tags = new ArrayList<>(other.getTags() != null ? other.getTags() : new LinkedList<>());
164 this.icon = other.getIcon();
165 this.contactId = other.getContactId();
166 this.UUID = other.getUUID();
167 this.normalizedName = other.getNormalizedName();
168 this.systemName = other.getSystemName();
169 this.allVersions = new HashMap<>(other.getAllVersions() != null ? other.getAllVersions() : new HashMap<>());
170 this.isDeleted = other.isDeleted();
171 this.projectCode = other.getProjectCode();
172 this.csarUUID = other.getCsarUUID();
173 this.csarVersion = other.csarVersion;
174 this.importedToscaChecksum = other.getImportedToscaChecksum();
175 this.invariantUUID = other.getInvariantUUID();
179 public String getUniqueId() {
183 public void setUniqueId(String uniqueId) {
184 if ( this.uniqueId != null && !this.uniqueId.equals( uniqueId ) )
185 log.warn("uniqueId changed more then once -> OLD : {} , NEW: {} ", this.uniqueId ,uniqueId );
186 this.uniqueId = uniqueId;
189 public String getName() {
193 public void setName(String name) {
197 public String getVersion() {
201 public void setVersion(String version) {
202 this.version = version;
205 public Boolean isHighestVersion() {
206 return isHighestVersion;
209 public void setHighestVersion(Boolean isHighestVersion) {
210 this.isHighestVersion = isHighestVersion;
213 public Long getCreationDate() {
217 public void setCreationDate(Long creationDate) {
218 this.creationDate = creationDate;
221 public Long getLastUpdateDate() {
222 return lastUpdateDate;
225 public void setLastUpdateDate(Long lastUpdateDate) {
226 this.lastUpdateDate = lastUpdateDate;
229 public String getDescription() {
233 public void setDescription(String description) {
234 this.description = description;
237 public String getState() {
241 public void setState(String state) {
245 public List<String> getTags() {
249 public void setTags(List<String> tags) {
253 public String getIcon() {
257 public void setIcon(String icon) {
261 public String getContactId() {
265 public void setContactId(String contactId) {
266 this.contactId = contactId;
269 public String getUUID() {
273 public void setUUID(String UUID) {
274 if ( this.UUID != null && !this.UUID.equals( UUID ) )
275 log.warn("UUID changed more then once -> OLD : {} , NEW: {} ", this.UUID, UUID );
279 public String getNormalizedName() {
280 return normalizedName;
283 public void setNormalizedName(String normalizedName) {
284 this.normalizedName = normalizedName;
287 public String getSystemName() {
291 public void setSystemName(String systemName) {
292 this.systemName = systemName;
295 public Map<String, String> getAllVersions() {
299 public void setAllVersions(Map<String, String> allVersions) {
300 this.allVersions = allVersions;
303 public String getInvariantUUID() {
304 return invariantUUID;
307 public void setInvariantUUID(String invariantUUID) {
308 if ( this.invariantUUID != null && !this.invariantUUID.equals( invariantUUID ) )
309 log.warn("InvariantUUID changed more then once -> OLD : {} , NEW: {} ", this.invariantUUID ,invariantUUID );
310 this.invariantUUID = invariantUUID;
313 public Boolean isDeleted() {
317 public void setIsDeleted(Boolean isDeleted) {
318 this.isDeleted = isDeleted;
321 public String getProjectCode() {
325 public void setProjectCode(String projectCode) {
326 this.projectCode = projectCode;
329 public String getCsarUUID() {
333 public void setCsarUUID(String csarUUID) {
334 this.csarUUID = csarUUID;
337 public String getCsarVersion() {
341 public void setCsarVersion(String csarVersion) {
342 this.csarVersion = csarVersion;
345 public String getImportedToscaChecksum() {
346 return importedToscaChecksum;
349 public void setImportedToscaChecksum(String importedToscaChecksum) {
350 this.importedToscaChecksum = importedToscaChecksum;
353 public String getConformanceLevel() {
354 return conformanceLevel;
357 public void setConformanceLevel(String conformanceLevel) {
358 this.conformanceLevel = conformanceLevel;
361 public String getLifecycleState() {
365 public void setLifecycleState(String state) {
370 public String toString() {
371 return "ComponentMetadataDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", version=" + version
372 + ", isHighestVersion=" + isHighestVersion + ", creationDate=" + creationDate + ", lastUpdateDate="
373 + lastUpdateDate + ", description=" + description + ", state=" + state + ", tags=" + tags
374 + ", conformanceLevel=" + conformanceLevel + ", icon=" + icon + ", UUID=" + UUID + ", normalizedName="
375 + normalizedName + ", systemName=" + systemName + ", contactId=" + contactId + ", allVersions="
376 + allVersions + ", isDeleted=" + isDeleted + ", projectCode=" + projectCode + ", csarUUID=" + csarUUID
377 + ", csarVersion=" + csarVersion + ", importedToscaChecksum=" + importedToscaChecksum
378 + ", invariantUUID=" + invariantUUID + ", componentType=" + componentType + ", creatorUserId="
379 + creatorUserId + ", creatorFullName=" + creatorFullName + ", lastUpdaterUserId=" + lastUpdaterUserId
380 + ", lastUpdaterFullName=" + lastUpdaterFullName + "]";
384 public int hashCode() {
385 final int prime = 31;
387 result = prime * result + ((UUID == null) ? 0 : UUID.hashCode());
388 result = prime * result + ((allVersions == null) ? 0 : allVersions.hashCode());
389 result = prime * result + ((componentType == null) ? 0 : componentType.hashCode());
390 result = prime * result + ((conformanceLevel == null) ? 0 : conformanceLevel.hashCode());
391 result = prime * result + ((contactId == null) ? 0 : contactId.hashCode());
392 result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode());
393 result = prime * result + ((creatorFullName == null) ? 0 : creatorFullName.hashCode());
394 result = prime * result + ((creatorUserId == null) ? 0 : creatorUserId.hashCode());
395 result = prime * result + ((csarUUID == null) ? 0 : csarUUID.hashCode());
396 result = prime * result + ((csarVersion == null) ? 0 : csarVersion.hashCode());
397 result = prime * result + ((description == null) ? 0 : description.hashCode());
398 result = prime * result + ((icon == null) ? 0 : icon.hashCode());
399 result = prime * result + ((importedToscaChecksum == null) ? 0 : importedToscaChecksum.hashCode());
400 result = prime * result + ((invariantUUID == null) ? 0 : invariantUUID.hashCode());
401 result = prime * result + ((isDeleted == null) ? 0 : isDeleted.hashCode());
402 result = prime * result + ((isHighestVersion == null) ? 0 : isHighestVersion.hashCode());
403 result = prime * result + ((lastUpdateDate == null) ? 0 : lastUpdateDate.hashCode());
404 result = prime * result + ((lastUpdaterFullName == null) ? 0 : lastUpdaterFullName.hashCode());
405 result = prime * result + ((lastUpdaterUserId == null) ? 0 : lastUpdaterUserId.hashCode());
406 result = prime * result + ((name == null) ? 0 : name.hashCode());
407 result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode());
408 result = prime * result + ((projectCode == null) ? 0 : projectCode.hashCode());
409 result = prime * result + ((state == null) ? 0 : state.hashCode());
410 result = prime * result + ((systemName == null) ? 0 : systemName.hashCode());
411 result = prime * result + ((tags == null) ? 0 : tags.hashCode());
412 result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
413 result = prime * result + ((version == null) ? 0 : version.hashCode());
418 public boolean equals(Object obj) {
423 if (getClass() != obj.getClass())
425 ComponentMetadataDataDefinition other = (ComponentMetadataDataDefinition) obj;
427 if (other.UUID != null)
429 } else if (!UUID.equals(other.UUID))
431 if (allVersions == null) {
432 if (other.allVersions != null)
434 } else if (!allVersions.equals(other.allVersions))
436 if (componentType != other.componentType)
438 if (conformanceLevel == null) {
439 if (other.conformanceLevel != null)
441 } else if (!conformanceLevel.equals(other.conformanceLevel))
443 if (contactId == null) {
444 if (other.contactId != null)
446 } else if (!contactId.equals(other.contactId))
448 if (creationDate == null) {
449 if (other.creationDate != null)
451 } else if (!creationDate.equals(other.creationDate))
453 if (creatorFullName == null) {
454 if (other.creatorFullName != null)
456 } else if (!creatorFullName.equals(other.creatorFullName))
458 if (creatorUserId == null) {
459 if (other.creatorUserId != null)
461 } else if (!creatorUserId.equals(other.creatorUserId))
463 if (csarUUID == null) {
464 if (other.csarUUID != null)
466 } else if (!csarUUID.equals(other.csarUUID))
468 if (csarVersion == null) {
469 if (other.csarVersion != null)
471 } else if (!csarVersion.equals(other.csarVersion))
473 if (description == null) {
474 if (other.description != null)
476 } else if (!description.equals(other.description))
479 if (other.icon != null)
481 } else if (!icon.equals(other.icon))
483 if (importedToscaChecksum == null) {
484 if (other.importedToscaChecksum != null)
486 } else if (!importedToscaChecksum.equals(other.importedToscaChecksum))
488 if (invariantUUID == null) {
489 if (other.invariantUUID != null)
491 } else if (!invariantUUID.equals(other.invariantUUID))
493 if (isDeleted == null) {
494 if (other.isDeleted != null)
496 } else if (!isDeleted.equals(other.isDeleted))
498 if (isHighestVersion == null) {
499 if (other.isHighestVersion != null)
501 } else if (!isHighestVersion.equals(other.isHighestVersion))
503 if (lastUpdateDate == null) {
504 if (other.lastUpdateDate != null)
506 } else if (!lastUpdateDate.equals(other.lastUpdateDate))
508 if (lastUpdaterFullName == null) {
509 if (other.lastUpdaterFullName != null)
511 } else if (!lastUpdaterFullName.equals(other.lastUpdaterFullName))
513 if (lastUpdaterUserId == null) {
514 if (other.lastUpdaterUserId != null)
516 } else if (!lastUpdaterUserId.equals(other.lastUpdaterUserId))
519 if (other.name != null)
521 } else if (!name.equals(other.name))
523 if (normalizedName == null) {
524 if (other.normalizedName != null)
526 } else if (!normalizedName.equals(other.normalizedName))
528 if (projectCode == null) {
529 if (other.projectCode != null)
531 } else if (!projectCode.equals(other.projectCode))
534 if (other.state != null)
536 } else if (!state.equals(other.state))
538 if (systemName == null) {
539 if (other.systemName != null)
541 } else if (!systemName.equals(other.systemName))
544 if (other.tags != null)
546 } else if (!tags.equals(other.tags))
548 if (uniqueId == null) {
549 if (other.uniqueId != null)
551 } else if (!uniqueId.equals(other.uniqueId))
553 if (version == null) {
554 if (other.version != null)
556 } else if (!version.equals(other.version))
562 * Return the type of the actual component - e.g. for a Resource, return the actual VF/CR
565 public abstract String getActualComponentType();