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.List;
29 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
30 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory;
34 public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition implements Serializable {
39 private static final long serialVersionUID = -9114770126086263552L;
40 private static final Logger log = LoggerFactory.getLogger(ComponentMetadataDataDefinition.class.getName());
42 private String uniqueId;
44 private String name; // archiveName
46 private String version; // archiveVersion
48 private Boolean isHighestVersion;
50 private Long creationDate;
52 private Long lastUpdateDate;
54 private String description;
58 private List<String> tags;
60 private String conformanceLevel;
66 private String normalizedName;
68 private String systemName;
70 private String contactId;
72 private Map<String, String> allVersions;
74 private Boolean isDeleted;
76 private String projectCode;
78 private String csarUUID;
80 private String csarVersion;
82 private String importedToscaChecksum;
84 private String invariantUUID;
86 protected ComponentTypeEnum componentType;
89 private String creatorUserId;
91 private String creatorFullName;
93 private String lastUpdaterUserId;
95 private String lastUpdaterFullName;
97 public Boolean getIsHighestVersion() {
98 return isHighestVersion;
101 public void setIsHighestVersion(Boolean isHighestVersion) {
102 this.isHighestVersion = isHighestVersion;
105 public ComponentTypeEnum getComponentType() {
106 return componentType;
109 public void setComponentType(ComponentTypeEnum componentType) {
110 this.componentType = componentType;
113 public String getCreatorUserId() {
114 return creatorUserId;
117 public void setCreatorUserId(String creatorUserId) {
118 this.creatorUserId = creatorUserId;
121 public String getCreatorFullName() {
122 return creatorFullName;
125 public void setCreatorFullName(String creatorFullName) {
126 this.creatorFullName = creatorFullName;
129 public String getLastUpdaterUserId() {
130 return lastUpdaterUserId;
133 public void setLastUpdaterUserId(String lastUpdaterUserId) {
134 this.lastUpdaterUserId = lastUpdaterUserId;
137 public String getLastUpdaterFullName() {
138 return lastUpdaterFullName;
141 public void setLastUpdaterFullName(String lastUpdaterFullName) {
142 this.lastUpdaterFullName = lastUpdaterFullName;
145 public Boolean getIsDeleted() {
149 public ComponentMetadataDataDefinition() {
153 public ComponentMetadataDataDefinition(ComponentMetadataDataDefinition other) {
154 this.uniqueId = other.getUniqueId();
155 this.name = other.getName();
156 this.version = other.getVersion();
157 this.isHighestVersion = other.isHighestVersion();
158 this.creationDate = other.getCreationDate();
159 this.lastUpdateDate = other.getLastUpdateDate();
160 this.description = other.getDescription();
161 this.state = other.getState();
162 this.tags = new ArrayList<>(other.getTags());
163 this.icon = other.getIcon();
164 this.contactId = other.getContactId();
165 this.UUID = other.getUUID();
166 this.normalizedName = other.getNormalizedName();
167 this.systemName = other.getSystemName();
168 this.allVersions = new HashMap<>(other.getAllVersions());
169 this.isDeleted = other.isDeleted();
170 this.projectCode = other.getProjectCode();
171 this.csarUUID = other.getCsarUUID();
172 this.csarVersion = other.csarVersion;
173 this.importedToscaChecksum = other.getImportedToscaChecksum();
174 this.invariantUUID = other.getInvariantUUID();
178 public String getUniqueId() {
182 public void setUniqueId(String uniqueId) {
183 if ( this.uniqueId != null && !this.uniqueId.equals( uniqueId ) )
184 log.warn("uniqueId changed more then once -> OLD : {} , NEW: {} ", this.uniqueId ,uniqueId );
185 this.uniqueId = uniqueId;
188 public String getName() {
192 public void setName(String name) {
196 public String getVersion() {
200 public void setVersion(String version) {
201 this.version = version;
204 public Boolean isHighestVersion() {
205 return isHighestVersion;
208 public void setHighestVersion(Boolean isHighestVersion) {
209 this.isHighestVersion = isHighestVersion;
212 public Long getCreationDate() {
216 public void setCreationDate(Long creationDate) {
217 this.creationDate = creationDate;
220 public Long getLastUpdateDate() {
221 return lastUpdateDate;
224 public void setLastUpdateDate(Long lastUpdateDate) {
225 this.lastUpdateDate = lastUpdateDate;
228 public String getDescription() {
232 public void setDescription(String description) {
233 this.description = description;
236 public String getState() {
240 public void setState(String state) {
244 public List<String> getTags() {
248 public void setTags(List<String> tags) {
252 public String getIcon() {
256 public void setIcon(String icon) {
260 public String getContactId() {
264 public void setContactId(String contactId) {
265 this.contactId = contactId;
268 public String getUUID() {
272 public void setUUID(String UUID) {
273 if ( this.UUID != null && !this.UUID.equals( UUID ) )
274 log.warn("UUID changed more then once -> OLD : {} , NEW: {} ", this.UUID, UUID );
278 public String getNormalizedName() {
279 return normalizedName;
282 public void setNormalizedName(String normalizedName) {
283 this.normalizedName = normalizedName;
286 public String getSystemName() {
290 public void setSystemName(String systemName) {
291 this.systemName = systemName;
294 public Map<String, String> getAllVersions() {
298 public void setAllVersions(Map<String, String> allVersions) {
299 this.allVersions = allVersions;
302 public String getInvariantUUID() {
303 return invariantUUID;
306 public void setInvariantUUID(String invariantUUID) {
307 if ( this.invariantUUID != null && !this.invariantUUID.equals( invariantUUID ) )
308 log.warn("InvariantUUID changed more then once -> OLD : {} , NEW: {} ", this.invariantUUID ,invariantUUID );
309 this.invariantUUID = invariantUUID;
312 public Boolean isDeleted() {
316 public void setIsDeleted(Boolean isDeleted) {
317 this.isDeleted = isDeleted;
320 public String getProjectCode() {
324 public void setProjectCode(String projectCode) {
325 this.projectCode = projectCode;
328 public String getCsarUUID() {
332 public void setCsarUUID(String csarUUID) {
333 this.csarUUID = csarUUID;
336 public String getCsarVersion() {
340 public void setCsarVersion(String csarVersion) {
341 this.csarVersion = csarVersion;
344 public String getImportedToscaChecksum() {
345 return importedToscaChecksum;
348 public void setImportedToscaChecksum(String importedToscaChecksum) {
349 this.importedToscaChecksum = importedToscaChecksum;
352 public String getConformanceLevel() {
353 return conformanceLevel;
356 public void setConformanceLevel(String conformanceLevel) {
357 this.conformanceLevel = conformanceLevel;
360 public String getLifecycleState() {
364 public void setLifecycleState(String state) {
369 public String toString() {
370 return "ComponentMetadataDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", version=" + version
371 + ", isHighestVersion=" + isHighestVersion + ", creationDate=" + creationDate + ", lastUpdateDate="
372 + lastUpdateDate + ", description=" + description + ", state=" + state + ", tags=" + tags
373 + ", conformanceLevel=" + conformanceLevel + ", icon=" + icon + ", UUID=" + UUID + ", normalizedName="
374 + normalizedName + ", systemName=" + systemName + ", contactId=" + contactId + ", allVersions="
375 + allVersions + ", isDeleted=" + isDeleted + ", projectCode=" + projectCode + ", csarUUID=" + csarUUID
376 + ", csarVersion=" + csarVersion + ", importedToscaChecksum=" + importedToscaChecksum
377 + ", invariantUUID=" + invariantUUID + ", componentType=" + componentType + ", creatorUserId="
378 + creatorUserId + ", creatorFullName=" + creatorFullName + ", lastUpdaterUserId=" + lastUpdaterUserId
379 + ", lastUpdaterFullName=" + lastUpdaterFullName + "]";
383 public int hashCode() {
384 final int prime = 31;
386 result = prime * result + ((UUID == null) ? 0 : UUID.hashCode());
387 result = prime * result + ((allVersions == null) ? 0 : allVersions.hashCode());
388 result = prime * result + ((componentType == null) ? 0 : componentType.hashCode());
389 result = prime * result + ((conformanceLevel == null) ? 0 : conformanceLevel.hashCode());
390 result = prime * result + ((contactId == null) ? 0 : contactId.hashCode());
391 result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode());
392 result = prime * result + ((creatorFullName == null) ? 0 : creatorFullName.hashCode());
393 result = prime * result + ((creatorUserId == null) ? 0 : creatorUserId.hashCode());
394 result = prime * result + ((csarUUID == null) ? 0 : csarUUID.hashCode());
395 result = prime * result + ((csarVersion == null) ? 0 : csarVersion.hashCode());
396 result = prime * result + ((description == null) ? 0 : description.hashCode());
397 result = prime * result + ((icon == null) ? 0 : icon.hashCode());
398 result = prime * result + ((importedToscaChecksum == null) ? 0 : importedToscaChecksum.hashCode());
399 result = prime * result + ((invariantUUID == null) ? 0 : invariantUUID.hashCode());
400 result = prime * result + ((isDeleted == null) ? 0 : isDeleted.hashCode());
401 result = prime * result + ((isHighestVersion == null) ? 0 : isHighestVersion.hashCode());
402 result = prime * result + ((lastUpdateDate == null) ? 0 : lastUpdateDate.hashCode());
403 result = prime * result + ((lastUpdaterFullName == null) ? 0 : lastUpdaterFullName.hashCode());
404 result = prime * result + ((lastUpdaterUserId == null) ? 0 : lastUpdaterUserId.hashCode());
405 result = prime * result + ((name == null) ? 0 : name.hashCode());
406 result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode());
407 result = prime * result + ((projectCode == null) ? 0 : projectCode.hashCode());
408 result = prime * result + ((state == null) ? 0 : state.hashCode());
409 result = prime * result + ((systemName == null) ? 0 : systemName.hashCode());
410 result = prime * result + ((tags == null) ? 0 : tags.hashCode());
411 result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
412 result = prime * result + ((version == null) ? 0 : version.hashCode());
417 public boolean equals(Object obj) {
422 if (getClass() != obj.getClass())
424 ComponentMetadataDataDefinition other = (ComponentMetadataDataDefinition) obj;
426 if (other.UUID != null)
428 } else if (!UUID.equals(other.UUID))
430 if (allVersions == null) {
431 if (other.allVersions != null)
433 } else if (!allVersions.equals(other.allVersions))
435 if (componentType != other.componentType)
437 if (conformanceLevel == null) {
438 if (other.conformanceLevel != null)
440 } else if (!conformanceLevel.equals(other.conformanceLevel))
442 if (contactId == null) {
443 if (other.contactId != null)
445 } else if (!contactId.equals(other.contactId))
447 if (creationDate == null) {
448 if (other.creationDate != null)
450 } else if (!creationDate.equals(other.creationDate))
452 if (creatorFullName == null) {
453 if (other.creatorFullName != null)
455 } else if (!creatorFullName.equals(other.creatorFullName))
457 if (creatorUserId == null) {
458 if (other.creatorUserId != null)
460 } else if (!creatorUserId.equals(other.creatorUserId))
462 if (csarUUID == null) {
463 if (other.csarUUID != null)
465 } else if (!csarUUID.equals(other.csarUUID))
467 if (csarVersion == null) {
468 if (other.csarVersion != null)
470 } else if (!csarVersion.equals(other.csarVersion))
472 if (description == null) {
473 if (other.description != null)
475 } else if (!description.equals(other.description))
478 if (other.icon != null)
480 } else if (!icon.equals(other.icon))
482 if (importedToscaChecksum == null) {
483 if (other.importedToscaChecksum != null)
485 } else if (!importedToscaChecksum.equals(other.importedToscaChecksum))
487 if (invariantUUID == null) {
488 if (other.invariantUUID != null)
490 } else if (!invariantUUID.equals(other.invariantUUID))
492 if (isDeleted == null) {
493 if (other.isDeleted != null)
495 } else if (!isDeleted.equals(other.isDeleted))
497 if (isHighestVersion == null) {
498 if (other.isHighestVersion != null)
500 } else if (!isHighestVersion.equals(other.isHighestVersion))
502 if (lastUpdateDate == null) {
503 if (other.lastUpdateDate != null)
505 } else if (!lastUpdateDate.equals(other.lastUpdateDate))
507 if (lastUpdaterFullName == null) {
508 if (other.lastUpdaterFullName != null)
510 } else if (!lastUpdaterFullName.equals(other.lastUpdaterFullName))
512 if (lastUpdaterUserId == null) {
513 if (other.lastUpdaterUserId != null)
515 } else if (!lastUpdaterUserId.equals(other.lastUpdaterUserId))
518 if (other.name != null)
520 } else if (!name.equals(other.name))
522 if (normalizedName == null) {
523 if (other.normalizedName != null)
525 } else if (!normalizedName.equals(other.normalizedName))
527 if (projectCode == null) {
528 if (other.projectCode != null)
530 } else if (!projectCode.equals(other.projectCode))
533 if (other.state != null)
535 } else if (!state.equals(other.state))
537 if (systemName == null) {
538 if (other.systemName != null)
540 } else if (!systemName.equals(other.systemName))
543 if (other.tags != null)
545 } else if (!tags.equals(other.tags))
547 if (uniqueId == null) {
548 if (other.uniqueId != null)
550 } else if (!uniqueId.equals(other.uniqueId))
552 if (version == null) {
553 if (other.version != null)
555 } else if (!version.equals(other.version))
561 * Return the type of the actual component - e.g. for a Resource, return the actual VF/CR
564 public abstract String getActualComponentType();