summaryrefslogtreecommitdiffstats
path: root/common-be/src/main/java/org
diff options
context:
space:
mode:
authorshrek2000 <oren.kleks@amdocs.com>2020-02-05 15:59:23 +0200
committerOren Kleks <oren.kleks@amdocs.com>2020-02-06 11:15:23 +0000
commitf0178710c8a578fcdc46379d44ccdaaf193ae23e (patch)
tree35a0ac79b668668f3ca40dc01af8a5c0759d6e8a /common-be/src/main/java/org
parent723992503b98f84da5aec904a384ade6d76a89f4 (diff)
Increase code coverage1.6.21.6.1
Moving to lombok. ComponentMetadataDataDefinition did not use lombok. The Equal, hashCode and toString functions were too completed to maintain. Issue-ID: SDC-2690 Change-Id: Ie83b6754579d2776cd0222d61ad4eb9be9e35e6c Signed-off-by: shrek2000 <oren.kleks@amdocs.com>
Diffstat (limited to 'common-be/src/main/java/org')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java658
1 files changed, 114 insertions, 544 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java
index 4feb026fd6..e1d0d96d9a 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java
@@ -20,168 +20,123 @@
package org.openecomp.sdc.be.datatypes.components;
-import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.common.log.wrappers.Logger;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import org.openecomp.sdc.common.log.wrappers.Logger;
+@NoArgsConstructor
+@EqualsAndHashCode
+@ToString
public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition {
private static final Logger LOGGER = Logger.getLogger(ComponentMetadataDataDefinition.class.getName());
+ @Getter
private String uniqueId;
-
+ @Getter
+ @Setter
private String name; // archiveName
-
+ @Getter
+ @Setter
private String version; // archiveVersion
-
- private Boolean isHighestVersion;
-
+ @Getter
+ @Setter
+ private Boolean highestVersion;
+ @Getter
+ @Setter
private Long creationDate;
-
+ @Getter
+ @Setter
private Long lastUpdateDate;
-
+ @Getter
+ @Setter
private String description;
-
+ @Getter
+ @Setter
private String state;
-
+ @Getter
+ @Setter
private List<String> tags;
-
+ @Getter
+ @Setter
private String conformanceLevel;
-
+ @Getter
+ @Setter
private String icon;
-
+ @Getter
private String UUID;
-
+ @Getter
+ @Setter
private String normalizedName;
-
+ @Getter
+ @Setter
private String systemName;
-
+ @Getter
+ @Setter
private String contactId;
-
+ @Getter
+ @Setter
private Map<String, String> allVersions;
-
+ @Getter
+ @Setter
private Boolean isDeleted;
-
+ @Getter
+ @Setter
private String projectCode;
-
+ @Getter
+ @Setter
private String csarUUID;
-
+ @Getter
+ @Setter
private String csarVersion;
-
+ @Getter
+ @Setter
private String importedToscaChecksum;
-
+ @Getter
private String invariantUUID;
-
+ @Getter
+ @Setter
protected ComponentTypeEnum componentType;
-
// USER
+ @Getter
+ @Setter
private String creatorUserId;
-
+ @Getter
+ @Setter
private String creatorFullName;
-
+ @Getter
+ @Setter
private String lastUpdaterUserId;
-
+ @Getter
+ @Setter
private String lastUpdaterFullName;
-
//Archive/Restore
+ @Getter
+ @Setter
private Boolean isArchived = false;
-
+ @Getter
+ @Setter
private Long archiveTime;
-
+ @Getter
+ @Setter
private Boolean isVspArchived = false;
- public Boolean getIsHighestVersion() {
- return isHighestVersion;
- }
-
- public void setIsHighestVersion(Boolean isHighestVersion) {
- this.isHighestVersion = isHighestVersion;
- }
-
- public ComponentTypeEnum getComponentType() {
- return componentType;
- }
-
- public void setComponentType(ComponentTypeEnum componentType) {
- this.componentType = componentType;
- }
-
- public String getCreatorUserId() {
- return creatorUserId;
- }
-
- public void setCreatorUserId(String creatorUserId) {
- this.creatorUserId = creatorUserId;
- }
-
- public String getCreatorFullName() {
- return creatorFullName;
- }
-
- public void setCreatorFullName(String creatorFullName) {
- this.creatorFullName = creatorFullName;
- }
-
- public String getLastUpdaterUserId() {
- return lastUpdaterUserId;
- }
-
- public void setLastUpdaterUserId(String lastUpdaterUserId) {
- this.lastUpdaterUserId = lastUpdaterUserId;
- }
-
- public String getLastUpdaterFullName() {
- return lastUpdaterFullName;
- }
-
- public void setLastUpdaterFullName(String lastUpdaterFullName) {
- this.lastUpdaterFullName = lastUpdaterFullName;
- }
-
- public Boolean getIsDeleted() {
- return isDeleted;
- }
-
- public Boolean isArchived() {
- return isArchived;
- }
-
- public void setArchived(Boolean archived) {
- isArchived = archived;
- }
-
- public Long getArchiveTime() {
- return archiveTime;
- }
-
- public void setArchiveTime(Long archiveTime) {
- this.archiveTime = archiveTime;
- }
-
- public Boolean isVspArchived() {
- return isVspArchived;
- }
-
- public void setVspArchived(Boolean vspArchived) {
- isVspArchived = vspArchived;
- }
-
- public ComponentMetadataDataDefinition() {
-
- }
-
public ComponentMetadataDataDefinition(ComponentMetadataDataDefinition other) {
this.uniqueId = other.getUniqueId();
this.name = other.getName();
this.version = other.getVersion();
- this.isHighestVersion = other.isHighestVersion();
+ this.highestVersion = other.isHighestVersion();
this.creationDate = other.getCreationDate();
this.lastUpdateDate = other.getLastUpdateDate();
this.description = other.getDescription();
@@ -193,7 +148,7 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
this.normalizedName = other.getNormalizedName();
this.systemName = other.getSystemName();
this.allVersions = new HashMap<>(other.getAllVersions() != null ? other.getAllVersions() : new HashMap<>());
- this.isDeleted = other.isDeleted();
+ this.isDeleted = other.getIsDeleted();
this.projectCode = other.getProjectCode();
this.csarUUID = other.getCsarUUID();
this.csarVersion = other.csarVersion;
@@ -204,35 +159,30 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
this.archiveTime = other.getArchiveTime();
}
- public ComponentMetadataDataDefinition(JsonPresentationFieldsExtractor extractor){
- this.uniqueId = extractor.getUniqueId();
- this.name = extractor.getName();
- this.version = extractor.getVersion();
- this.isHighestVersion = extractor.isHighestVersion();
- this.creationDate = extractor.getCreationDate();
- this.lastUpdateDate = extractor.getLastUpdateDate();
- this.description = extractor.getDescription();
- this.state = extractor.getState();
- this.tags = extractor.getTags();
- this.icon = extractor.getIcon();
- this.contactId = extractor.getContactId();
- this.UUID = extractor.getUUID();
- this.normalizedName = extractor.getNormalizedName();
- this.systemName = extractor.getSystemName();
- this.isDeleted = extractor.isDeleted();
- this.projectCode = extractor.getProjectCode();
- this.csarUUID = extractor.getCsarUuid();
- this.csarVersion = extractor.getCsarVersion();
- this.importedToscaChecksum = extractor.getImportedToscaChecksum();
- this.invariantUUID = extractor.getInvariantUuid();
- this.isArchived = extractor.isArchived();
- this.isVspArchived = extractor.isVspArchived();
- this.archiveTime = extractor.getArchiveTime();
- }
-
-
- public String getUniqueId() {
- return uniqueId;
+ public ComponentMetadataDataDefinition(JsonPresentationFieldsExtractor extractor) {
+ this.uniqueId = extractor.getUniqueId();
+ this.name = extractor.getName();
+ this.version = extractor.getVersion();
+ this.highestVersion = extractor.isHighestVersion();
+ this.creationDate = extractor.getCreationDate();
+ this.lastUpdateDate = extractor.getLastUpdateDate();
+ this.description = extractor.getDescription();
+ this.state = extractor.getState();
+ this.tags = extractor.getTags();
+ this.icon = extractor.getIcon();
+ this.contactId = extractor.getContactId();
+ this.UUID = extractor.getUUID();
+ this.normalizedName = extractor.getNormalizedName();
+ this.systemName = extractor.getSystemName();
+ this.isDeleted = extractor.isDeleted();
+ this.projectCode = extractor.getProjectCode();
+ this.csarUUID = extractor.getCsarUuid();
+ this.csarVersion = extractor.getCsarVersion();
+ this.importedToscaChecksum = extractor.getImportedToscaChecksum();
+ this.invariantUUID = extractor.getInvariantUuid();
+ this.isArchived = extractor.isArchived();
+ this.isVspArchived = extractor.isVspArchived();
+ this.archiveTime = extractor.getArchiveTime();
}
public void setUniqueId(String uniqueId) {
@@ -242,90 +192,6 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
this.uniqueId = uniqueId;
}
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public Boolean isHighestVersion() {
- return isHighestVersion;
- }
-
- public void setHighestVersion(Boolean isHighestVersion) {
- this.isHighestVersion = isHighestVersion;
- }
-
- public Long getCreationDate() {
- return creationDate;
- }
-
- public void setCreationDate(Long creationDate) {
- this.creationDate = creationDate;
- }
-
- public Long getLastUpdateDate() {
- return lastUpdateDate;
- }
-
- public void setLastUpdateDate(Long lastUpdateDate) {
- this.lastUpdateDate = lastUpdateDate;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public List<String> getTags() {
- return tags;
- }
-
- public void setTags(List<String> tags) {
- this.tags = tags;
- }
-
- public String getIcon() {
- return icon;
- }
-
- public void setIcon(String icon) {
- this.icon = icon;
- }
-
- public String getContactId() {
- return contactId;
- }
-
- public void setContactId(String contactId) {
- this.contactId = contactId;
- }
-
- public String getUUID() {
- return UUID;
- }
-
public void setUUID(String UUID) {
if (this.UUID != null && !this.UUID.equals(UUID)) {
LOGGER.warn("UUID changed more then once -> OLD : {} , NEW: {} ", this.UUID, UUID);
@@ -333,87 +199,16 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
this.UUID = UUID;
}
- public String getNormalizedName() {
- return normalizedName;
- }
-
- public void setNormalizedName(String normalizedName) {
- this.normalizedName = normalizedName;
- }
-
- public String getSystemName() {
- return systemName;
- }
-
- public void setSystemName(String systemName) {
- this.systemName = systemName;
- }
-
- public Map<String, String> getAllVersions() {
- return allVersions;
- }
-
- public void setAllVersions(Map<String, String> allVersions) {
- this.allVersions = allVersions;
- }
-
- public String getInvariantUUID() {
- return invariantUUID;
- }
-
public void setInvariantUUID(String invariantUUID) {
if (this.invariantUUID != null && !this.invariantUUID.equals(invariantUUID)) {
- LOGGER.warn("InvariantUUID changed more then once -> OLD : {} , NEW: {} ", this.invariantUUID, invariantUUID);
+ LOGGER.warn("InvariantUUID changed more then once -> OLD : {} , NEW: {} ", this.invariantUUID,
+ invariantUUID);
}
this.invariantUUID = invariantUUID;
}
- public Boolean isDeleted() {
- return isDeleted;
- }
-
- public void setIsDeleted(Boolean isDeleted) {
- this.isDeleted = isDeleted;
- }
-
- public String getProjectCode() {
- return projectCode;
- }
-
- public void setProjectCode(String projectCode) {
- this.projectCode = projectCode;
- }
-
- public String getCsarUUID() {
- return csarUUID;
- }
-
- public void setCsarUUID(String csarUUID) {
- this.csarUUID = csarUUID;
- }
-
- public String getCsarVersion() {
- return csarVersion;
- }
-
- public void setCsarVersion(String csarVersion) {
- this.csarVersion = csarVersion;
- }
-
- public String getImportedToscaChecksum() {
- return importedToscaChecksum;
- }
-
- public void setImportedToscaChecksum(String importedToscaChecksum) {
- this.importedToscaChecksum = importedToscaChecksum;
- }
-
- public String getConformanceLevel() {
- return conformanceLevel;
- }
-
- public void setConformanceLevel(String conformanceLevel) {
- this.conformanceLevel = conformanceLevel;
+ public Boolean isHighestVersion() {
+ return highestVersion;
}
public String getLifecycleState() {
@@ -424,249 +219,24 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
this.state = state;
}
- @Override
- public String toString() {
- return "ComponentMetadataDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", version=" + version
- + ", isHighestVersion=" + isHighestVersion + ", creationDate=" + creationDate + ", lastUpdateDate="
- + lastUpdateDate + ", description=" + description + ", state=" + state + ", tags=" + tags
- + ", conformanceLevel=" + conformanceLevel + ", icon=" + icon + ", UUID=" + UUID + ", normalizedName="
- + normalizedName + ", systemName=" + systemName + ", contactId=" + contactId + ", allVersions="
- + allVersions + ", isDeleted=" + isDeleted + ", projectCode=" + projectCode + ", csarUUID=" + csarUUID
- + ", csarVersion=" + csarVersion + ", importedToscaChecksum=" + importedToscaChecksum
- + ", invariantUUID=" + invariantUUID + ", componentType=" + componentType + ", creatorUserId="
- + creatorUserId + ", creatorFullName=" + creatorFullName + ", lastUpdaterUserId=" + lastUpdaterUserId
- + ", lastUpdaterFullName=" + lastUpdaterFullName + "]";
+ public Boolean isDeleted() {
+ return getIsDeleted();
}
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((UUID == null) ? 0 : UUID.hashCode());
- result = prime * result + ((allVersions == null) ? 0 : allVersions.hashCode());
- result = prime * result + ((componentType == null) ? 0 : componentType.hashCode());
- result = prime * result + ((conformanceLevel == null) ? 0 : conformanceLevel.hashCode());
- result = prime * result + ((contactId == null) ? 0 : contactId.hashCode());
- result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode());
- result = prime * result + ((creatorFullName == null) ? 0 : creatorFullName.hashCode());
- result = prime * result + ((creatorUserId == null) ? 0 : creatorUserId.hashCode());
- result = prime * result + ((csarUUID == null) ? 0 : csarUUID.hashCode());
- result = prime * result + ((csarVersion == null) ? 0 : csarVersion.hashCode());
- result = prime * result + ((description == null) ? 0 : description.hashCode());
- result = prime * result + ((icon == null) ? 0 : icon.hashCode());
- result = prime * result + ((importedToscaChecksum == null) ? 0 : importedToscaChecksum.hashCode());
- result = prime * result + ((invariantUUID == null) ? 0 : invariantUUID.hashCode());
- result = prime * result + ((isDeleted == null) ? 0 : isDeleted.hashCode());
- result = prime * result + ((isHighestVersion == null) ? 0 : isHighestVersion.hashCode());
- result = prime * result + ((lastUpdateDate == null) ? 0 : lastUpdateDate.hashCode());
- result = prime * result + ((lastUpdaterFullName == null) ? 0 : lastUpdaterFullName.hashCode());
- result = prime * result + ((lastUpdaterUserId == null) ? 0 : lastUpdaterUserId.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode());
- result = prime * result + ((projectCode == null) ? 0 : projectCode.hashCode());
- result = prime * result + ((state == null) ? 0 : state.hashCode());
- result = prime * result + ((systemName == null) ? 0 : systemName.hashCode());
- result = prime * result + ((tags == null) ? 0 : tags.hashCode());
- result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
- result = prime * result + ((version == null) ? 0 : version.hashCode());
- return result;
+ public Boolean isArchived() {
+ return getIsArchived();
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ComponentMetadataDataDefinition other = (ComponentMetadataDataDefinition) obj;
- if (UUID == null) {
- if (other.UUID != null) {
- return false;
- }
- } else if (!UUID.equals(other.UUID)) {
- return false;
- }
- if (allVersions == null) {
- if (other.allVersions != null) {
- return false;
- }
- } else if (!allVersions.equals(other.allVersions)) {
- return false;
- }
- if (componentType != other.componentType) {
- return false;
- }
- if (conformanceLevel == null) {
- if (other.conformanceLevel != null) {
- return false;
- }
- } else if (!conformanceLevel.equals(other.conformanceLevel)) {
- return false;
- }
- if (contactId == null) {
- if (other.contactId != null) {
- return false;
- }
- } else if (!contactId.equals(other.contactId)) {
- return false;
- }
- if (creationDate == null) {
- if (other.creationDate != null) {
- return false;
- }
- } else if (!creationDate.equals(other.creationDate)) {
- return false;
- }
- if (creatorFullName == null) {
- if (other.creatorFullName != null) {
- return false;
- }
- } else if (!creatorFullName.equals(other.creatorFullName)) {
- return false;
- }
- if (creatorUserId == null) {
- if (other.creatorUserId != null) {
- return false;
- }
- } else if (!creatorUserId.equals(other.creatorUserId)) {
- return false;
- }
- if (csarUUID == null) {
- if (other.csarUUID != null) {
- return false;
- }
- } else if (!csarUUID.equals(other.csarUUID)) {
- return false;
- }
- if (csarVersion == null) {
- if (other.csarVersion != null) {
- return false;
- }
- } else if (!csarVersion.equals(other.csarVersion)) {
- return false;
- }
- if (description == null) {
- if (other.description != null) {
- return false;
- }
- } else if (!description.equals(other.description)) {
- return false;
- }
- if (icon == null) {
- if (other.icon != null) {
- return false;
- }
- } else if (!icon.equals(other.icon)) {
- return false;
- }
- if (importedToscaChecksum == null) {
- if (other.importedToscaChecksum != null) {
- return false;
- }
- } else if (!importedToscaChecksum.equals(other.importedToscaChecksum)) {
- return false;
- }
- if (invariantUUID == null) {
- if (other.invariantUUID != null) {
- return false;
- }
- } else if (!invariantUUID.equals(other.invariantUUID)) {
- return false;
- }
- if (isDeleted == null) {
- if (other.isDeleted != null) {
- return false;
- }
- } else if (!isDeleted.equals(other.isDeleted)) {
- return false;
- }
- if (isHighestVersion == null) {
- if (other.isHighestVersion != null) {
- return false;
- }
- } else if (!isHighestVersion.equals(other.isHighestVersion)) {
- return false;
- }
- if (lastUpdateDate == null) {
- if (other.lastUpdateDate != null) {
- return false;
- }
- } else if (!lastUpdateDate.equals(other.lastUpdateDate)) {
- return false;
- }
- if (lastUpdaterFullName == null) {
- if (other.lastUpdaterFullName != null) {
- return false;
- }
- } else if (!lastUpdaterFullName.equals(other.lastUpdaterFullName)) {
- return false;
- }
- if (lastUpdaterUserId == null) {
- if (other.lastUpdaterUserId != null) {
- return false;
- }
- } else if (!lastUpdaterUserId.equals(other.lastUpdaterUserId)) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (normalizedName == null) {
- if (other.normalizedName != null) {
- return false;
- }
- } else if (!normalizedName.equals(other.normalizedName)) {
- return false;
- }
- if (projectCode == null) {
- if (other.projectCode != null) {
- return false;
- }
- } else if (!projectCode.equals(other.projectCode)) {
- return false;
- }
- if (state == null) {
- if (other.state != null) {
- return false;
- }
- } else if (!state.equals(other.state)) {
- return false;
- }
- if (systemName == null) {
- if (other.systemName != null) {
- return false;
- }
- } else if (!systemName.equals(other.systemName)) {
- return false;
- }
- if (tags == null) {
- if (other.tags != null) {
- return false;
- }
- } else if (!tags.equals(other.tags)) {
- return false;
- }
- if (uniqueId == null) {
- if (other.uniqueId != null) {
- return false;
- }
- } else if (!uniqueId.equals(other.uniqueId)) {
- return false;
- }
- if (version == null) {
- return other.version == null;
- } else {
- return version.equals(other.version);
- }
+ public void setArchived(Boolean archived) {
+ setIsArchived(archived);
+ }
+
+ public Boolean isVspArchived() {
+ return getIsVspArchived();
+ }
+
+ public void setVspArchived(Boolean vspArchived) {
+ setIsVspArchived(vspArchived);
}
/**