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 org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
24 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
25 import org.openecomp.sdc.common.log.wrappers.Logger;
29 public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition {
31 private static final Logger log = Logger.getLogger(ComponentMetadataDataDefinition.class.getName());
33 private String uniqueId;
35 private String name; // archiveName
37 private String version; // archiveVersion
39 private Boolean isHighestVersion;
41 private Long creationDate;
43 private Long lastUpdateDate;
45 private String description;
49 private List<String> tags;
51 private String conformanceLevel;
57 private String normalizedName;
59 private String systemName;
61 private String contactId;
63 private Map<String, String> allVersions;
65 private Boolean isDeleted;
67 private String projectCode;
69 private String csarUUID;
71 private String csarVersion;
73 private String importedToscaChecksum;
75 private String invariantUUID;
77 protected ComponentTypeEnum componentType;
80 private String creatorUserId;
82 private String creatorFullName;
84 private String lastUpdaterUserId;
86 private String lastUpdaterFullName;
89 private Boolean isArchived = false;
91 private Long archiveTime;
93 private Boolean isVspArchived = false;
95 public Boolean getIsHighestVersion() {
96 return isHighestVersion;
99 public void setIsHighestVersion(Boolean isHighestVersion) {
100 this.isHighestVersion = isHighestVersion;
103 public ComponentTypeEnum getComponentType() {
104 return componentType;
107 public void setComponentType(ComponentTypeEnum componentType) {
108 this.componentType = componentType;
111 public String getCreatorUserId() {
112 return creatorUserId;
115 public void setCreatorUserId(String creatorUserId) {
116 this.creatorUserId = creatorUserId;
119 public String getCreatorFullName() {
120 return creatorFullName;
123 public void setCreatorFullName(String creatorFullName) {
124 this.creatorFullName = creatorFullName;
127 public String getLastUpdaterUserId() {
128 return lastUpdaterUserId;
131 public void setLastUpdaterUserId(String lastUpdaterUserId) {
132 this.lastUpdaterUserId = lastUpdaterUserId;
135 public String getLastUpdaterFullName() {
136 return lastUpdaterFullName;
139 public void setLastUpdaterFullName(String lastUpdaterFullName) {
140 this.lastUpdaterFullName = lastUpdaterFullName;
143 public Boolean getIsDeleted() {
147 public Boolean isArchived() { return isArchived; }
149 public void setArchived(Boolean archived) { isArchived = archived; }
151 public Long getArchiveTime() { return archiveTime; }
153 public void setArchiveTime(Long archiveTime) { this.archiveTime = archiveTime; }
155 public Boolean isVspArchived() { return isVspArchived; }
157 public void setVspArchived(Boolean vspArchived) { isVspArchived = vspArchived; }
159 public ComponentMetadataDataDefinition() {
163 public ComponentMetadataDataDefinition(ComponentMetadataDataDefinition other) {
164 this.uniqueId = other.getUniqueId();
165 this.name = other.getName();
166 this.version = other.getVersion();
167 this.isHighestVersion = other.isHighestVersion();
168 this.creationDate = other.getCreationDate();
169 this.lastUpdateDate = other.getLastUpdateDate();
170 this.description = other.getDescription();
171 this.state = other.getState();
172 this.tags = new ArrayList<>(other.getTags() != null ? other.getTags() : new LinkedList<>());
173 this.icon = other.getIcon();
174 this.contactId = other.getContactId();
175 this.UUID = other.getUUID();
176 this.normalizedName = other.getNormalizedName();
177 this.systemName = other.getSystemName();
178 this.allVersions = new HashMap<>(other.getAllVersions() != null ? other.getAllVersions() : new HashMap<>());
179 this.isDeleted = other.isDeleted();
180 this.projectCode = other.getProjectCode();
181 this.csarUUID = other.getCsarUUID();
182 this.csarVersion = other.csarVersion;
183 this.importedToscaChecksum = other.getImportedToscaChecksum();
184 this.invariantUUID = other.getInvariantUUID();
185 this.isArchived = other.isArchived;
186 this.isVspArchived = other.isVspArchived;
187 this.archiveTime = other.getArchiveTime();
190 public String getUniqueId() {
194 public void setUniqueId(String uniqueId) {
195 if ( this.uniqueId != null && !this.uniqueId.equals( uniqueId ) )
196 log.warn("uniqueId changed more then once -> OLD : {} , NEW: {} ", this.uniqueId ,uniqueId );
197 this.uniqueId = uniqueId;
200 public String getName() {
204 public void setName(String name) {
208 public String getVersion() {
212 public void setVersion(String version) {
213 this.version = version;
216 public Boolean isHighestVersion() {
217 return isHighestVersion;
220 public void setHighestVersion(Boolean isHighestVersion) {
221 this.isHighestVersion = isHighestVersion;
224 public Long getCreationDate() {
228 public void setCreationDate(Long creationDate) {
229 this.creationDate = creationDate;
232 public Long getLastUpdateDate() {
233 return lastUpdateDate;
236 public void setLastUpdateDate(Long lastUpdateDate) {
237 this.lastUpdateDate = lastUpdateDate;
240 public String getDescription() {
244 public void setDescription(String description) {
245 this.description = description;
248 public String getState() {
252 public void setState(String state) {
256 public List<String> getTags() {
260 public void setTags(List<String> tags) {
264 public String getIcon() {
268 public void setIcon(String icon) {
272 public String getContactId() {
276 public void setContactId(String contactId) {
277 this.contactId = contactId;
280 public String getUUID() {
284 public void setUUID(String UUID) {
285 if ( this.UUID != null && !this.UUID.equals( UUID ) )
286 log.warn("UUID changed more then once -> OLD : {} , NEW: {} ", this.UUID, UUID );
290 public String getNormalizedName() {
291 return normalizedName;
294 public void setNormalizedName(String normalizedName) {
295 this.normalizedName = normalizedName;
298 public String getSystemName() {
302 public void setSystemName(String systemName) {
303 this.systemName = systemName;
306 public Map<String, String> getAllVersions() {
310 public void setAllVersions(Map<String, String> allVersions) {
311 this.allVersions = allVersions;
314 public String getInvariantUUID() {
315 return invariantUUID;
318 public void setInvariantUUID(String invariantUUID) {
319 if ( this.invariantUUID != null && !this.invariantUUID.equals( invariantUUID ) )
320 log.warn("InvariantUUID changed more then once -> OLD : {} , NEW: {} ", this.invariantUUID ,invariantUUID );
321 this.invariantUUID = invariantUUID;
324 public Boolean isDeleted() {
328 public void setIsDeleted(Boolean isDeleted) {
329 this.isDeleted = isDeleted;
332 public String getProjectCode() {
336 public void setProjectCode(String projectCode) {
337 this.projectCode = projectCode;
340 public String getCsarUUID() {
344 public void setCsarUUID(String csarUUID) {
345 this.csarUUID = csarUUID;
348 public String getCsarVersion() {
352 public void setCsarVersion(String csarVersion) {
353 this.csarVersion = csarVersion;
356 public String getImportedToscaChecksum() {
357 return importedToscaChecksum;
360 public void setImportedToscaChecksum(String importedToscaChecksum) {
361 this.importedToscaChecksum = importedToscaChecksum;
364 public String getConformanceLevel() {
365 return conformanceLevel;
368 public void setConformanceLevel(String conformanceLevel) {
369 this.conformanceLevel = conformanceLevel;
372 public String getLifecycleState() {
376 public void setLifecycleState(String state) {
381 public String toString() {
382 return "ComponentMetadataDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", version=" + version
383 + ", isHighestVersion=" + isHighestVersion + ", creationDate=" + creationDate + ", lastUpdateDate="
384 + lastUpdateDate + ", description=" + description + ", state=" + state + ", tags=" + tags
385 + ", conformanceLevel=" + conformanceLevel + ", icon=" + icon + ", UUID=" + UUID + ", normalizedName="
386 + normalizedName + ", systemName=" + systemName + ", contactId=" + contactId + ", allVersions="
387 + allVersions + ", isDeleted=" + isDeleted + ", projectCode=" + projectCode + ", csarUUID=" + csarUUID
388 + ", csarVersion=" + csarVersion + ", importedToscaChecksum=" + importedToscaChecksum
389 + ", invariantUUID=" + invariantUUID + ", componentType=" + componentType + ", creatorUserId="
390 + creatorUserId + ", creatorFullName=" + creatorFullName + ", lastUpdaterUserId=" + lastUpdaterUserId
391 + ", lastUpdaterFullName=" + lastUpdaterFullName + "]";
395 public int hashCode() {
396 final int prime = 31;
398 result = prime * result + ((UUID == null) ? 0 : UUID.hashCode());
399 result = prime * result + ((allVersions == null) ? 0 : allVersions.hashCode());
400 result = prime * result + ((componentType == null) ? 0 : componentType.hashCode());
401 result = prime * result + ((conformanceLevel == null) ? 0 : conformanceLevel.hashCode());
402 result = prime * result + ((contactId == null) ? 0 : contactId.hashCode());
403 result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode());
404 result = prime * result + ((creatorFullName == null) ? 0 : creatorFullName.hashCode());
405 result = prime * result + ((creatorUserId == null) ? 0 : creatorUserId.hashCode());
406 result = prime * result + ((csarUUID == null) ? 0 : csarUUID.hashCode());
407 result = prime * result + ((csarVersion == null) ? 0 : csarVersion.hashCode());
408 result = prime * result + ((description == null) ? 0 : description.hashCode());
409 result = prime * result + ((icon == null) ? 0 : icon.hashCode());
410 result = prime * result + ((importedToscaChecksum == null) ? 0 : importedToscaChecksum.hashCode());
411 result = prime * result + ((invariantUUID == null) ? 0 : invariantUUID.hashCode());
412 result = prime * result + ((isDeleted == null) ? 0 : isDeleted.hashCode());
413 result = prime * result + ((isHighestVersion == null) ? 0 : isHighestVersion.hashCode());
414 result = prime * result + ((lastUpdateDate == null) ? 0 : lastUpdateDate.hashCode());
415 result = prime * result + ((lastUpdaterFullName == null) ? 0 : lastUpdaterFullName.hashCode());
416 result = prime * result + ((lastUpdaterUserId == null) ? 0 : lastUpdaterUserId.hashCode());
417 result = prime * result + ((name == null) ? 0 : name.hashCode());
418 result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode());
419 result = prime * result + ((projectCode == null) ? 0 : projectCode.hashCode());
420 result = prime * result + ((state == null) ? 0 : state.hashCode());
421 result = prime * result + ((systemName == null) ? 0 : systemName.hashCode());
422 result = prime * result + ((tags == null) ? 0 : tags.hashCode());
423 result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
424 result = prime * result + ((version == null) ? 0 : version.hashCode());
429 public boolean equals(Object obj) {
434 if (getClass() != obj.getClass())
436 ComponentMetadataDataDefinition other = (ComponentMetadataDataDefinition) obj;
438 if (other.UUID != null)
440 } else if (!UUID.equals(other.UUID))
442 if (allVersions == null) {
443 if (other.allVersions != null)
445 } else if (!allVersions.equals(other.allVersions))
447 if (componentType != other.componentType)
449 if (conformanceLevel == null) {
450 if (other.conformanceLevel != null)
452 } else if (!conformanceLevel.equals(other.conformanceLevel))
454 if (contactId == null) {
455 if (other.contactId != null)
457 } else if (!contactId.equals(other.contactId))
459 if (creationDate == null) {
460 if (other.creationDate != null)
462 } else if (!creationDate.equals(other.creationDate))
464 if (creatorFullName == null) {
465 if (other.creatorFullName != null)
467 } else if (!creatorFullName.equals(other.creatorFullName))
469 if (creatorUserId == null) {
470 if (other.creatorUserId != null)
472 } else if (!creatorUserId.equals(other.creatorUserId))
474 if (csarUUID == null) {
475 if (other.csarUUID != null)
477 } else if (!csarUUID.equals(other.csarUUID))
479 if (csarVersion == null) {
480 if (other.csarVersion != null)
482 } else if (!csarVersion.equals(other.csarVersion))
484 if (description == null) {
485 if (other.description != null)
487 } else if (!description.equals(other.description))
490 if (other.icon != null)
492 } else if (!icon.equals(other.icon))
494 if (importedToscaChecksum == null) {
495 if (other.importedToscaChecksum != null)
497 } else if (!importedToscaChecksum.equals(other.importedToscaChecksum))
499 if (invariantUUID == null) {
500 if (other.invariantUUID != null)
502 } else if (!invariantUUID.equals(other.invariantUUID))
504 if (isDeleted == null) {
505 if (other.isDeleted != null)
507 } else if (!isDeleted.equals(other.isDeleted))
509 if (isHighestVersion == null) {
510 if (other.isHighestVersion != null)
512 } else if (!isHighestVersion.equals(other.isHighestVersion))
514 if (lastUpdateDate == null) {
515 if (other.lastUpdateDate != null)
517 } else if (!lastUpdateDate.equals(other.lastUpdateDate))
519 if (lastUpdaterFullName == null) {
520 if (other.lastUpdaterFullName != null)
522 } else if (!lastUpdaterFullName.equals(other.lastUpdaterFullName))
524 if (lastUpdaterUserId == null) {
525 if (other.lastUpdaterUserId != null)
527 } else if (!lastUpdaterUserId.equals(other.lastUpdaterUserId))
530 if (other.name != null)
532 } else if (!name.equals(other.name))
534 if (normalizedName == null) {
535 if (other.normalizedName != null)
537 } else if (!normalizedName.equals(other.normalizedName))
539 if (projectCode == null) {
540 if (other.projectCode != null)
542 } else if (!projectCode.equals(other.projectCode))
545 if (other.state != null)
547 } else if (!state.equals(other.state))
549 if (systemName == null) {
550 if (other.systemName != null)
552 } else if (!systemName.equals(other.systemName))
555 if (other.tags != null)
557 } else if (!tags.equals(other.tags))
559 if (uniqueId == null) {
560 if (other.uniqueId != null)
562 } else if (!uniqueId.equals(other.uniqueId))
564 if (version == null) {
565 if (other.version != null)
567 } else if (!version.equals(other.version))
573 * Return the type of the actual component - e.g. for a Resource, return the actual VF/CR
576 public abstract String getActualComponentType();