diff options
Diffstat (limited to 'common-be/src')
83 files changed, 5893 insertions, 5613 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java index 641d0c143d..27d6ae56fa 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,101 +26,109 @@ import java.util.List; public class CategoryDataDefinition extends ToscaDataDefinition { - private String name; - private String normalizedName; - private String uniqueId; - private List<String> icons; - - public CategoryDataDefinition() { - - } - - public CategoryDataDefinition(CategoryDataDefinition c) { - this.name = c.name; - this.normalizedName = c.normalizedName; - this.uniqueId = c.uniqueId; - this.icons = c.icons; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNormalizedName() { - return normalizedName; - } - - public void setNormalizedName(String normalizedName) { - this.normalizedName = normalizedName; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public List<String> getIcons() { - return icons; - } - - public void setIcons(List<String> icons) { - this.icons = icons; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - result = prime * result + ((icons == null) ? 0 : icons.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CategoryDataDefinition other = (CategoryDataDefinition) obj; - 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 (uniqueId == null) { - if (other.uniqueId != null) - return false; - } else if (!uniqueId.equals(other.uniqueId)) - return false; - if (icons == null) { - if (other.icons != null) - return false; - } else if (!icons.equals(other.icons)) - return false; - return true; - } - - @Override - public String toString() { - return "CategoryDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId - + ", icons=" + icons + "]"; - } + private String name; + private String normalizedName; + private String uniqueId; + private List<String> icons; + + public CategoryDataDefinition() { + + } + + public CategoryDataDefinition(CategoryDataDefinition c) { + this.name = c.name; + this.normalizedName = c.normalizedName; + this.uniqueId = c.uniqueId; + this.icons = c.icons; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getNormalizedName() { + return normalizedName; + } + + public void setNormalizedName(String normalizedName) { + this.normalizedName = normalizedName; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public List<String> getIcons() { + return icons; + } + + public void setIcons(List<String> icons) { + this.icons = icons; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + result = prime * result + ((icons == null) ? 0 : icons.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + CategoryDataDefinition other = (CategoryDataDefinition) obj; + 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 (uniqueId == null) { + if (other.uniqueId != null) { + return false; + } + } else if (!uniqueId.equals(other.uniqueId)) { + return false; + } + if (icons == null) { + return other.icons == null; + } else { + return icons.equals(other.icons); + } + } + + @Override + public String toString() { + return "CategoryDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId + + ", icons=" + icons + "]"; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java index 077862d3f6..69edbf2833 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,85 +24,91 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class GroupingDataDefinition extends ToscaDataDefinition { - private String name; - private String normalizedName; - private String uniqueId; - - public GroupingDataDefinition() { - - } - - public GroupingDataDefinition(GroupingDataDefinition c) { - this.name = c.name; - this.normalizedName = c.normalizedName; - this.uniqueId = c.uniqueId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNormalizedName() { - return normalizedName; - } - - public void setNormalizedName(String normalizedName) { - this.normalizedName = normalizedName; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - GroupingDataDefinition other = (GroupingDataDefinition) obj; - 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 (uniqueId == null) { - if (other.uniqueId != null) - return false; - } else if (!uniqueId.equals(other.uniqueId)) - return false; - return true; - } - - @Override - public String toString() { - return "GroupingDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId - + "]"; - } + private String name; + private String normalizedName; + private String uniqueId; + + public GroupingDataDefinition() { + + } + + public GroupingDataDefinition(GroupingDataDefinition c) { + this.name = c.name; + this.normalizedName = c.normalizedName; + this.uniqueId = c.uniqueId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getNormalizedName() { + return normalizedName; + } + + public void setNormalizedName(String normalizedName) { + this.normalizedName = normalizedName; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + GroupingDataDefinition other = (GroupingDataDefinition) obj; + 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 (uniqueId == null) { + return other.uniqueId == null; + } else { + return uniqueId.equals(other.uniqueId); + } + } + + @Override + public String toString() { + return "GroupingDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId + + "]"; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java index 96579dafe1..986f79fd4b 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,100 +26,108 @@ import java.util.List; public class SubCategoryDataDefinition extends ToscaDataDefinition { - private String name; - private String normalizedName; - private String uniqueId; - private List<String> icons; - - public SubCategoryDataDefinition() { - - } - - public SubCategoryDataDefinition(SubCategoryDataDefinition c) { - this.name = c.name; - this.normalizedName = c.normalizedName; - this.uniqueId = c.uniqueId; - this.icons = c.icons; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNormalizedName() { - return normalizedName; - } - - public void setNormalizedName(String normalizedName) { - this.normalizedName = normalizedName; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public List<String> getIcons() { - return icons; - } - - public void setIcons(List<String> icons) { - this.icons = icons; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - result = prime * result + ((icons == null) ? 0 : icons.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - SubCategoryDataDefinition other = (SubCategoryDataDefinition) obj; - 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 (uniqueId == null) { - if (other.uniqueId != null) - return false; - } else if (!uniqueId.equals(other.uniqueId)) - return false; - if (icons == null) { - if (other.icons != null) - return false; - } else if (!icons.equals(other.icons)) - return false; - return true; - } - - @Override - public String toString() { - return "SubCategoryDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" - + uniqueId + ", icons=" + icons + "]"; - } + private String name; + private String normalizedName; + private String uniqueId; + private List<String> icons; + + public SubCategoryDataDefinition() { + + } + + public SubCategoryDataDefinition(SubCategoryDataDefinition c) { + this.name = c.name; + this.normalizedName = c.normalizedName; + this.uniqueId = c.uniqueId; + this.icons = c.icons; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getNormalizedName() { + return normalizedName; + } + + public void setNormalizedName(String normalizedName) { + this.normalizedName = normalizedName; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public List<String> getIcons() { + return icons; + } + + public void setIcons(List<String> icons) { + this.icons = icons; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + result = prime * result + ((icons == null) ? 0 : icons.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + SubCategoryDataDefinition other = (SubCategoryDataDefinition) obj; + 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 (uniqueId == null) { + if (other.uniqueId != null) { + return false; + } + } else if (!uniqueId.equals(other.uniqueId)) { + return false; + } + if (icons == null) { + return other.icons == null; + } else { + return icons.equals(other.icons); + } + } + + @Override + public String toString() { + return "SubCategoryDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + + uniqueId + ", icons=" + icons + "]"; + } } 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 3f75583ef2..4cee3ff49d 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,554 +24,627 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.common.log.wrappers.Logger; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition { - private static final Logger log = Logger.getLogger(ComponentMetadataDataDefinition.class.getName()); - - private String uniqueId; + private static final Logger LOGGER = Logger.getLogger(ComponentMetadataDataDefinition.class.getName()); - private String name; // archiveName + private String uniqueId; - private String version; // archiveVersion + private String name; // archiveName - private Boolean isHighestVersion; + private String version; // archiveVersion - private Long creationDate; + private Boolean isHighestVersion; - private Long lastUpdateDate; + private Long creationDate; - private String description; + private Long lastUpdateDate; - private String state; + private String description; - private List<String> tags; + private String state; - private String conformanceLevel; + private List<String> tags; - private String icon; + private String conformanceLevel; - private String UUID; + private String icon; - private String normalizedName; + private String UUID; - private String systemName; + private String normalizedName; - private String contactId; + private String systemName; - private Map<String, String> allVersions; + private String contactId; - private Boolean isDeleted; + private Map<String, String> allVersions; - private String projectCode; + private Boolean isDeleted; - private String csarUUID; + private String projectCode; - private String csarVersion; + private String csarUUID; - private String importedToscaChecksum; + private String csarVersion; - private String invariantUUID; + private String importedToscaChecksum; - protected ComponentTypeEnum componentType; + private String invariantUUID; - // USER - private String creatorUserId; + protected ComponentTypeEnum componentType; - private String creatorFullName; + // USER + private String creatorUserId; - private String lastUpdaterUserId; + private String creatorFullName; - private String lastUpdaterFullName; + private String lastUpdaterUserId; - //Archive/Restore - private Boolean isArchived = false; + private String lastUpdaterFullName; - private Long archiveTime; + //Archive/Restore + private Boolean isArchived = false; - private Boolean isVspArchived = false; + private Long archiveTime; - public Boolean getIsHighestVersion() { - return isHighestVersion; - } + private Boolean isVspArchived = false; - public void setIsHighestVersion(Boolean isHighestVersion) { - this.isHighestVersion = isHighestVersion; - } + public Boolean getIsHighestVersion() { + return isHighestVersion; + } - public ComponentTypeEnum getComponentType() { - return componentType; - } + public void setIsHighestVersion(Boolean isHighestVersion) { + this.isHighestVersion = isHighestVersion; + } - public void setComponentType(ComponentTypeEnum componentType) { - this.componentType = componentType; - } + public ComponentTypeEnum getComponentType() { + return componentType; + } - public String getCreatorUserId() { - return creatorUserId; - } + public void setComponentType(ComponentTypeEnum componentType) { + this.componentType = componentType; + } - public void setCreatorUserId(String creatorUserId) { - this.creatorUserId = creatorUserId; - } + public String getCreatorUserId() { + return creatorUserId; + } - public String getCreatorFullName() { - return creatorFullName; - } + public void setCreatorUserId(String creatorUserId) { + this.creatorUserId = creatorUserId; + } - public void setCreatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; - } + public String getCreatorFullName() { + return creatorFullName; + } - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } + public void setCreatorFullName(String creatorFullName) { + this.creatorFullName = creatorFullName; + } - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } + public String getLastUpdaterUserId() { + return lastUpdaterUserId; + } - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } + public void setLastUpdaterUserId(String lastUpdaterUserId) { + this.lastUpdaterUserId = lastUpdaterUserId; + } - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } + public String getLastUpdaterFullName() { + return lastUpdaterFullName; + } - public Boolean getIsDeleted() { - return isDeleted; - } + public void setLastUpdaterFullName(String lastUpdaterFullName) { + this.lastUpdaterFullName = lastUpdaterFullName; + } - public Boolean isArchived() { return isArchived; } + public Boolean getIsDeleted() { + return isDeleted; + } - public void setArchived(Boolean archived) { isArchived = archived; } + public Boolean isArchived() { + return isArchived; + } - public Long getArchiveTime() { return archiveTime; } + public void setArchived(Boolean archived) { + isArchived = archived; + } - public void setArchiveTime(Long archiveTime) { this.archiveTime = archiveTime; } + public Long getArchiveTime() { + return archiveTime; + } - public Boolean isVspArchived() { return isVspArchived; } + public void setArchiveTime(Long archiveTime) { + this.archiveTime = archiveTime; + } - public void setVspArchived(Boolean vspArchived) { isVspArchived = vspArchived; } + public Boolean isVspArchived() { + return isVspArchived; + } - public ComponentMetadataDataDefinition() { + 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.creationDate = other.getCreationDate(); - this.lastUpdateDate = other.getLastUpdateDate(); - this.description = other.getDescription(); - this.state = other.getState(); - this.tags = new ArrayList<>(other.getTags() != null ? other.getTags() : new LinkedList<>()); - this.icon = other.getIcon(); - this.contactId = other.getContactId(); - this.UUID = other.getUUID(); - this.normalizedName = other.getNormalizedName(); - this.systemName = other.getSystemName(); - this.allVersions = new HashMap<>(other.getAllVersions() != null ? other.getAllVersions() : new HashMap<>()); - this.isDeleted = other.isDeleted(); - this.projectCode = other.getProjectCode(); - this.csarUUID = other.getCsarUUID(); - this.csarVersion = other.csarVersion; - this.importedToscaChecksum = other.getImportedToscaChecksum(); - this.invariantUUID = other.getInvariantUUID(); - this.isArchived = other.isArchived; - this.isVspArchived = other.isVspArchived; - this.archiveTime = other.getArchiveTime(); - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - if ( this.uniqueId != null && !this.uniqueId.equals( uniqueId ) ) - log.warn("uniqueId changed more then once -> OLD : {} , NEW: {} ", this.uniqueId ,uniqueId ); - 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 ) ) - log.warn("UUID changed more then once -> OLD : {} , NEW: {} ", this.UUID, UUID ); - 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 ) ) - log.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 String getLifecycleState() { - return state; - } - - public void setLifecycleState(String state) { - 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 + "]"; - } - - @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; - } - - @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) { - if (other.version != null) - return false; - } else if (!version.equals(other.version)) - return false; - return true; - } - - /** - * Return the type of the actual component - e.g. for a Resource, return the actual VF/CR - * @return - */ - public abstract String getActualComponentType(); + } + + public ComponentMetadataDataDefinition(ComponentMetadataDataDefinition other) { + this.uniqueId = other.getUniqueId(); + this.name = other.getName(); + this.version = other.getVersion(); + this.isHighestVersion = other.isHighestVersion(); + this.creationDate = other.getCreationDate(); + this.lastUpdateDate = other.getLastUpdateDate(); + this.description = other.getDescription(); + this.state = other.getState(); + this.tags = new ArrayList<>(other.getTags() != null ? other.getTags() : new LinkedList<>()); + this.icon = other.getIcon(); + this.contactId = other.getContactId(); + this.UUID = other.getUUID(); + this.normalizedName = other.getNormalizedName(); + this.systemName = other.getSystemName(); + this.allVersions = new HashMap<>(other.getAllVersions() != null ? other.getAllVersions() : new HashMap<>()); + this.isDeleted = other.isDeleted(); + this.projectCode = other.getProjectCode(); + this.csarUUID = other.getCsarUUID(); + this.csarVersion = other.csarVersion; + this.importedToscaChecksum = other.getImportedToscaChecksum(); + this.invariantUUID = other.getInvariantUUID(); + this.isArchived = other.isArchived; + this.isVspArchived = other.isVspArchived; + this.archiveTime = other.getArchiveTime(); + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + if (this.uniqueId != null && !this.uniqueId.equals(uniqueId)) { + LOGGER.warn("uniqueId changed more then once -> OLD : {} , NEW: {} ", this.uniqueId, uniqueId); + } + 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); + } + 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); + } + 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 String getLifecycleState() { + return state; + } + + public void setLifecycleState(String state) { + 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 + "]"; + } + + @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; + } + + @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); + } + } + + /** + * Return the type of the actual component - e.g. for a Resource, return the actual VF/CR + * + * @return + */ + public abstract String getActualComponentType(); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java index 2b7ece292f..3a48286280 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,170 +24,187 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition { - private String vendorName; - private String vendorRelease; - private String resourceVendorModelNumber; - private ResourceTypeEnum resourceType = ResourceTypeEnum.VFC; // ResourceType.VFC - // is - // default - private Boolean isAbstract; - private String cost; - private String licenseType; - private String toscaResourceName; - - public ResourceMetadataDataDefinition() { - super(); - resourceVendorModelNumber = ""; - } - - public ResourceMetadataDataDefinition(ResourceMetadataDataDefinition other) { - super(other); - this.vendorName = other.getVendorName(); - this.vendorRelease = other.getVendorRelease(); - this.resourceVendorModelNumber = other.getResourceVendorModelNumber(); - this.isAbstract = other.isHighestVersion(); - this.resourceType = other.getResourceType(); - this.toscaResourceName = other.getToscaResourceName(); - } - - public String getVendorName() { - return vendorName; - } - - public void setVendorName(String vendorName) { - this.vendorName = vendorName; - } - - public String getVendorRelease() { - return vendorRelease; - } - - public void setVendorRelease(String vendorRelease) { - this.vendorRelease = vendorRelease; - } - - public String getResourceVendorModelNumber() { - return resourceVendorModelNumber; - } - - public void setResourceVendorModelNumber(String resourceVendorModelNumber) { - this.resourceVendorModelNumber = resourceVendorModelNumber; - } - - - public ResourceTypeEnum getResourceType() { - return resourceType; - } - - public void setResourceType(ResourceTypeEnum resourceType) { - this.resourceType = resourceType; - } - - public Boolean isAbstract() { - return isAbstract; - } - - public void setAbstract(Boolean isAbstract) { - this.isAbstract = isAbstract; - } - - public String getCost() { - return cost; - } - - public void setCost(String cost) { - this.cost = cost; - } - - public String getLicenseType() { - return licenseType; - } - - public void setLicenseType(String licenseType) { - this.licenseType = licenseType; - } - - public String getToscaResourceName() { - return toscaResourceName; - } - - public void setToscaResourceName(String toscaResourceName) { - this.toscaResourceName = toscaResourceName; - } - - @Override - public String toString() { - return "ResourceMetadataDataDefinition [vendorName=" + vendorName + ", vendorRelease=" + vendorRelease - + ", resourceVendorModelNumber=" + resourceVendorModelNumber + ", resourceType=" + resourceType + - ", isAbstract=" + isAbstract + super.toString() + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((cost == null) ? 0 : cost.hashCode()); - result = prime * result + ((isAbstract == null) ? 0 : isAbstract.hashCode()); - result = prime * result + ((licenseType == null) ? 0 : licenseType.hashCode()); - result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); - result = prime * result + ((vendorName == null) ? 0 : vendorName.hashCode()); - result = prime * result + ((vendorRelease == null) ? 0 : vendorRelease.hashCode()); - result = prime * result + ((resourceVendorModelNumber == null)? 0 : resourceVendorModelNumber.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - ResourceMetadataDataDefinition other = (ResourceMetadataDataDefinition) obj; - if (cost == null) { - if (other.cost != null) - return false; - } else if (!cost.equals(other.cost)) - return false; - if (isAbstract == null) { - if (other.isAbstract != null) - return false; - } else if (!isAbstract.equals(other.isAbstract)) - return false; - if (licenseType == null) { - if (other.licenseType != null) - return false; - } else if (!licenseType.equals(other.licenseType)) - return false; - if (resourceType != other.resourceType) - return false; - if (vendorName == null) { - if (other.vendorName != null) - return false; - } else if (!vendorName.equals(other.vendorName)) - return false; - if (vendorRelease == null) { - if (other.vendorRelease != null) - return false; - } - if (toscaResourceName == null) { - if (other.toscaResourceName != null) - return false; - } else if (!vendorRelease.equals(other.vendorRelease)) - return false; - if (resourceVendorModelNumber == null) { - if (other.resourceVendorModelNumber != null) - return false; - } else if (!resourceVendorModelNumber.equals(other.resourceVendorModelNumber)) - return false; - - return super.equals(obj); - } - - @Override - public String getActualComponentType() { - return getResourceType().getValue(); - } + private String vendorName; + private String vendorRelease; + private String resourceVendorModelNumber; + private ResourceTypeEnum resourceType = ResourceTypeEnum.VFC; // ResourceType.VFC + // is + // default + private Boolean isAbstract; + private String cost; + private String licenseType; + private String toscaResourceName; + + public ResourceMetadataDataDefinition() { + super(); + resourceVendorModelNumber = ""; + } + + public ResourceMetadataDataDefinition(ResourceMetadataDataDefinition other) { + super(other); + this.vendorName = other.getVendorName(); + this.vendorRelease = other.getVendorRelease(); + this.resourceVendorModelNumber = other.getResourceVendorModelNumber(); + this.isAbstract = other.isHighestVersion(); + this.resourceType = other.getResourceType(); + this.toscaResourceName = other.getToscaResourceName(); + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorRelease() { + return vendorRelease; + } + + public void setVendorRelease(String vendorRelease) { + this.vendorRelease = vendorRelease; + } + + public String getResourceVendorModelNumber() { + return resourceVendorModelNumber; + } + + public void setResourceVendorModelNumber(String resourceVendorModelNumber) { + this.resourceVendorModelNumber = resourceVendorModelNumber; + } + + + public ResourceTypeEnum getResourceType() { + return resourceType; + } + + public void setResourceType(ResourceTypeEnum resourceType) { + this.resourceType = resourceType; + } + + public Boolean isAbstract() { + return isAbstract; + } + + public void setAbstract(Boolean isAbstract) { + this.isAbstract = isAbstract; + } + + public String getCost() { + return cost; + } + + public void setCost(String cost) { + this.cost = cost; + } + + public String getLicenseType() { + return licenseType; + } + + public void setLicenseType(String licenseType) { + this.licenseType = licenseType; + } + + public String getToscaResourceName() { + return toscaResourceName; + } + + public void setToscaResourceName(String toscaResourceName) { + this.toscaResourceName = toscaResourceName; + } + + @Override + public String toString() { + return "ResourceMetadataDataDefinition [vendorName=" + vendorName + ", vendorRelease=" + vendorRelease + + ", resourceVendorModelNumber=" + resourceVendorModelNumber + ", resourceType=" + resourceType + + ", isAbstract=" + isAbstract + super.toString() + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((cost == null) ? 0 : cost.hashCode()); + result = prime * result + ((isAbstract == null) ? 0 : isAbstract.hashCode()); + result = prime * result + ((licenseType == null) ? 0 : licenseType.hashCode()); + result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); + result = prime * result + ((vendorName == null) ? 0 : vendorName.hashCode()); + result = prime * result + ((vendorRelease == null) ? 0 : vendorRelease.hashCode()); + result = prime * result + ((resourceVendorModelNumber == null) ? 0 : resourceVendorModelNumber.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ResourceMetadataDataDefinition other = (ResourceMetadataDataDefinition) obj; + if (cost == null) { + if (other.cost != null) { + return false; + } + } else if (!cost.equals(other.cost)) { + return false; + } + if (isAbstract == null) { + if (other.isAbstract != null) { + return false; + } + } else if (!isAbstract.equals(other.isAbstract)) { + return false; + } + if (licenseType == null) { + if (other.licenseType != null) { + return false; + } + } else if (!licenseType.equals(other.licenseType)) { + return false; + } + if (resourceType != other.resourceType) { + return false; + } + if (vendorName == null) { + if (other.vendorName != null) { + return false; + } + } else if (!vendorName.equals(other.vendorName)) { + return false; + } + if (vendorRelease == null) { + if (other.vendorRelease != null) { + return false; + } + } + if (toscaResourceName == null) { + if (other.toscaResourceName != null) { + return false; + } + } else if (!vendorRelease.equals(other.vendorRelease)) { + return false; + } + if (resourceVendorModelNumber == null) { + if (other.resourceVendorModelNumber != null) { + return false; + } + } else if (!resourceVendorModelNumber.equals(other.resourceVendorModelNumber)) { + return false; + } + + return super.equals(obj); + } + + @Override + public String getActualComponentType() { + return getResourceType().getValue(); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java index 8e80f927ae..0ef10d4c95 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,167 +21,188 @@ package org.openecomp.sdc.be.datatypes.components; public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition { - public static final String EMPTY_STR = ""; - - private String distributionStatus; - private String serviceType; - private String serviceRole; - private String instantiationType = EMPTY_STR; - - private Boolean ecompGeneratedNaming = true; - - private String namingPolicy = EMPTY_STR; - - private String environmentContext; - - public ServiceMetadataDataDefinition() { - super(); - serviceType = ""; - serviceRole = ""; - } - - public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) { - super(other); - serviceType = other.getServiceType(); - serviceRole = other.getServiceRole(); - } - - public String getDistributionStatus() { - return distributionStatus; - } - - public void setDistributionStatus(String distributionStatus) { - this.distributionStatus = distributionStatus; - } - - public String getServiceType(){ - return serviceType; - } - - public void setServiceType(String serviceType){ - this.serviceType = serviceType; - } - - public String getServiceRole(){ - return serviceRole; - } - - public String getInstantiationType() { - return instantiationType; - } - - public void setInstantiationType(String instantiationType){ - this.instantiationType = instantiationType; - } - - public void setServiceRole(String serviceRole){ - this.serviceRole = serviceRole; - } - - public Boolean isEcompGeneratedNaming() { - return ecompGeneratedNaming; - } - - public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) { - this.ecompGeneratedNaming = ecompGeneratedNaming; - } - - public String getNamingPolicy() { - return namingPolicy; - } - - public void setNamingPolicy(String namingPolicy) { - this.namingPolicy = namingPolicy; - } - - public String getEnvironmentContext() { return environmentContext; } - - public void setEnvironmentContext(String environmentContext) { this.environmentContext = environmentContext; } - - @Override - public String toString() { - return "ServiceMetadataDataDefinition{" + - "distributionStatus='" + distributionStatus + '\'' + - ", serviceType='" + serviceType + '\'' + - ", serviceRole='" + serviceRole + '\'' + - ", ecompGeneratedNaming=" + ecompGeneratedNaming + - ", namingPolicy='" + namingPolicy + '\'' + - ", environmentContext='" + environmentContext + '\'' + - ", instantiationType='" + instantiationType + '\'' + - '}'; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((distributionStatus == null) ? 0 : distributionStatus.hashCode()); - result = prime * result + ((ecompGeneratedNaming == null) ? 0 : ecompGeneratedNaming.hashCode()); - result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode()); - result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode()); - result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode()); - result = prime * result + ((environmentContext == null) ? 0 : environmentContext.hashCode()); - result = prime * result + ((instantiationType == null) ? 0 : instantiationType.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof ComponentMetadataDataDefinition)) { - return false; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) - return false; - ServiceMetadataDataDefinition other = (ServiceMetadataDataDefinition) obj; - if (distributionStatus == null) { - if (other.distributionStatus != null) - return false; - } else if (!distributionStatus.equals(other.distributionStatus)) - return false; - if (ecompGeneratedNaming == null) { - if (other.ecompGeneratedNaming != null) - return false; - } else if (!ecompGeneratedNaming.equals(other.ecompGeneratedNaming)) - return false; - if (namingPolicy == null) { - if (other.namingPolicy != null) - return false; - } else if (!namingPolicy.equals(other.namingPolicy)) - return false; - if (serviceType == null){ - if (other.serviceType != null) - return false; - } else if (!serviceType.equals(other.serviceType)) - return false; - if (serviceRole == null){ - if (other.serviceRole != null) - return false; - } else if (!serviceRole.equals(other.serviceRole)) - return false; - if (environmentContext == null){ - if (other.environmentContext != null) - return false; - } else if (!environmentContext.equals(other.environmentContext)) - return false; - if (instantiationType == null) { - if (other.instantiationType != null) - return false; - } else if (!instantiationType.equals(other.instantiationType)) - return false; - return super.equals(obj); - } - - @Override - public String getActualComponentType() { - - return componentType != null ? componentType.getValue() : ""; - } + private static final String EMPTY_STR = ""; + + private String distributionStatus; + private String serviceType; + private String serviceRole; + private String instantiationType = EMPTY_STR; + + private Boolean ecompGeneratedNaming = true; + + private String namingPolicy = EMPTY_STR; + + private String environmentContext; + + public ServiceMetadataDataDefinition() { + super(); + serviceType = ""; + serviceRole = ""; + } + + public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) { + super(other); + serviceType = other.getServiceType(); + serviceRole = other.getServiceRole(); + } + + public String getDistributionStatus() { + return distributionStatus; + } + + public void setDistributionStatus(String distributionStatus) { + this.distributionStatus = distributionStatus; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getServiceRole() { + return serviceRole; + } + + public String getInstantiationType() { + return instantiationType; + } + + public void setInstantiationType(String instantiationType) { + this.instantiationType = instantiationType; + } + + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + + public Boolean isEcompGeneratedNaming() { + return ecompGeneratedNaming; + } + + public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) { + this.ecompGeneratedNaming = ecompGeneratedNaming; + } + + public String getNamingPolicy() { + return namingPolicy; + } + + public void setNamingPolicy(String namingPolicy) { + this.namingPolicy = namingPolicy; + } + + public String getEnvironmentContext() { + return environmentContext; + } + + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + + @Override + public String toString() { + return "ServiceMetadataDataDefinition{" + + "distributionStatus='" + distributionStatus + '\'' + + ", serviceType='" + serviceType + '\'' + + ", serviceRole='" + serviceRole + '\'' + + ", ecompGeneratedNaming=" + ecompGeneratedNaming + + ", namingPolicy='" + namingPolicy + '\'' + + ", environmentContext='" + environmentContext + '\'' + + ", instantiationType='" + instantiationType + '\'' + + '}'; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((distributionStatus == null) ? 0 : distributionStatus.hashCode()); + result = prime * result + ((ecompGeneratedNaming == null) ? 0 : ecompGeneratedNaming.hashCode()); + result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode()); + result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode()); + result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode()); + result = prime * result + ((environmentContext == null) ? 0 : environmentContext.hashCode()); + result = prime * result + ((instantiationType == null) ? 0 : instantiationType.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ComponentMetadataDataDefinition)) { + return false; + } + if (!super.equals(obj)) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ServiceMetadataDataDefinition other = (ServiceMetadataDataDefinition) obj; + if (distributionStatus == null) { + if (other.distributionStatus != null) { + return false; + } + } else if (!distributionStatus.equals(other.distributionStatus)) { + return false; + } + if (ecompGeneratedNaming == null) { + if (other.ecompGeneratedNaming != null) { + return false; + } + } else if (!ecompGeneratedNaming.equals(other.ecompGeneratedNaming)) { + return false; + } + if (namingPolicy == null) { + if (other.namingPolicy != null) { + return false; + } + } else if (!namingPolicy.equals(other.namingPolicy)) { + return false; + } + if (serviceType == null) { + if (other.serviceType != null) { + return false; + } + } else if (!serviceType.equals(other.serviceType)) { + return false; + } + if (serviceRole == null) { + if (other.serviceRole != null) { + return false; + } + } else if (!serviceRole.equals(other.serviceRole)) { + return false; + } + if (environmentContext == null) { + if (other.environmentContext != null) { + return false; + } + } else if (!environmentContext.equals(other.environmentContext)) { + return false; + } + if (instantiationType == null) { + if (other.instantiationType != null) { + return false; + } + } else if (!instantiationType.equals(other.instantiationType)) { + return false; + } + return super.equals(obj); + } + + @Override + public String getActualComponentType() { + + return componentType != null ? componentType.getValue() : ""; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java index 76cb358962..e92a806032 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,70 +26,72 @@ import java.util.List; public class AdditionalInfoParameterDataDefinition extends ToscaDataDefinition { - private String uniqueId; + private String uniqueId; - private Long creationTime; + private Long creationTime; - private Long modificationTime; + private Long modificationTime; - private Integer lastCreatedCounter = 0; + private Integer lastCreatedCounter = 0; - private List<AdditionalInfoParameterInfo> parameters; + private List<AdditionalInfoParameterInfo> parameters; - public AdditionalInfoParameterDataDefinition() { + public AdditionalInfoParameterDataDefinition() { - } + } - public AdditionalInfoParameterDataDefinition(AdditionalInfoParameterDataDefinition p) { - this.uniqueId = p.uniqueId; - this.creationTime = p.creationTime; - this.modificationTime = p.modificationTime; - this.lastCreatedCounter = p.lastCreatedCounter; - this.parameters = p.parameters; - } + public AdditionalInfoParameterDataDefinition(AdditionalInfoParameterDataDefinition p) { + this.uniqueId = p.uniqueId; + this.creationTime = p.creationTime; + this.modificationTime = p.modificationTime; + this.lastCreatedCounter = p.lastCreatedCounter; + this.parameters = p.parameters; + } - public String getUniqueId() { - return uniqueId; - } + public String getUniqueId() { + return uniqueId; + } - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } - public Long getCreationTime() { - return creationTime; - } + public Long getCreationTime() { + return creationTime; + } - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } - public Long getModificationTime() { - return modificationTime; - } + public Long getModificationTime() { + return modificationTime; + } - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } - public Integer getLastCreatedCounter() { - return lastCreatedCounter; - } + public Integer getLastCreatedCounter() { + return lastCreatedCounter; + } - public void setLastCreatedCounter(Integer lastCreatedCounter) { - this.lastCreatedCounter = lastCreatedCounter; - } - public List<AdditionalInfoParameterInfo> getParameters() { - return parameters; - } + public void setLastCreatedCounter(Integer lastCreatedCounter) { + this.lastCreatedCounter = lastCreatedCounter; + } - public void setParameters(List<AdditionalInfoParameterInfo> parameters) { - this.parameters = parameters; - } - @Override - public String toString() { - return "AdditionalInfoParameterDataDefinition [uniqueId=" + uniqueId + ", creationTime=" + creationTime - + ", modificationTime=" + modificationTime + ", lastCreatedCounter=" + lastCreatedCounter + "]"; - } + public List<AdditionalInfoParameterInfo> getParameters() { + return parameters; + } + + public void setParameters(List<AdditionalInfoParameterInfo> parameters) { + this.parameters = parameters; + } + + @Override + public String toString() { + return "AdditionalInfoParameterDataDefinition [uniqueId=" + uniqueId + ", creationTime=" + creationTime + + ", modificationTime=" + modificationTime + ", lastCreatedCounter=" + lastCreatedCounter + "]"; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java index 8dc95bc9d3..9b9cc497ad 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,52 +24,52 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class AdditionalInfoParameterInfo extends ToscaDataDefinition { - private String uniqueId; - private String key; - private String value; + private String uniqueId; + private String key; + private String value; - public AdditionalInfoParameterInfo() { - super(); - } + public AdditionalInfoParameterInfo() { + super(); + } - public AdditionalInfoParameterInfo(String key, String value) { - this.key = key; - this.value = value; - } + public AdditionalInfoParameterInfo(String key, String value) { + this.key = key; + this.value = value; + } - public AdditionalInfoParameterInfo(String uniqueId, String key, String value) { - this.uniqueId = uniqueId; - this.key = key; - this.value = value; - } + public AdditionalInfoParameterInfo(String uniqueId, String key, String value) { + this.uniqueId = uniqueId; + this.key = key; + this.value = value; + } - public String getUniqueId() { - return uniqueId; - } + public String getUniqueId() { + return uniqueId; + } - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } - public String getKey() { - return key; - } + public String getKey() { + return key; + } - public void setKey(String key) { - this.key = key; - } + public void setKey(String key) { + this.key = key; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public void setValue(String value) { - this.value = value; - } + public void setValue(String value) { + this.value = value; + } - @Override - public String toString() { - return "AdditionalInfoParameterInfo [uniqueId=" + uniqueId + ", key=" + key + ", value=" + value + "]"; - } + @Override + public String toString() { + return "AdditionalInfoParameterInfo [uniqueId=" + uniqueId + ", key=" + key + ", value=" + value + "]"; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/Annotation.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/Annotation.java index 4dd0841a1b..d77c906243 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/Annotation.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/Annotation.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AnnotationTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AnnotationTypeDataDefinition.java index b7a4b7c464..38e52583c4 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AnnotationTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AnnotationTypeDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class AnnotationTypeDataDefinition extends ToscaDataDefinition { protected String uniqueId; - protected String type; + protected String type; protected String description; protected Long creationTime; @@ -34,7 +34,8 @@ public class AnnotationTypeDataDefinition extends ToscaDataDefinition { protected String version; protected boolean highestVersion; - public AnnotationTypeDataDefinition() {} + public AnnotationTypeDataDefinition() { + } public AnnotationTypeDataDefinition(AnnotationTypeDataDefinition other) { uniqueId = other.uniqueId; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java index 93519d29fe..7360c03f44 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,545 +32,552 @@ import java.util.Map; public class ArtifactDataDefinition extends ToscaDataDefinition { - public ArtifactDataDefinition() { - setArtifactVersion("0"); - } - - public ArtifactDataDefinition(Map<String, Object> art) { - super(art); - setArtifactVersion("0"); - } - - - - public ArtifactDataDefinition(ArtifactDataDefinition a ) { - this.setUniqueId(a.getUniqueId()); - this.setArtifactType(a.getArtifactType()); - this.setArtifactRef( a.getArtifactRef()); - this.setArtifactName( a.getArtifactName()); - this.setArtifactRepository( a.getArtifactRepository()); - this.setArtifactChecksum( a.getArtifactChecksum()); - this.setUserIdCreator( a.getUserIdCreator()); - this.setUserIdLastUpdater( a.getUserIdLastUpdater()); - this.setCreatorFullName( a.getCreatorFullName()); - this.setUpdaterFullName( a.getUpdaterFullName()); - this.setCreationDate ( a.getCreationDate()); - this.setLastUpdateDate ( a.getLastUpdateDate()); - this.setDescription ( a.getDescription()); - this.setEsId ( a.getEsId()); - this.setArtifactLabel( a.getArtifactLabel()); - this.setArtifactCreator( a.getArtifactCreator()); - this.setMandatory ( a.getMandatory()); - this.setArtifactDisplayName( a.getArtifactDisplayName()); - this.setApiUrl( a.getApiUrl()); - this.setServiceApi ( a.getServiceApi()); - this.setArtifactGroupType ( a.getArtifactGroupType()); - this.setTimeout ( a.getTimeout()); - this.setArtifactVersion( a.getArtifactVersion()); - this.setArtifactUUID ( a.getArtifactUUID()); - this.setPayloadUpdateDate ( a.getPayloadUpdateDate()); - this.setHeatParamsUpdateDate ( a.getHeatParamsUpdateDate()); - this.setGenerated(a.getGenerated()); - this.setDuplicated(a.getDuplicated()); - if (a.getRequiredArtifacts() != null) - this.setRequiredArtifacts(new ArrayList<>(a.getRequiredArtifacts())); - if (a.getHeatParameters() != null) - this.setHeatParameters(new ArrayList<>(a.getHeatParameters())); - this.setGeneratedFromId( a.getGeneratedFromId()); - this.setIsFromCsar(a.getIsFromCsar()); - - - } - - public String getArtifactName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - - } - - public String getArtifactType() { - return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE); - } - - public void setArtifactType(String artifactType) { - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE, artifactType); - - } - - public String getArtifactRef() { - return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF); - - } - - public void setArtifactRef(String artifactRef) { - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF, artifactRef); - } - - public String getArtifactRepository() { - return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY); - - } - - public void setArtifactRepository(String artifactRepository) { - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY, artifactRepository); - } - - public void setArtifactName(String artifactName) { - setToscaPresentationValue(JsonPresentationFields.NAME, artifactName); - - } - - public String getArtifactChecksum() { - return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CHECKSUM); - } - - public void setArtifactChecksum(String artifactChecksum) { - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_CHECKSUM, artifactChecksum); - } - - public String getUserIdCreator() { - - return (String) getToscaPresentationValue(JsonPresentationFields.USER_ID_CREATOR); - } - - public void setUserIdCreator(String userIdCreator) { - setToscaPresentationValue(JsonPresentationFields.USER_ID_CREATOR, userIdCreator); - } - - public String getUserIdLastUpdater() { - return (String) getToscaPresentationValue(JsonPresentationFields.USER_ID_LAST_UPDATER); - } - - public void setUserIdLastUpdater(String userIdLastUpdater) { - setToscaPresentationValue(JsonPresentationFields.USER_ID_LAST_UPDATER, userIdLastUpdater); - } - - public String getCreatorFullName() { - return (String) getToscaPresentationValue(JsonPresentationFields.CREATOR_FULL_NAME); - } - - public void setCreatorFullName(String creatorFullName) { - setToscaPresentationValue(JsonPresentationFields.CREATOR_FULL_NAME, creatorFullName); - } - - public String getUpdaterFullName() { - return (String) getToscaPresentationValue(JsonPresentationFields.UPDATER_FULL_NAME); - } - - public void setUpdaterFullName(String updaterFullName) { - setToscaPresentationValue(JsonPresentationFields.UPDATER_FULL_NAME, updaterFullName); - } - - public Long getCreationDate() { - return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_DATE); - } - - public void setCreationDate(Long creationDate) { - setToscaPresentationValue(JsonPresentationFields.CREATION_DATE, creationDate); - } - - public Long getLastUpdateDate() { - return (Long) getToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE); - } - - public void setLastUpdateDate(Long lastUpdateDate) { - setToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate); - } - - public String getUniqueId() { - return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); - } - - public void setUniqueId(String uniqueId) { - setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); - } - - public String getDescription() { - return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); - } - - public void setDescription(String description) { - setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); - } - - public String getArtifactLabel() { - return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL); - } - - public void setArtifactLabel(String artifactLabel) { - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL, artifactLabel); - } - - public String getEsId() { - return (String) getToscaPresentationValue(JsonPresentationFields.ES_ID); - } - - public void setEsId(String esId) { - setToscaPresentationValue(JsonPresentationFields.ES_ID, esId); - } - - public String getArtifactCreator() { - return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CREATOR); - } - - public void setArtifactCreator(String artifactCreator) { - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_CREATOR, artifactCreator); - } - - public Boolean getMandatory() { - Boolean isMandatory = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_ABSTRACT); - return isMandatory == null? Boolean.FALSE: isMandatory; - } - - public void setMandatory(Boolean mandatory) { - setToscaPresentationValue(JsonPresentationFields.IS_ABSTRACT, mandatory); - } - - public String getArtifactDisplayName() { - return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_DISPLAY_NAME); - } - - public void setArtifactDisplayName(String artifactDisplayName) { - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_DISPLAY_NAME, artifactDisplayName); - } - - public String getApiUrl() { - return (String) getToscaPresentationValue(JsonPresentationFields.API_URL); - } - - public void setApiUrl(String apiUrl) { - setToscaPresentationValue(JsonPresentationFields.API_URL, apiUrl); - } - - public Boolean getServiceApi() { - Boolean serviceApi = (Boolean) getToscaPresentationValue(JsonPresentationFields.SERVICE_API); - return serviceApi == null? Boolean.FALSE: serviceApi; - } - - public void setServiceApi(Boolean serviceApi) { - setToscaPresentationValue(JsonPresentationFields.SERVICE_API, serviceApi); - } - - public ArtifactGroupTypeEnum getArtifactGroupType() { - ArtifactGroupTypeEnum artifactGroupType = null; - String groupType = (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_GROUP_TYPE); - if (groupType != null && !groupType.isEmpty()) { - - artifactGroupType = ArtifactGroupTypeEnum.findType(groupType); - } - return artifactGroupType; - } - - public void setArtifactGroupType(ArtifactGroupTypeEnum artifactGroupType) { - if(artifactGroupType != null) - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_GROUP_TYPE, artifactGroupType.getType()); - } - - public Integer getTimeout() { - return (Integer) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TIMEOUT); - } - - public void setTimeout(Integer timeout) { - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_TIMEOUT, timeout); - } - - public String getArtifactVersion() { - return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_VERSION); - } - - public void setArtifactVersion(String artifactVersion) { - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_VERSION, artifactVersion); - } - - public String getArtifactUUID() { - return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_UUID); - } - - public void setArtifactUUID(String artifactUUID) { - setToscaPresentationValue(JsonPresentationFields.ARTIFACT_UUID, artifactUUID); - } - - public Long getPayloadUpdateDate() { - return (Long) getToscaPresentationValue(JsonPresentationFields.PAYLOAD_UPDATE_DATE); - } - - public void setPayloadUpdateDate(Long payloadUpdateDate) { - setToscaPresentationValue(JsonPresentationFields.PAYLOAD_UPDATE_DATE, payloadUpdateDate); - } - - public Long getHeatParamsUpdateDate() { - return (Long) getToscaPresentationValue(JsonPresentationFields.HEAT_PARAMS_UPDATE_DATE); - } - - public void setHeatParamsUpdateDate(Long heatParamsUpdateDate) { - setToscaPresentationValue(JsonPresentationFields.HEAT_PARAMS_UPDATE_DATE, heatParamsUpdateDate); - } - - public List<String> getRequiredArtifacts() { - return (List<String>) getToscaPresentationValue(JsonPresentationFields.REQUIRED_ARTIFACTS); - } - - public void setRequiredArtifacts(List<String> requiredArtifacts) { - setToscaPresentationValue(JsonPresentationFields.REQUIRED_ARTIFACTS, requiredArtifacts); - } - - public Boolean getGenerated() { - Boolean generated = (Boolean) getToscaPresentationValue(JsonPresentationFields.GENERATED); - return generated == null ? Boolean.FALSE: generated; - } - - public void setGenerated(Boolean generated) { - setToscaPresentationValue(JsonPresentationFields.GENERATED, generated); - } - - public Boolean getDuplicated() { - Boolean duplicated = (Boolean) getToscaPresentationValue(JsonPresentationFields.DUPLICATED); - return duplicated == null ? Boolean.FALSE: duplicated; - } - - public void setDuplicated(Boolean duplicated) { - setToscaPresentationValue(JsonPresentationFields.DUPLICATED, duplicated); - } - - public List<HeatParameterDataDefinition> getHeatParameters() { - return (List<HeatParameterDataDefinition>) getToscaPresentationValue(JsonPresentationFields.HEAT_PARAMETERS); - } - - public void setHeatParameters(List<HeatParameterDataDefinition> properties) { - setToscaPresentationValue(JsonPresentationFields.HEAT_PARAMETERS, properties); - } - - public String getGeneratedFromId() { - return (String) getToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID); - } - public boolean getIsFromCsar(){ - Boolean isFromCsar = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR); - return isFromCsar == null ? Boolean.FALSE: isFromCsar; - } - public void setIsFromCsar(Boolean isFromCsar) { - setToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR, isFromCsar); - } - - public void setGeneratedFromId(String generatedFromId) { - setToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID, generatedFromId); - } - - - @Override - public String toString() { - return "ArtifactDataDefinition [uniqueId=" + getUniqueId() + ", artifactType=" + getArtifactType() + ", artifactRef=" + getArtifactRef() + ", artifactName=" + getArtifactName() + ", artifactRepository=" + getArtifactRepository() + ", artifactChecksum=" - + getArtifactChecksum() + ", userIdCreator=" + getUserIdCreator() + ", userIdLastUpdater=" + getUserIdLastUpdater() + ", creatorFullName=" + getCreatorFullName() + ", updaterFullName=" + getUpdaterFullName() + ", creationDate=" + getCreationDate() - + ", lastUpdateDate=" + getLastUpdateDate() + ", esId=" + getEsId() + ", artifactLabel=" + getArtifactLabel() + ", artifactCreator=" + getArtifactCreator() + ", description=" + getDescription() + ", mandatory=" + getMandatory() + ", artifactDisplayName=" - + getArtifactDisplayName() + ", apiUrl=" + getApiUrl() + ", serviceApi=" + getServiceApi() + ", artifactGroupType=" + getArtifactGroupType() + ", timeout=" + getTimeout() + ", artifactVersion=" + getArtifactVersion() + ", artifactUUID=" + getArtifactUUID() - + ", payloadUpdateDate=" + getPayloadUpdateDate() + ", heatParamsUpdateDate=" + getHeatParamsUpdateDate() + ", requiredArtifacts=" + getRequiredArtifacts() + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - - String apiUrl = getApiUrl(); - String artifactChecksum = getArtifactChecksum(); - String artifactCreator = getArtifactCreator(); - String artifactDisplayName = getArtifactDisplayName(); - ArtifactGroupTypeEnum artifactGroupType = getArtifactGroupType(); - String artifactLabel = getArtifactLabel(); - String artifactName = getArtifactName(); - String artifactRef = getArtifactRef(); - String artifactRepository = getArtifactRepository(); - String artifactType = getArtifactType(); - - String artifactUUID = getArtifactUUID(); - String artifactVersion = getArtifactVersion(); - String userIdCreator = getUserIdCreator(); - String userIdLastUpdater = getUserIdLastUpdater(); - Long creationDate = getCreationDate(); - - String creatorFullName = getCreatorFullName(); - String description = getDescription(); - String esId = getEsId(); - Long heatParamsUpdateDate = getHeatParamsUpdateDate(); - Long lastUpdateDate = getLastUpdateDate(); - Boolean mandatory = getMandatory(); - - Long payloadUpdateDate = getPayloadUpdateDate(); - List<String> requiredArtifacts = getRequiredArtifacts(); - Boolean serviceApi = getServiceApi(); - Integer timeout = getTimeout(); - String uniqueId = getUniqueId(); - String updaterFullName = getUpdaterFullName(); - - result = prime * result + ((apiUrl == null) ? 0 : apiUrl.hashCode()); - result = prime * result + ((artifactChecksum == null) ? 0 : artifactChecksum.hashCode()); - result = prime * result + ((artifactCreator == null) ? 0 : artifactCreator.hashCode()); - result = prime * result + ((artifactDisplayName == null) ? 0 : artifactDisplayName.hashCode()); - result = prime * result + ((artifactGroupType == null) ? 0 : artifactGroupType.hashCode()); - result = prime * result + ((artifactLabel == null) ? 0 : artifactLabel.hashCode()); - result = prime * result + ((artifactName == null) ? 0 : artifactName.hashCode()); - result = prime * result + ((artifactRef == null) ? 0 : artifactRef.hashCode()); - result = prime * result + ((artifactRepository == null) ? 0 : artifactRepository.hashCode()); - result = prime * result + ((artifactType == null) ? 0 : artifactType.hashCode()); - result = prime * result + ((artifactUUID == null) ? 0 : artifactUUID.hashCode()); - result = prime * result + ((artifactVersion == null) ? 0 : artifactVersion.hashCode()); - result = prime * result + ((userIdCreator == null) ? 0 : userIdCreator.hashCode()); - result = prime * result + ((userIdLastUpdater == null) ? 0 : userIdLastUpdater.hashCode()); - result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode()); - result = prime * result + ((creatorFullName == null) ? 0 : creatorFullName.hashCode()); - result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result + ((esId == null) ? 0 : esId.hashCode()); - result = prime * result + ((heatParamsUpdateDate == null) ? 0 : heatParamsUpdateDate.hashCode()); - result = prime * result + ((lastUpdateDate == null) ? 0 : lastUpdateDate.hashCode()); - result = prime * result + ((mandatory == null) ? 0 : mandatory.hashCode()); - result = prime * result + ((payloadUpdateDate == null) ? 0 : payloadUpdateDate.hashCode()); - result = prime * result + ((requiredArtifacts == null) ? 0 : requiredArtifacts.hashCode()); - result = prime * result + ((serviceApi == null) ? 0 : serviceApi.hashCode()); - result = prime * result + ((timeout == null) ? 0 : timeout.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - result = prime * result + ((updaterFullName == null) ? 0 : updaterFullName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ArtifactDataDefinition other = (ArtifactDataDefinition) obj; - if (getApiUrl() == null) { - if (other.getApiUrl() != null) - return false; - } else if (!getApiUrl().equals(other.getApiUrl())) - return false; - if (getArtifactChecksum() == null) { - if (other.getArtifactChecksum() != null) - return false; - } else if (!getArtifactChecksum().equals(other.getArtifactChecksum())) - return false; - if (getArtifactCreator() == null) { - if (other.getArtifactCreator() != null) - return false; - } else if (!getArtifactCreator().equals(other.getArtifactCreator())) - return false; - if (getArtifactDisplayName() == null) { - if (other.getArtifactDisplayName() != null) - return false; - } else if (!getArtifactDisplayName().equals(other.getArtifactDisplayName())) - return false; - if (getArtifactGroupType() != other.getArtifactGroupType()) - return false; - if (getArtifactLabel() == null) { - if (other.getArtifactLabel() != null) - return false; - } else if (!getArtifactLabel().equals(other.getArtifactLabel())) - return false; - if (getArtifactName() == null) { - if (other.getArtifactName() != null) - return false; - } else if (!getArtifactName().equals(other.getArtifactName())) - return false; - if (getArtifactRef() == null) { - if (other.getArtifactRef() != null) - return false; - } else if (!getArtifactRef().equals(other.getArtifactRef())) - return false; - if (getArtifactRepository() == null) { - if (other.getArtifactRepository() != null) - return false; - } else if (!getArtifactRepository().equals(other.getArtifactRepository())) - return false; - if (getArtifactType() == null) { - if (other.getArtifactType() != null) - return false; - } else if (!getArtifactType().equals(other.getArtifactType())) - return false; - if (getArtifactUUID() == null) { - if (other.getArtifactUUID() != null) - return false; - } else if (!getArtifactUUID().equals(other.getArtifactUUID())) - return false; - if (getArtifactVersion() == null) { - if (other.getArtifactVersion() != null) - return false; - } else if (!getArtifactVersion().equals(other.getArtifactVersion())) - return false; - if (getUserIdCreator() == null) { - if (other.getUserIdCreator() != null) - return false; - } else if (!getUserIdCreator().equals(other.getUserIdCreator())) - return false; - if (getUserIdLastUpdater() == null) { - if (other.getUserIdLastUpdater() != null) - return false; - } else if (!getUserIdLastUpdater().equals(other.getUserIdLastUpdater())) - return false; - if (getCreationDate() == null) { - if (other.getCreationDate() != null) - return false; - } else if (!getCreationDate().equals(other.getCreationDate())) - return false; - if (getCreatorFullName() == null) { - if (other.getCreatorFullName() != null) - return false; - } else if (!getCreatorFullName().equals(other.getCreatorFullName())) - return false; - if (getDescription() == null) { - if (other.getDescription() != null) - return false; - } else if (!getDescription().equals(other.getDescription())) - return false; - if (getEsId() == null) { - if (other.getEsId() != null) - return false; - } else if (!getEsId().equals(other.getEsId())) - return false; - if (getHeatParamsUpdateDate() == null) { - if (other.getHeatParamsUpdateDate() != null) - return false; - } else if (!getHeatParamsUpdateDate().equals(other.getHeatParamsUpdateDate())) - return false; - if (getLastUpdateDate() == null) { - if (other.getLastUpdateDate() != null) - return false; - } else if (!getLastUpdateDate().equals(other.getLastUpdateDate())) - return false; - if (getMandatory() == null) { - if (other.getMandatory() != null) - return false; - } else if (!getMandatory().equals(other.getMandatory())) - return false; - if (getPayloadUpdateDate() == null) { - if (other.getPayloadUpdateDate() != null) - return false; - } else if (!getPayloadUpdateDate().equals(other.getPayloadUpdateDate())) - return false; - if (getRequiredArtifacts() == null) { - if (other.getRequiredArtifacts() != null) - return false; - } else if (!getRequiredArtifacts().equals(other.getRequiredArtifacts())) - return false; - if (getServiceApi() == null) { - if (other.getServiceApi() != null) - return false; - } else if (!getServiceApi().equals(other.getServiceApi())) - return false; - if (getTimeout() == null) { - if (other.getTimeout() != null) - return false; - } else if (!getTimeout().equals(other.getTimeout())) - return false; - if (getUniqueId() == null) { - if (other.getUniqueId() != null) - return false; - } else if (!getUniqueId().equals(other.getUniqueId())) - return false; - if (getUpdaterFullName() == null) { - if (other.getUpdaterFullName() != null) - return false; - } else if (!getUpdaterFullName().equals(other.getUpdaterFullName())) - return false; - return true; - } + public ArtifactDataDefinition() { + setArtifactVersion("0"); + } + + public ArtifactDataDefinition(Map<String, Object> art) { + super(art); + setArtifactVersion("0"); + } + + + public ArtifactDataDefinition(ArtifactDataDefinition a) { + this.setUniqueId(a.getUniqueId()); + this.setArtifactType(a.getArtifactType()); + this.setArtifactRef(a.getArtifactRef()); + this.setArtifactName(a.getArtifactName()); + this.setArtifactRepository(a.getArtifactRepository()); + this.setArtifactChecksum(a.getArtifactChecksum()); + this.setUserIdCreator(a.getUserIdCreator()); + this.setUserIdLastUpdater(a.getUserIdLastUpdater()); + this.setCreatorFullName(a.getCreatorFullName()); + this.setUpdaterFullName(a.getUpdaterFullName()); + this.setCreationDate(a.getCreationDate()); + this.setLastUpdateDate(a.getLastUpdateDate()); + this.setDescription(a.getDescription()); + this.setEsId(a.getEsId()); + this.setArtifactLabel(a.getArtifactLabel()); + this.setArtifactCreator(a.getArtifactCreator()); + this.setMandatory(a.getMandatory()); + this.setArtifactDisplayName(a.getArtifactDisplayName()); + this.setApiUrl(a.getApiUrl()); + this.setServiceApi(a.getServiceApi()); + this.setArtifactGroupType(a.getArtifactGroupType()); + this.setTimeout(a.getTimeout()); + this.setArtifactVersion(a.getArtifactVersion()); + this.setArtifactUUID(a.getArtifactUUID()); + this.setPayloadUpdateDate(a.getPayloadUpdateDate()); + this.setHeatParamsUpdateDate(a.getHeatParamsUpdateDate()); + this.setGenerated(a.getGenerated()); + this.setDuplicated(a.getDuplicated()); + if (a.getRequiredArtifacts() != null) { + this.setRequiredArtifacts(new ArrayList<>(a.getRequiredArtifacts())); + } + if (a.getHeatParameters() != null) { + this.setHeatParameters(new ArrayList<>(a.getHeatParameters())); + } + this.setGeneratedFromId(a.getGeneratedFromId()); + this.setIsFromCsar(a.getIsFromCsar()); + + + } + + public String getArtifactName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + + } + + public String getArtifactType() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE); + } + + public void setArtifactType(String artifactType) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE, artifactType); + + } + + public String getArtifactRef() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF); + + } + + public void setArtifactRef(String artifactRef) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF, artifactRef); + } + + public String getArtifactRepository() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY); + + } + + public void setArtifactRepository(String artifactRepository) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY, artifactRepository); + } + + public void setArtifactName(String artifactName) { + setToscaPresentationValue(JsonPresentationFields.NAME, artifactName); + + } + + public String getArtifactChecksum() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CHECKSUM); + } + + public void setArtifactChecksum(String artifactChecksum) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_CHECKSUM, artifactChecksum); + } + + public String getUserIdCreator() { + + return (String) getToscaPresentationValue(JsonPresentationFields.USER_ID_CREATOR); + } + + public void setUserIdCreator(String userIdCreator) { + setToscaPresentationValue(JsonPresentationFields.USER_ID_CREATOR, userIdCreator); + } + + public String getUserIdLastUpdater() { + return (String) getToscaPresentationValue(JsonPresentationFields.USER_ID_LAST_UPDATER); + } + + public void setUserIdLastUpdater(String userIdLastUpdater) { + setToscaPresentationValue(JsonPresentationFields.USER_ID_LAST_UPDATER, userIdLastUpdater); + } + + public String getCreatorFullName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CREATOR_FULL_NAME); + } + + public void setCreatorFullName(String creatorFullName) { + setToscaPresentationValue(JsonPresentationFields.CREATOR_FULL_NAME, creatorFullName); + } + + public String getUpdaterFullName() { + return (String) getToscaPresentationValue(JsonPresentationFields.UPDATER_FULL_NAME); + } + + public void setUpdaterFullName(String updaterFullName) { + setToscaPresentationValue(JsonPresentationFields.UPDATER_FULL_NAME, updaterFullName); + } + + public Long getCreationDate() { + return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_DATE); + } + + public void setCreationDate(Long creationDate) { + setToscaPresentationValue(JsonPresentationFields.CREATION_DATE, creationDate); + } + + public Long getLastUpdateDate() { + return (Long) getToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE); + } + + public void setLastUpdateDate(Long lastUpdateDate) { + setToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate); + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + public String getArtifactLabel() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL); + } + + public void setArtifactLabel(String artifactLabel) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL, artifactLabel); + } + + public String getEsId() { + return (String) getToscaPresentationValue(JsonPresentationFields.ES_ID); + } + + public void setEsId(String esId) { + setToscaPresentationValue(JsonPresentationFields.ES_ID, esId); + } + + public String getArtifactCreator() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CREATOR); + } + + public void setArtifactCreator(String artifactCreator) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_CREATOR, artifactCreator); + } + + public Boolean getMandatory() { + Boolean isMandatory = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_ABSTRACT); + return isMandatory == null ? Boolean.FALSE : isMandatory; + } + + public void setMandatory(Boolean mandatory) { + setToscaPresentationValue(JsonPresentationFields.IS_ABSTRACT, mandatory); + } + + public String getArtifactDisplayName() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_DISPLAY_NAME); + } + + public void setArtifactDisplayName(String artifactDisplayName) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_DISPLAY_NAME, artifactDisplayName); + } + + public String getApiUrl() { + return (String) getToscaPresentationValue(JsonPresentationFields.API_URL); + } + + public void setApiUrl(String apiUrl) { + setToscaPresentationValue(JsonPresentationFields.API_URL, apiUrl); + } + + public Boolean getServiceApi() { + Boolean serviceApi = (Boolean) getToscaPresentationValue(JsonPresentationFields.SERVICE_API); + return serviceApi == null ? Boolean.FALSE : serviceApi; + } + + public void setServiceApi(Boolean serviceApi) { + setToscaPresentationValue(JsonPresentationFields.SERVICE_API, serviceApi); + } + + public ArtifactGroupTypeEnum getArtifactGroupType() { + ArtifactGroupTypeEnum artifactGroupType = null; + String groupType = (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_GROUP_TYPE); + if (groupType != null && !groupType.isEmpty()) { + artifactGroupType = ArtifactGroupTypeEnum.findType(groupType); + } + return artifactGroupType; + } + + public void setArtifactGroupType(ArtifactGroupTypeEnum artifactGroupType) { + if (artifactGroupType != null) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_GROUP_TYPE, artifactGroupType.getType()); + } + } + + public Integer getTimeout() { + return (Integer) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TIMEOUT); + } + + public void setTimeout(Integer timeout) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_TIMEOUT, timeout); + } + + public String getArtifactVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_VERSION); + } + + public void setArtifactVersion(String artifactVersion) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_VERSION, artifactVersion); + } + + public String getArtifactUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_UUID); + } + + public void setArtifactUUID(String artifactUUID) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_UUID, artifactUUID); + } + + public Long getPayloadUpdateDate() { + return (Long) getToscaPresentationValue(JsonPresentationFields.PAYLOAD_UPDATE_DATE); + } + + public void setPayloadUpdateDate(Long payloadUpdateDate) { + setToscaPresentationValue(JsonPresentationFields.PAYLOAD_UPDATE_DATE, payloadUpdateDate); + } + + public Long getHeatParamsUpdateDate() { + return (Long) getToscaPresentationValue(JsonPresentationFields.HEAT_PARAMS_UPDATE_DATE); + } + + public void setHeatParamsUpdateDate(Long heatParamsUpdateDate) { + setToscaPresentationValue(JsonPresentationFields.HEAT_PARAMS_UPDATE_DATE, heatParamsUpdateDate); + } + + public List<String> getRequiredArtifacts() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.REQUIRED_ARTIFACTS); + } + + public void setRequiredArtifacts(List<String> requiredArtifacts) { + setToscaPresentationValue(JsonPresentationFields.REQUIRED_ARTIFACTS, requiredArtifacts); + } + + public Boolean getGenerated() { + Boolean generated = (Boolean) getToscaPresentationValue(JsonPresentationFields.GENERATED); + return generated == null ? Boolean.FALSE : generated; + } + + public void setGenerated(Boolean generated) { + setToscaPresentationValue(JsonPresentationFields.GENERATED, generated); + } + + public Boolean getDuplicated() { + Boolean duplicated = (Boolean) getToscaPresentationValue(JsonPresentationFields.DUPLICATED); + return duplicated == null ? Boolean.FALSE : duplicated; + } + + public void setDuplicated(Boolean duplicated) { + setToscaPresentationValue(JsonPresentationFields.DUPLICATED, duplicated); + } + + public List<HeatParameterDataDefinition> getHeatParameters() { + return (List<HeatParameterDataDefinition>) getToscaPresentationValue(JsonPresentationFields.HEAT_PARAMETERS); + } + + public void setHeatParameters(List<HeatParameterDataDefinition> properties) { + setToscaPresentationValue(JsonPresentationFields.HEAT_PARAMETERS, properties); + } + + public String getGeneratedFromId() { + return (String) getToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID); + } + + public boolean getIsFromCsar() { + Boolean isFromCsar = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR); + return isFromCsar == null ? Boolean.FALSE : isFromCsar; + } + + public void setIsFromCsar(Boolean isFromCsar) { + setToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR, isFromCsar); + } + + public void setGeneratedFromId(String generatedFromId) { + setToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID, generatedFromId); + } + + + @Override + public String toString() { + return "ArtifactDataDefinition [uniqueId=" + getUniqueId() + ", artifactType=" + getArtifactType() + ", artifactRef=" + getArtifactRef() + ", artifactName=" + getArtifactName() + ", artifactRepository=" + getArtifactRepository() + ", artifactChecksum=" + + getArtifactChecksum() + ", userIdCreator=" + getUserIdCreator() + ", userIdLastUpdater=" + getUserIdLastUpdater() + ", creatorFullName=" + getCreatorFullName() + ", updaterFullName=" + getUpdaterFullName() + ", creationDate=" + getCreationDate() + + ", lastUpdateDate=" + getLastUpdateDate() + ", esId=" + getEsId() + ", artifactLabel=" + getArtifactLabel() + ", artifactCreator=" + getArtifactCreator() + ", description=" + getDescription() + ", mandatory=" + getMandatory() + ", artifactDisplayName=" + + getArtifactDisplayName() + ", apiUrl=" + getApiUrl() + ", serviceApi=" + getServiceApi() + ", artifactGroupType=" + getArtifactGroupType() + ", timeout=" + getTimeout() + ", artifactVersion=" + getArtifactVersion() + ", artifactUUID=" + getArtifactUUID() + + ", payloadUpdateDate=" + getPayloadUpdateDate() + ", heatParamsUpdateDate=" + getHeatParamsUpdateDate() + ", requiredArtifacts=" + getRequiredArtifacts() + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + + String apiUrl = getApiUrl(); + String artifactChecksum = getArtifactChecksum(); + String artifactCreator = getArtifactCreator(); + String artifactDisplayName = getArtifactDisplayName(); + ArtifactGroupTypeEnum artifactGroupType = getArtifactGroupType(); + String artifactLabel = getArtifactLabel(); + String artifactName = getArtifactName(); + String artifactRef = getArtifactRef(); + String artifactRepository = getArtifactRepository(); + String artifactType = getArtifactType(); + + String artifactUUID = getArtifactUUID(); + String artifactVersion = getArtifactVersion(); + String userIdCreator = getUserIdCreator(); + String userIdLastUpdater = getUserIdLastUpdater(); + Long creationDate = getCreationDate(); + + String creatorFullName = getCreatorFullName(); + String description = getDescription(); + String esId = getEsId(); + Long heatParamsUpdateDate = getHeatParamsUpdateDate(); + Long lastUpdateDate = getLastUpdateDate(); + Boolean mandatory = getMandatory(); + + Long payloadUpdateDate = getPayloadUpdateDate(); + List<String> requiredArtifacts = getRequiredArtifacts(); + Boolean serviceApi = getServiceApi(); + Integer timeout = getTimeout(); + String uniqueId = getUniqueId(); + String updaterFullName = getUpdaterFullName(); + + result = prime * result + ((apiUrl == null) ? 0 : apiUrl.hashCode()); + result = prime * result + ((artifactChecksum == null) ? 0 : artifactChecksum.hashCode()); + result = prime * result + ((artifactCreator == null) ? 0 : artifactCreator.hashCode()); + result = prime * result + ((artifactDisplayName == null) ? 0 : artifactDisplayName.hashCode()); + result = prime * result + ((artifactGroupType == null) ? 0 : artifactGroupType.hashCode()); + result = prime * result + ((artifactLabel == null) ? 0 : artifactLabel.hashCode()); + result = prime * result + ((artifactName == null) ? 0 : artifactName.hashCode()); + result = prime * result + ((artifactRef == null) ? 0 : artifactRef.hashCode()); + result = prime * result + ((artifactRepository == null) ? 0 : artifactRepository.hashCode()); + result = prime * result + ((artifactType == null) ? 0 : artifactType.hashCode()); + result = prime * result + ((artifactUUID == null) ? 0 : artifactUUID.hashCode()); + result = prime * result + ((artifactVersion == null) ? 0 : artifactVersion.hashCode()); + result = prime * result + ((userIdCreator == null) ? 0 : userIdCreator.hashCode()); + result = prime * result + ((userIdLastUpdater == null) ? 0 : userIdLastUpdater.hashCode()); + result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode()); + result = prime * result + ((creatorFullName == null) ? 0 : creatorFullName.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((esId == null) ? 0 : esId.hashCode()); + result = prime * result + ((heatParamsUpdateDate == null) ? 0 : heatParamsUpdateDate.hashCode()); + result = prime * result + ((lastUpdateDate == null) ? 0 : lastUpdateDate.hashCode()); + result = prime * result + ((mandatory == null) ? 0 : mandatory.hashCode()); + result = prime * result + ((payloadUpdateDate == null) ? 0 : payloadUpdateDate.hashCode()); + result = prime * result + ((requiredArtifacts == null) ? 0 : requiredArtifacts.hashCode()); + result = prime * result + ((serviceApi == null) ? 0 : serviceApi.hashCode()); + result = prime * result + ((timeout == null) ? 0 : timeout.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + result = prime * result + ((updaterFullName == null) ? 0 : updaterFullName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ArtifactDataDefinition other = (ArtifactDataDefinition) obj; + if (getApiUrl() == null) { + if (other.getApiUrl() != null) { + return false; + } + } else if (!getArtifactRepository().equals(other.getArtifactRepository())) { + return false; + } + if (getArtifactType() == null) { + if (other.getArtifactType() != null) { + return false; + } + } else if (!getArtifactType().equals(other.getArtifactType())) { + return false; + } + if (getArtifactUUID() == null) { + if (other.getArtifactUUID() != null) { + return false; + } + } else if (!getArtifactUUID().equals(other.getArtifactUUID())) { + return false; + } + if (getArtifactVersion() == null) { + if (other.getArtifactVersion() != null) { + return false; + } + } else if (!getArtifactVersion().equals(other.getArtifactVersion())) { + return false; + } + if (getUserIdCreator() == null) { + if (other.getUserIdCreator() != null) { + return false; + } + } else if (!getUserIdCreator().equals(other.getUserIdCreator())) { + return false; + } + if (getUserIdLastUpdater() == null) { + if (other.getUserIdLastUpdater() != null) { + return false; + } + } else if (!getUserIdLastUpdater().equals(other.getUserIdLastUpdater())) { + return false; + } + if (getCreationDate() == null) { + if (other.getCreationDate() != null) { + return false; + } + } else if (!getCreationDate().equals(other.getCreationDate())) { + return false; + } + if (getCreatorFullName() == null) { + if (other.getCreatorFullName() != null) { + return false; + } + } else if (!getCreatorFullName().equals(other.getCreatorFullName())) { + return false; + } + if (getDescription() == null) { + if (other.getDescription() != null) { + return false; + } + } else if (!getDescription().equals(other.getDescription())) { + return false; + } + if (getEsId() == null) { + if (other.getEsId() != null) { + return false; + } + } else if (!getEsId().equals(other.getEsId())) { + return false; + } + if (getHeatParamsUpdateDate() == null) { + if (other.getHeatParamsUpdateDate() != null) { + return false; + } + } else if (!getHeatParamsUpdateDate().equals(other.getHeatParamsUpdateDate())) { + return false; + } + if (getLastUpdateDate() == null) { + if (other.getLastUpdateDate() != null) { + return false; + } + } else if (!getLastUpdateDate().equals(other.getLastUpdateDate())) { + return false; + } + if (getMandatory() == null) { + if (other.getMandatory() != null) { + return false; + } + } else if (!getMandatory().equals(other.getMandatory())) { + return false; + } + if (getPayloadUpdateDate() == null) { + if (other.getPayloadUpdateDate() != null) { + return false; + } + } else if (!getPayloadUpdateDate().equals(other.getPayloadUpdateDate())) { + return false; + } + if (getRequiredArtifacts() == null) { + if (other.getRequiredArtifacts() != null) { + return false; + } + } else if (!getRequiredArtifacts().equals(other.getRequiredArtifacts())) { + return false; + } + if (getServiceApi() == null) { + if (other.getServiceApi() != null) { + return false; + } + } else if (!getServiceApi().equals(other.getServiceApi())) { + return false; + } + if (getTimeout() == null) { + if (other.getTimeout() != null) { + return false; + } + } else if (!getTimeout().equals(other.getTimeout())) { + return false; + } + if (getUniqueId() == null) { + if (other.getUniqueId() != null) { + return false; + } + } else if (!getUniqueId().equals(other.getUniqueId())) { + return false; + } + if (getUpdaterFullName() == null) { + if (other.getUpdaterFullName() != null) { + return false; + } + } else if (!getUpdaterFullName().equals(other.getUpdaterFullName())) { + return false; + } + return true; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CINodeFilterDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CINodeFilterDataDefinition.java index ffad1a4c16..22055e0620 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CINodeFilterDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CINodeFilterDataDefinition.java @@ -16,17 +16,18 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; -import java.io.Serializable; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.io.Serializable; + public class CINodeFilterDataDefinition extends ToscaDataDefinition implements Serializable { @JsonCreator public CINodeFilterDataDefinition() { } - public CINodeFilterDataDefinition(CINodeFilterDataDefinition inData){ + public CINodeFilterDataDefinition(CINodeFilterDataDefinition inData) { super(); this.setID(inData.getID()); this.setName(inData.getName()); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java index 2612e6f888..78bfe50d5c 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java @@ -59,15 +59,13 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { if (other.getValidSourceTypes() == null) { this.setValidSourceTypes(Lists.newArrayList()); - } - else { + } else { this.setValidSourceTypes(Lists.newArrayList(other.getValidSourceTypes())); } if (other.getCapabilitySources() == null) { this.setCapabilitySources(Lists.newArrayList()); - } - else { + } else { this.setCapabilitySources(Lists.newArrayList(other.getCapabilitySources())); } @@ -80,26 +78,26 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { if (other.getPath() == null) { this.setPath(Lists.newArrayList()); - } - else { + } else { this.setPath(Lists.newArrayList(other.getPath())); } this.setSource(other.getSource()); - this.setOwnerType(other.getOwnerType()); - } - - public CapabilityDataDefinition(CapabilityTypeDataDefinition other) { - super(); - this.setUniqueId(other.getUniqueId()); - this.setType(other.getType()); - this.setDescription(other.getDescription()); + this.setOwnerType(other.getOwnerType()); + } + + public CapabilityDataDefinition(CapabilityTypeDataDefinition other) { + super(); + this.setUniqueId(other.getUniqueId()); + this.setType(other.getType()); + this.setDescription(other.getDescription()); + this.setOwnerId(other.getOwnerId()); + if (other.getValidSourceTypes() == null) { + this.setValidSourceTypes(Lists.newArrayList()); + } else { + this.setValidSourceTypes(Lists.newArrayList(other.getValidSourceTypes())); + } this.setOwnerId(other.getOwnerId()); - if(other.getValidSourceTypes() == null) - this.setValidSourceTypes(Lists.newArrayList()); - else - this.setValidSourceTypes(Lists.newArrayList(other.getValidSourceTypes())); - this.setOwnerId(other.getOwnerId()); } @Override @@ -120,14 +118,15 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.OWNER_NAME, ownerName); } - public OwnerType getOwnerType() { - return OwnerType.getByValue((String) getToscaPresentationValue(JsonPresentationFields.OWNER_TYPE)); - } + public OwnerType getOwnerType() { + return OwnerType.getByValue((String) getToscaPresentationValue(JsonPresentationFields.OWNER_TYPE)); + } - public void setOwnerType(OwnerType ownerType) { - if(ownerType != null) - setToscaPresentationValue(JsonPresentationFields.OWNER_TYPE, ownerType.getValue()); - } + public void setOwnerType(OwnerType ownerType) { + if (ownerType != null) { + setToscaPresentationValue(JsonPresentationFields.OWNER_TYPE, ownerType.getValue()); + } + } public String getMinOccurrences() { return (String) getToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES); @@ -321,107 +320,91 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { if (other.getCapabilitySources() != null) { return false; } - } - else if (!capabilitySources.equals(other.getCapabilitySources())) { + } else if (!capabilitySources.equals(other.getCapabilitySources())) { return false; } if (description == null) { if (other.getDescription() != null) { return false; } - } - else if (!description.equals(other.getDescription())) { + } else if (!description.equals(other.getDescription())) { return false; } if (maxOccurrences == null) { if (other.getMaxOccurrences() != null) { return false; } - } - else if (!maxOccurrences.equals(other.getMaxOccurrences())) { + } else if (!maxOccurrences.equals(other.getMaxOccurrences())) { return false; } if (minOccurrences == null) { if (other.getMinOccurrences() != null) { return false; } - } - else if (!minOccurrences.equals(other.getMinOccurrences())) { + } else if (!minOccurrences.equals(other.getMinOccurrences())) { return false; } if (name == null) { if (other.getName() != null) { return false; } - } - else if (!name.equals(other.getName())) { + } else if (!name.equals(other.getName())) { return false; } if (ownerId == null) { if (other.getOwnerId() != null) { return false; } - } - else if (!ownerId.equals(other.getOwnerId())) { + } else if (!ownerId.equals(other.getOwnerId())) { return false; } if (ownerName == null) { if (other.getOwnerName() != null) { return false; } - } - else if (!ownerName.equals(other.getOwnerName())) { + } else if (!ownerName.equals(other.getOwnerName())) { return false; } if (type == null) { if (other.getType() != null) { return false; } - } - else if (!type.equals(other.getType())) { + } else if (!type.equals(other.getType())) { return false; } if (uniqueId == null) { if (other.getUniqueId() != null) { return false; } - } - else if (!uniqueId.equals(other.getUniqueId())) { + } else if (!uniqueId.equals(other.getUniqueId())) { return false; } if (validSourceTypes == null) { if (other.getValidSourceTypes() != null) { return false; } - } - else if (!validSourceTypes.equals(other.getValidSourceTypes())) { + } else if (!validSourceTypes.equals(other.getValidSourceTypes())) { return false; } if (leftOccurrences == null) { if (other.getLeftOccurrences() != null) { return false; } - } - else if (!leftOccurrences.equals(other.getLeftOccurrences())) { + } else if (!leftOccurrences.equals(other.getLeftOccurrences())) { return false; } if (path == null) { if (other.getPath() != null) { return false; } - } - else if (!path.equals(other.getPath())) { + } else if (!path.equals(other.getPath())) { return false; } if (source == null) { - if (other.getSource() != null) { - return false; - } + return other.getSource() == null; + } else { + return source.equals(other.getSource()); } - else if (!source.equals(other.getSource())) { - return false; - } - return true; } @Override @@ -444,29 +427,31 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { + ", type=" + type + ", validSourceTypes=" + validSourceTypes + ", capabilitySources=" + capabilitySources + ", ownerId=" + ownerId + ", ownerName=" + ownerName + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + maxOccurrences + ", path=" + path + ", source=" + source + "]"; - } + } - public enum OwnerType{ - GROUP("group"), - COMPONENT_INSTANCE("component instance"), - RESOURCE("resource"); + public enum OwnerType { + GROUP("group"), + COMPONENT_INSTANCE("component instance"), + RESOURCE("resource"); - private String value; + private String value; - private OwnerType(String value) { - this.value = value; - } + OwnerType(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public static OwnerType getByValue(String value){ - for(OwnerType type : values()) - if(type.getValue().equals(value)) + public static OwnerType getByValue(String value) { + for (OwnerType type : values()) { + if (type.getValue().equals(value)) { return type; - return null; - } + } + } + return null; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java index ac3e5d2fab..36b3f0d9bc 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,89 +27,89 @@ import java.util.List; public class CapabilityTypeDataDefinition extends ToscaDataDefinition { - public CapabilityTypeDataDefinition(CapabilityTypeDataDefinition cdt) { - this.setUniqueId(cdt.getUniqueId()); - this.setDescription ( cdt.getDescription()); - this.setType(cdt.getType()); - this.setValidSourceTypes( cdt.getValidSourceTypes()); - this.setVersion( cdt.getVersion()); - this.setCreationTime (cdt.getCreationTime()); - this.setModificationTime (cdt.getModificationTime()); - } - - public CapabilityTypeDataDefinition() { - super(); - } - - public String getUniqueId() { - return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); - } - - public void setUniqueId(String uniqueId) { - setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); - } - - public String getDescription() { - return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); - } - - public void setDescription(String description) { - setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); - } - - public String getType() { - return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); - } - - public void setType(String type) { - setToscaPresentationValue(JsonPresentationFields.TYPE, type); - } - - public List<String> getValidSourceTypes() { - return (List<String> ) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE); - } - - public void setValidSourceTypes(List<String> validSourceTypes) { - setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE, validSourceTypes); - } - - public String getVersion() { - return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); - } - - public void setVersion(String version) { - setToscaPresentationValue(JsonPresentationFields.VERSION, version); - } - - public Long getCreationTime() { - return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); - } - - public void setCreationTime(Long creationTime) { - setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); - } - - public Long getModificationTime() { - return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); - } - - public void setModificationTime(Long modificationTime) { - setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); - } - - @Override - public String toString() { - String uniqueId = getUniqueId(); - String description = getDescription(); - String type = getType(); - List<String> validSourceTypes = getValidSourceTypes(); - String version = getVersion(); - Long creationTime = getCreationTime(); - Long modificationTime = getModificationTime(); - - return "CapabilityTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type - + ", validSourceTypes=" + validSourceTypes + ", version=" + version + ", creationTime=" + creationTime - + ", modificationTime=" + modificationTime + "]"; - } + public CapabilityTypeDataDefinition(CapabilityTypeDataDefinition cdt) { + this.setUniqueId(cdt.getUniqueId()); + this.setDescription(cdt.getDescription()); + this.setType(cdt.getType()); + this.setValidSourceTypes(cdt.getValidSourceTypes()); + this.setVersion(cdt.getVersion()); + this.setCreationTime(cdt.getCreationTime()); + this.setModificationTime(cdt.getModificationTime()); + } + + public CapabilityTypeDataDefinition() { + super(); + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + public String getType() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public void setType(String type) { + setToscaPresentationValue(JsonPresentationFields.TYPE, type); + } + + public List<String> getValidSourceTypes() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE); + } + + public void setValidSourceTypes(List<String> validSourceTypes) { + setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE, validSourceTypes); + } + + public String getVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); + } + + public void setVersion(String version) { + setToscaPresentationValue(JsonPresentationFields.VERSION, version); + } + + public Long getCreationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); + } + + public void setCreationTime(Long creationTime) { + setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); + } + + public Long getModificationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); + } + + public void setModificationTime(Long modificationTime) { + setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); + } + + @Override + public String toString() { + String uniqueId = getUniqueId(); + String description = getDescription(); + String type = getType(); + List<String> validSourceTypes = getValidSourceTypes(); + String version = getVersion(); + Long creationTime = getCreationTime(); + Long modificationTime = getModificationTime(); + + return "CapabilityTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + + ", validSourceTypes=" + validSourceTypes + ", version=" + version + ", creationTime=" + creationTime + + ", modificationTime=" + modificationTime + "]"; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java index 5354d31eb2..d701b0f6ca 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,298 +20,302 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.common.util.ValidationUtils; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + public class ComponentInstanceDataDefinition extends ToscaDataDefinition { - public ComponentInstanceDataDefinition() { - setPropertyValueCounter(1); - setAttributeValueCounter(1); - setInputValueCounter(1); - setIsProxy(false); - } - - public ComponentInstanceDataDefinition(ComponentInstanceDataDefinition dataDefinition) { - setIcon(dataDefinition.getIcon()); - setUniqueId(dataDefinition.getUniqueId()); - setName(dataDefinition.getName()); - setComponentUid(dataDefinition.getComponentUid()); - setCreationTime(dataDefinition.getCreationTime()); - setModificationTime(dataDefinition.getModificationTime()); - setDescription(dataDefinition.getDescription()); - setPosX(dataDefinition.getPosX()); - setPosY(dataDefinition.getPosY()); - setPropertyValueCounter(dataDefinition.getPropertyValueCounter()); - setNormalizedName(dataDefinition.getNormalizedName()); - setOriginType(dataDefinition.getOriginType()); - setCustomizationUUID(dataDefinition.getCustomizationUUID()); - setComponentName(dataDefinition.getComponentName()); - setComponentVersion(dataDefinition.getComponentVersion()); - setToscaComponentName(dataDefinition.getToscaComponentName()); - setInvariantName(dataDefinition.getInvariantName()); - setSourceModelInvariant(dataDefinition.getSourceModelInvariant()); - setSourceModelName(dataDefinition.getSourceModelName()); - setSourceModelUuid(dataDefinition.getSourceModelUuid()); - setSourceModelUid(dataDefinition.getSourceModelUid()); - setIsProxy(dataDefinition.getIsProxy()); - setDirectives(dataDefinition.getDirectives()); - setOriginArchived(dataDefinition.isOriginArchived()); - } - - public String getIcon() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_ICON); - } - - public void setIcon(String icon) { - setToscaPresentationValue(JsonPresentationFields.CI_ICON, icon); - } - - public String getUniqueId() { - return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); - } - - public void setUniqueId(String uniqueId) { - setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); - } - - public Long getCreationTime() { - return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); - } - - public void setCreationTime(Long creationTime) { - setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); - } - - public Long getModificationTime() { - return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); - } - - public void setModificationTime(Long modificationTime) { - setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); - } - - public String getDescription() { - return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); - } - - public void setDescription(String description) { - setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); - } - - public String getPosX() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_POS_X); - } - - public void setPosX(String posX) { - setToscaPresentationValue(JsonPresentationFields.CI_POS_X, posX); - } - - public String getPosY() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_POS_Y); - } - - public void setPosY(String posY) { - setToscaPresentationValue(JsonPresentationFields.CI_POS_Y, posY); - } - - public String getComponentUid() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID); - } - - public void setComponentUid(String resourceUid) { - setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID, resourceUid); - } - - public String getName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } - - public void setName(String name) { - if (this.getInvariantName() == null && name != null) { - this.setInvariantName(ValidationUtils.normalizeComponentInstanceName(name)); - } - setToscaPresentationValue(JsonPresentationFields.NAME, name); - } - - public String getInvariantName() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME); - } - - public void setInvariantName(String invariantName) { - setToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME, invariantName); - } - - public Integer getPropertyValueCounter() { - return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_PROP_VALUE_COUNTER); - } - - public void setPropertyValueCounter(Integer propertyValueCounter) { - setToscaPresentationValue(JsonPresentationFields.CI_PROP_VALUE_COUNTER, propertyValueCounter); - } - - public String getNormalizedName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME); - } - - public void setNormalizedName(String normalizedName) { - setToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME, normalizedName); - } - - public OriginTypeEnum getOriginType() { - OriginTypeEnum originType = null; - String origType = (String) getToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE); - if (origType != null && !origType.isEmpty()) { - - originType = OriginTypeEnum.findByValue(origType); - } - return originType; - } - - public void setOriginType(OriginTypeEnum originType) { - if (originType != null) - setToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE, originType.getValue()); - } - - public Integer getAttributeValueCounter() { - return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_ATTR_VALUE_COUNTER); - } - - public void setAttributeValueCounter(Integer attributeValueCounter) { - setToscaPresentationValue(JsonPresentationFields.CI_ATTR_VALUE_COUNTER, attributeValueCounter); - } - - public Integer getInputValueCounter() { - return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_INPUT_VALUE_COUNTER); - } - - public void setInputValueCounter(Integer inputValueCounter) { - setToscaPresentationValue(JsonPresentationFields.CI_INPUT_VALUE_COUNTER, inputValueCounter); - } - - public String getCustomizationUUID() { - return (String) getToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID); - } - - public void setCustomizationUUID(String customizationUUID) { - setToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID, customizationUUID); - } - - public String getComponentName() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME); - } - - public void setComponentName(String resourceName) { - setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME, resourceName); - } - - public String getComponentVersion() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION); - } - - public String getToscaComponentName() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME); - } - - public void setToscaComponentName(String toscaComponentName) { - setToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME, toscaComponentName); - } - - public void setComponentVersion(String resourceVersion) { - setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion); - } - - public void setSourceModelUuid(String targetModelUuid) { - setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID, targetModelUuid); - } - public void setSourceModelUid(String targetModelUid) { - setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID, targetModelUid); - } - - public void setSourceModelName(String targetModelName) { - setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME, targetModelName); - } - - public void setSourceModelInvariant(String targetModelInvariant) { - setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT, targetModelInvariant); - } - - public String getSourceModelUuid() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID); - } - public String getSourceModelUid() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID); - } - - public String getSourceModelName() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME); - } - - public String getSourceModelInvariant() { - return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT); - } - - public void setIsProxy(Boolean isProxy) { - if (isProxy == null) { - setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, false); - } else { - setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, isProxy); - } - } - - public Boolean getIsProxy() { - Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY); - return ( isProxy != null ) ? isProxy : false; - } - - public void setOriginArchived(Boolean originArchived) { - if (originArchived == null) { - setToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED, false); - } else { - setToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED, originArchived); - } - } - - public List<String> getDirectives() { - return ( List<String>) getToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES); - } - - public void setDirectives(List<String> directives) { - if (directives == null){ - directives = new ArrayList<>(); - } - setToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES, directives); - } - - public Boolean isOriginArchived() { - Boolean originArchived = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED); - return ( originArchived != null ) ? originArchived : false; - } - - private String getDirectivesString(){ - if (CollectionUtils.isEmpty(getDirectives())){ - return ""; - } - return getDirectives().stream().collect(Collectors.joining(",")); - } - - @Override - public String toString() { - return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name=" - + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid() - + ", creationTime=" + getCreationTime() + ", modificationTime=" + getModificationTime() - + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY() - + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter=" - + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() + ", originType=" - + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName=" - + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName=" - + getToscaComponentName() + ", directives =" + getDirectivesString() +"]"; - } + public ComponentInstanceDataDefinition() { + setPropertyValueCounter(1); + setAttributeValueCounter(1); + setInputValueCounter(1); + setIsProxy(false); + } + + public ComponentInstanceDataDefinition(ComponentInstanceDataDefinition dataDefinition) { + setIcon(dataDefinition.getIcon()); + setUniqueId(dataDefinition.getUniqueId()); + setName(dataDefinition.getName()); + setComponentUid(dataDefinition.getComponentUid()); + setCreationTime(dataDefinition.getCreationTime()); + setModificationTime(dataDefinition.getModificationTime()); + setDescription(dataDefinition.getDescription()); + setPosX(dataDefinition.getPosX()); + setPosY(dataDefinition.getPosY()); + setPropertyValueCounter(dataDefinition.getPropertyValueCounter()); + setNormalizedName(dataDefinition.getNormalizedName()); + setOriginType(dataDefinition.getOriginType()); + setCustomizationUUID(dataDefinition.getCustomizationUUID()); + setComponentName(dataDefinition.getComponentName()); + setComponentVersion(dataDefinition.getComponentVersion()); + setToscaComponentName(dataDefinition.getToscaComponentName()); + setInvariantName(dataDefinition.getInvariantName()); + setSourceModelInvariant(dataDefinition.getSourceModelInvariant()); + setSourceModelName(dataDefinition.getSourceModelName()); + setSourceModelUuid(dataDefinition.getSourceModelUuid()); + setSourceModelUid(dataDefinition.getSourceModelUid()); + setIsProxy(dataDefinition.getIsProxy()); + setDirectives(dataDefinition.getDirectives()); + setOriginArchived(dataDefinition.isOriginArchived()); + } + + public String getIcon() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_ICON); + } + + public void setIcon(String icon) { + setToscaPresentationValue(JsonPresentationFields.CI_ICON, icon); + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public Long getCreationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); + } + + public void setCreationTime(Long creationTime) { + setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); + } + + public Long getModificationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); + } + + public void setModificationTime(Long modificationTime) { + setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + public String getPosX() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_POS_X); + } + + public void setPosX(String posX) { + setToscaPresentationValue(JsonPresentationFields.CI_POS_X, posX); + } + + public String getPosY() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_POS_Y); + } + + public void setPosY(String posY) { + setToscaPresentationValue(JsonPresentationFields.CI_POS_Y, posY); + } + + public String getComponentUid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID); + } + + public void setComponentUid(String resourceUid) { + setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID, resourceUid); + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + if (this.getInvariantName() == null && name != null) { + this.setInvariantName(ValidationUtils.normalizeComponentInstanceName(name)); + } + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + + public String getInvariantName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME); + } + + public void setInvariantName(String invariantName) { + setToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME, invariantName); + } + + public Integer getPropertyValueCounter() { + return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_PROP_VALUE_COUNTER); + } + + public void setPropertyValueCounter(Integer propertyValueCounter) { + setToscaPresentationValue(JsonPresentationFields.CI_PROP_VALUE_COUNTER, propertyValueCounter); + } + + public String getNormalizedName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME); + } + + public void setNormalizedName(String normalizedName) { + setToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME, normalizedName); + } + + public OriginTypeEnum getOriginType() { + OriginTypeEnum originType = null; + String origType = (String) getToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE); + if (origType != null && !origType.isEmpty()) { + + originType = OriginTypeEnum.findByValue(origType); + } + return originType; + } + + public void setOriginType(OriginTypeEnum originType) { + if (originType != null) { + setToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE, originType.getValue()); + } + } + + public Integer getAttributeValueCounter() { + return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_ATTR_VALUE_COUNTER); + } + + public void setAttributeValueCounter(Integer attributeValueCounter) { + setToscaPresentationValue(JsonPresentationFields.CI_ATTR_VALUE_COUNTER, attributeValueCounter); + } + + public Integer getInputValueCounter() { + return (Integer) getToscaPresentationValue(JsonPresentationFields.CI_INPUT_VALUE_COUNTER); + } + + public void setInputValueCounter(Integer inputValueCounter) { + setToscaPresentationValue(JsonPresentationFields.CI_INPUT_VALUE_COUNTER, inputValueCounter); + } + + public String getCustomizationUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID); + } + + public void setCustomizationUUID(String customizationUUID) { + setToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID, customizationUUID); + } + + public String getComponentName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME); + } + + public void setComponentName(String resourceName) { + setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_NAME, resourceName); + } + + public String getComponentVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION); + } + + public String getToscaComponentName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME); + } + + public void setToscaComponentName(String toscaComponentName) { + setToscaPresentationValue(JsonPresentationFields.CI_TOSCA_COMPONENT_NAME, toscaComponentName); + } + + public void setComponentVersion(String resourceVersion) { + setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion); + } + + public void setSourceModelUuid(String targetModelUuid) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID, targetModelUuid); + } + + public void setSourceModelUid(String targetModelUid) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID, targetModelUid); + } + + public void setSourceModelName(String targetModelName) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME, targetModelName); + } + + public void setSourceModelInvariant(String targetModelInvariant) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT, targetModelInvariant); + } + + public String getSourceModelUuid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID); + } + + public String getSourceModelUid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID); + } + + public String getSourceModelName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME); + } + + public String getSourceModelInvariant() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT); + } + + public void setIsProxy(Boolean isProxy) { + if (isProxy == null) { + setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, false); + } else { + setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, isProxy); + } + } + + public Boolean getIsProxy() { + Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY); + return (isProxy != null) ? isProxy : false; + } + + public void setOriginArchived(Boolean originArchived) { + if (originArchived == null) { + setToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED, false); + } else { + setToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED, originArchived); + } + } + + public List<String> getDirectives() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES); + } + + public void setDirectives(List<String> directives) { + if (directives == null) { + directives = new ArrayList<>(); + } + setToscaPresentationValue(JsonPresentationFields.CI_DIRECTIVES, directives); + } + + public Boolean isOriginArchived() { + Boolean originArchived = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_ORIGIN_ARCHIVED); + return (originArchived != null) ? originArchived : false; + } + + private String getDirectivesString() { + if (CollectionUtils.isEmpty(getDirectives())) { + return ""; + } + return getDirectives().stream().collect(Collectors.joining(",")); + } + + @Override + public String toString() { + return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name=" + + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid() + + ", creationTime=" + getCreationTime() + ", modificationTime=" + getModificationTime() + + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY() + + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter=" + + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() + ", originType=" + + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName=" + + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName=" + + getToscaComponentName() + ", directives =" + getDirectivesString() + "]"; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java index 590cdb8a5a..0061213253 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,34 +27,38 @@ import java.util.HashMap; import java.util.Map; public class CompositionDataDefinition extends ToscaDataDefinition { - - public Map<String, ComponentInstanceDataDefinition> getComponentInstances() { - return (Map<String, ComponentInstanceDataDefinition>) getToscaPresentationValue(JsonPresentationFields.COMPONENT_INSTANCES); - } - public void setComponentInstances(Map<String, ComponentInstanceDataDefinition> componentInstances) { - setToscaPresentationValue(JsonPresentationFields.COMPONENT_INSTANCES, componentInstances); - } - public Map<String, RelationshipInstDataDefinition> getRelations() { - return (Map<String, RelationshipInstDataDefinition>) getToscaPresentationValue(JsonPresentationFields.RELATIONS); - } - public void setRelations(Map<String, RelationshipInstDataDefinition> relations) { - setToscaPresentationValue(JsonPresentationFields.RELATIONS, relations); - } - public void addInstance( String key, ComponentInstanceDataDefinition instance ){ - Map<String, ComponentInstanceDataDefinition> instances = getComponentInstances(); - if (instances == null ){ - instances = new HashMap<>(); - setToscaPresentationValue(JsonPresentationFields.COMPONENT_INSTANCES, instances ); - } - instances.put(key, instance); - } - - public void addRelation( String key, RelationshipInstDataDefinition relation ){ - Map<String, RelationshipInstDataDefinition> relations = getRelations(); - if (relations == null ){ - relations = new HashMap<>(); - setToscaPresentationValue(JsonPresentationFields.RELATIONS, relations ); - } - relations.put(key, relation); - } + + public Map<String, ComponentInstanceDataDefinition> getComponentInstances() { + return (Map<String, ComponentInstanceDataDefinition>) getToscaPresentationValue(JsonPresentationFields.COMPONENT_INSTANCES); + } + + public void setComponentInstances(Map<String, ComponentInstanceDataDefinition> componentInstances) { + setToscaPresentationValue(JsonPresentationFields.COMPONENT_INSTANCES, componentInstances); + } + + public Map<String, RelationshipInstDataDefinition> getRelations() { + return (Map<String, RelationshipInstDataDefinition>) getToscaPresentationValue(JsonPresentationFields.RELATIONS); + } + + public void setRelations(Map<String, RelationshipInstDataDefinition> relations) { + setToscaPresentationValue(JsonPresentationFields.RELATIONS, relations); + } + + public void addInstance(String key, ComponentInstanceDataDefinition instance) { + Map<String, ComponentInstanceDataDefinition> instances = getComponentInstances(); + if (instances == null) { + instances = new HashMap<>(); + setToscaPresentationValue(JsonPresentationFields.COMPONENT_INSTANCES, instances); + } + instances.put(key, instance); + } + + public void addRelation(String key, RelationshipInstDataDefinition relation) { + Map<String, RelationshipInstDataDefinition> relations = getRelations(); + if (relations == null) { + relations = new HashMap<>(); + setToscaPresentationValue(JsonPresentationFields.RELATIONS, relations); + } + relations.put(key, relation); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java index 143c28d068..2b3b5fbbbf 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,183 +24,183 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class ConsumerDataDefinition extends ToscaDataDefinition { - // ECOMP Consumer Name - UTF-8 string up to 255 characters containing the - // following characters : ( maybe to limit 4-64 chars ? ) - // Lowercase characters {a-z} - // Uppercase characters {A-Z} - // Numbers {0-9} - // Dash {-}; this character is not supported as the first character in the - // user name - // Period {.}; this character is not supported as the first character in the - // user name - // Underscore {_} - // * ECOMP Consumer Password - expected to be SHA-2 256 encrypted value ( - // SALT + "real" password ) => maximal length 256 bytes = 32 characters - // Before storing/comparing please convert upper case letter to lower. - // The "normalized" encrypted password should match the following format : - // [a-z0-9]{32} = alphanumeric string - // - // * ECOMP Consumer Salt - alphanumeric string [a-z0-9] , length = 32 chars. - // * ECOMP Consumer Last Authentication Time ( for future use) - - // time when ECOMP Consumer was authenticated for the last time in - // milliseconds from 1970 (GMT) - should be set to "0" on creation . - // * ECOMP Consumer Details Last updated time - time of the last update in - // milliseconds from 1970 (GMT) - // * USER_ID - USER_ID of the last user that created/updated credentials ( - // should be retrieved from USER_ID header) - private String consumerName; - private String consumerPassword; - private String consumerSalt; - private Long consumerLastAuthenticationTime; - private Long consumerDetailsLastupdatedtime; - private String lastModfierAtuid; - - public ConsumerDataDefinition() { - - } - - public ConsumerDataDefinition(ConsumerDataDefinition a) { - this.consumerName = a.consumerName; - this.consumerPassword = a.consumerPassword; - this.consumerSalt = a.consumerSalt; - this.consumerLastAuthenticationTime = a.consumerLastAuthenticationTime; - this.consumerDetailsLastupdatedtime = a.consumerDetailsLastupdatedtime; - this.lastModfierAtuid = a.lastModfierAtuid; - - } - - public String getConsumerName() { - return consumerName; - } - - public void setConsumerName(String consumerName) { - this.consumerName = consumerName; - } - - public String getConsumerPassword() { - return consumerPassword; - } - - public void setConsumerPassword(String consumerPassword) { - this.consumerPassword = consumerPassword; - } - - public String getConsumerSalt() { - return consumerSalt; - } - - public void setConsumerSalt(String consumerSalt) { - this.consumerSalt = consumerSalt; - } - - public Long getConsumerLastAuthenticationTime() { - return consumerLastAuthenticationTime; - } - - public void setConsumerLastAuthenticationTime(Long consumerLastAuthenticationTime) { - this.consumerLastAuthenticationTime = consumerLastAuthenticationTime; - } - - public Long getConsumerDetailsLastupdatedtime() { - return consumerDetailsLastupdatedtime; - } - - public void setConsumerDetailsLastupdatedtime(Long consumerDetailsLastupdatedtime) { - this.consumerDetailsLastupdatedtime = consumerDetailsLastupdatedtime; - } - - public String getLastModfierAtuid() { - return lastModfierAtuid; - } - - public void setLastModfierAtuid(String lastModfierAtuid) { - this.lastModfierAtuid = lastModfierAtuid; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("ConsumerDataDefinition [").append("consumerName=").append(consumerName).append(",") - .append("consumerPassword=").append(consumerPassword).append(",").append("consumerSalt=") - .append(consumerSalt).append(",").append("consumerLastAuthenticationTime=") - .append(consumerLastAuthenticationTime).append(",").append("consumerDetailsLastupdatedtime=") - .append(consumerDetailsLastupdatedtime).append(",").append("lastModfierAtuid=").append(lastModfierAtuid) - .append("]"); - return sb.toString(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((consumerName == null) ? 0 : consumerName.hashCode()); - result = prime * result + ((consumerPassword == null) ? 0 : consumerPassword.hashCode()); - result = prime * result + ((consumerSalt == null) ? 0 : consumerSalt.hashCode()); - result = prime * result - + ((consumerLastAuthenticationTime == null) ? 0 : consumerLastAuthenticationTime.hashCode()); - result = prime * result - + ((consumerDetailsLastupdatedtime == null) ? 0 : consumerDetailsLastupdatedtime.hashCode()); - result = prime * result + ((lastModfierAtuid == null) ? 0 : lastModfierAtuid.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ConsumerDataDefinition other = (ConsumerDataDefinition) obj; - if (consumerName == null) { - if (other.consumerName != null) { - return false; - } - } else if (!consumerName.equals(other.consumerName)) { - return false; - } - if (consumerPassword == null) { - if (other.consumerPassword != null) { - return false; - } - } else if (!consumerPassword.equals(other.consumerPassword)) { - return false; - } - - if (consumerSalt == null) { - if (other.consumerSalt != null) { - return false; - } - } else if (!consumerSalt.equals(other.consumerSalt)) { - return false; - } - - if (consumerLastAuthenticationTime == null) { - if (other.consumerLastAuthenticationTime != null) { - return false; - } - } else if (!consumerLastAuthenticationTime.equals(other.consumerLastAuthenticationTime)) { - return false; - } - - if (consumerDetailsLastupdatedtime == null) { - if (other.consumerDetailsLastupdatedtime != null) { - return false; - } - } else if (!consumerDetailsLastupdatedtime.equals(other.consumerDetailsLastupdatedtime)) { - return false; - } - - if (lastModfierAtuid == null) { - if (other.lastModfierAtuid != null) { - return false; - } - } else if (!lastModfierAtuid.equals(other.lastModfierAtuid)) { - return false; - } - - return true; - } + // ECOMP Consumer Name - UTF-8 string up to 255 characters containing the + // following characters : ( maybe to limit 4-64 chars ? ) + // Lowercase characters {a-z} + // Uppercase characters {A-Z} + // Numbers {0-9} + // Dash {-}; this character is not supported as the first character in the + // user name + // Period {.}; this character is not supported as the first character in the + // user name + // Underscore {_} + // * ECOMP Consumer Password - expected to be SHA-2 256 encrypted value ( + // SALT + "real" password ) => maximal length 256 bytes = 32 characters + // Before storing/comparing please convert upper case letter to lower. + // The "normalized" encrypted password should match the following format : + // [a-z0-9]{32} = alphanumeric string + // + // * ECOMP Consumer Salt - alphanumeric string [a-z0-9] , length = 32 chars. + // * ECOMP Consumer Last Authentication Time ( for future use) - + // time when ECOMP Consumer was authenticated for the last time in + // milliseconds from 1970 (GMT) - should be set to "0" on creation . + // * ECOMP Consumer Details Last updated time - time of the last update in + // milliseconds from 1970 (GMT) + // * USER_ID - USER_ID of the last user that created/updated credentials ( + // should be retrieved from USER_ID header) + private String consumerName; + private String consumerPassword; + private String consumerSalt; + private Long consumerLastAuthenticationTime; + private Long consumerDetailsLastupdatedtime; + private String lastModfierAtuid; + + public ConsumerDataDefinition() { + + } + + public ConsumerDataDefinition(ConsumerDataDefinition a) { + this.consumerName = a.consumerName; + this.consumerPassword = a.consumerPassword; + this.consumerSalt = a.consumerSalt; + this.consumerLastAuthenticationTime = a.consumerLastAuthenticationTime; + this.consumerDetailsLastupdatedtime = a.consumerDetailsLastupdatedtime; + this.lastModfierAtuid = a.lastModfierAtuid; + + } + + public String getConsumerName() { + return consumerName; + } + + public void setConsumerName(String consumerName) { + this.consumerName = consumerName; + } + + public String getConsumerPassword() { + return consumerPassword; + } + + public void setConsumerPassword(String consumerPassword) { + this.consumerPassword = consumerPassword; + } + + public String getConsumerSalt() { + return consumerSalt; + } + + public void setConsumerSalt(String consumerSalt) { + this.consumerSalt = consumerSalt; + } + + public Long getConsumerLastAuthenticationTime() { + return consumerLastAuthenticationTime; + } + + public void setConsumerLastAuthenticationTime(Long consumerLastAuthenticationTime) { + this.consumerLastAuthenticationTime = consumerLastAuthenticationTime; + } + + public Long getConsumerDetailsLastupdatedtime() { + return consumerDetailsLastupdatedtime; + } + + public void setConsumerDetailsLastupdatedtime(Long consumerDetailsLastupdatedtime) { + this.consumerDetailsLastupdatedtime = consumerDetailsLastupdatedtime; + } + + public String getLastModfierAtuid() { + return lastModfierAtuid; + } + + public void setLastModfierAtuid(String lastModfierAtuid) { + this.lastModfierAtuid = lastModfierAtuid; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("ConsumerDataDefinition [").append("consumerName=").append(consumerName).append(",") + .append("consumerPassword=").append(consumerPassword).append(",").append("consumerSalt=") + .append(consumerSalt).append(",").append("consumerLastAuthenticationTime=") + .append(consumerLastAuthenticationTime).append(",").append("consumerDetailsLastupdatedtime=") + .append(consumerDetailsLastupdatedtime).append(",").append("lastModfierAtuid=").append(lastModfierAtuid) + .append("]"); + return sb.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((consumerName == null) ? 0 : consumerName.hashCode()); + result = prime * result + ((consumerPassword == null) ? 0 : consumerPassword.hashCode()); + result = prime * result + ((consumerSalt == null) ? 0 : consumerSalt.hashCode()); + result = prime * result + + ((consumerLastAuthenticationTime == null) ? 0 : consumerLastAuthenticationTime.hashCode()); + result = prime * result + + ((consumerDetailsLastupdatedtime == null) ? 0 : consumerDetailsLastupdatedtime.hashCode()); + result = prime * result + ((lastModfierAtuid == null) ? 0 : lastModfierAtuid.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ConsumerDataDefinition other = (ConsumerDataDefinition) obj; + if (consumerName == null) { + if (other.consumerName != null) { + return false; + } + } else if (!consumerName.equals(other.consumerName)) { + return false; + } + if (consumerPassword == null) { + if (other.consumerPassword != null) { + return false; + } + } else if (!consumerPassword.equals(other.consumerPassword)) { + return false; + } + + if (consumerSalt == null) { + if (other.consumerSalt != null) { + return false; + } + } else if (!consumerSalt.equals(other.consumerSalt)) { + return false; + } + + if (consumerLastAuthenticationTime == null) { + if (other.consumerLastAuthenticationTime != null) { + return false; + } + } else if (!consumerLastAuthenticationTime.equals(other.consumerLastAuthenticationTime)) { + return false; + } + + if (consumerDetailsLastupdatedtime == null) { + if (other.consumerDetailsLastupdatedtime != null) { + return false; + } + } else if (!consumerDetailsLastupdatedtime.equals(other.consumerDetailsLastupdatedtime)) { + return false; + } + + if (lastModfierAtuid == null) { + return other.lastModfierAtuid == null; + } else { + return lastModfierAtuid.equals(other.lastModfierAtuid); + } + + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java index a4042d9917..75b5e56719 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,101 +26,101 @@ import java.util.List; public class DataTypeDataDefinition extends ToscaDataDefinition { - private String name; + private String name; - private String uniqueId; + private String uniqueId; - // "boolean", "string", "float", "integer", "version" }) - private String derivedFromName; + // "boolean", "string", "float", "integer", "version" }) + private String derivedFromName; - private String description; + private String description; - /** - * Timestamp of data type creation - */ - private Long creationTime; + /** + * Timestamp of data type creation + */ + private Long creationTime; - /** - * Timestamp of the data type last update - */ - private Long modificationTime; + /** + * Timestamp of the data type last update + */ + private Long modificationTime; - private List<PropertyDataDefinition> propertiesData; + private List<PropertyDataDefinition> propertiesData; - public DataTypeDataDefinition() { + public DataTypeDataDefinition() { - } + } - public DataTypeDataDefinition(DataTypeDataDefinition p) { - this.name = p.name; - this.uniqueId = p.uniqueId; - this.derivedFromName = p.derivedFromName; - this.description = p.description; - this.creationTime = p.creationTime; - this.modificationTime = p.modificationTime; - } + public DataTypeDataDefinition(DataTypeDataDefinition p) { + this.name = p.name; + this.uniqueId = p.uniqueId; + this.derivedFromName = p.derivedFromName; + this.description = p.description; + this.creationTime = p.creationTime; + this.modificationTime = p.modificationTime; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getDerivedFromName() { - return derivedFromName; - } + public String getDerivedFromName() { + return derivedFromName; + } - public void setDerivedFromName(String derivedFromName) { - this.derivedFromName = derivedFromName; - } + public void setDerivedFromName(String derivedFromName) { + this.derivedFromName = derivedFromName; + } - public String getDescription() { - return description; - } + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } + public void setDescription(String description) { + this.description = description; + } - public String getUniqueId() { - return uniqueId; - } + public String getUniqueId() { + return uniqueId; + } - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } - public Long getCreationTime() { - return creationTime; - } + public Long getCreationTime() { + return creationTime; + } - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } - public Long getModificationTime() { - return modificationTime; - } + public Long getModificationTime() { + return modificationTime; + } - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } - public List<PropertyDataDefinition> getPropertiesData() { - return propertiesData; - } + public List<PropertyDataDefinition> getPropertiesData() { + return propertiesData; + } - public void setPropertiesData(List<PropertyDataDefinition> propertiesData) { - this.propertiesData = propertiesData; - } + public void setPropertiesData(List<PropertyDataDefinition> propertiesData) { + this.propertiesData = propertiesData; + } - @Override - public String toString() { - return "DataTypeDataDefinition [name=" + name + ", uniqueId=" + uniqueId + ", derivedFromName=" - + derivedFromName + ", description=" + description + ", creationTime=" + creationTime - + ", modificationTime=" + modificationTime + ", propertiesData=" + propertiesData + "]"; - } + @Override + public String toString() { + return "DataTypeDataDefinition [name=" + name + ", uniqueId=" + uniqueId + ", derivedFromName=" + + derivedFromName + ", description=" + description + ", creationTime=" + creationTime + + ", modificationTime=" + modificationTime + ", propertiesData=" + propertiesData + "]"; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinition.java index 6e6bb03566..499d523119 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,13 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.*; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.DESCRIPTION; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.PATH_DESTINATION_PORT_NUMBER; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.PATH_ELEMENT_LIST; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.PATH_NAME; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.PATH_PROTOCOL; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.UNIQUE_ID; public class ForwardingPathDataDefinition extends ToscaDataDefinition { @@ -98,7 +104,7 @@ public class ForwardingPathDataDefinition extends ToscaDataDefinition { } public String getToscaResourceName() { - return (String) getToscaPresentationValue(TOSCA_RESOURCE_NAME); + return (String) getToscaPresentationValue(TOSCA_RESOURCE_NAME); } public void setToscaResourceName(String toscaResourceName) { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinition.java index ff94770ed2..52e653d3f9 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ForwardingPathElementDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public class ForwardingPathElementDataDefinition extends ToscaDataDefinition { super(); } - public ForwardingPathElementDataDefinition(String fromNode, String toNode, String fromCPName, String toCPName , String fromCPOriginId, String toCPOriginId) { + public ForwardingPathElementDataDefinition(String fromNode, String toNode, String fromCPName, String toCPName, String fromCPOriginId, String toCPOriginId) { super(); setFromNode(fromNode); setToNode(toNode); @@ -103,16 +103,20 @@ public class ForwardingPathElementDataDefinition extends ToscaDataDefinition { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } ForwardingPathElementDataDefinition that = (ForwardingPathElementDataDefinition) o; return Objects.equals(getFromNode(), that.getFromNode()) && Objects.equals(getToNode(), that.getToNode()) - && Objects.equals(getFromCPOriginId(), that.getFromCPOriginId()) && Objects.equals(getToCPOriginId(), that.getToCPOriginId()); + && Objects.equals(getFromCPOriginId(), that.getFromCPOriginId()) && Objects.equals(getToCPOriginId(), that.getToCPOriginId()); } @Override public int hashCode() { - return Objects.hash(getFromNode(), getToNode(), getFromCP(),getToCP(), getFromCPOriginId(), getToCPOriginId()); + return Objects.hash(getFromNode(), getToNode(), getFromCP(), getToCP(), getFromCPOriginId(), getToCPOriginId()); } @Override diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java index 5ce336c805..010840eaee 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,135 +24,145 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import java.util.Map; -public class GetInputValueDataDefinition extends ToscaDataDefinition { - - private String propName; - private String inputName; - private String inputId; - private Integer indexValue; - private GetInputValueDataDefinition getInputIndex; - - private boolean isList = false; - - public GetInputValueDataDefinition(){ - super(); - } - - public GetInputValueDataDefinition(Map<String, Object> pr) { - super(pr); - } - - public GetInputValueDataDefinition(GetInputValueDataDefinition p) { - this.setPropName(p.getPropName()); - this.setInputName( p.getInputName()); - this.setInputId( p.getInputId()); - this.setIndexValue ( p.getIndexValue()); - this.setGetInputIndex ( p.getGetInputIndex()); - this.setList ( p.isList()); - - - } - - public String getPropName() { - return propName; - } - - public void setPropName(String propName) { - this.propName = propName; - } - - public String getInputName() { - return inputName; - } - - public void setInputName(String inputName) { - this.inputName = inputName; - } - - public Integer getIndexValue() { - return indexValue; - } - - public void setIndexValue(Integer indexValue) { - this.indexValue = indexValue; - } - - public GetInputValueDataDefinition getGetInputIndex() { - return getInputIndex; - } - - public void setGetInputIndex(GetInputValueDataDefinition getInputIndex) { - this.getInputIndex = getInputIndex; - } - - public boolean isList() { - return isList; - } - - public void setList(boolean isList) { - this.isList = isList; - } - - - public String getInputId() { - return inputId; - } - - public void setInputId(String inputId) { - this.inputId = inputId; - } - - @Override - public String toString() { - return "GetInputValueDataDefinition [propName=" + propName + ", inputName=" + inputName + ", indexValue=" + indexValue + ", getInputIndex=" + getInputIndex + ", isList=" + isList + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((getInputIndex == null) ? 0 : getInputIndex.hashCode()); - result = prime * result + ((indexValue == null) ? 0 : indexValue.hashCode()); - result = prime * result + ((inputName == null) ? 0 : inputName.hashCode()); - result = prime * result + (isList ? 1231 : 1237); - result = prime * result + ((propName == null) ? 0 : propName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - GetInputValueDataDefinition other = (GetInputValueDataDefinition) obj; - if (getInputIndex == null) { - if (other.getInputIndex != null) - return false; - } else if (!getInputIndex.equals(other.getInputIndex)) - return false; - if (indexValue == null) { - if (other.indexValue != null) - return false; - } else if (!indexValue.equals(other.indexValue)) - return false; - if (inputName == null) { - if (other.inputName != null) - return false; - } else if (!inputName.equals(other.inputName)) - return false; - if (isList != other.isList) - return false; - if (propName == null) { - if (other.propName != null) - return false; - } else if (!propName.equals(other.propName)) - return false; - return true; - } - - +public class GetInputValueDataDefinition extends ToscaDataDefinition { + + private String propName; + private String inputName; + private String inputId; + private Integer indexValue; + private GetInputValueDataDefinition getInputIndex; + + private boolean isList = false; + + public GetInputValueDataDefinition() { + super(); + } + + public GetInputValueDataDefinition(Map<String, Object> pr) { + super(pr); + } + + public GetInputValueDataDefinition(GetInputValueDataDefinition p) { + this.setPropName(p.getPropName()); + this.setInputName(p.getInputName()); + this.setInputId(p.getInputId()); + this.setIndexValue(p.getIndexValue()); + this.setGetInputIndex(p.getGetInputIndex()); + this.setList(p.isList()); + + + } + + public String getPropName() { + return propName; + } + + public void setPropName(String propName) { + this.propName = propName; + } + + public String getInputName() { + return inputName; + } + + public void setInputName(String inputName) { + this.inputName = inputName; + } + + public Integer getIndexValue() { + return indexValue; + } + + public void setIndexValue(Integer indexValue) { + this.indexValue = indexValue; + } + + public GetInputValueDataDefinition getGetInputIndex() { + return getInputIndex; + } + + public void setGetInputIndex(GetInputValueDataDefinition getInputIndex) { + this.getInputIndex = getInputIndex; + } + + public boolean isList() { + return isList; + } + + public void setList(boolean isList) { + this.isList = isList; + } + + + public String getInputId() { + return inputId; + } + + public void setInputId(String inputId) { + this.inputId = inputId; + } + + @Override + public String toString() { + return "GetInputValueDataDefinition [propName=" + propName + ", inputName=" + inputName + ", indexValue=" + indexValue + ", getInputIndex=" + getInputIndex + ", isList=" + isList + "]"; + } + + @Override + public int hashCode() { + final int hashingNumerList = 1231; + final int hashingNumerNoList = 1237; + final int prime = 31; + int result = 1; + result = prime * result + ((getInputIndex == null) ? 0 : getInputIndex.hashCode()); + result = prime * result + ((indexValue == null) ? 0 : indexValue.hashCode()); + result = prime * result + ((inputName == null) ? 0 : inputName.hashCode()); + result = prime * result + (isList ? hashingNumerList : hashingNumerNoList); + result = prime * result + ((propName == null) ? 0 : propName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + GetInputValueDataDefinition other = (GetInputValueDataDefinition) obj; + if (getInputIndex == null) { + if (other.getInputIndex != null) { + return false; + } + } else if (!getInputIndex.equals(other.getInputIndex)) { + return false; + } + if (indexValue == null) { + if (other.indexValue != null) { + return false; + } + } else if (!indexValue.equals(other.indexValue)) { + return false; + } + if (inputName == null) { + if (other.inputName != null) { + return false; + } + } else if (!inputName.equals(other.inputName)) { + return false; + } + if (isList != other.isList) { + return false; + } + if (propName == null) { + return other.propName == null; + } else { + return propName.equals(other.propName); + } + } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java index 1fa1439c72..064f356290 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetPolicyValueDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.Objects; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java index 1e03372b32..bf8b868847 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java @@ -160,6 +160,7 @@ public class GroupDataDefinition extends ToscaDataDefinition { public Map<String, String> getMembers() { return (Map<String, String>) getToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER); } + //this is used by GroupCompositionMixin public Map<String, String> resolveMembersList() { Map<String, String> members = getMembers(); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java index 69cca1e7be..c1cfa31412 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,211 +29,218 @@ import java.util.Map; public class GroupInstanceDataDefinition extends ToscaDataDefinition { - public GroupInstanceDataDefinition() { - super(); - } - public GroupInstanceDataDefinition(Map<String, Object> gi) { - super(gi); - } - public GroupInstanceDataDefinition(GroupInstanceDataDefinition other) { - this.setUniqueId(other.getUniqueId()); - this.setName(other.getName()); - this.setGroupUid(other.getGroupUid()); - this.setCreationTime(other.getCreationTime()); - this.setModificationTime(other.getModificationTime()); - this.setPosX(other.getPosX()); - this.setPosY(other.getPosY()); - this.setPropertyValueCounter(other.getPropertyValueCounter()); - this.setNormalizedName(other.getNormalizedName()); - this.setCustomizationUUID(other.getCustomizationUUID()); - this.setGroupName(other.getGroupName()); - this.setInvariantUUID(other.getInvariantUUID()); - this.setType(other.getType()); - this.setGroupUUID(other.getGroupUUID()); - this.setVersion(other.getVersion()); - this.setDescription(other.getDescription()); - if(other.getArtifacts() != null) - this.setArtifacts(new ArrayList<>(other.getArtifacts())); - if(other.getArtifactsUuid() != null) - this.setArtifactsUuid(new ArrayList<>(other.getArtifactsUuid())); - if(other.getGroupInstanceArtifacts() != null) - this.setGroupInstanceArtifacts(new ArrayList<>(other.getGroupInstanceArtifacts())); - if(other.getGroupInstanceArtifactsUuid() != null) - this.setGroupInstanceArtifactsUuid(new ArrayList<>(other.getGroupInstanceArtifactsUuid())); - if(other.getProperties() != null) - this.setProperties(new ArrayList<>(other.getProperties())); - } - - public String getUniqueId() { - return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); - } - - public void setUniqueId(String uniqueId) { - setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); - } - - public String getName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } - - public void setName(String name) { - setToscaPresentationValue(JsonPresentationFields.NAME, name); - } - - public String getNormalizedName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME); - } - - public void setNormalizedName(String normalizedName) { - setToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME, normalizedName); - } - - public String getGroupUid() { - return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UNIQUE_ID); - } - - public void setGroupUid(String groupUid) { - setToscaPresentationValue(JsonPresentationFields.GROUP_UNIQUE_ID, groupUid); - } - - public Long getCreationTime() { - return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); - } - - public void setCreationTime(Long creationTime) { - setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); - } - - public Long getModificationTime() { - return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); - } - - public void setModificationTime(Long modificationTime) { - setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); - } - - public String getPosX() { - return (String) getToscaPresentationValue(JsonPresentationFields.POS_X); - } - - public void setPosX(String posX) { - setToscaPresentationValue(JsonPresentationFields.POS_X, posX); - } - - public String getPosY() { - return (String) getToscaPresentationValue(JsonPresentationFields.POS_Y); - } - - public void setPosY(String posY) { - setToscaPresentationValue(JsonPresentationFields.POS_Y, posY); - } - - public Integer getPropertyValueCounter() { - return (Integer) getToscaPresentationValue(JsonPresentationFields.PROPERTY_VALUE_COUNTER); - } - - public void setPropertyValueCounter(Integer propertyValueCounter) { - setToscaPresentationValue(JsonPresentationFields.PROPERTY_VALUE_COUNTER, propertyValueCounter); - } - - public String getCustomizationUUID() { - return (String) getToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID); - } - - public void setCustomizationUUID(String customizationUUID) { - setToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID, customizationUUID); - } - - public String getGroupName() { - return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_NAME); - } - - public void setGroupName(String groupName) { - setToscaPresentationValue(JsonPresentationFields.GROUP_NAME, groupName); - } - - public String getInvariantUUID() { - return (String) getToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID); - } - - public void setInvariantUUID(String invariantUUID) { - setToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID, invariantUUID); - } - - public String getType() { - return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); - } - - public void setType(String type) { - setToscaPresentationValue(JsonPresentationFields.TYPE, type); - } - - public String getGroupUUID() { - return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UUID); - } - - public void setGroupUUID(String groupUUID) { - setToscaPresentationValue(JsonPresentationFields.GROUP_UUID, groupUUID); - } - - public String getVersion() { - return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); - } - - public void setVersion(String version) { - setToscaPresentationValue(JsonPresentationFields.VERSION, version); - } - - public String getDescription() { - return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); - } - - public void setDescription(String description) { - setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); - } - - @SuppressWarnings("unchecked") - public List<String> getArtifacts() { - return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS); - } - - public void setArtifacts(List<String> artifacts) { - setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS, artifacts); - } - - @SuppressWarnings("unchecked") - public List<String> getArtifactsUuid() { - return (List<String> ) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID); - } - - public void setArtifactsUuid(List<String> artifactsUuid) { - setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID, artifactsUuid); - } - - @SuppressWarnings("unchecked") - public List<String> getGroupInstanceArtifacts() { - return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS); - } - - public void setGroupInstanceArtifacts(List<String> groupInstanceArtifacts) { - setToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS, groupInstanceArtifacts); - } - - @SuppressWarnings("unchecked") - public List<String> getGroupInstanceArtifactsUuid() { - return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS_UUID); - } - - public void setGroupInstanceArtifactsUuid(List<String> groupInstanceArtifactsUuid) { - setToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS_UUID, groupInstanceArtifactsUuid); - } - - @SuppressWarnings("unchecked") - public List<PropertyDataDefinition> getProperties() { - return (List<PropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_PROPERTIES); - } - - public void setProperties(List<PropertyDataDefinition> properties) { - setToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_PROPERTIES, properties); - } + public GroupInstanceDataDefinition() { + super(); + } + + public GroupInstanceDataDefinition(Map<String, Object> gi) { + super(gi); + } + + public GroupInstanceDataDefinition(GroupInstanceDataDefinition other) { + this.setUniqueId(other.getUniqueId()); + this.setName(other.getName()); + this.setGroupUid(other.getGroupUid()); + this.setCreationTime(other.getCreationTime()); + this.setModificationTime(other.getModificationTime()); + this.setPosX(other.getPosX()); + this.setPosY(other.getPosY()); + this.setPropertyValueCounter(other.getPropertyValueCounter()); + this.setNormalizedName(other.getNormalizedName()); + this.setCustomizationUUID(other.getCustomizationUUID()); + this.setGroupName(other.getGroupName()); + this.setInvariantUUID(other.getInvariantUUID()); + this.setType(other.getType()); + this.setGroupUUID(other.getGroupUUID()); + this.setVersion(other.getVersion()); + this.setDescription(other.getDescription()); + if (other.getArtifacts() != null) { + this.setArtifacts(new ArrayList<>(other.getArtifacts())); + } + if (other.getArtifactsUuid() != null) { + this.setArtifactsUuid(new ArrayList<>(other.getArtifactsUuid())); + } + if (other.getGroupInstanceArtifacts() != null) { + this.setGroupInstanceArtifacts(new ArrayList<>(other.getGroupInstanceArtifacts())); + } + if (other.getGroupInstanceArtifactsUuid() != null) { + this.setGroupInstanceArtifactsUuid(new ArrayList<>(other.getGroupInstanceArtifactsUuid())); + } + if (other.getProperties() != null) { + this.setProperties(new ArrayList<>(other.getProperties())); + } + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + + public String getNormalizedName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME); + } + + public void setNormalizedName(String normalizedName) { + setToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME, normalizedName); + } + + public String getGroupUid() { + return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UNIQUE_ID); + } + + public void setGroupUid(String groupUid) { + setToscaPresentationValue(JsonPresentationFields.GROUP_UNIQUE_ID, groupUid); + } + + public Long getCreationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); + } + + public void setCreationTime(Long creationTime) { + setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); + } + + public Long getModificationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); + } + + public void setModificationTime(Long modificationTime) { + setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); + } + + public String getPosX() { + return (String) getToscaPresentationValue(JsonPresentationFields.POS_X); + } + + public void setPosX(String posX) { + setToscaPresentationValue(JsonPresentationFields.POS_X, posX); + } + + public String getPosY() { + return (String) getToscaPresentationValue(JsonPresentationFields.POS_Y); + } + + public void setPosY(String posY) { + setToscaPresentationValue(JsonPresentationFields.POS_Y, posY); + } + + public Integer getPropertyValueCounter() { + return (Integer) getToscaPresentationValue(JsonPresentationFields.PROPERTY_VALUE_COUNTER); + } + + public void setPropertyValueCounter(Integer propertyValueCounter) { + setToscaPresentationValue(JsonPresentationFields.PROPERTY_VALUE_COUNTER, propertyValueCounter); + } + + public String getCustomizationUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID); + } + + public void setCustomizationUUID(String customizationUUID) { + setToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID, customizationUUID); + } + + public String getGroupName() { + return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_NAME); + } + + public void setGroupName(String groupName) { + setToscaPresentationValue(JsonPresentationFields.GROUP_NAME, groupName); + } + + public String getInvariantUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID); + } + + public void setInvariantUUID(String invariantUUID) { + setToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID, invariantUUID); + } + + public String getType() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public void setType(String type) { + setToscaPresentationValue(JsonPresentationFields.TYPE, type); + } + + public String getGroupUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UUID); + } + + public void setGroupUUID(String groupUUID) { + setToscaPresentationValue(JsonPresentationFields.GROUP_UUID, groupUUID); + } + + public String getVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); + } + + public void setVersion(String version) { + setToscaPresentationValue(JsonPresentationFields.VERSION, version); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + @SuppressWarnings("unchecked") + public List<String> getArtifacts() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS); + } + + public void setArtifacts(List<String> artifacts) { + setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS, artifacts); + } + + @SuppressWarnings("unchecked") + public List<String> getArtifactsUuid() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID); + } + + public void setArtifactsUuid(List<String> artifactsUuid) { + setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID, artifactsUuid); + } + + @SuppressWarnings("unchecked") + public List<String> getGroupInstanceArtifacts() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS); + } + + public void setGroupInstanceArtifacts(List<String> groupInstanceArtifacts) { + setToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS, groupInstanceArtifacts); + } + + @SuppressWarnings("unchecked") + public List<String> getGroupInstanceArtifactsUuid() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS_UUID); + } + + public void setGroupInstanceArtifactsUuid(List<String> groupInstanceArtifactsUuid) { + setToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS_UUID, groupInstanceArtifactsUuid); + } + + @SuppressWarnings("unchecked") + public List<PropertyDataDefinition> getProperties() { + return (List<PropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_PROPERTIES); + } + + public void setProperties(List<PropertyDataDefinition> properties) { + setToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_PROPERTIES, properties); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java index a3bb8d4183..19f88b3196 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,117 +25,117 @@ import java.util.Map; public class GroupTypeDataDefinition extends ToscaTypeDataDefinition { - private String uniqueId; - private String version; - private String derivedFrom; - private List<String> members; - private Map<String, String> metadata; - private String description; - private boolean highestVersion; - - /** - * Timestamp of data type creation - */ - private Long creationTime; - - /** - * Timestamp of the data type last update - */ - private Long modificationTime; - - public GroupTypeDataDefinition() { - } - - public GroupTypeDataDefinition(GroupTypeDataDefinition other) { - super(other); - this.uniqueId = other.uniqueId; - this.version = other.version; - this.members = other.members; - this.metadata = other.metadata; - this.description = other.description; - this.creationTime = other.creationTime; - this.modificationTime = other.modificationTime; - this.highestVersion = other.highestVersion; - this.derivedFrom = other.derivedFrom; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public List<String> getMembers() { - return members; - } - - public void setMembers(List<String> members) { - this.members = members; - } - - public Map<String, String> getMetadata() { - return metadata; - } - - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public Long getCreationTime() { - return creationTime; - } - - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } - - public Long getModificationTime() { - return modificationTime; - } - - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } - - @Override - public String toString() { - return "GroupTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + getType() + ", name=" + getName() + ", icon=" + getIcon() + ", version=" + version - + ", members=" + members + ", metadata=" + metadata + ", description=" + description + ", creationTime=" - + creationTime + ", modificationTime=" + modificationTime + "]"; - } - - public String getDerivedFrom() { - return derivedFrom; - } - - public void setDerivedFrom(String derivedFrom) { - this.derivedFrom = derivedFrom; - } - - public boolean isHighestVersion() { - return highestVersion; - } - - public void setHighestVersion(boolean isLatestVersion) { - this.highestVersion = isLatestVersion; - } + private String uniqueId; + private String version; + private String derivedFrom; + private List<String> members; + private Map<String, String> metadata; + private String description; + private boolean highestVersion; + + /** + * Timestamp of data type creation + */ + private Long creationTime; + + /** + * Timestamp of the data type last update + */ + private Long modificationTime; + + public GroupTypeDataDefinition() { + } + + public GroupTypeDataDefinition(GroupTypeDataDefinition other) { + super(other); + this.uniqueId = other.uniqueId; + this.version = other.version; + this.members = other.members; + this.metadata = other.metadata; + this.description = other.description; + this.creationTime = other.creationTime; + this.modificationTime = other.modificationTime; + this.highestVersion = other.highestVersion; + this.derivedFrom = other.derivedFrom; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public List<String> getMembers() { + return members; + } + + public void setMembers(List<String> members) { + this.members = members; + } + + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public Long getCreationTime() { + return creationTime; + } + + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } + + public Long getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } + + @Override + public String toString() { + return "GroupTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + getType() + ", name=" + getName() + ", icon=" + getIcon() + ", version=" + version + + ", members=" + members + ", metadata=" + metadata + ", description=" + description + ", creationTime=" + + creationTime + ", modificationTime=" + modificationTime + "]"; + } + + public String getDerivedFrom() { + return derivedFrom; + } + + public void setDerivedFrom(String derivedFrom) { + this.derivedFrom = derivedFrom; + } + + public boolean isHighestVersion() { + return highestVersion; + } + + public void setHighestVersion(boolean isLatestVersion) { + this.highestVersion = isLatestVersion; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java index 4b5ed0c140..da6e63d110 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,134 +24,146 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class HeatParameterDataDefinition extends ToscaDataDefinition { - String uniqueId; - - String name; - String type; - String description; - - String currentValue; - String defaultValue; - - public HeatParameterDataDefinition() { - } - - public HeatParameterDataDefinition(HeatParameterDataDefinition hp) { - this.uniqueId = hp.uniqueId; - this.name = hp.name; - this.type = hp.type; - this.description = hp.description; - this.currentValue = hp.currentValue; - this.defaultValue = hp.defaultValue; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getCurrentValue() { - return currentValue; - } - - public void setCurrentValue(String currentValue) { - this.currentValue = currentValue; - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - @Override - public String toString() { - return "HeatParameterDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", type=" + type - + ", description=" + description + ", currentValue=" + currentValue + ", defaultValue=" + defaultValue - + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((currentValue == null) ? 0 : currentValue.hashCode()); - result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode()); - result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - HeatParameterDataDefinition other = (HeatParameterDataDefinition) obj; - if (currentValue == null) { - if (other.currentValue != null) - return false; - } else if (!currentValue.equals(other.currentValue)) - return false; - if (defaultValue == null) { - if (other.defaultValue != null) - return false; - } else if (!defaultValue.equals(other.defaultValue)) - return false; - if (description == null) { - if (other.description != null) - return false; - } else if (!description.equals(other.description)) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (type == null) { - if (other.type != null) - return false; - } else if (!type.equals(other.type)) - return false; - if (uniqueId == null) { - if (other.uniqueId != null) - return false; - } else if (!uniqueId.equals(other.uniqueId)) - return false; - return true; - } + private String uniqueId; + + private String name; + private String type; + private String description; + + private String currentValue; + private String defaultValue; + + public HeatParameterDataDefinition() { + } + + public HeatParameterDataDefinition(HeatParameterDataDefinition hp) { + this.uniqueId = hp.uniqueId; + this.name = hp.name; + this.type = hp.type; + this.description = hp.description; + this.currentValue = hp.currentValue; + this.defaultValue = hp.defaultValue; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCurrentValue() { + return currentValue; + } + + public void setCurrentValue(String currentValue) { + this.currentValue = currentValue; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public String toString() { + return "HeatParameterDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", type=" + type + + ", description=" + description + ", currentValue=" + currentValue + ", defaultValue=" + defaultValue + + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((currentValue == null) ? 0 : currentValue.hashCode()); + result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + HeatParameterDataDefinition other = (HeatParameterDataDefinition) obj; + if (currentValue == null) { + if (other.currentValue != null) { + return false; + } + } else if (!currentValue.equals(other.currentValue)) { + return false; + } + if (defaultValue == null) { + if (other.defaultValue != null) { + return false; + } + } else if (!defaultValue.equals(other.defaultValue)) { + return false; + } + if (description == null) { + if (other.description != null) { + return false; + } + } else if (!description.equals(other.description)) { + return false; + } + if (name == null) { + if (other.name != null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } + if (type == null) { + if (other.type != null) { + return false; + } + } else if (!type.equals(other.type)) { + return false; + } + if (uniqueId == null) { + return other.uniqueId == null; + } else { + return uniqueId.equals(other.uniqueId); + } + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java index c093d171a2..422b7eac6c 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,51 +23,51 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.Map; public class InputDataDefinition extends PropertyDataDefinition { - - String label; - Boolean hidden; - Boolean immutable; - - public InputDataDefinition(){ - super(); - } - public InputDataDefinition(Map<String, Object> pr) { - super(pr); - } + private String label; + private Boolean hidden; + private Boolean immutable; - public InputDataDefinition(InputDataDefinition p) { - super(p); - this.setLabel(p.getLabel()); - this.setHidden( p.isHidden()); - this.setImmutable( p.isImmutable()); - } - - public InputDataDefinition(PropertyDataDefinition p) { - super(p); - } - - public Boolean isHidden() { - return hidden; - } + InputDataDefinition() { + super(); + } - public void setHidden(Boolean hidden) { - this.hidden = hidden; - } + InputDataDefinition(Map<String, Object> pr) { + super(pr); + } - public Boolean isImmutable() { - return immutable; - } + InputDataDefinition(InputDataDefinition p) { + super(p); + this.setLabel(p.getLabel()); + this.setHidden(p.isHidden()); + this.setImmutable(p.isImmutable()); + } - public void setImmutable(Boolean immutable) { - this.immutable = immutable; - } + InputDataDefinition(PropertyDataDefinition p) { + super(p); + } - public String getLabel() { - return label; - } + public Boolean isHidden() { + return hidden; + } - public void setLabel(String label) { - this.label = label; - } -}
\ No newline at end of file + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + + public Boolean isImmutable() { + return immutable; + } + + public void setImmutable(Boolean immutable) { + this.immutable = immutable; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java index b54c960cf2..3300c5dae0 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,42 +23,42 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class InputsValueDataDefinition extends ToscaDataDefinition { - private String name; - private String value; - private String uniqueId; + private String name; + private String value; + private String uniqueId; - public InputsValueDataDefinition(String name, String value) { - super(); - this.name = name; - this.value = value; - } + public InputsValueDataDefinition(String name, String value) { + super(); + this.name = name; + this.value = value; + } - public InputsValueDataDefinition() { - super(); - } + public InputsValueDataDefinition() { + super(); + } - public String getUniqueId() { - return uniqueId; - } + public String getUniqueId() { + return uniqueId; + } - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public void setValue(String value) { - this.value = value; - } + public void setValue(String value) { + this.value = value; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java index 7ffd74772c..d263771002 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java @@ -20,14 +20,15 @@ package org.openecomp.sdc.be.datatypes.elements; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME; - import com.fasterxml.jackson.annotation.JsonCreator; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + import java.io.Serializable; import java.util.HashMap; import java.util.Map; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME; public class InterfaceDataDefinition extends ToscaDataDefinition implements Serializable { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java index 113a6f4ed4..d5f4f3ccbb 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java @@ -26,49 +26,49 @@ import java.util.Objects; public class InterfaceInstanceDataDefinition extends ToscaDataDefinition implements Serializable { - public InterfaceInstanceDataDefinition( - InterfaceInstanceDataDefinition inter) { - this.toscaPresentation = null; - setInputs(inter.getInputs() == null? new HashMap():new HashMap<>(inter.getInputs())); - setOperations(new HashMap<>(inter.getOperations())); - } - - public InterfaceInstanceDataDefinition(){ - this.toscaPresentation = null; - } + public InterfaceInstanceDataDefinition( + InterfaceInstanceDataDefinition inter) { + this.toscaPresentation = null; + setInputs(inter.getInputs() == null ? new HashMap() : new HashMap<>(inter.getInputs())); + setOperations(new HashMap<>(inter.getOperations())); + } - public Map<String, Object> getInputs() { - return (Map<String, Object>)getToscaPresentationValue(JsonPresentationFields.INPUTS); - } + public InterfaceInstanceDataDefinition() { + this.toscaPresentation = null; + } - public void setInputs(Map<String, Object> inputs) { - setToscaPresentationValue(JsonPresentationFields.INPUTS, inputs); - } + public Map<String, Object> getInputs() { + return (Map<String, Object>) getToscaPresentationValue(JsonPresentationFields.INPUTS); + } - public Map<String, OperationInstance> getOperations() { - return (Map<String, OperationInstance>)getToscaPresentationValue(JsonPresentationFields.OPERATIONS); - } + public void setInputs(Map<String, Object> inputs) { + setToscaPresentationValue(JsonPresentationFields.INPUTS, inputs); + } - public void setOperations(Map<String, OperationInstance> operations) { - setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations); - } + public Map<String, OperationInstance> getOperations() { + return (Map<String, OperationInstance>) getToscaPresentationValue(JsonPresentationFields.OPERATIONS); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + public void setOperations(Map<String, OperationInstance> operations) { + setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations); } - if (!(o instanceof InterfaceInstanceDataDefinition)) { - return false; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof InterfaceInstanceDataDefinition)) { + return false; + } + InterfaceInstanceDataDefinition that = (InterfaceInstanceDataDefinition) o; + return Objects.equals(this.getInputs(), that.getInputs()); } - InterfaceInstanceDataDefinition that = (InterfaceInstanceDataDefinition) o; - return Objects.equals(this.getInputs(), that.getInputs()); - } - @Override - public int hashCode() { + @Override + public int hashCode() { - return Objects.hash(this.getInputs()); - } + return Objects.hash(this.getInputs()); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java index b705be49e0..2f97cad243 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,29 +26,31 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.List; public class ListCapabilityDataDefinition extends ListDataDefinition<CapabilityDataDefinition> { - - public ListCapabilityDataDefinition(ListCapabilityDataDefinition cdt) { - super(cdt); - - } - - @JsonCreator - public ListCapabilityDataDefinition(List< CapabilityDataDefinition > listToscaDataDefinition) { - super(listToscaDataDefinition); - } - public ListCapabilityDataDefinition() { - super(); - - } - @JsonValue - @Override - public List<CapabilityDataDefinition> getListToscaDataDefinition() { - return listToscaDataDefinition; - } - - - public void setListToscaDataDefinition(List<CapabilityDataDefinition> listToscaDataDefinition) { - this.listToscaDataDefinition = listToscaDataDefinition; - } + + public ListCapabilityDataDefinition(ListCapabilityDataDefinition cdt) { + super(cdt); + + } + + @JsonCreator + public ListCapabilityDataDefinition(List<CapabilityDataDefinition> listToscaDataDefinition) { + super(listToscaDataDefinition); + } + + public ListCapabilityDataDefinition() { + super(); + + } + + @JsonValue + @Override + public List<CapabilityDataDefinition> getListToscaDataDefinition() { + return listToscaDataDefinition; + } + + + public void setListToscaDataDefinition(List<CapabilityDataDefinition> listToscaDataDefinition) { + this.listToscaDataDefinition = listToscaDataDefinition; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java index 073635a9f5..b6b75de678 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,93 +24,98 @@ import com.fasterxml.jackson.annotation.JsonCreator; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaDataDefinition { - protected List<T> listToscaDataDefinition; - - public ListDataDefinition(ListDataDefinition<T> cdt) { - listToscaDataDefinition = cdt.listToscaDataDefinition; - - } - - public ListDataDefinition(List<T> listToscaDataDefinition) { - this.listToscaDataDefinition = listToscaDataDefinition; - } - - @JsonCreator - public ListDataDefinition() { - this.listToscaDataDefinition = new ArrayList<>(); - } - - public List<T> getListToscaDataDefinition() { - return listToscaDataDefinition; - } - - public void add(T value) { - if (listToscaDataDefinition == null) { - listToscaDataDefinition = new ArrayList<>(); - } - listToscaDataDefinition.add(value); - } - - public void delete(T value) { - if (listToscaDataDefinition != null) { - listToscaDataDefinition.remove(value); - } - } - - @Override - public void setOwnerIdIfEmpty(String ownerId) { - if (listToscaDataDefinition != null) { - listToscaDataDefinition.forEach(e -> e.setOwnerIdIfEmpty(ownerId)); - } - } - - @Override - public <S extends ToscaDataDefinition> S mergeFunction(S other, boolean allowDefaultValueOverride) { - Map<String, T> mapByName = listToMapByName(listToscaDataDefinition); - List<T> otherList = ((ListDataDefinition) other).getListToscaDataDefinition(); - for (T item : otherList) { - mapByName.merge((String) item.getToscaPresentationValue(JsonPresentationFields.NAME), item, (thisItem, otherItem) -> thisItem.mergeFunction(otherItem, allowDefaultValueOverride)); - } - ((ListDataDefinition) other).listToscaDataDefinition = mapByName.values().stream().collect(Collectors.toList()); - return other; - } - - @Override - public boolean findUidMatch(String uid) { - return listToscaDataDefinition.stream().anyMatch(p -> p.findUidMatch(uid)); - } - - @Override - public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { - List<T> collect1 = (List<T>) listToscaDataDefinition.stream().filter(e -> ownerIdList.contains(e.getOwnerId())).collect(Collectors.toList()); - ListDataDefinition listDef = new ListDataDefinition(collect1); - - listToscaDataDefinition.removeIf(e -> ownerIdList.contains(e.getOwnerId())); - return (T) listDef; - } - - @Override - public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) { - - List<T> list = ((ListDataDefinition)other).getListToscaDataDefinition(); - list.forEach(e -> { - String nameFromPrev = (String)e.getToscaPresentationValue(JsonPresentationFields.NAME); - if ( nameFromPrev != null ){ - Optional<T> findAny = (Optional<T>) listToscaDataDefinition.stream().filter(o->nameFromPrev.equals(e.getToscaPresentationValue(JsonPresentationFields.NAME))).findAny(); - if ( findAny.isPresent() ){ - e.mergeFunction(findAny.get(), allowDefaultValueOverride); - } - } - }); - return other; - } - @Override - public boolean isEmpty(){ - return listToscaDataDefinition == null || listToscaDataDefinition.isEmpty(); - } + List<T> listToscaDataDefinition; + + public ListDataDefinition(ListDataDefinition<T> cdt) { + listToscaDataDefinition = cdt.listToscaDataDefinition; + + } + + public ListDataDefinition(List<T> listToscaDataDefinition) { + this.listToscaDataDefinition = listToscaDataDefinition; + } + + @JsonCreator + public ListDataDefinition() { + this.listToscaDataDefinition = new ArrayList<>(); + } + + public List<T> getListToscaDataDefinition() { + return listToscaDataDefinition; + } + + public void add(T value) { + if (listToscaDataDefinition == null) { + listToscaDataDefinition = new ArrayList<>(); + } + listToscaDataDefinition.add(value); + } + + public void delete(T value) { + if (listToscaDataDefinition != null) { + listToscaDataDefinition.remove(value); + } + } + + @Override + public void setOwnerIdIfEmpty(String ownerId) { + if (listToscaDataDefinition != null) { + listToscaDataDefinition.forEach(e -> e.setOwnerIdIfEmpty(ownerId)); + } + } + + @Override + public <S extends ToscaDataDefinition> S mergeFunction(S other, boolean allowDefaultValueOverride) { + Map<String, T> mapByName = listToMapByName(listToscaDataDefinition); + List<T> otherList = ((ListDataDefinition) other).getListToscaDataDefinition(); + for (T item : otherList) { + mapByName.merge((String) item.getToscaPresentationValue(JsonPresentationFields.NAME), item, (thisItem, otherItem) -> thisItem.mergeFunction(otherItem, allowDefaultValueOverride)); + } + ((ListDataDefinition) other).listToscaDataDefinition = mapByName.values().stream().collect(Collectors.toList()); + return other; + } + + @Override + public boolean findUidMatch(String uid) { + return listToscaDataDefinition.stream().anyMatch(p -> p.findUidMatch(uid)); + } + + @Override + public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { + List<T> collect1 = (List<T>) listToscaDataDefinition.stream().filter(e -> ownerIdList.contains(e.getOwnerId())).collect(Collectors.toList()); + ListDataDefinition listDef = new ListDataDefinition(collect1); + + listToscaDataDefinition.removeIf(e -> ownerIdList.contains(e.getOwnerId())); + return (T) listDef; + } + + @Override + public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) { + + List<T> list = ((ListDataDefinition) other).getListToscaDataDefinition(); + list.forEach(e -> { + String nameFromPrev = (String) e.getToscaPresentationValue(JsonPresentationFields.NAME); + if (nameFromPrev != null) { + Optional<T> findAny = (Optional<T>) listToscaDataDefinition.stream().filter(o -> nameFromPrev.equals(e.getToscaPresentationValue(JsonPresentationFields.NAME))).findAny(); + if (findAny.isPresent()) { + e.mergeFunction(findAny.get(), allowDefaultValueOverride); + } + } + }); + return other; + } + + @Override + public boolean isEmpty() { + return listToscaDataDefinition == null || listToscaDataDefinition.isEmpty(); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java index 368ed1bdc4..a9b57ac801 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,30 +26,32 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.List; public class ListMapPropertiesDataDefinition extends ListDataDefinition<MapPropertiesDataDefinition> { - - public ListMapPropertiesDataDefinition(ListMapPropertiesDataDefinition cdt) { - super(cdt); - - } - - @JsonCreator - public ListMapPropertiesDataDefinition(List< MapPropertiesDataDefinition > listToscaDataDefinition) { - super(listToscaDataDefinition); - } - public ListMapPropertiesDataDefinition() { - super(); - - } - @JsonValue - @Override - public List<MapPropertiesDataDefinition> getListToscaDataDefinition() { - return listToscaDataDefinition; - } - - - public void setMapToscaDataDefinition(List<MapPropertiesDataDefinition> listToscaDataDefinition) { - this.listToscaDataDefinition = listToscaDataDefinition; - } + + public ListMapPropertiesDataDefinition(ListMapPropertiesDataDefinition cdt) { + super(cdt); + + } + + @JsonCreator + public ListMapPropertiesDataDefinition(List<MapPropertiesDataDefinition> listToscaDataDefinition) { + super(listToscaDataDefinition); + } + + public ListMapPropertiesDataDefinition() { + super(); + + } + + @JsonValue + @Override + public List<MapPropertiesDataDefinition> getListToscaDataDefinition() { + return listToscaDataDefinition; + } + + + public void setMapToscaDataDefinition(List<MapPropertiesDataDefinition> listToscaDataDefinition) { + this.listToscaDataDefinition = listToscaDataDefinition; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java index 652ab335c6..ccf3dd82cf 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,33 +26,32 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.List; public class ListRequirementDataDefinition extends ListDataDefinition<RequirementDataDefinition> { - - public ListRequirementDataDefinition(ListRequirementDataDefinition cdt) { - super(cdt); - - } - - @JsonCreator - public ListRequirementDataDefinition(List< RequirementDataDefinition > listToscaDataDefinition) { - super(listToscaDataDefinition); - } - public ListRequirementDataDefinition() { - super(); - - } - @JsonValue - @Override - public List<RequirementDataDefinition> getListToscaDataDefinition() { - return listToscaDataDefinition; - } - - - public void setListToscaDataDefinition(List<RequirementDataDefinition> listToscaDataDefinition) { - this.listToscaDataDefinition = listToscaDataDefinition; - } - - - - - + + public ListRequirementDataDefinition(ListRequirementDataDefinition cdt) { + super(cdt); + + } + + @JsonCreator + public ListRequirementDataDefinition(List<RequirementDataDefinition> listToscaDataDefinition) { + super(listToscaDataDefinition); + } + + public ListRequirementDataDefinition() { + super(); + + } + + @JsonValue + @Override + public List<RequirementDataDefinition> getListToscaDataDefinition() { + return listToscaDataDefinition; + } + + + public void setListToscaDataDefinition(List<RequirementDataDefinition> listToscaDataDefinition) { + this.listToscaDataDefinition = listToscaDataDefinition; + } + + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java index 6629d10802..ab54fcf226 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,41 +25,43 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Map; -public class MapArtifactDataDefinition extends MapDataDefinition<ArtifactDataDefinition>{ - - private String parentName; - - public MapArtifactDataDefinition(MapDataDefinition cdt, String parentName) { - super(cdt); - this.parentName = parentName; - } - - @JsonCreator - public MapArtifactDataDefinition(Map<String, ArtifactDataDefinition > mapToscaDataDefinition) { - super(mapToscaDataDefinition); - } - public MapArtifactDataDefinition() { - super(); - - } - @JsonValue - @Override - public Map<String, ArtifactDataDefinition> getMapToscaDataDefinition() { - return mapToscaDataDefinition; - } - - - public void setMapToscaDataDefinition(Map<String, ArtifactDataDefinition> mapToscaDataDefinition) { - this.mapToscaDataDefinition = mapToscaDataDefinition; - } - - public String getParentName() { - return parentName; - } - - public void setParentName(String parentName) { - this.parentName = parentName; - } - +public class MapArtifactDataDefinition extends MapDataDefinition<ArtifactDataDefinition> { + + private String parentName; + + public MapArtifactDataDefinition(MapDataDefinition cdt, String parentName) { + super(cdt); + this.parentName = parentName; + } + + @JsonCreator + public MapArtifactDataDefinition(Map<String, ArtifactDataDefinition> mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + + public MapArtifactDataDefinition() { + super(); + + } + + @JsonValue + @Override + public Map<String, ArtifactDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + + public void setMapToscaDataDefinition(Map<String, ArtifactDataDefinition> mapToscaDataDefinition) { + this.mapToscaDataDefinition = mapToscaDataDefinition; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityProperty.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityProperty.java index 39588524bf..2cd075afad 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityProperty.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabilityProperty.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,22 +27,24 @@ import com.fasterxml.jackson.annotation.JsonValue; import java.util.Map; public class MapCapabilityProperty extends MapDataDefinition<MapPropertiesDataDefinition> { - @JsonCreator - public MapCapabilityProperty(Map<String, MapPropertiesDataDefinition > mapToscaDataDefinition) { - super(mapToscaDataDefinition); - } - public MapCapabilityProperty() { - super(); - - } - @JsonValue - @Override - public Map<String, MapPropertiesDataDefinition> getMapToscaDataDefinition() { - return mapToscaDataDefinition; - } - - public void setMapToscaDataDefinition(Map<String, MapPropertiesDataDefinition> mapToscaDataDefinition) { - this.mapToscaDataDefinition = mapToscaDataDefinition; - } + @JsonCreator + public MapCapabilityProperty(Map<String, MapPropertiesDataDefinition> mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + + public MapCapabilityProperty() { + super(); + + } + + @JsonValue + @Override + public Map<String, MapPropertiesDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + public void setMapToscaDataDefinition(Map<String, MapPropertiesDataDefinition> mapToscaDataDefinition) { + this.mapToscaDataDefinition = mapToscaDataDefinition; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefs.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefs.java index a3b28e57af..47ecde228e 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefs.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapComponentInstanceExternalRefs.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,14 +23,17 @@ package org.openecomp.sdc.be.datatypes.elements; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * Maps an object type (e.g. "monitoring", "workflows" etc) to a list of external references. * * "monitoring" -> { "ref1", "ref2" }, * "workflows" -> { "ref1", "ref2" } - * */ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition { @@ -58,9 +61,9 @@ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition { * Adds a reference to the given object type. Will do nothing if already exist. * * @param objectType object type to associate reference to - * @param ref to add + * @param ref to add */ - public boolean addExternalRef(String objectType, String ref){ + public boolean addExternalRef(String objectType, String ref) { List<String> refList = this.getExternalRefsByObjectType(objectType); @@ -71,7 +74,7 @@ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition { } //Add reference to list if does not exist - if (!refList.contains(ref)){ + if (!refList.contains(ref)) { return refList.add(ref); } @@ -79,7 +82,7 @@ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition { } - public boolean deleteExternalRef(String objectType, String ref){ + public boolean deleteExternalRef(String objectType, String ref) { List<String> refList = this.getExternalRefsByObjectType(objectType); if (refList != null) { @@ -92,7 +95,7 @@ public class MapComponentInstanceExternalRefs extends ToscaDataDefinition { public boolean replaceExternalRef(String objectType, String oldRef, String newRef) { List<String> refList = this.getExternalRefsByObjectType(objectType); - if (refList != null && !refList.contains(newRef)) { + if (refList != null && !refList.contains(newRef)) { return Collections.replaceAll(refList, oldRef, newRef); } else { return false; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java index 0d619ce1b4..9801e3b83f 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,98 +29,105 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDataDefinition { - - protected Map<String, T > mapToscaDataDefinition; - - public MapDataDefinition(MapDataDefinition<T> cdt) { - super(); - mapToscaDataDefinition = cdt.mapToscaDataDefinition; - - } - @JsonCreator - public MapDataDefinition(Map<String, T > mapToscaDataDefinition) { - super(); - this.mapToscaDataDefinition = mapToscaDataDefinition; - } - - public MapDataDefinition() { - super(); - } - @JsonValue - public Map<String, T > getMapToscaDataDefinition() { - return mapToscaDataDefinition; - } - - public void put(String key, T value){ - if(mapToscaDataDefinition == null){ - mapToscaDataDefinition = new HashMap<>(); - } - mapToscaDataDefinition.put(key, value); - } - - public void delete(String key){ - if(mapToscaDataDefinition != null && mapToscaDataDefinition.containsKey(key)){ - mapToscaDataDefinition.remove(key); - } - } - - public T findByKey(String key){ - T value = null; - if(mapToscaDataDefinition != null && mapToscaDataDefinition.containsKey(key)){ - value = mapToscaDataDefinition.get(key); - } - return value; - } - @Override - public void setOwnerIdIfEmpty(String ownerId) { - if ( mapToscaDataDefinition != null ){ - mapToscaDataDefinition.entrySet().forEach(e -> e.getValue().setOwnerIdIfEmpty(ownerId)); - } - } - - - public String findKeyByItemUidMatch(String uid){ - if(null == mapToscaDataDefinition || uid == null) - return null; - Map.Entry<String, T> entry = mapToscaDataDefinition.entrySet().stream().filter(e -> - e.getValue().findUidMatch(uid)) - .findAny().orElse(null); - if(null == entry) - return null; - return entry.getKey(); - } - @Override - public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { - if(mapToscaDataDefinition != null) { - Map<String, T > collect = (Map<String, T >)mapToscaDataDefinition.entrySet() - .stream() - .filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue))); - - MapDataDefinition collectMap = new MapDataDefinition<>(collect); - - mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId())); - return (T) collectMap; - } - return (T) new MapDataDefinition(new HashMap<>()); - } - - @Override - public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) { - - Map<String, T > map = ((MapDataDefinition)other).getMapToscaDataDefinition(); - if(map != null) { - map.entrySet().forEach(e ->{ - String key = e.getKey(); - if ( mapToscaDataDefinition.containsKey(key) ){ - e.getValue().mergeFunction(mapToscaDataDefinition.get(key), allowDefaultValueOverride); - } - }); - } - return other; - } - @Override - public boolean isEmpty(){ - return mapToscaDataDefinition == null || mapToscaDataDefinition.isEmpty(); - } +public class MapDataDefinition<T extends ToscaDataDefinition> extends ToscaDataDefinition { + + protected Map<String, T> mapToscaDataDefinition; + + public MapDataDefinition(MapDataDefinition<T> cdt) { + super(); + mapToscaDataDefinition = cdt.mapToscaDataDefinition; + + } + + @JsonCreator + public MapDataDefinition(Map<String, T> mapToscaDataDefinition) { + super(); + this.mapToscaDataDefinition = mapToscaDataDefinition; + } + + public MapDataDefinition() { + super(); + } + + @JsonValue + public Map<String, T> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + public void put(String key, T value) { + if (mapToscaDataDefinition == null) { + mapToscaDataDefinition = new HashMap<>(); + } + mapToscaDataDefinition.put(key, value); + } + + public void delete(String key) { + if (mapToscaDataDefinition != null && mapToscaDataDefinition.containsKey(key)) { + mapToscaDataDefinition.remove(key); + } + } + + public T findByKey(String key) { + T value = null; + if (mapToscaDataDefinition != null && mapToscaDataDefinition.containsKey(key)) { + value = mapToscaDataDefinition.get(key); + } + return value; + } + + @Override + public void setOwnerIdIfEmpty(String ownerId) { + if (mapToscaDataDefinition != null) { + mapToscaDataDefinition.entrySet().forEach(e -> e.getValue().setOwnerIdIfEmpty(ownerId)); + } + } + + + public String findKeyByItemUidMatch(String uid) { + if (null == mapToscaDataDefinition || uid == null) { + return null; + } + Map.Entry<String, T> entry = mapToscaDataDefinition.entrySet().stream().filter(e -> + e.getValue().findUidMatch(uid)) + .findAny().orElse(null); + if (null == entry) { + return null; + } + return entry.getKey(); + } + + @Override + public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { + if (mapToscaDataDefinition != null) { + Map<String, T> collect = (Map<String, T>) mapToscaDataDefinition.entrySet() + .stream() + .filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue))); + + MapDataDefinition collectMap = new MapDataDefinition<>(collect); + + mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId())); + return (T) collectMap; + } + return (T) new MapDataDefinition(new HashMap<>()); + } + + @Override + public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) { + + Map<String, T> map = ((MapDataDefinition) other).getMapToscaDataDefinition(); + if (map != null) { + map.entrySet().forEach(e -> { + String key = e.getKey(); + if (mapToscaDataDefinition.containsKey(key)) { + e.getValue().mergeFunction(mapToscaDataDefinition.get(key), allowDefaultValueOverride); + } + }); + } + return other; + } + + @Override + public boolean isEmpty() { + return mapToscaDataDefinition == null || mapToscaDataDefinition.isEmpty(); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java index cdb48336a7..6b490a3505 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,48 +21,48 @@ package org.openecomp.sdc.be.datatypes.elements; - - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.util.Map; -public class MapGroupsDataDefinition extends MapDataDefinition<GroupInstanceDataDefinition>{ - - private String parentName; - - public MapGroupsDataDefinition(MapDataDefinition<GroupInstanceDataDefinition> cdt, String parentName) { - super(cdt); - this.parentName = parentName; - } - - @JsonCreator - public MapGroupsDataDefinition(Map<String, GroupInstanceDataDefinition> mapToscaDataDefinition) { - super(mapToscaDataDefinition); - } - public MapGroupsDataDefinition() { - super(); - - } - @JsonValue - @Override - public Map<String, GroupInstanceDataDefinition> getMapToscaDataDefinition() { - return mapToscaDataDefinition; - } - - - public void setMapToscaDataDefinition(Map<String, GroupInstanceDataDefinition> mapToscaDataDefinition) { - this.mapToscaDataDefinition = mapToscaDataDefinition; - } - - public String getParentName() { - return parentName; - } - - public void setParentName(String parentName) { - this.parentName = parentName; - } - +public class MapGroupsDataDefinition extends MapDataDefinition<GroupInstanceDataDefinition> { + + private String parentName; + + public MapGroupsDataDefinition(MapDataDefinition<GroupInstanceDataDefinition> cdt, String parentName) { + super(cdt); + this.parentName = parentName; + } + + @JsonCreator + public MapGroupsDataDefinition(Map<String, GroupInstanceDataDefinition> mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + + public MapGroupsDataDefinition() { + super(); + + } + + @JsonValue + @Override + public Map<String, GroupInstanceDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + + public void setMapToscaDataDefinition(Map<String, GroupInstanceDataDefinition> mapToscaDataDefinition) { + this.mapToscaDataDefinition = mapToscaDataDefinition; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapInterfaceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapInterfaceDataDefinition.java index 7b1b43ebd7..4cb282fee2 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapInterfaceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapInterfaceDataDefinition.java @@ -23,18 +23,18 @@ import java.util.Map; public class MapInterfaceDataDefinition extends MapDataDefinition<InterfaceDataDefinition> { - public MapInterfaceDataDefinition() { + public MapInterfaceDataDefinition() { - } + } - @JsonCreator - public MapInterfaceDataDefinition(Map<String, InterfaceDataDefinition > mapToscaDataDefinition) { - super(mapToscaDataDefinition); - } + @JsonCreator + public MapInterfaceDataDefinition(Map<String, InterfaceDataDefinition> mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } - @JsonValue - @Override - public Map<String, InterfaceDataDefinition> getMapToscaDataDefinition() { - return mapToscaDataDefinition; - } + @JsonValue + @Override + public Map<String, InterfaceDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinition.java index 9f2e13ee78..2bf5920758 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabilityDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,8 +21,6 @@ package org.openecomp.sdc.be.datatypes.elements; - - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; @@ -31,42 +29,42 @@ import java.util.Map; public class MapListCapabilityDataDefinition extends MapDataDefinition<ListCapabilityDataDefinition> { - public MapListCapabilityDataDefinition(MapListCapabilityDataDefinition cdt) { - super(cdt); + public MapListCapabilityDataDefinition(MapListCapabilityDataDefinition cdt) { + super(cdt); - } + } - @JsonCreator - public MapListCapabilityDataDefinition(Map<String, ListCapabilityDataDefinition> mapToscaDataDefinition) { - super(mapToscaDataDefinition); - } + @JsonCreator + public MapListCapabilityDataDefinition(Map<String, ListCapabilityDataDefinition> mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } - public MapListCapabilityDataDefinition() { - super(); + public MapListCapabilityDataDefinition() { + super(); - } + } - @JsonValue - @Override - public Map<String, ListCapabilityDataDefinition> getMapToscaDataDefinition() { - return mapToscaDataDefinition; - } + @JsonValue + @Override + public Map<String, ListCapabilityDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } - public void add(String key, CapabilityDataDefinition value) { - if (mapToscaDataDefinition == null) { - mapToscaDataDefinition = new HashMap<>(); - ListCapabilityDataDefinition newList = new ListCapabilityDataDefinition(); - newList.add(value); - put(key, newList); - } else { - ListCapabilityDataDefinition existValue = mapToscaDataDefinition.get(key); - if (existValue == null) { - ListCapabilityDataDefinition newList = new ListCapabilityDataDefinition(); - newList.add(value); - put(key, newList); - } else { - existValue.getListToscaDataDefinition().add(value); - } - } - } + public void add(String key, CapabilityDataDefinition value) { + if (mapToscaDataDefinition == null) { + mapToscaDataDefinition = new HashMap<>(); + ListCapabilityDataDefinition newList = new ListCapabilityDataDefinition(); + newList.add(value); + put(key, newList); + } else { + ListCapabilityDataDefinition existValue = mapToscaDataDefinition.get(key); + if (existValue == null) { + ListCapabilityDataDefinition newList = new ListCapabilityDataDefinition(); + newList.add(value); + put(key, newList); + } else { + existValue.getListToscaDataDefinition().add(value); + } + } + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java index d4fecb70e3..ada4411d03 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,8 +21,6 @@ package org.openecomp.sdc.be.datatypes.elements; - - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; @@ -31,43 +29,43 @@ import java.util.Map; public class MapListRequirementDataDefinition extends MapDataDefinition<ListRequirementDataDefinition> { - public MapListRequirementDataDefinition(MapListRequirementDataDefinition cdt) { - super(cdt); + public MapListRequirementDataDefinition(MapListRequirementDataDefinition cdt) { + super(cdt); - } + } - @JsonCreator - public MapListRequirementDataDefinition(Map<String, ListRequirementDataDefinition> mapToscaDataDefinition) { - super(mapToscaDataDefinition); - } + @JsonCreator + public MapListRequirementDataDefinition(Map<String, ListRequirementDataDefinition> mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } - public MapListRequirementDataDefinition() { - super(); + public MapListRequirementDataDefinition() { + super(); - } + } - @JsonValue - @Override - public Map<String, ListRequirementDataDefinition> getMapToscaDataDefinition() { - return mapToscaDataDefinition; - } + @JsonValue + @Override + public Map<String, ListRequirementDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } - public void add(String key, RequirementDataDefinition value) { - if (mapToscaDataDefinition == null) { - mapToscaDataDefinition = new HashMap<>(); - ListRequirementDataDefinition newList = new ListRequirementDataDefinition(); - newList.add(value); - put(key, newList); - } else { - ListRequirementDataDefinition existValue = mapToscaDataDefinition.get(key); - if (existValue == null) { - ListRequirementDataDefinition newList = new ListRequirementDataDefinition(); - newList.add(value); - put(key, newList); - } else { - existValue.getListToscaDataDefinition().add(value); - } - } - } + public void add(String key, RequirementDataDefinition value) { + if (mapToscaDataDefinition == null) { + mapToscaDataDefinition = new HashMap<>(); + ListRequirementDataDefinition newList = new ListRequirementDataDefinition(); + newList.add(value); + put(key, newList); + } else { + ListRequirementDataDefinition existValue = mapToscaDataDefinition.get(key); + if (existValue == null) { + ListRequirementDataDefinition newList = new ListRequirementDataDefinition(); + newList.add(value); + put(key, newList); + } else { + existValue.getListToscaDataDefinition().add(value); + } + } + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java index eec5bc1fb8..075806a709 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,58 +21,58 @@ package org.openecomp.sdc.be.datatypes.elements; - - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.util.HashMap; import java.util.Map; -public class MapPropertiesDataDefinition extends MapDataDefinition<PropertyDataDefinition>{ - - private String parentName; - - public MapPropertiesDataDefinition(MapDataDefinition cdt, String parentName) { - super(cdt); - this.parentName = parentName; - } - - @JsonCreator - public MapPropertiesDataDefinition(Map<String, PropertyDataDefinition > mapToscaDataDefinition) { - super(mapToscaDataDefinition); - } - - /** - * Copy Constructor - */ - public MapPropertiesDataDefinition(MapPropertiesDataDefinition toBeDeepCopiedMapPropertiesDataDefinition){ - this.parentName = toBeDeepCopiedMapPropertiesDataDefinition.parentName; - this.toscaPresentation = toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation); - this.mapToscaDataDefinition = toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition); - } - public MapPropertiesDataDefinition() { - super(); - - } - @JsonValue - @Override - public Map<String, PropertyDataDefinition> getMapToscaDataDefinition() { - return mapToscaDataDefinition; - } - - - public void setMapToscaDataDefinition(Map<String, PropertyDataDefinition> mapToscaDataDefinition) { - this.mapToscaDataDefinition = mapToscaDataDefinition; - } - - public String getParentName() { - return parentName; - } - - public void setParentName(String parentName) { - this.parentName = parentName; - } - +public class MapPropertiesDataDefinition extends MapDataDefinition<PropertyDataDefinition> { + + private String parentName; + + public MapPropertiesDataDefinition(MapDataDefinition cdt, String parentName) { + super(cdt); + this.parentName = parentName; + } + + @JsonCreator + public MapPropertiesDataDefinition(Map<String, PropertyDataDefinition> mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + + /** + * Copy Constructor + */ + public MapPropertiesDataDefinition(MapPropertiesDataDefinition toBeDeepCopiedMapPropertiesDataDefinition) { + this.parentName = toBeDeepCopiedMapPropertiesDataDefinition.parentName; + this.toscaPresentation = toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation); + this.mapToscaDataDefinition = toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition); + } + + public MapPropertiesDataDefinition() { + super(); + + } + + @JsonValue + @Override + public Map<String, PropertyDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + + public void setMapToscaDataDefinition(Map<String, PropertyDataDefinition> mapToscaDataDefinition) { + this.mapToscaDataDefinition = mapToscaDataDefinition; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java index 84b6124b97..4c14551c1b 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java @@ -20,15 +20,16 @@ package org.openecomp.sdc.be.datatypes.elements; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ASSOCIATION_TYPE; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ID; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_VERSION_ID; - import com.fasterxml.jackson.annotation.JsonCreator; -import java.io.Serializable; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.io.Serializable; + +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ASSOCIATION_TYPE; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ID; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_VERSION_ID; + public class OperationDataDefinition extends ToscaDataDefinition implements Serializable { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationImplementation.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationImplementation.java index 7d6ebdd2ed..2364ff4e3b 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationImplementation.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationImplementation.java @@ -22,40 +22,40 @@ import java.util.Objects; public class OperationImplementation { - private String primary; - private List<String> dependencies; + private String primary; + private List<String> dependencies; - public String getPrimary() { - return primary; - } + public String getPrimary() { + return primary; + } - public void setPrimary(String primary) { - this.primary = primary; - } + public void setPrimary(String primary) { + this.primary = primary; + } - public List<String> getDependencies() { - return dependencies; - } + public List<String> getDependencies() { + return dependencies; + } - public void setDependencies(List<String> dependencies) { - this.dependencies = dependencies; - } + public void setDependencies(List<String> dependencies) { + this.dependencies = dependencies; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof OperationImplementation)) { + return false; + } + OperationImplementation that = (OperationImplementation) o; + return Objects.equals(primary, that.primary) + && Objects.equals(new HashSet<>(dependencies), new HashSet<>(that.dependencies)); } - if (!(o instanceof OperationImplementation)) { - return false; + + @Override + public int hashCode() { + return Objects.hash(primary, dependencies); } - OperationImplementation that = (OperationImplementation) o; - return Objects.equals(primary, that.primary) && - Objects.equals(new HashSet<>(dependencies), new HashSet<>(that.dependencies)); - } - - @Override - public int hashCode() { - return Objects.hash(primary, dependencies); - } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java index ab3f536d63..0fcdd9ce36 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java @@ -17,7 +17,6 @@ package org.openecomp.sdc.be.datatypes.elements; import com.fasterxml.jackson.annotation.JsonCreator; - import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; @@ -38,12 +37,12 @@ public class OperationInputDefinition extends InputDataDefinition { setSourceProperty(sourceProperty); } - public OperationInputDefinition(OperationInputDefinition oid) { - super(oid); - setName(oid.getName()); - setSource(oid.getSource()); - setSourceProperty(oid.getSourceProperty()); - } + public OperationInputDefinition(OperationInputDefinition oid) { + super(oid); + setName(oid.getName()); + setSource(oid.getSource()); + setSourceProperty(oid.getSourceProperty()); + } public OperationInputDefinition(String name, String property, Boolean mandatory, String type) { super(); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInstance.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInstance.java index 59a235b554..80c86d8d78 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInstance.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInstance.java @@ -20,42 +20,42 @@ import java.util.Map; import java.util.Objects; public class OperationInstance/* extends Operation*/ { - private OperationImplementation implementation; - private Map<String, Object> inputs; + private OperationImplementation implementation; + private Map<String, Object> inputs; - public OperationImplementation getImplementation() { - return implementation; - } - - public void setImplementation(OperationImplementation implementation) { - this.implementation = implementation; - } + public OperationImplementation getImplementation() { + return implementation; + } - public Map<String, Object> getInputs() { - return inputs; - } + public void setImplementation(OperationImplementation implementation) { + this.implementation = implementation; + } - public void setInputs(Map<String, Object> inputs) { - this.inputs = inputs; - } + public Map<String, Object> getInputs() { + return inputs; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + public void setInputs(Map<String, Object> inputs) { + this.inputs = inputs; } - if (!(o instanceof OperationInstance)) { - return false; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof OperationInstance)) { + return false; + } + OperationInstance that = (OperationInstance) o; + return Objects.equals(implementation, that.implementation) + && Objects.equals(inputs, that.inputs); } - OperationInstance that = (OperationInstance) o; - return Objects.equals(implementation, that.implementation) && - Objects.equals(inputs, that.inputs); - } - @Override - public int hashCode() { + @Override + public int hashCode() { - return Objects.hash(implementation, inputs); - } + return Objects.hash(implementation, inputs); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationOutputDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationOutputDefinition.java index 82607d765d..dc2ea93b01 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationOutputDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationOutputDefinition.java @@ -30,12 +30,14 @@ public class OperationOutputDefinition extends InputDataDefinition { super(definition); setName(name); } + public OperationOutputDefinition(String name, Boolean mandatory, String type) { super(); setName(name); setRequired(mandatory); setType(type); } + public String getLabel() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java index 59df9865f2..44d76fb42f 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,16 +20,17 @@ package org.openecomp.sdc.be.datatypes.elements; -import static java.util.Collections.emptyList; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import java.util.List; import java.util.Map; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; + +import static java.util.Collections.emptyList; /** * public class representing the component policy, * described by the next properties: - * <p> + * * name * uniqueId * type (policy type name) diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java index 900f44eb29..30ad169a88 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,6 +35,7 @@ public enum PolicyTargetType { public String getName() { return name; } + public static PolicyTargetType getByNameIgnoreCase(String name) { for (PolicyTargetType inst : PolicyTargetType.values()) { if (inst.getName().equalsIgnoreCase(name)) { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java index b5c21e5e6d..8a663374b2 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java @@ -137,4 +137,4 @@ public class PolicyTypeDataDefinition extends ToscaTypeDataDefinition { public void setHighestVersion(boolean isLatestVersion) { this.highestVersion = isLatestVersion; } -}
\ No newline at end of file +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java index 7c38eb5087..97107dbbf2 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,99 +27,108 @@ import java.util.List; public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition { - private String fullName; - - private List<String> contacts; - - private Boolean isActive; - - public ProductMetadataDataDefinition() { - super(); - } - - public ProductMetadataDataDefinition(ProductMetadataDataDefinition other) { - super(other); - } - - public Boolean getIsActive() { - return isActive; - } - - public void setIsActive(Boolean active) { - isActive = active; - } - - public List<String> getContacts() { - return contacts; - } - - public void setContacts(List<String> contacts) { - this.contacts = contacts; - } - - public void addContact(String contact) { - if (contact != null) { - if (contacts == null) { - contacts = new ArrayList<>(); - } - contacts.add(contact); - } - } - - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - @Override - public String toString() { - return "ProductMetadataDataDefinition [fullName=" + fullName + ", contacts=" + contacts + ", isActive=" - + isActive + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - - result = prime * result + ((contacts == null) ? 0 : contacts.hashCode()); - result = prime * result + ((fullName == null) ? 0 : fullName.hashCode()); - result = prime * result + ((isActive == null) ? 0 : isActive.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - ProductMetadataDataDefinition other = (ProductMetadataDataDefinition) obj; - if (contacts == null) { - if (other.contacts != null) - return false; - } else if (!contacts.equals(other.contacts)) - return false; - if (fullName == null) { - if (other.fullName != null) - return false; - } else if (!fullName.equals(other.fullName)) - return false; - if (isActive == null) { - if (other.isActive != null) - return false; - } else if (!isActive.equals(other.isActive)) - return false; - return super.equals(obj); - } - - @Override - public String getActualComponentType() { - return getComponentType() != null ? getComponentType().getValue() : null; - } + private String fullName; + + private List<String> contacts; + + private Boolean isActive; + + public ProductMetadataDataDefinition() { + super(); + } + + public ProductMetadataDataDefinition(ProductMetadataDataDefinition other) { + super(other); + } + + public Boolean getIsActive() { + return isActive; + } + + public void setIsActive(Boolean active) { + isActive = active; + } + + public List<String> getContacts() { + return contacts; + } + + public void setContacts(List<String> contacts) { + this.contacts = contacts; + } + + public void addContact(String contact) { + if (contact != null) { + if (contacts == null) { + contacts = new ArrayList<>(); + } + contacts.add(contact); + } + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + @Override + public String toString() { + return "ProductMetadataDataDefinition [fullName=" + fullName + ", contacts=" + contacts + ", isActive=" + + isActive + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + + result = prime * result + ((contacts == null) ? 0 : contacts.hashCode()); + result = prime * result + ((fullName == null) ? 0 : fullName.hashCode()); + result = prime * result + ((isActive == null) ? 0 : isActive.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ProductMetadataDataDefinition other = (ProductMetadataDataDefinition) obj; + if (contacts == null) { + if (other.contacts != null) { + return false; + } + } else if (!contacts.equals(other.contacts)) { + return false; + } + if (fullName == null) { + if (other.fullName != null) { + return false; + } + } else if (!fullName.equals(other.fullName)) { + return false; + } + if (isActive == null) { + if (other.isActive != null) { + return false; + } + } else if (!isActive.equals(other.isActive)) { + return false; + } + return super.equals(obj); + } + + @Override + public String getActualComponentType() { + return getComponentType() != null ? getComponentType().getValue() : null; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertiesOwner.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertiesOwner.java index 5b664b6a7f..fd9ea26922 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertiesOwner.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertiesOwner.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java index e59d9a6a62..af29a2f424 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,505 +20,507 @@ package org.openecomp.sdc.be.datatypes.elements; -import static org.apache.commons.collections.CollectionUtils.isNotEmpty; +import org.apache.commons.collections.CollectionUtils; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.apache.commons.collections.CollectionUtils; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +import static org.apache.commons.collections.CollectionUtils.isNotEmpty; public class PropertyDataDefinition extends ToscaDataDefinition { - private String uniqueId; + private String uniqueId; - // "boolean", "string", "float", "integer", "version" }) - private String type; + // "boolean", "string", "float", "integer", "version" }) + private String type; - private Boolean required = Boolean.FALSE; + private Boolean required = Boolean.FALSE; - protected boolean definition = false; + protected boolean definition = false; - private String defaultValue; + private String defaultValue; - private String description; + private String description; - private SchemaDefinition schema; + private SchemaDefinition schema; - private boolean password; + private boolean password; - private String name; + private String name; - private String value; + private String value; - private String label; - protected Boolean hidden = Boolean.FALSE; - private Boolean immutable = Boolean.FALSE; + private String label; + protected Boolean hidden = Boolean.FALSE; + private Boolean immutable = Boolean.FALSE; - private String inputPath; - private String status; - private String inputId; - private String instanceUniqueId; - private String propertyId; + private String inputPath; + private String status; + private String inputId; + private String instanceUniqueId; + private String propertyId; private String parentPropertyType; private String subPropertyInputPath; - private List<Annotation> annotations; - /** - * The resource id which this property belongs to - */ - private String parentUniqueId; - - private List<GetInputValueDataDefinition> getInputValues; - - private Boolean isDeclaredListInput = Boolean.FALSE; - - private List<GetPolicyValueDataDefinition> getPolicyValues; - - public PropertyDataDefinition() { - super(); - } - - public PropertyDataDefinition(Map<String, Object> pr) { - super(pr); - - } - - public PropertyDataDefinition(PropertyDataDefinition propertyDataDefinition) { - super(); - this.setUniqueId(propertyDataDefinition.getUniqueId()); - this.setRequired(propertyDataDefinition.isRequired()); - this.setDefaultValue(propertyDataDefinition.getDefaultValue()); - this.setDescription(propertyDataDefinition.getDescription()); - this.setSchema(propertyDataDefinition.getSchema()); - this.setPassword(propertyDataDefinition.isPassword()); - this.setType(propertyDataDefinition.getType()); - this.setName(propertyDataDefinition.getName()); - this.setValue(propertyDataDefinition.getValue()); - this.setRequired(propertyDataDefinition.isRequired()); - this.setHidden(propertyDataDefinition.isHidden()); - this.setLabel(propertyDataDefinition.getLabel()); - this.setImmutable(propertyDataDefinition.isImmutable()); - this.setParentUniqueId(propertyDataDefinition.getParentUniqueId()); - this.setOwnerId(propertyDataDefinition.getOwnerId()); - this.setGetInputValues(propertyDataDefinition.getGetInputValues()); - this.setGetPolicyValues(propertyDataDefinition.getGetPolicyValues()); - this.setInputPath(propertyDataDefinition.getInputPath()); - this.setStatus(propertyDataDefinition.getStatus()); - this.setInputId(propertyDataDefinition.getInputId()); - this.setInstanceUniqueId(propertyDataDefinition.getInstanceUniqueId()); - this.setPropertyId(propertyDataDefinition.getPropertyId()); - this.parentPropertyType = propertyDataDefinition.getParentPropertyType(); - this.subPropertyInputPath = propertyDataDefinition.getSubPropertyInputPath(); - if(isNotEmpty(propertyDataDefinition.annotations)){ - this.setAnnotations(propertyDataDefinition.annotations); + private List<Annotation> annotations; + /** + * The resource id which this property belongs to + */ + private String parentUniqueId; + + private List<GetInputValueDataDefinition> getInputValues; + + private Boolean isDeclaredListInput = Boolean.FALSE; + + private List<GetPolicyValueDataDefinition> getPolicyValues; + + public PropertyDataDefinition() { + super(); + } + + public PropertyDataDefinition(Map<String, Object> pr) { + super(pr); + + } + + public PropertyDataDefinition(PropertyDataDefinition propertyDataDefinition) { + super(); + this.setUniqueId(propertyDataDefinition.getUniqueId()); + this.setRequired(propertyDataDefinition.isRequired()); + this.setDefaultValue(propertyDataDefinition.getDefaultValue()); + this.setDescription(propertyDataDefinition.getDescription()); + this.setSchema(propertyDataDefinition.getSchema()); + this.setPassword(propertyDataDefinition.isPassword()); + this.setType(propertyDataDefinition.getType()); + this.setName(propertyDataDefinition.getName()); + this.setValue(propertyDataDefinition.getValue()); + this.setRequired(propertyDataDefinition.isRequired()); + this.setHidden(propertyDataDefinition.isHidden()); + this.setLabel(propertyDataDefinition.getLabel()); + this.setImmutable(propertyDataDefinition.isImmutable()); + this.setParentUniqueId(propertyDataDefinition.getParentUniqueId()); + this.setOwnerId(propertyDataDefinition.getOwnerId()); + this.setGetInputValues(propertyDataDefinition.getGetInputValues()); + this.setGetPolicyValues(propertyDataDefinition.getGetPolicyValues()); + this.setInputPath(propertyDataDefinition.getInputPath()); + this.setStatus(propertyDataDefinition.getStatus()); + this.setInputId(propertyDataDefinition.getInputId()); + this.setInstanceUniqueId(propertyDataDefinition.getInstanceUniqueId()); + this.setPropertyId(propertyDataDefinition.getPropertyId()); + this.parentPropertyType = propertyDataDefinition.getParentPropertyType(); + this.subPropertyInputPath = propertyDataDefinition.getSubPropertyInputPath(); + if (isNotEmpty(propertyDataDefinition.annotations)) { + this.setAnnotations(propertyDataDefinition.annotations); } - this.setIsDeclaredListInput(propertyDataDefinition.getIsDeclaredListInput()); - } + this.setIsDeclaredListInput(propertyDataDefinition.getIsDeclaredListInput()); + } + + public String getParentPropertyType() { + return parentPropertyType; + } - public String getParentPropertyType() { - return parentPropertyType; - } + public void setParentPropertyType(String parentPropertyType) { + this.parentPropertyType = parentPropertyType; + } + + public String getSubPropertyInputPath() { + return subPropertyInputPath; + } - public void setParentPropertyType(String parentPropertyType) { - this.parentPropertyType = parentPropertyType; - } + public void setSubPropertyInputPath(String subPropertyInputPath) { + this.subPropertyInputPath = subPropertyInputPath; + } + + public String getInputPath() { + return inputPath; + } - public String getSubPropertyInputPath() { - return subPropertyInputPath; - } + public void setInputPath(String inputPath) { + this.inputPath = inputPath; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + // @Override + public boolean isDefinition() { + return true; + } + + public void setDefinition(boolean definition) { + this.definition = definition; + } + + public String getType() { + return type; + } - public void setSubPropertyInputPath(String subPropertyInputPath) { - this.subPropertyInputPath = subPropertyInputPath; - } - - public String getInputPath() { - return inputPath; - } - - public void setInputPath(String inputPath) { - this.inputPath = inputPath; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - // @Override - public boolean isDefinition() { - return true; - } - - public void setDefinition(boolean definition) { - this.definition = definition; - } - - public String getType() { - return type; - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - public void setType(String type) { - this.type = type; - } - - public Boolean isRequired() { - return required; - } - - public void setRequired(Boolean required) { - this.required = required; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public boolean isPassword() { - return password; - } - - public void setPassword(boolean password) { - this.password = password; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public SchemaDefinition getSchema() { - return schema; - } - - public void setSchemaType(String schemaType) { - if (schema != null && schema.getProperty() != null) { - schema.getProperty().setType(schemaType); - } - } - - public void setSchema(SchemaDefinition entrySchema) { - this.schema = entrySchema; - } - - public String getSchemaType() { - if (schema != null && schema.getProperty() != null) { - return schema.getProperty().getType(); - } - return null; - } - - public PropertyDataDefinition getSchemaProperty() { - if (schema != null) { - return schema.getProperty(); - } - - return null; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public Boolean isHidden() { - return hidden; - } - - public void setHidden(Boolean hidden) { - this.hidden = hidden; - } - - public Boolean isImmutable() { - return immutable; - } - - public void setImmutable(Boolean immutable) { - this.immutable = immutable; - } - - public String getParentUniqueId() { - return getOwnerId(); - } - - public void setParentUniqueId(String parentUniqueId) { - setOwnerId(parentUniqueId); - } - - public List<GetInputValueDataDefinition> getGetInputValues() { - return getInputValues; - } - - public void setGetInputValues(List<GetInputValueDataDefinition> getInputValues) { - this.getInputValues = getInputValues; - } - - public List<GetPolicyValueDataDefinition> safeGetGetPolicyValues() { - return CollectionUtils.isEmpty(getPolicyValues) ? new ArrayList<>() : getPolicyValues; - } - - public List<GetPolicyValueDataDefinition> getGetPolicyValues() { - return getPolicyValues; - } - - public void setGetPolicyValues(List<GetPolicyValueDataDefinition> getPolicyValues) { - this.getPolicyValues = getPolicyValues; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getInputId() { - return inputId; - } - - public void setInputId(String inputId) { - this.inputId = inputId; - } - - public String getInstanceUniqueId() { - return instanceUniqueId; - } - - public void setInstanceUniqueId(String instanceUniqueId) { - this.instanceUniqueId = instanceUniqueId; - } - - public String getPropertyId() { - return propertyId; - } - - public void setPropertyId(String propertyId) { - this.propertyId = propertyId; - } - - public Boolean getIsDeclaredListInput() { - return isDeclaredListInput; - } - - public void setIsDeclaredListInput(Boolean isDeclaredListInput) { - this.isDeclaredListInput = isDeclaredListInput; - } - - @Override - public String toString() { - return "PropertyDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", required=" + required + ", definition=" + definition + ", defaultValue=" + defaultValue + ", description=" + description + ", schema=" + schema + ", password=" - + password + ", name=" + name + ", value=" + value + ", label=" + label + ", hidden=" + hidden + ", immutable=" + immutable + ", inputPath=" + inputPath + ", status=" + status + ", inputId=" + inputId + ", instanceUniqueId=" - + instanceUniqueId + ", propertyId=" + propertyId + ", parentUniqueId=" + parentUniqueId + ", getInputValues=" + getInputValues + ", isDeclaredListInput=" + isDeclaredListInput - + ", parentPropertyType=" + parentPropertyType - + ", subPropertyInputPath=" + subPropertyInputPath +"]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode()); - result = prime * result + (definition ? 1231 : 1237); - result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result + (password ? 1231 : 1237); - result = prime * result + ((required == null) ? 0 : required.hashCode()); - result = prime * result + ((schema == null) ? 0 : schema.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - result = prime * result + ((parentUniqueId == null) ? 0 : parentUniqueId.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - result = prime * result + ((isDeclaredListInput == null) ? 0 : isDeclaredListInput.hashCode()); - return result; - } - - public boolean typeEquals(Object obj) { - if (this == obj) { + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public void setType(String type) { + this.type = type; + } + + public Boolean isRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public boolean isPassword() { + return password; + } + + public void setPassword(boolean password) { + this.password = password; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public SchemaDefinition getSchema() { + return schema; + } + + public void setSchemaType(String schemaType) { + if (schema != null && schema.getProperty() != null) { + schema.getProperty().setType(schemaType); + } + } + + public void setSchema(SchemaDefinition entrySchema) { + this.schema = entrySchema; + } + + public String getSchemaType() { + if (schema != null && schema.getProperty() != null) { + return schema.getProperty().getType(); + } + return null; + } + + public PropertyDataDefinition getSchemaProperty() { + if (schema != null) { + return schema.getProperty(); + } + + return null; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public Boolean isHidden() { + return hidden; + } + + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + + public Boolean isImmutable() { + return immutable; + } + + public void setImmutable(Boolean immutable) { + this.immutable = immutable; + } + + public String getParentUniqueId() { + return getOwnerId(); + } + + public void setParentUniqueId(String parentUniqueId) { + setOwnerId(parentUniqueId); + } + + public List<GetInputValueDataDefinition> getGetInputValues() { + return getInputValues; + } + + public void setGetInputValues(List<GetInputValueDataDefinition> getInputValues) { + this.getInputValues = getInputValues; + } + + public List<GetPolicyValueDataDefinition> safeGetGetPolicyValues() { + return CollectionUtils.isEmpty(getPolicyValues) ? new ArrayList<>() : getPolicyValues; + } + + public List<GetPolicyValueDataDefinition> getGetPolicyValues() { + return getPolicyValues; + } + + public void setGetPolicyValues(List<GetPolicyValueDataDefinition> getPolicyValues) { + this.getPolicyValues = getPolicyValues; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getInputId() { + return inputId; + } + + public void setInputId(String inputId) { + this.inputId = inputId; + } + + public String getInstanceUniqueId() { + return instanceUniqueId; + } + + public void setInstanceUniqueId(String instanceUniqueId) { + this.instanceUniqueId = instanceUniqueId; + } + + public String getPropertyId() { + return propertyId; + } + + public void setPropertyId(String propertyId) { + this.propertyId = propertyId; + } + + public Boolean getIsDeclaredListInput() { + return isDeclaredListInput; + } + + public void setIsDeclaredListInput(Boolean isDeclaredListInput) { + this.isDeclaredListInput = isDeclaredListInput; + } + + @Override + public String toString() { + return "PropertyDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", required=" + required + ", definition=" + definition + ", defaultValue=" + defaultValue + ", description=" + description + ", schema=" + schema + ", password=" + + password + ", name=" + name + ", value=" + value + ", label=" + label + ", hidden=" + hidden + ", immutable=" + immutable + ", inputPath=" + inputPath + ", status=" + status + ", inputId=" + inputId + ", instanceUniqueId=" + + instanceUniqueId + ", propertyId=" + propertyId + ", parentUniqueId=" + parentUniqueId + ", getInputValues=" + getInputValues + ", isDeclaredListInput=" + isDeclaredListInput + + ", parentPropertyType=" + parentPropertyType + + ", subPropertyInputPath=" + subPropertyInputPath + "]"; + } + + @Override + public int hashCode() { + final int hashingValueDefinition = 1231; + final int hashingValueNoDefinition = 1237; + final int prime = 31; + int result = 1; + result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode()); + result = prime * result + (definition ? hashingValueDefinition : hashingValueNoDefinition); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + (password ? hashingValueDefinition : hashingValueNoDefinition); + result = prime * result + ((required == null) ? 0 : required.hashCode()); + result = prime * result + ((schema == null) ? 0 : schema.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + result = prime * result + ((parentUniqueId == null) ? 0 : parentUniqueId.hashCode()); + result = prime * result + ((status == null) ? 0 : status.hashCode()); + result = prime * result + ((isDeclaredListInput == null) ? 0 : isDeclaredListInput.hashCode()); + return result; + } + + public boolean typeEquals(Object obj) { + if (this == obj) { return true; } - if (obj == null) { + if (obj == null) { return false; } - if (getClass() != obj.getClass()) { + if (getClass() != obj.getClass()) { return false; } - PropertyDataDefinition other = (PropertyDataDefinition) obj; - if (this.getType() == null) { + PropertyDataDefinition other = (PropertyDataDefinition) obj; + if (this.getType() == null) { return other.getType() == null; } - if (!this.type.equals(other.type)) { - return false; - } - String thisSchemaType = this.getSchemaType(); - String otherSchemaType = other.getSchemaType(); - if (thisSchemaType == null) { - return otherSchemaType == null; - } - return thisSchemaType.equals(otherSchemaType); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { + if (!this.type.equals(other.type)) { + return false; + } + String thisSchemaType = this.getSchemaType(); + String otherSchemaType = other.getSchemaType(); + if (thisSchemaType == null) { + return otherSchemaType == null; + } + return thisSchemaType.equals(otherSchemaType); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { return true; } - if (obj == null) { + if (obj == null) { return false; } - if (getClass() != obj.getClass()) { + if (getClass() != obj.getClass()) { return false; } - PropertyDataDefinition other = (PropertyDataDefinition) obj; - if (defaultValue == null) { - if (other.defaultValue != null) { + PropertyDataDefinition other = (PropertyDataDefinition) obj; + if (defaultValue == null) { + if (other.defaultValue != null) { return false; } - } else if (!defaultValue.equals(other.defaultValue)) { + } else if (!defaultValue.equals(other.defaultValue)) { return false; } - if (definition != other.definition) { + if (definition != other.definition) { return false; } - if (description == null) { - if (other.description != null) { + if (description == null) { + if (other.description != null) { return false; } - } else if (!description.equals(other.description)) { + } else if (!description.equals(other.description)) { return false; } - if (password != other.password) { + if (password != other.password) { return false; } - if (required == null) { - if (other.required != null) { + if (required == null) { + if (other.required != null) { return false; } - } else if (!required.equals(other.required)) { + } else if (!required.equals(other.required)) { return false; } - if (schema == null) { - if (other.schema != null) { + if (schema == null) { + if (other.schema != null) { return false; } - } else if (!schema.equals(other.schema)) { + } else if (!schema.equals(other.schema)) { return false; } - if (type == null) { - if (other.type != null) { + if (type == null) { + if (other.type != null) { return false; } - } else if (!type.equals(other.type)) { + } else if (!type.equals(other.type)) { return false; } - if (parentUniqueId == null) { - if (other.parentUniqueId != null) { + if (parentUniqueId == null) { + if (other.parentUniqueId != null) { return false; } - } else if (!parentUniqueId.equals(other.parentUniqueId)) { + } else if (!parentUniqueId.equals(other.parentUniqueId)) { return false; } - if (uniqueId == null) { - if (other.uniqueId != null) { + if (uniqueId == null) { + if (other.uniqueId != null) { return false; } - } else if (!uniqueId.equals(other.uniqueId)) { + } else if (!uniqueId.equals(other.uniqueId)) { return false; } - if (status == null) { - if (other.status != null) { + if (status == null) { + if (other.status != null) { return false; } - } else if (!status.equals(other.status)) { + } else if (!status.equals(other.status)) { return false; } - if (isDeclaredListInput == null) { - if (other.isDeclaredListInput != null) { - return false; - } - } else if (!isDeclaredListInput.equals(other.isDeclaredListInput)) { - return false; - } - return true; - } - - @Override - public Object getToscaPresentationValue(JsonPresentationFields field) { - switch (field) { - case NAME: - return name; - case UNIQUE_ID: - return uniqueId; - case PASSWORD: - return password; - case TYPE: - return type; - case DEFINITION: - return definition; - case VALUE: - return value; - case DEFAULT_VALUE: - return defaultValue; - default: - return super.getToscaPresentationValue(field); - } - } - - @Override - public void setToscaPresentationValue(JsonPresentationFields name, Object value) { + if (isDeclaredListInput == null) { + if (other.isDeclaredListInput != null) { + return false; + } + } else if (!isDeclaredListInput.equals(other.isDeclaredListInput)) { + return false; + } + return true; + } + + @Override + public Object getToscaPresentationValue(JsonPresentationFields field) { + switch (field) { + case NAME: + return name; + case UNIQUE_ID: + return uniqueId; + case PASSWORD: + return password; + case TYPE: + return type; + case DEFINITION: + return definition; + case VALUE: + return value; + case DEFAULT_VALUE: + return defaultValue; + default: + return super.getToscaPresentationValue(field); + } + } + + @Override + public void setToscaPresentationValue(JsonPresentationFields name, Object value) { switch (name) { case NAME: - setName((String)value); + setName((String) value); break; case UNIQUE_ID: - setUniqueId((String)value); + setUniqueId((String) value); break; case PASSWORD: - setPassword((Boolean)value); + setPassword((Boolean) value); break; case TYPE: - setType((String)value); + setType((String) value); break; case DEFINITION: - setDefinition((Boolean)value); + setDefinition((Boolean) value); break; case VALUE: - setValue((String)value); + setValue((String) value); break; case DEFAULT_VALUE: - setDefaultValue((String)value); + setDefaultValue((String) value); break; default: super.setToscaPresentationValue(name, value); @@ -526,48 +528,51 @@ public class PropertyDataDefinition extends ToscaDataDefinition { } } - private <T extends ToscaDataDefinition> boolean compareSchemaType(T other) { - return !"list".equals(type) && !"map".equals(type) || this.getSchema().getProperty().getType().equals(((PropertyDataDefinition) other).getSchema().getProperty().getType()); - } + private <T extends ToscaDataDefinition> boolean compareSchemaType(T other) { + return !"list".equals(type) && !"map".equals(type) || this.getSchema().getProperty().getType().equals(((PropertyDataDefinition) other).getSchema().getProperty().getType()); + } - @Override - public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride) { - if (this.getType() != null && - this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && - compareSchemaType(other)) { - other.setOwnerId(getOwnerId()); - if (allowDefaultValueOverride && getDefaultValue() != null && !getDefaultValue().isEmpty()) { + @Override + public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride) { + if (this.getType() != null + && this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) + && compareSchemaType(other)) { + other.setOwnerId(getOwnerId()); + if (allowDefaultValueOverride + && getDefaultValue() != null + && !getDefaultValue().isEmpty()) { other.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, getDefaultValue()); - } - return other; - } - return null; - } - - public void convertPropertyDataToInstancePropertyData() { - if (null != value) { + } + return other; + } + return null; + } + + public void convertPropertyDataToInstancePropertyData() { + if (null != value) { defaultValue = value; } - } - - public boolean isGetInputProperty() { - return this.getGetInputValues() != null && !this.getGetInputValues().isEmpty(); - } - - public void setAnnotations(List<Annotation> newAnnotations) { - Set<Annotation> annotationSet = isNotEmpty(newAnnotations) ? new HashSet<>(newAnnotations) : new HashSet<>(); - //We would to prioritize the new valid annotations over the old ones if the same one existed. - if(this.annotations != null){ - for(Annotation oldInputAnnotation : this.annotations) - annotationSet.add(oldInputAnnotation); - } - - this.annotations = new ArrayList<>(annotationSet); - setToscaPresentationValue(JsonPresentationFields.ANNOTATIONS, this.annotations); - } - - public List<Annotation> getAnnotations() { - return (List<Annotation>) getToscaPresentationValue(JsonPresentationFields.ANNOTATIONS); - } + } + + public boolean isGetInputProperty() { + return this.getGetInputValues() != null && !this.getGetInputValues().isEmpty(); + } + + public void setAnnotations(List<Annotation> newAnnotations) { + Set<Annotation> annotationSet = isNotEmpty(newAnnotations) ? new HashSet<>(newAnnotations) : new HashSet<>(); + //We would to prioritize the new valid annotations over the old ones if the same one existed. + if (this.annotations != null) { + for (Annotation oldInputAnnotation : this.annotations) { + annotationSet.add(oldInputAnnotation); + } + } + + this.annotations = new ArrayList<>(annotationSet); + setToscaPresentationValue(JsonPresentationFields.ANNOTATIONS, this.annotations); + } + + public List<Annotation> getAnnotations() { + return (List<Annotation>) getToscaPresentationValue(JsonPresentationFields.ANNOTATIONS); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java index ee39401391..f0fc8b7dac 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,106 +27,119 @@ import java.util.List; public class PropertyRule extends ToscaDataDefinition { - public final static String FORCE_ALL = "FORCE_ALL"; - public final static String ALL = "ALL"; - public final static String RULE_ANY_MATCH = ".+"; - - List<String> rule; - String value; - - public PropertyRule() { - super(); - } - - public PropertyRule(List<String> rule, String value) { - super(); - this.rule = rule; - this.value = value; - } - - public List<String> getRule() { - return rule; - } - - public void setRule(List<String> rule) { - this.rule = rule; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - @JsonIgnore - public String getFirstToken() { - return getToken(1); - } - - public String getToken(int tokenNumber) { - - int index = tokenNumber - 1; - if (rule == null || index >= rule.size() || index < 0) { - return null; - } - - return rule.get(index); - } - - @JsonIgnore - public int getRuleSize() { - if (rule == null) { - return 0; - } - return rule.size(); - } - - @Override - public String toString() { - return "PropertyRule [rule=" + rule + ", value=" + value + "]"; - } - - public boolean compareRule(PropertyRule comparedPropertyRule) { - - if (comparedPropertyRule == null) { - return false; - } - - List<String> comparedRule = comparedPropertyRule.getRule(); - if (rule == null && comparedRule == null) { - return true; - } - - if (rule != null && comparedRule != null) { - if (rule.size() != comparedRule.size()) { - return false; - } else { - int size = rule.size(); - boolean isEqual = true; - for (int i = 0; i < size; i++) { - String item = rule.get(i); - String comparedItem = comparedRule.get(i); - if (item == null || !item.equals(comparedItem)) { - isEqual = false; - break; - } - } - return isEqual; - } - } else { - return false; - } - - } - - public void replaceFirstToken(String token) { - - if (rule != null && rule.size() > 0) { - rule.set(0, token); - } - - } + private static final String FORCE_ALL = "FORCE_ALL"; + private static final String ALL = "ALL"; + private static final String RULE_ANY_MATCH = ".+"; + + public static String getForceAll() { + return FORCE_ALL; + } + + public static String getALL() { + return ALL; + } + + public static String getRuleAnyMatch() { + return RULE_ANY_MATCH; + } + + + private List<String> rule; + private String value; + + public PropertyRule() { + super(); + } + + public PropertyRule(List<String> rule, String value) { + super(); + this.rule = rule; + this.value = value; + } + + public List<String> getRule() { + return rule; + } + + public void setRule(List<String> rule) { + this.rule = rule; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @JsonIgnore + public String getFirstToken() { + return getToken(1); + } + + public String getToken(int tokenNumber) { + + int index = tokenNumber - 1; + if (rule == null || index >= rule.size() || index < 0) { + return null; + } + + return rule.get(index); + } + + @JsonIgnore + public int getRuleSize() { + if (rule == null) { + return 0; + } + return rule.size(); + } + + @Override + public String toString() { + return "PropertyRule [rule=" + rule + ", value=" + value + "]"; + } + + public boolean compareRule(PropertyRule comparedPropertyRule) { + + if (comparedPropertyRule == null) { + return false; + } + + List<String> comparedRule = comparedPropertyRule.getRule(); + if (rule == null && comparedRule == null) { + return true; + } + + if (rule != null && comparedRule != null) { + if (rule.size() != comparedRule.size()) { + return false; + } else { + int size = rule.size(); + boolean isEqual = true; + for (int i = 0; i < size; i++) { + String item = rule.get(i); + String comparedItem = comparedRule.get(i); + if (item == null || !item.equals(comparedItem)) { + isEqual = false; + break; + } + } + return isEqual; + } + } else { + return false; + } + + } + + public void replaceFirstToken(String token) { + + if (rule != null && rule.size() > 0) { + rule.set(0, token); + } + + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java index 2f995fd844..0c6067af53 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,178 +27,182 @@ import java.util.List; public class RelationshipInstDataDefinition extends ToscaDataDefinition { - public RelationshipInstDataDefinition(RelationshipInstDataDefinition cdt) { - this.setUniqueId(cdt.getUniqueId()); - this.setDescription(cdt.getDescription()); - this.setType(cdt.getType()); - this.setValidSourceTypes(cdt.getValidSourceTypes()); - this.setValidTargetTypes(cdt.getValidTargetTypes()); - this.setVersion(cdt.getVersion()); - this.setOriginUI(cdt.isOriginUI()); - this.setCreationTime(cdt.getCreationTime()); - this.setModificationTime(cdt.getModificationTime()); - this.setCapabilityOwnerId(cdt.getCapabilityOwnerId()); - this.setRequirementOwnerId(cdt.getRequirementOwnerId()); - this.setCapabilityId(cdt.getCapabilityId()); - this.setRequirementId(cdt.getRequirementId()); - this.setFromId(cdt.getFromId()); - this.setToId(cdt.getToId()); - this.setRequirement(cdt.getRequirement()); - this.setCapability(cdt.getCapability()); - } - - public void setRequirement(String requirement) { - setToscaPresentationValue(JsonPresentationFields.REQUIREMENT, requirement); - } - - public String getRequirement() { - return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT); - } - public void setCapability(String capability) { - setToscaPresentationValue(JsonPresentationFields.CAPABILITY, capability); - } - - public String getCapability() { - return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY); - } - public void setToId(Object toId) { - setToscaPresentationValue(JsonPresentationFields.TO_ID, toId); - } - - public void setFromId(Object fromId) { - setToscaPresentationValue(JsonPresentationFields.FROM_ID, fromId); - } - - public String getToId() { - return (String) getToscaPresentationValue(JsonPresentationFields.TO_ID); - } - - public String getFromId() { - return (String) getToscaPresentationValue(JsonPresentationFields.FROM_ID); - } - - public void setRequirementId(Object requirementId) { - setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID, requirementId); - } - - public void setCapabilityId(Object capabilityId) { - setToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID, capabilityId); - } - - public String getRequirementId() { - return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID); - } - - public String getCapabilityId() { - return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID); - } - - public void setRequirementOwnerId(Object requirementOwnerId) { - setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID, requirementOwnerId); - } - - public String getRequirementOwnerId() { - return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID); - } - - public void setCapabilityOwnerId(Object capabilityOwnerId) { - setToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID, capabilityOwnerId); - } - - public String getCapabilityOwnerId() { - return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID); - } - - public RelationshipInstDataDefinition() { - } - - public String getUniqueId() { - return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); - } - - public void setUniqueId(String uniqueId) { - setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); - } - - public String getDescription() { - return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); - } - - public void setDescription(String description) { - setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); - } - - /** Identifies the type of the capability. */ - public String getType() { - return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); - } - - public void setType(String type) { - setToscaPresentationValue(JsonPresentationFields.TYPE, type); - } - - public List<String> getValidSourceTypes() { - return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPES); - } - - public void setValidSourceTypes(List<String> validSourceTypes) { - setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPES, validSourceTypes); - } - - public List<String> getValidTargetTypes() { - return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_TARGET_TYPES); - } - - public void setValidTargetTypes(List<String> validTargetTypes) { - setToscaPresentationValue(JsonPresentationFields.VALID_TARGET_TYPES, validTargetTypes); - } - - public String getVersion() { - return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); - } - - public void setVersion(String version) { - setToscaPresentationValue(JsonPresentationFields.VERSION, version); - } - - public Boolean isOriginUI() { - return (Boolean) getToscaPresentationValue(JsonPresentationFields.ORIGIN_UI); - } - - public void setOriginUI(Boolean originUI) { - setToscaPresentationValue(JsonPresentationFields.ORIGIN_UI, originUI); - } - - public Long getCreationTime() { - return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); - - } - - public void setCreationTime(Long creationTime) { - setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); - } - - public Long getModificationTime() { - return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); - } - - public void setModificationTime(Long modificationTime) { - setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); - } - - @Override - public String toString() { - String uniqueId = getUniqueId(); - String description = getDescription(); - String type = getType(); - List<String> validSourceTypes = getValidSourceTypes(); - String version = getVersion(); - Boolean originUI = isOriginUI(); - Long creationTime = getCreationTime(); - Long modificationTime = getModificationTime(); - - return "RelationshipTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + ", validSourceTypes=" + validSourceTypes + - ", version=" + version + ", originUI=" + originUI + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]"; - } + public RelationshipInstDataDefinition(RelationshipInstDataDefinition cdt) { + this.setUniqueId(cdt.getUniqueId()); + this.setDescription(cdt.getDescription()); + this.setType(cdt.getType()); + this.setValidSourceTypes(cdt.getValidSourceTypes()); + this.setValidTargetTypes(cdt.getValidTargetTypes()); + this.setVersion(cdt.getVersion()); + this.setOriginUI(cdt.isOriginUI()); + this.setCreationTime(cdt.getCreationTime()); + this.setModificationTime(cdt.getModificationTime()); + this.setCapabilityOwnerId(cdt.getCapabilityOwnerId()); + this.setRequirementOwnerId(cdt.getRequirementOwnerId()); + this.setCapabilityId(cdt.getCapabilityId()); + this.setRequirementId(cdt.getRequirementId()); + this.setFromId(cdt.getFromId()); + this.setToId(cdt.getToId()); + this.setRequirement(cdt.getRequirement()); + this.setCapability(cdt.getCapability()); + } + + public void setRequirement(String requirement) { + setToscaPresentationValue(JsonPresentationFields.REQUIREMENT, requirement); + } + + public String getRequirement() { + return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT); + } + + public void setCapability(String capability) { + setToscaPresentationValue(JsonPresentationFields.CAPABILITY, capability); + } + + public String getCapability() { + return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY); + } + + public void setToId(Object toId) { + setToscaPresentationValue(JsonPresentationFields.TO_ID, toId); + } + + public void setFromId(Object fromId) { + setToscaPresentationValue(JsonPresentationFields.FROM_ID, fromId); + } + + public String getToId() { + return (String) getToscaPresentationValue(JsonPresentationFields.TO_ID); + } + + public String getFromId() { + return (String) getToscaPresentationValue(JsonPresentationFields.FROM_ID); + } + + public void setRequirementId(Object requirementId) { + setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID, requirementId); + } + + public void setCapabilityId(Object capabilityId) { + setToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID, capabilityId); + } + + public String getRequirementId() { + return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID); + } + + public String getCapabilityId() { + return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID); + } + + public void setRequirementOwnerId(Object requirementOwnerId) { + setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID, requirementOwnerId); + } + + public String getRequirementOwnerId() { + return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID); + } + + public void setCapabilityOwnerId(Object capabilityOwnerId) { + setToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID, capabilityOwnerId); + } + + public String getCapabilityOwnerId() { + return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID); + } + + public RelationshipInstDataDefinition() { + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + /** + * Identifies the type of the capability. + */ + public String getType() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public void setType(String type) { + setToscaPresentationValue(JsonPresentationFields.TYPE, type); + } + + public List<String> getValidSourceTypes() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPES); + } + + public void setValidSourceTypes(List<String> validSourceTypes) { + setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPES, validSourceTypes); + } + + public List<String> getValidTargetTypes() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_TARGET_TYPES); + } + + public void setValidTargetTypes(List<String> validTargetTypes) { + setToscaPresentationValue(JsonPresentationFields.VALID_TARGET_TYPES, validTargetTypes); + } + + public String getVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); + } + + public void setVersion(String version) { + setToscaPresentationValue(JsonPresentationFields.VERSION, version); + } + + public Boolean isOriginUI() { + return (Boolean) getToscaPresentationValue(JsonPresentationFields.ORIGIN_UI); + } + + public void setOriginUI(Boolean originUI) { + setToscaPresentationValue(JsonPresentationFields.ORIGIN_UI, originUI); + } + + public Long getCreationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); + + } + + public void setCreationTime(Long creationTime) { + setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); + } + + public Long getModificationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); + } + + public void setModificationTime(Long modificationTime) { + setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); + } + + @Override + public String toString() { + String uniqueId = getUniqueId(); + String description = getDescription(); + String type = getType(); + List<String> validSourceTypes = getValidSourceTypes(); + String version = getVersion(); + Boolean originUI = isOriginUI(); + Long creationTime = getCreationTime(); + Long modificationTime = getModificationTime(); + + return "RelationshipTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + ", validSourceTypes=" + validSourceTypes + + ", version=" + version + ", originUI=" + originUI + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]"; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java index 0df5ba500d..f8402b7a3a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,329 +26,358 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import java.util.ArrayList; import java.util.List; + /** * Represents the requirement of the component or component instance */ public class RequirementDataDefinition extends ToscaDataDefinition { - public static final String MIN_OCCURRENCES = "0"; - public static final String MAX_OCCURRENCES = "UNBOUNDED"; - public static final String MAX_DEFAULT_OCCURRENCES = "1"; - - /** - * The default constructor initializing limits of the occurrences - */ - public RequirementDataDefinition() { - this.setMinOccurrences( MIN_OCCURRENCES ); - this.setMaxOccurrences( MAX_OCCURRENCES); - this.setLeftOccurrences( MAX_OCCURRENCES); - } - /** - * Deep copy constructor - * @param other - */ - public RequirementDataDefinition(RequirementDataDefinition other) { - this.setUniqueId(other.getUniqueId()); - this.setName(other.getName()); - this.setParentName(other.getParentName()); - this.setPreviousName(other.getPreviousName()); - this.setCapability(other.getCapability()); - this.setNode(other.getNode()); - this.setRelationship(other.getRelationship()); - this.setOwnerId(other.getOwnerId()); - this.setOwnerName(other.getOwnerName()); - this.setMinOccurrences(other.getMinOccurrences()); - this.setMaxOccurrences(other.getMaxOccurrences()); - this.setLeftOccurrences(other.getLeftOccurrences()); - if(other.getPath() == null) - this.setPath(Lists.newArrayList()); - else - this.setPath(Lists.newArrayList(other.getPath())); - this.setSource(other.getSource()); - } - - /** - * Unique id of the requirement - */ - public String getUniqueId() { - return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); - } - - public void setUniqueId(String uniqueId) { - setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); - } - - public String getName() { - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } - - public void setName(String name) { - setToscaPresentationValue(JsonPresentationFields.NAME, name); - } - - public String getParentName() { - return (String) getToscaPresentationValue(JsonPresentationFields.PARENT_NAME); - } - - public void setParentName(String parentName) { - setToscaPresentationValue(JsonPresentationFields.PARENT_NAME, parentName); - } - - public String getPreviousName() { - return (String) getToscaPresentationValue(JsonPresentationFields.PREVIOUS_NAME); - } - - public void setPreviousName(String previousName) { - setToscaPresentationValue(JsonPresentationFields.PREVIOUS_NAME, previousName); - } - - /** - * specify the capability type - */ - - public String getCapability() { - return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY); - } - - public void setCapability(String capability) { - setToscaPresentationValue(JsonPresentationFields.CAPABILITY, capability); - } - - /** - * specify the node type(Optional by tosca) - */ - public String getNode() { - return (String) getToscaPresentationValue(JsonPresentationFields.NODE); - } - - public void setNode(String node) { - setToscaPresentationValue(JsonPresentationFields.NODE, node); - } - - /** - * specify the relationship type(Optional by tosca) - */ - public String getRelationship() { - return (String) getToscaPresentationValue(JsonPresentationFields.RELATIONSHIP); - } - - public void setRelationship(String relationship) { - setToscaPresentationValue(JsonPresentationFields.RELATIONSHIP, relationship); - } - - /** - * specifies the resource instance holding this requirement - */ - @Override - public String getOwnerId() { - return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); - } - - @Override - public void setOwnerId(String ownerId) { - setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); - } - - public String getOwnerName() { - return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_NAME); - } - - public void setOwnerName(String ownerName) { - setToscaPresentationValue(JsonPresentationFields.OWNER_NAME, ownerName); - } - - public String getMinOccurrences() { - return (String) getToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES); - } - - public void setMinOccurrences(String minOccurrences) { - setToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES, minOccurrences); - } - - public String getLeftOccurrences() { - return (String) getToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES); - } - - public void setLeftOccurrences(String leftOccurrences) { - setToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES, leftOccurrences); - } - - public String getMaxOccurrences() { - return (String) getToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES); - } - - public void setMaxOccurrences(String maxOccurrences) { - setToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES, maxOccurrences); - } - - public void setPath(List<String> path) { - setToscaPresentationValue(JsonPresentationFields.PATH, path); - } - - @SuppressWarnings({ "unchecked" }) - public List<String> getPath() { - return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH); - } - - public void setSource(String source) { - setToscaPresentationValue(JsonPresentationFields.SOURCE, source); - } - - public String getSource() { - return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE); - } - - /** - * Adds the element to the path avoiding duplication - * @param elementInPath - */ - public void addToPath(String elementInPath) { - List<String> path = getPath(); - if (path == null) { - path = new ArrayList<>(); - } - if(!path.contains(elementInPath)){ - path.add(elementInPath); - } - setPath(path); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - String name = getName(); - String uniqueId = getUniqueId(); - String capability = getCapability(); - String node = getNode(); - String relationship = getRelationship(); - String ownerId = getOwnerId(); - String ownerName = getOwnerName(); - String minOccurrences = getMinOccurrences(); - String maxOccurrences = getMaxOccurrences(); - String leftOccurrences = getLeftOccurrences(); - - List<String> path = this.getPath(); - String source = getSource(); - - result = prime * result + ((capability == null) ? 0 : capability.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((node == null) ? 0 : node.hashCode()); - result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); - result = prime * result + ((ownerName == null) ? 0 : ownerName.hashCode()); - result = prime * result + ((relationship == null) ? 0 : relationship.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - result = prime * result + ((minOccurrences == null) ? 0 : minOccurrences.hashCode()); - result = prime * result + ((maxOccurrences == null) ? 0 : maxOccurrences.hashCode()); - result = prime * result + ((leftOccurrences == null) ? 0 : leftOccurrences.hashCode()); - result = prime * result + ((path == null) ? 0 : path.hashCode()); - result = prime * result + ((source == null) ? 0 : source.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - RequirementDataDefinition other = (RequirementDataDefinition) obj; - - String name = getName(); - String uniqueId = getUniqueId(); - String capability = getCapability(); - String node = getNode(); - String relationship = getRelationship(); - String ownerId = getOwnerId(); - String ownerName = getOwnerName(); - String minOccurrences = getMinOccurrences(); - String maxOccurrences = getMaxOccurrences(); - String leftOccurrences = getLeftOccurrences(); - List<String> path = this.getPath(); - String source = getSource(); - - if (capability == null) { - if (other.getCapability() != null) - return false; - } else if (!capability.equals(other.getCapability())) - return false; - if (name == null) { - if (other.getName() != null) - return false; - } else if (!name.equals(other.getName())) - return false; - if (node == null) { - if (other.getNode() != null) - return false; - } else if (!node.equals(other.getNode())) - return false; - if (ownerId == null) { - if (other.getOwnerId() != null) - return false; - } else if (!ownerId.equals(other.getOwnerId())) - return false; - if (ownerName == null) { - if (other.getOwnerName() != null) - return false; - } else if (!ownerName.equals(other.getOwnerName())) - return false; - if (relationship == null) { - if (other.getRelationship() != null) - return false; - } else if (!relationship.equals(other.getRelationship())) - return false; - if (uniqueId == null) { - if (other.getUniqueId() != null) - return false; - } else if (!uniqueId.equals(other.getUniqueId())) - return false; - if (minOccurrences == null) { - if (other.getMinOccurrences() != null) - return false; - } else if (!minOccurrences.equals(other.getMinOccurrences())) - return false; - if (maxOccurrences == null) { - if (other.getMaxOccurrences() != null) - return false; - } else if (!maxOccurrences.equals(other.getMaxOccurrences())) - return false; - if (leftOccurrences == null) { - if (other.getLeftOccurrences() != null) - return false; - } else if (!leftOccurrences.equals(other.getLeftOccurrences())) - return false; - if (path == null) { - if (other.getPath() != null) - return false; - } else if (!path.equals(other.getPath())) - return false; - if (source == null) { - if (other.getSource() != null) - return false; - } else if (!source.equals(other.getSource())) - return false; - return true; - } - - @Override - public String toString() { - String name = getName(); - String uniqueId = getUniqueId(); - String capability = getCapability(); - String node = getNode(); - String relationship = getRelationship(); - String ownerId = getOwnerId(); - String ownerName = getOwnerName(); - String minOccurrences = getMinOccurrences(); - String maxOccurrences = getMaxOccurrences(); - String leftOccurrences = getLeftOccurrences(); - List<String> path = this.getPath(); - String source = getSource(); - - return "RequirementDefinition [uniqueId=" + uniqueId + ", name=" + name + ", capability=" + capability + ", node=" + node + ", relationship=" + relationship + ", ownerId=" + ownerId + ", ownerName=" + ownerName + ", minOccurrences=" - + minOccurrences + ", maxOccurrences=" + maxOccurrences + ",leftOccurrences=" + leftOccurrences + ", path=" + path + ", source=" + source + "]"; - } + public static final String MIN_OCCURRENCES = "0"; + public static final String MAX_OCCURRENCES = "UNBOUNDED"; + public static final String MAX_DEFAULT_OCCURRENCES = "1"; + + /** + * The default constructor initializing limits of the occurrences + */ + public RequirementDataDefinition() { + this.setMinOccurrences(MIN_OCCURRENCES); + this.setMaxOccurrences(MAX_OCCURRENCES); + this.setLeftOccurrences(MAX_OCCURRENCES); + } + + /** + * Deep copy constructor + * + * @param other + */ + public RequirementDataDefinition(RequirementDataDefinition other) { + this.setUniqueId(other.getUniqueId()); + this.setName(other.getName()); + this.setParentName(other.getParentName()); + this.setPreviousName(other.getPreviousName()); + this.setCapability(other.getCapability()); + this.setNode(other.getNode()); + this.setRelationship(other.getRelationship()); + this.setOwnerId(other.getOwnerId()); + this.setOwnerName(other.getOwnerName()); + this.setMinOccurrences(other.getMinOccurrences()); + this.setMaxOccurrences(other.getMaxOccurrences()); + this.setLeftOccurrences(other.getLeftOccurrences()); + if (other.getPath() == null) { + this.setPath(Lists.newArrayList()); + } else { + this.setPath(Lists.newArrayList(other.getPath())); + } + this.setSource(other.getSource()); + } + + /** + * Unique id of the requirement + */ + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + + public String getParentName() { + return (String) getToscaPresentationValue(JsonPresentationFields.PARENT_NAME); + } + + public void setParentName(String parentName) { + setToscaPresentationValue(JsonPresentationFields.PARENT_NAME, parentName); + } + + public String getPreviousName() { + return (String) getToscaPresentationValue(JsonPresentationFields.PREVIOUS_NAME); + } + + public void setPreviousName(String previousName) { + setToscaPresentationValue(JsonPresentationFields.PREVIOUS_NAME, previousName); + } + + /** + * specify the capability type + */ + + public String getCapability() { + return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY); + } + + public void setCapability(String capability) { + setToscaPresentationValue(JsonPresentationFields.CAPABILITY, capability); + } + + /** + * specify the node type(Optional by tosca) + */ + public String getNode() { + return (String) getToscaPresentationValue(JsonPresentationFields.NODE); + } + + public void setNode(String node) { + setToscaPresentationValue(JsonPresentationFields.NODE, node); + } + + /** + * specify the relationship type(Optional by tosca) + */ + public String getRelationship() { + return (String) getToscaPresentationValue(JsonPresentationFields.RELATIONSHIP); + } + + public void setRelationship(String relationship) { + setToscaPresentationValue(JsonPresentationFields.RELATIONSHIP, relationship); + } + + /** + * specifies the resource instance holding this requirement + */ + @Override + public String getOwnerId() { + return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); + } + + @Override + public void setOwnerId(String ownerId) { + setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); + } + + public String getOwnerName() { + return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_NAME); + } + + public void setOwnerName(String ownerName) { + setToscaPresentationValue(JsonPresentationFields.OWNER_NAME, ownerName); + } + + public String getMinOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES); + } + + public void setMinOccurrences(String minOccurrences) { + setToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES, minOccurrences); + } + + public String getLeftOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES); + } + + public void setLeftOccurrences(String leftOccurrences) { + setToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES, leftOccurrences); + } + + public String getMaxOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES); + } + + public void setMaxOccurrences(String maxOccurrences) { + setToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES, maxOccurrences); + } + + public void setPath(List<String> path) { + setToscaPresentationValue(JsonPresentationFields.PATH, path); + } + + @SuppressWarnings({"unchecked"}) + public List<String> getPath() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH); + } + + public void setSource(String source) { + setToscaPresentationValue(JsonPresentationFields.SOURCE, source); + } + + public String getSource() { + return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE); + } + + /** + * Adds the element to the path avoiding duplication + * + * @param elementInPath + */ + public void addToPath(String elementInPath) { + List<String> path = getPath(); + if (path == null) { + path = new ArrayList<>(); + } + if (!path.contains(elementInPath)) { + path.add(elementInPath); + } + setPath(path); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + String name = getName(); + String uniqueId = getUniqueId(); + String capability = getCapability(); + String node = getNode(); + String relationship = getRelationship(); + String ownerId = getOwnerId(); + String ownerName = getOwnerName(); + String minOccurrences = getMinOccurrences(); + String maxOccurrences = getMaxOccurrences(); + String leftOccurrences = getLeftOccurrences(); + + List<String> path = this.getPath(); + String source = getSource(); + + result = prime * result + ((capability == null) ? 0 : capability.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((node == null) ? 0 : node.hashCode()); + result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); + result = prime * result + ((ownerName == null) ? 0 : ownerName.hashCode()); + result = prime * result + ((relationship == null) ? 0 : relationship.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + result = prime * result + ((minOccurrences == null) ? 0 : minOccurrences.hashCode()); + result = prime * result + ((maxOccurrences == null) ? 0 : maxOccurrences.hashCode()); + result = prime * result + ((leftOccurrences == null) ? 0 : leftOccurrences.hashCode()); + result = prime * result + ((path == null) ? 0 : path.hashCode()); + result = prime * result + ((source == null) ? 0 : source.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + RequirementDataDefinition other = (RequirementDataDefinition) obj; + + String name = getName(); + String uniqueId = getUniqueId(); + String capability = getCapability(); + String node = getNode(); + String relationship = getRelationship(); + String ownerId = getOwnerId(); + String ownerName = getOwnerName(); + String minOccurrences = getMinOccurrences(); + String maxOccurrences = getMaxOccurrences(); + String leftOccurrences = getLeftOccurrences(); + List<String> path = this.getPath(); + String source = getSource(); + + if (capability == null) { + if (other.getCapability() != null) { + return false; + } + } else if (!capability.equals(other.getCapability())) { + return false; + } + if (name == null) { + if (other.getName() != null) { + return false; + } + } else if (!name.equals(other.getName())) { + return false; + } + if (node == null) { + if (other.getNode() != null) { + return false; + } + } else if (!node.equals(other.getNode())) { + return false; + } + if (ownerId == null) { + if (other.getOwnerId() != null) { + return false; + } + } else if (!ownerId.equals(other.getOwnerId())) { + return false; + } + if (ownerName == null) { + if (other.getOwnerName() != null) { + return false; + } + } else if (!ownerName.equals(other.getOwnerName())) { + return false; + } + if (relationship == null) { + if (other.getRelationship() != null) { + return false; + } + } else if (!relationship.equals(other.getRelationship())) { + return false; + } + if (uniqueId == null) { + if (other.getUniqueId() != null) { + return false; + } + } else if (!uniqueId.equals(other.getUniqueId())) { + return false; + } + if (minOccurrences == null) { + if (other.getMinOccurrences() != null) { + return false; + } + } else if (!minOccurrences.equals(other.getMinOccurrences())) { + return false; + } + if (maxOccurrences == null) { + if (other.getMaxOccurrences() != null) { + return false; + } + } else if (!maxOccurrences.equals(other.getMaxOccurrences())) { + return false; + } + if (leftOccurrences == null) { + if (other.getLeftOccurrences() != null) { + return false; + } + } else if (!leftOccurrences.equals(other.getLeftOccurrences())) { + return false; + } + if (path == null) { + if (other.getPath() != null) { + return false; + } + } else if (!path.equals(other.getPath())) { + return false; + } + if (source == null) { + return other.getSource() == null; + } else { + return source.equals(other.getSource()); + } + } + + @Override + public String toString() { + String name = getName(); + String uniqueId = getUniqueId(); + String capability = getCapability(); + String node = getNode(); + String relationship = getRelationship(); + String ownerId = getOwnerId(); + String ownerName = getOwnerName(); + String minOccurrences = getMinOccurrences(); + String maxOccurrences = getMaxOccurrences(); + String leftOccurrences = getLeftOccurrences(); + List<String> path = this.getPath(); + String source = getSource(); + + return "RequirementDefinition [uniqueId=" + uniqueId + ", name=" + name + ", capability=" + capability + ", node=" + node + ", relationship=" + relationship + ", ownerId=" + ownerId + ", ownerName=" + ownerName + ", minOccurrences=" + + minOccurrences + ", maxOccurrences=" + maxOccurrences + ",leftOccurrences=" + leftOccurrences + ", path=" + path + ", source=" + source + "]"; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterCapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterCapabilityDataDefinition.java index 3df0f28162..34dc43760f 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterCapabilityDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterCapabilityDataDefinition.java @@ -16,10 +16,11 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.io.Serializable; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.io.Serializable; + public class RequirementNodeFilterCapabilityDataDefinition extends ToscaDataDefinition implements Serializable { /** diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterPropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterPropertyDataDefinition.java index 1ee33eeafe..ce27e3ba44 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterPropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementNodeFilterPropertyDataDefinition.java @@ -15,11 +15,12 @@ */ package org.openecomp.sdc.be.datatypes.elements; -import java.io.Serializable; -import java.util.List; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import java.io.Serializable; +import java.util.List; + public class RequirementNodeFilterPropertyDataDefinition extends ToscaDataDefinition implements Serializable { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java index 57fe56412c..1e4fc58ffe 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,108 +30,115 @@ import java.util.Map; */ public class SchemaDefinition extends ToscaDataDefinition { - private String derivedFrom; - private List<String> constraints; - private Map<String, PropertyDataDefinition> properties; - - private PropertyDataDefinition property; - - - - public SchemaDefinition() { - } - - public SchemaDefinition(String derivedFrom, List<String> constraints, - Map<String, PropertyDataDefinition> properties) { - this.setDerivedFrom(derivedFrom); - this.setConstraints( constraints); - this.setProperties( properties); - - } - - public String getDerivedFrom() { - return derivedFrom; - } - - public void setProperty(PropertyDataDefinition property) { - this.property = property; - } - - public PropertyDataDefinition getProperty() { - return this.property; - } - - public void setDerivedFrom(String derivedFrom) { - this.derivedFrom = derivedFrom; - } - - public List<String> getConstraints() { - return constraints; - } - - public void setConstraints(List<String> constraints) { - this.constraints = constraints; - } - - public Map<String, PropertyDataDefinition> getProperties() { - return properties; - } - - public void setProperties(Map<String, PropertyDataDefinition> properties) { - this.properties = properties; - } - - public void addProperty(String key, PropertyDataDefinition property) { - - properties.put(key, property); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((constraints == null) ? 0 : constraints.hashCode()); - result = prime * result + ((derivedFrom == null) ? 0 : derivedFrom.hashCode()); - result = prime * result + ((properties == null) ? 0 : properties.hashCode()); - result = prime * result + ((property == null) ? 0 : property.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - SchemaDefinition other = (SchemaDefinition) obj; - if (constraints == null) { - if (other.constraints != null) - return false; - } else if (!constraints.equals(other.constraints)) - return false; - if (derivedFrom == null) { - if (other.derivedFrom != null) - return false; - } else if (!derivedFrom.equals(other.derivedFrom)) - return false; - if (properties == null) { - if (other.properties != null) - return false; - } else if (!properties.equals(other.properties)) - return false; - if (property == null) { - if (other.property != null) - return false; - } else if (!property.equals(other.property)) - return false; - return true; - } - - @Override - public String toString() { - return "SchemaDefinition [" + "derivedFrom='" + derivedFrom + ", constraints=" + constraints + ", properties=" - + properties + ", property=" + property + ']'; - } + private String derivedFrom; + private List<String> constraints; + private Map<String, PropertyDataDefinition> properties; + + private PropertyDataDefinition property; + + + public SchemaDefinition() { + } + + public SchemaDefinition(String derivedFrom, List<String> constraints, + Map<String, PropertyDataDefinition> properties) { + this.setDerivedFrom(derivedFrom); + this.setConstraints(constraints); + this.setProperties(properties); + + } + + public String getDerivedFrom() { + return derivedFrom; + } + + public void setProperty(PropertyDataDefinition property) { + this.property = property; + } + + public PropertyDataDefinition getProperty() { + return this.property; + } + + public void setDerivedFrom(String derivedFrom) { + this.derivedFrom = derivedFrom; + } + + public List<String> getConstraints() { + return constraints; + } + + public void setConstraints(List<String> constraints) { + this.constraints = constraints; + } + + public Map<String, PropertyDataDefinition> getProperties() { + return properties; + } + + public void setProperties(Map<String, PropertyDataDefinition> properties) { + this.properties = properties; + } + + public void addProperty(String key, PropertyDataDefinition property) { + + properties.put(key, property); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((constraints == null) ? 0 : constraints.hashCode()); + result = prime * result + ((derivedFrom == null) ? 0 : derivedFrom.hashCode()); + result = prime * result + ((properties == null) ? 0 : properties.hashCode()); + result = prime * result + ((property == null) ? 0 : property.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + SchemaDefinition other = (SchemaDefinition) obj; + if (constraints == null) { + if (other.constraints != null) { + return false; + } + } else if (!constraints.equals(other.constraints)) { + return false; + } + if (derivedFrom == null) { + if (other.derivedFrom != null) { + return false; + } + } else if (!derivedFrom.equals(other.derivedFrom)) { + return false; + } + if (properties == null) { + if (other.properties != null) { + return false; + } + } else if (!properties.equals(other.properties)) { + return false; + } + if (property == null) { + return other.property == null; + } else { + return property.equals(other.property); + } + } + + @Override + public String toString() { + return "SchemaDefinition [" + "derivedFrom='" + derivedFrom + ", constraints=" + constraints + ", properties=" + + properties + ", property=" + property + ']'; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaTypeDataDefinition.java index b56d3ec342..b6f9fa236d 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ToscaTypeDataDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnum.java index 9bd7a48505..00105f8c5d 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnum.java @@ -3,9 +3,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,33 +16,33 @@ package org.openecomp.sdc.be.datatypes.enums; public enum AssetTypeEnum { - RESOURCES("resources", "Resource"), SERVICES("services", "Service"), PRODUCTS("products", "Product"); + RESOURCES("resources", "Resource"), SERVICES("services", "Service"), PRODUCTS("products", "Product"); - private String value; + private String value; - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public String getCorrespondingComponent() { - return correspondingComponent; - } + public String getCorrespondingComponent() { + return correspondingComponent; + } - private String correspondingComponent; + private String correspondingComponent; - private AssetTypeEnum(String value, String correspondingComponent) { - this.value = value; - this.correspondingComponent = correspondingComponent; - } + AssetTypeEnum(String value, String correspondingComponent) { + this.value = value; + this.correspondingComponent = correspondingComponent; + } - public static ComponentTypeEnum convertToComponentTypeEnum(String assetType) { - ComponentTypeEnum ret = null; - for (AssetTypeEnum curr : AssetTypeEnum.values()) { - if (curr.value.equals(assetType)) { - return ComponentTypeEnum.findByValue(curr.correspondingComponent); - } - } + public static ComponentTypeEnum convertToComponentTypeEnum(String assetType) { + ComponentTypeEnum ret = null; + for (AssetTypeEnum curr : AssetTypeEnum.values()) { + if (curr.value.equals(assetType)) { + return ComponentTypeEnum.findByValue(curr.correspondingComponent); + } + } - return ret; - } + return ret; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java index 8d83be461f..a92a711a38 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java @@ -46,13 +46,12 @@ public enum ComponentFieldsEnum { NON_EXCLUDED_POLICIES("nonExcludedPolicies"), NODE_FILTER("nodeFilter"), COMPONENT_INSTANCES_INTERFACES("componentInstancesInterfaces"), - DATA_TYPES("dataTypes") - ; + DATA_TYPES("dataTypes"); private String value; - private ComponentFieldsEnum(String value) { + ComponentFieldsEnum(String value) { this.value = value; } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java index c6e3fc613f..d155240e19 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java @@ -3,9 +3,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,7 @@ public enum ComponentTypeEnum { private String value; - private ComponentTypeEnum(String value) { + ComponentTypeEnum(String value) { this.value = value; } @@ -85,10 +85,10 @@ public enum ComponentTypeEnum { public static String findParamByType(ComponentTypeEnum type) { String ret = null; - if (type == null) { - return ret; - } - + if (type == null) { + return ret; + } + switch (type) { case RESOURCE: ret = RESOURCE_PARAM_NAME; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ConnectionPointEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ConnectionPointEnum.java index ef42ebdfef..aea66c9d47 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ConnectionPointEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ConnectionPointEnum.java @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + package org.openecomp.sdc.be.datatypes.enums; import java.util.Arrays; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/CreatedFrom.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/CreatedFrom.java index cc52152d74..74b8cba9c0 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/CreatedFrom.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/CreatedFrom.java @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + package org.openecomp.sdc.be.datatypes.enums; public enum CreatedFrom { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java index fd862613ca..a25df30fcd 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/DeclarationTypeEnum.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ package org.openecomp.sdc.be.datatypes.enums; -public enum DeclarationTypeEnum { +public enum DeclarationTypeEnum { INPUT, POLICY; } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/EnvironmentStatusEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/EnvironmentStatusEnum.java index f4cd126c3b..aabe4aabbe 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/EnvironmentStatusEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/EnvironmentStatusEnum.java @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + package org.openecomp.sdc.be.datatypes.enums; public enum EnvironmentStatusEnum { @@ -23,19 +23,24 @@ public enum EnvironmentStatusEnum { private final String name; - private EnvironmentStatusEnum(String name){ + EnvironmentStatusEnum(String name) { this.name = name; } public String getName() { return name; } - public static EnvironmentStatusEnum getByName(final String name){ - switch(name){ - case ("in_progress") : return IN_PROGRESS; - case ("failed") : return FAILED; - case ("completed") : return COMPLETED; - default: return UNKNOWN; + + public static EnvironmentStatusEnum getByName(final String name) { + switch (name) { + case ("in_progress"): + return IN_PROGRESS; + case ("failed"): + return FAILED; + case ("completed"): + return COMPLETED; + default: + return UNKNOWN; } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java index 99cf514f82..ffe64e73df 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java @@ -3,9 +3,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,34 +20,36 @@ import java.util.List; import java.util.stream.Collectors; public enum FilterKeyEnum { - RESOURCE_TYPE("resourceType"), SUB_CATEGORY("subCategory"), CATEGORY("category"), DISTRIBUTION_STATUS("distributionStatus"), NAME_FRAGMENT("nameFragment"); - - private String name; - - FilterKeyEnum(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public static List<String> getAllFilters() { - return Arrays.stream(FilterKeyEnum.values()).map(FilterKeyEnum::getName).collect(Collectors.toList()); - } - - public static List<String> getValidFiltersByAssetType(ComponentTypeEnum assetType) { - if(assetType == null) { - return null; - } - switch (assetType) { - case RESOURCE: - return getAllFilters().subList(0, 3); - case SERVICE: - return getAllFilters().subList(2, 4); - default: - return null; - } - - } + RESOURCE_TYPE("resourceType"), SUB_CATEGORY("subCategory"), CATEGORY("category"), DISTRIBUTION_STATUS("distributionStatus"), NAME_FRAGMENT("nameFragment"); + + private static final int NUMBER_OF_RESOURCES_FILTERED = 3; + private static final int NUMBER_OF_SERVICES_FILTERED = 4; + private String name; + + FilterKeyEnum(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public static List<String> getAllFilters() { + return Arrays.stream(FilterKeyEnum.values()).map(FilterKeyEnum::getName).collect(Collectors.toList()); + } + + public static List<String> getValidFiltersByAssetType(ComponentTypeEnum assetType) { + if (assetType == null) { + return null; + } + switch (assetType) { + case RESOURCE: + return getAllFilters().subList(0, NUMBER_OF_RESOURCES_FILTERED); + case SERVICE: + return getAllFilters().subList(2, NUMBER_OF_SERVICES_FILTERED); + default: + return null; + } + + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java index 4613a594e0..058bcac046 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java @@ -3,9 +3,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,108 +19,107 @@ import java.util.ArrayList; import java.util.List; - public enum GraphPropertyEnum { -// field name class type unique indexed -// stored in graph index - UNIQUE_ID ("uid", String.class, true, true), - LABEL ("nodeLabel", String.class, false, true), - JSON ("json", String.class, false, false), - METADATA ("metadata", String.class, false, false), - VERSION ("version", String.class, false, true), - STATE ("state", String.class, false, true), - IS_HIGHEST_VERSION ("highestVersion", Boolean.class, false, true), - IS_DELETED ("deleted", Boolean.class, false, true), - NORMALIZED_NAME ("normalizedName", String.class, false, true), - NAME ("name", String.class, false, true), - TOSCA_RESOURCE_NAME ("toscaResourceName", String.class, false, true), - DISTRIBUTION_STATUS ("distributionStatus", String.class, false, false), - RESOURCE_TYPE ("resourceType", String.class, false, true), - COMPONENT_TYPE ("componentType", String.class, false, true), - UUID ("uuid", String.class, false, true), - SYSTEM_NAME ("systemName", String.class, false, true), - IS_ABSTRACT ("abstract", Boolean.class, false, true), - INVARIANT_UUID ("invariantUuid", String.class, false, true), - CSAR_UUID ("csarUuid", String.class, false, true), - //used for user (old format, no json for users) - USERID ("userId", String.class, true, true), - ROLE ("role", String.class, false, false), - FIRST_NAME ("firstName", String.class, false, false), - LAST_NAME ("lastName", String.class, false, false), - EMAIL ("email", String.class, false, false), - LAST_LOGIN_TIME ("lastLoginTime", Long.class, false, false), - //used for category (old format, no json for categories) - ICONS ("icons", String.class, false, false), - - //Archive/Restore - IS_ARCHIVED ("isArchived", Boolean.class, false, true), - IS_VSP_ARCHIVED ("isVspArchived", Boolean.class, false, true), - ARCHIVE_TIME ("archiveTime", Long.class, false, true), - - //Healing - HEALING_VERSION ("healVersion", Integer.class, false, true); - - private String property; - private Class clazz; - private boolean unique; - private boolean indexed; - - GraphPropertyEnum(String property, Class clazz, boolean unique, boolean indexed) { - this.property = property; - this.clazz = clazz; - this.unique = unique; - this.indexed = indexed; - } - - public static GraphPropertyEnum getByProperty(String property){ - for(GraphPropertyEnum currProperty :GraphPropertyEnum.values()){ - if(currProperty.getProperty().equals(property)){ - return currProperty; - } - } - return null; - } - - public String getProperty() { - return property; - } - - public void setProperty(String property) { - this.property = property; - } - - public Class getClazz() { - return clazz; - } - - public void setClazz(Class clazz) { - this.clazz = clazz; - } - - public boolean isUnique() { - return unique; - } - - public void setUnique(boolean unique) { - this.unique = unique; - } - - public boolean isIndexed() { - return indexed; - } - - public void setIndexed(boolean indexed) { - this.indexed = indexed; - } - - public static List<String> getAllProperties() { - - List<String> arrayList = new ArrayList<>(); - - for (GraphPropertyEnum graphProperty : GraphPropertyEnum.values()) { - arrayList.add(graphProperty.getProperty()); - } - - return arrayList; - } + + // field name ,class type ,unique ,indexed + UNIQUE_ID("uid", String.class, true, true), + LABEL("nodeLabel", String.class, false, true), + JSON("json", String.class, false, false), + METADATA("metadata", String.class, false, false), + VERSION("version", String.class, false, true), + STATE("state", String.class, false, true), + IS_HIGHEST_VERSION("highestVersion", Boolean.class, false, true), + IS_DELETED("deleted", Boolean.class, false, true), + NORMALIZED_NAME("normalizedName", String.class, false, true), + NAME("name", String.class, false, true), + TOSCA_RESOURCE_NAME("toscaResourceName", String.class, false, true), + DISTRIBUTION_STATUS("distributionStatus", String.class, false, false), + RESOURCE_TYPE("resourceType", String.class, false, true), + COMPONENT_TYPE("componentType", String.class, false, true), + UUID("uuid", String.class, false, true), + SYSTEM_NAME("systemName", String.class, false, true), + IS_ABSTRACT("abstract", Boolean.class, false, true), + INVARIANT_UUID("invariantUuid", String.class, false, true), + CSAR_UUID("csarUuid", String.class, false, true), + //used for user (old format, no json for users) + USERID("userId", String.class, true, true), + ROLE("role", String.class, false, false), + FIRST_NAME("firstName", String.class, false, false), + LAST_NAME("lastName", String.class, false, false), + EMAIL("email", String.class, false, false), + LAST_LOGIN_TIME("lastLoginTime", Long.class, false, false), + //used for category (old format, no json for categories) + ICONS("icons", String.class, false, false), + + //Archive/Restore + IS_ARCHIVED("isArchived", Boolean.class, false, true), + IS_VSP_ARCHIVED("isVspArchived", Boolean.class, false, true), + ARCHIVE_TIME("archiveTime", Long.class, false, true), + + //Healing + HEALING_VERSION("healVersion", Integer.class, false, true); + + private String property; + private Class clazz; + private boolean unique; + private boolean indexed; + + GraphPropertyEnum(String property, Class clazz, boolean unique, boolean indexed) { + this.property = property; + this.clazz = clazz; + this.unique = unique; + this.indexed = indexed; + } + + public static GraphPropertyEnum getByProperty(String property) { + for (GraphPropertyEnum currProperty : GraphPropertyEnum.values()) { + if (currProperty.getProperty().equals(property)) { + return currProperty; + } + } + return null; + } + + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + public Class getClazz() { + return clazz; + } + + public void setClazz(Class clazz) { + this.clazz = clazz; + } + + public boolean isUnique() { + return unique; + } + + public void setUnique(boolean unique) { + this.unique = unique; + } + + public boolean isIndexed() { + return indexed; + } + + public void setIndexed(boolean indexed) { + this.indexed = indexed; + } + + public static List<String> getAllProperties() { + + List<String> arrayList = new ArrayList<>(); + + for (GraphPropertyEnum graphProperty : GraphPropertyEnum.values()) { + arrayList.add(graphProperty.getProperty()); + } + + return arrayList; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnum.java index 001375c91d..7d55845a0b 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnum.java @@ -3,9 +3,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,15 +17,15 @@ package org.openecomp.sdc.be.datatypes.enums; public enum GroupTypeEnum { - VF_MODULE("org.openecomp.groups.VfModule"), HEAT_STACK("org.openecomp.groups.HeatStack"); + VF_MODULE("org.openecomp.groups.VfModule"), HEAT_STACK("org.openecomp.groups.HeatStack"); - private String groupTypeName; + private String groupTypeName; - GroupTypeEnum(String groupTypeName) { - this.groupTypeName = groupTypeName; - } + GroupTypeEnum(String groupTypeName) { + this.groupTypeName = groupTypeName; + } - public String getGroupTypeName() { - return groupTypeName; - } + public String getGroupTypeName() { + return groupTypeName; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/InstantiationTypes.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/InstantiationTypes.java index 5ff4473894..319c98dcca 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/InstantiationTypes.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/InstantiationTypes.java @@ -12,35 +12,35 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + package org.openecomp.sdc.be.datatypes.enums; import java.util.stream.Stream; public enum InstantiationTypes { - - A_LA_CARTE("A-la-carte"), - MACRO("Macro"); - - private String value; - - private InstantiationTypes(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - /** - * Checks if enum with the given type exists. - * - * @param type - * @return bool - */ - - public static boolean containsName(String type) { - return Stream.of(InstantiationTypes.values()) - .anyMatch(instType -> type.equals(instType.getValue())); - } + + A_LA_CARTE("A-la-carte"), + MACRO("Macro"); + + private String value; + + InstantiationTypes(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + /** + * Checks if enum with the given type exists. + * + * @param type + * @return bool + */ + + public static boolean containsName(String type) { + return Stream.of(InstantiationTypes.values()) + .anyMatch(instType -> type.equals(instType.getValue())); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java index fa4afe1251..0adf681d7c 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java @@ -120,7 +120,7 @@ public enum JsonPresentationFields { CAPABILITY_SOURCES("capabilitySources", null), MAX_OCCURRENCES("maxOccurrences", null), MIN_OCCURRENCES("minOccurrences", null), - OWNER_TYPE("ownerType",null), + OWNER_TYPE("ownerType", null), OWNER_NAME("ownerName", null), OWNER_ID("ownerId", null), LEFT_OCCURRENCES("leftOccurences", null), @@ -137,14 +137,14 @@ public enum JsonPresentationFields { REQUIREMENT_ID("requirementId", null), PARENT_NAME("parentName", null), PREVIOUS_NAME("previousName", null), - NODE_FILTER_CAPABILITIES("capabilities",null), - PROPERTY_FILTER_NAME("propertyName",null), - PROPERTY_FILTER_CONSTRAINT("propertyFilterConstraint",null), - EQUAL_CONSTRAINT("equal",null), - CONSTRAINT_VALUE("constraintValue",null), - CONSTRAINT_FUNCTION("constraintFunction",null), - NODE_FILTER("nodeFilter",null), - TOSCA_ID("tosca_id",null), + NODE_FILTER_CAPABILITIES("capabilities", null), + PROPERTY_FILTER_NAME("propertyName", null), + PROPERTY_FILTER_CONSTRAINT("propertyFilterConstraint", null), + EQUAL_CONSTRAINT("equal", null), + CONSTRAINT_VALUE("constraintValue", null), + CONSTRAINT_FUNCTION("constraintFunction", null), + NODE_FILTER("nodeFilter", null), + TOSCA_ID("tosca_id", null), //Relation CAPABILTY_OWNER_ID("capabilityOwnerId", null), @@ -152,7 +152,7 @@ public enum JsonPresentationFields { FROM_ID("fromId", null), TO_ID("toId", null), REQUIREMENT("requirement", null), - ORIGIN_UI("originUI",null), + ORIGIN_UI("originUI", null), //Groups @@ -228,8 +228,8 @@ public enum JsonPresentationFields { //Interface INTERFACES("interfaces", null), OPERATIONS("operations", null), - OPERATION_IMPLEMENTATION("implementation",null), - OPERATION_INPUTS("inputs",null), + OPERATION_IMPLEMENTATION("implementation", null), + OPERATION_INPUTS("inputs", null), OPERATION_OUTPUTS("outputs", null), INPUTS("inputs", null), diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java index 329b9a9392..a6266d30f0 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java @@ -3,9 +3,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,45 +16,45 @@ package org.openecomp.sdc.be.datatypes.enums; public enum NodeTypeEnum { - User("user"), - Service("service"), - Resource("resource"), - Product("product"), - ResourceCategory("resourceCategory"), - ServiceCategory("serviceCategory"), - ServiceNewCategory("serviceNewCategory"), - ResourceNewCategory("resourceNewCategory"), - ProductCategory("productCategory"), - ResourceSubcategory("resourceSubcategory"), - ProductSubcategory("productSubcategory"), - ProductGrouping("productGrouping"), - Tag("tag"), - Property("property"), - Attribute("attribute"), - CapabilityType("capabilityType"), - Requirement("requirement"), - RelationshipType("relationshipType"), - Capability("capability"), - RequirementImpl("requirementImpl"), - CapabilityInst("capabilityInst"), - AttributeValue("attributeValue"), - InputValue("inputValue"), - PropertyValue("propertyValue"), - LockNode("lockNode"), - ArtifactRef("artifactRef"), - Interface("interface"), - InterfaceOperation("interfaceOperation"), - ResourceInstance("resourceInstance"), - RelationshipInst("relationshipInst"), - AdditionalInfoParameters("additionalInfoParameters"), - ConsumerCredentials("consumerCredentials"), - HeatParameter("heatParameter"), - HeatParameterValue("heatParameterValue"), - DataType("dataType"), - GroupType("groupType"), - PolicyType("policyType"), - Group("group"), - UserFunctionalMenu("userFunctionalMenu"), + User("user"), + Service("service"), + Resource("resource"), + Product("product"), + ResourceCategory("resourceCategory"), + ServiceCategory("serviceCategory"), + ServiceNewCategory("serviceNewCategory"), + ResourceNewCategory("resourceNewCategory"), + ProductCategory("productCategory"), + ResourceSubcategory("resourceSubcategory"), + ProductSubcategory("productSubcategory"), + ProductGrouping("productGrouping"), + Tag("tag"), + Property("property"), + Attribute("attribute"), + CapabilityType("capabilityType"), + Requirement("requirement"), + RelationshipType("relationshipType"), + Capability("capability"), + RequirementImpl("requirementImpl"), + CapabilityInst("capabilityInst"), + AttributeValue("attributeValue"), + InputValue("inputValue"), + PropertyValue("propertyValue"), + LockNode("lockNode"), + ArtifactRef("artifactRef"), + Interface("interface"), + InterfaceOperation("interfaceOperation"), + ResourceInstance("resourceInstance"), + RelationshipInst("relationshipInst"), + AdditionalInfoParameters("additionalInfoParameters"), + ConsumerCredentials("consumerCredentials"), + HeatParameter("heatParameter"), + HeatParameterValue("heatParameterValue"), + DataType("dataType"), + GroupType("groupType"), + PolicyType("policyType"), + Group("group"), + UserFunctionalMenu("userFunctionalMenu"), Input("input"), GroupInstance("groupInstance"), AnnotationType("annotationType"), diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java index 51a2173e41..c7c576d95a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java @@ -3,9 +3,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,56 +16,55 @@ package org.openecomp.sdc.be.datatypes.enums; public enum OriginTypeEnum { - PRODUCT("Product", "Product", "product instance", ComponentTypeEnum.PRODUCT, false), - SERVICE("Service", "Service", "service instance", ComponentTypeEnum.SERVICE, false), - VF("VF", "VF (Virtual Function)", "resource instance", ComponentTypeEnum.RESOURCE, false), - VFC("VFC", "VFC (Virtual Function Component)", "resource instance", ComponentTypeEnum.RESOURCE, true), - CP("CP", "CP (Connection Point)", "resource instance", ComponentTypeEnum.RESOURCE, true), - VL("VL", "VL (Virtual Link)", "resource instance", ComponentTypeEnum.RESOURCE, true), - Configuration("Configuration", "Configuration ()", "resource instance", ComponentTypeEnum.RESOURCE, true), - VFCMT("VFCMT", "VFCMT (VFC Monitoring Template)", "resource instance", ComponentTypeEnum.RESOURCE, true), - CVFC("CVFC", "CVFC (Complex Virtual Function Component)", "resource instance", ComponentTypeEnum.RESOURCE, false), - PNF("PNF", "PNF (Physical Network Function)", "resource instance", ComponentTypeEnum.RESOURCE, false), - CR("CR", "CR (Complex Resource)", "resource instance", ComponentTypeEnum.RESOURCE, false), - ServiceProxy("Service Proxy", "Service Proxy", "service proxy", ComponentTypeEnum.RESOURCE, false) - ; + PRODUCT("Product", "Product", "product instance", ComponentTypeEnum.PRODUCT, false), + SERVICE("Service", "Service", "service instance", ComponentTypeEnum.SERVICE, false), + VF("VF", "VF (Virtual Function)", "resource instance", ComponentTypeEnum.RESOURCE, false), + VFC("VFC", "VFC (Virtual Function Component)", "resource instance", ComponentTypeEnum.RESOURCE, true), + CP("CP", "CP (Connection Point)", "resource instance", ComponentTypeEnum.RESOURCE, true), + VL("VL", "VL (Virtual Link)", "resource instance", ComponentTypeEnum.RESOURCE, true), + Configuration("Configuration", "Configuration ()", "resource instance", ComponentTypeEnum.RESOURCE, true), + VFCMT("VFCMT", "VFCMT (VFC Monitoring Template)", "resource instance", ComponentTypeEnum.RESOURCE, true), + CVFC("CVFC", "CVFC (Complex Virtual Function Component)", "resource instance", ComponentTypeEnum.RESOURCE, false), + PNF("PNF", "PNF (Physical Network Function)", "resource instance", ComponentTypeEnum.RESOURCE, false), + CR("CR", "CR (Complex Resource)", "resource instance", ComponentTypeEnum.RESOURCE, false), + ServiceProxy("Service Proxy", "Service Proxy", "service proxy", ComponentTypeEnum.RESOURCE, false); - private String value; - private String displayValue; - private String instanceType; - private ComponentTypeEnum componentType; + private String value; + private String displayValue; + private String instanceType; + private ComponentTypeEnum componentType; - private OriginTypeEnum(String value, String displayValue, String instanceType, ComponentTypeEnum componentType, boolean isAtomicType) { - this.value = value; - this.displayValue = displayValue; - this.instanceType = instanceType; - this.componentType = componentType; - } + OriginTypeEnum(String value, String displayValue, String instanceType, ComponentTypeEnum componentType, boolean isAtomicType) { + this.value = value; + this.displayValue = displayValue; + this.instanceType = instanceType; + this.componentType = componentType; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public String getDisplayValue() { - return displayValue; - } + public String getDisplayValue() { + return displayValue; + } - public String getInstanceType() { - return instanceType; - } + public String getInstanceType() { + return instanceType; + } - public ComponentTypeEnum getComponentType() { - return componentType; - } + public ComponentTypeEnum getComponentType() { + return componentType; + } - public static OriginTypeEnum findByValue(String value) { - OriginTypeEnum ret = null; - for (OriginTypeEnum curr : OriginTypeEnum.values()) { - if (curr.getValue().equals(value)) { - ret = curr; - break; - } - } - return ret; - } + public static OriginTypeEnum findByValue(String value) { + OriginTypeEnum ret = null; + for (OriginTypeEnum curr : OriginTypeEnum.values()) { + if (curr.getValue().equals(value)) { + ret = curr; + break; + } + } + return ret; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java index 947b5c575a..21d4e5ca53 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java @@ -3,9 +3,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,102 +17,102 @@ package org.openecomp.sdc.be.datatypes.enums; /** * Resource Type Enum - * @author mshitrit * + * @author mshitrit */ public enum ResourceTypeEnum { - VFC("VFC"/* (Virtual Function Component)"*/, true), - VF("VF"/* (Virtual Function)" */, false), - CR("CR"/* (Complex Resource"*/, false), - CP("CP"/* (Connection Point)"*/, true), - PNF("PNF"/* (Physical Network Function)" */, false), - CVFC("CVFC"/* Complex Virtual Function Component*/, false), - VL("VL"/* (Virtual Link)"*/, true), - VFCMT("VFCMT"/* (VFC Monitoring Template)"*/, true), - Configuration("Configuration ()", true), - ServiceProxy("ServiceProxy ()", true), - ABSTRACT("Abstract (Generic VFC/VF/PNF/Service Type)", true); + VFC("VFC"/* (Virtual Function Component)"*/, true), + VF("VF"/* (Virtual Function)" */, false), + CR("CR"/* (Complex Resource"*/, false), + CP("CP"/* (Connection Point)"*/, true), + PNF("PNF"/* (Physical Network Function)" */, false), + CVFC("CVFC"/* Complex Virtual Function Component*/, false), + VL("VL"/* (Virtual Link)"*/, true), + VFCMT("VFCMT"/* (VFC Monitoring Template)"*/, true), + Configuration("Configuration ()", true), + ServiceProxy("ServiceProxy ()", true), + ABSTRACT("Abstract (Generic VFC/VF/PNF/Service Type)", true); - private String value; - private boolean isAtomicType; + private String value; + private boolean isAtomicType; - private ResourceTypeEnum(String value, boolean isAtomicType) { - this.value = value; - this.isAtomicType = isAtomicType; - } + ResourceTypeEnum(String value, boolean isAtomicType) { + this.value = value; + this.isAtomicType = isAtomicType; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public boolean isAtomicType() { - return isAtomicType; - } + public boolean isAtomicType() { + return isAtomicType; + } - public static ResourceTypeEnum getType(String type) { - for (ResourceTypeEnum e : ResourceTypeEnum.values()) { - if (e.name().equals(type)) { - return e; - } - } - return null; - } + public static ResourceTypeEnum getType(String type) { + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().equals(type)) { + return e; + } + } + return null; + } - public static ResourceTypeEnum getTypeByName(String type) { - for (ResourceTypeEnum e : ResourceTypeEnum.values()) { - if (e.name().equalsIgnoreCase(type)) { - return e; - } - } - return null; - } + public static ResourceTypeEnum getTypeByName(String type) { + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().equalsIgnoreCase(type)) { + return e; + } + } + return null; + } - /** - * Returns ResourceTypeEnum matching to received String ignore case - * - * @param type - * @return - */ - public static ResourceTypeEnum getTypeIgnoreCase(String type) { - for (ResourceTypeEnum e : ResourceTypeEnum.values()) { - if (e.name().toLowerCase().equals(type.toLowerCase())) { - return e; - } - } - return null; - } + /** + * Returns ResourceTypeEnum matching to received String ignore case + * + * @param type + * @return + */ + public static ResourceTypeEnum getTypeIgnoreCase(String type) { + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().toLowerCase().equals(type.toLowerCase())) { + return e; + } + } + return null; + } - /** - * Checks if enum exist with given type - * - * @param type - * @return - */ - public static boolean containsName(String type) { + /** + * Checks if enum exist with given type + * + * @param type + * @return + */ + public static boolean containsName(String type) { - for (ResourceTypeEnum e : ResourceTypeEnum.values()) { - if (e.name().equals(type)) { - return true; - } - } - return false; - } + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().equals(type)) { + return true; + } + } + return false; + } - /** - * Checks if enum exist with given type ignore case - * - * @param type - * @return - */ - public static boolean containsIgnoreCase(String type) { + /** + * Checks if enum exist with given type ignore case + * + * @param type + * @return + */ + public static boolean containsIgnoreCase(String type) { - for (ResourceTypeEnum e : ResourceTypeEnum.values()) { - if (e.name().toLowerCase().equals(type.toLowerCase())) { - return true; - } - } - return false; - } + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().toLowerCase().equals(type.toLowerCase())) { + return true; + } + } + return false; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java index 6002bd034c..ee985d3fa1 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java @@ -107,7 +107,7 @@ public abstract class ToscaDataDefinition { public static <T extends ToscaDataDefinition> Map<String, T> listToMapByName(List<T> dataList) { return null == dataList ? new HashMap<>() : dataList.stream() - .collect(Collectors.toMap(p -> (String) p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p)); + .collect(Collectors.toMap(p -> (String) p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p)); } public boolean findUidMatch(String uid) { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/utils/CommonBeUtils.java b/common-be/src/main/java/org/openecomp/sdc/be/utils/CommonBeUtils.java index 8ad45a31f1..0539e32cc8 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/utils/CommonBeUtils.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/utils/CommonBeUtils.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,68 +23,65 @@ package org.openecomp.sdc.be.utils; import org.openecomp.sdc.common.api.Constants; public class CommonBeUtils { - /** - * Compares two ASDC versions of a component. It's for internal usage, so the assumption is that the versions are in valid format. - * - * @param firstVersion - * - version in format major.minor or just major (e.g, 2.0 or 2) - * @param secondVersion - * - version in format major.minor or just major (e.g, 2.0 or 2) - * @return Returns true iff:<br> - * 1) first version's major number is higher than second's (e.g., firstVersion = 1.1, secondVersion = 0.3)<br> - * 2) major version are equal, but first's minor version is higher than second's (e.g., firstVersion = 0.10, secondVersion = 0.9) <br> - */ - public static boolean compareAsdcComponentVersions(String firstVersion, String secondVersion) { - String[] firstVersionNums = firstVersion.split("\\."); - String[] secondVersionNums = secondVersion.split("\\."); - int firstMajor = Integer.parseInt(firstVersionNums[0]); - int secondMajor = Integer.parseInt(secondVersionNums[0]); - int compareRes = Integer.compare(firstMajor, secondMajor); - if (compareRes == 0) { - int firstMinor = (firstVersionNums.length == 2 ? Integer.parseInt(firstVersionNums[1]) : 0); - int secondMinor = (secondVersionNums.length == 2 ? Integer.parseInt(secondVersionNums[1]) : 0); - compareRes = Integer.compare(firstMinor, secondMinor); - return (compareRes > 0); - } else { - return (compareRes > 0); - } - } + /** + * Compares two ASDC versions of a component. It's for internal usage, so the assumption is that the versions are in valid format. + * + * @param firstVersion - version in format major.minor or just major (e.g, 2.0 or 2) + * @param secondVersion - version in format major.minor or just major (e.g, 2.0 or 2) + * @return Returns true iff:<br> + * 1) first version's major number is higher than second's (e.g., firstVersion = 1.1, secondVersion = 0.3)<br> + * 2) major version are equal, but first's minor version is higher than second's (e.g., firstVersion = 0.10, secondVersion = 0.9) <br> + */ + public static boolean compareAsdcComponentVersions(String firstVersion, String secondVersion) { + String[] firstVersionNums = firstVersion.split("\\."); + String[] secondVersionNums = secondVersion.split("\\."); + int firstMajor = Integer.parseInt(firstVersionNums[0]); + int secondMajor = Integer.parseInt(secondVersionNums[0]); + int compareRes = Integer.compare(firstMajor, secondMajor); + if (compareRes == 0) { + int firstMinor = (firstVersionNums.length == 2 ? Integer.parseInt(firstVersionNums[1]) : 0); + int secondMinor = (secondVersionNums.length == 2 ? Integer.parseInt(secondVersionNums[1]) : 0); + compareRes = Integer.compare(firstMinor, secondMinor); + return (compareRes > 0); + } else { + return (compareRes > 0); + } + } - - /** - * Compares two version strings. - * - * Use this instead of String.compareTo() for a non-lexicographical - * comparison that works for version strings. e.g. "1.10".compareTo("1.6"). - * - * @note It does not work if "1.10" is supposed to be equal to "1.10.0". - * - * @param str1 a string of ordinal numbers separated by decimal points. - * @param str2 a string of ordinal numbers separated by decimal points. - * @return The result is a negative integer if str1 is _numerically_ less than str2. - * The result is a positive integer if str1 is _numerically_ greater than str2. - * The result is zero if the strings are _numerically_ equal. - */ - public static int conformanceLevelCompare(String str1, String str2) { - String[] vals1 = str1.split("\\."); - String[] vals2 = str2.split("\\."); - int i = 0; - // set index to first non-equal ordinal or length of shortest version string - while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) { - i++; - } - // compare first non-equal ordinal number - if (i < vals1.length && i < vals2.length) { - int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i])); - return Integer.signum(diff); - } - // the strings are equal or one string is a substring of the other - // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" - return Integer.signum(vals1.length - vals2.length); - } - - public static String generateToscaResourceName(String resourceType, String resourceSystemName) { - return Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX + resourceType.toLowerCase() + "." + resourceSystemName; - } + + /** + * Compares two version strings. + * + * Use this instead of String.compareTo() for a non-lexicographical + * comparison that works for version strings. e.g. "1.10".compareTo("1.6"). + * + * @param str1 a string of ordinal numbers separated by decimal points. + * @param str2 a string of ordinal numbers separated by decimal points. + * @return The result is a negative integer if str1 is _numerically_ less than str2. + * The result is a positive integer if str1 is _numerically_ greater than str2. + * The result is zero if the strings are _numerically_ equal. + * @note It does not work if "1.10" is supposed to be equal to "1.10.0". + */ + public static int conformanceLevelCompare(String str1, String str2) { + String[] vals1 = str1.split("\\."); + String[] vals2 = str2.split("\\."); + int i = 0; + // set index to first non-equal ordinal or length of shortest version string + while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) { + i++; + } + // compare first non-equal ordinal number + if (i < vals1.length && i < vals2.length) { + int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i])); + return Integer.signum(diff); + } + // the strings are equal or one string is a substring of the other + // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" + return Integer.signum(vals1.length - vals2.length); + } + + public static String generateToscaResourceName(String resourceType, String resourceSystemName) { + return Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX + resourceType.toLowerCase() + "." + resourceSystemName; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java b/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java index 576582b9bf..6f2cc9c7cc 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java @@ -24,7 +24,8 @@ import java.util.function.Consumer; public class TypeUtils { - public static final String FIRST_CERTIFIED_VERSION_VERSION = "1.0"; + + private static final String FIRST_CERTIFIED_VERSION_VERSION = "1.0"; public static <FieldType> void setField(Map<String, Object> toscaJson, ToscaTagNamesEnum tagName, Consumer<FieldType> setter) { String fieldName = tagName.getElementName(); @@ -34,6 +35,10 @@ public class TypeUtils { } } + public static String getFirstCertifiedVersionVersion() { + return FIRST_CERTIFIED_VERSION_VERSION; + } + public enum ToscaTagNamesEnum { DERIVED_FROM("derived_from"), IS_PASSWORD("is_password"), // Properties @@ -51,7 +56,7 @@ public class TypeUtils { PARAMETERS("parameters"), // Import Validations TOSCA_VERSION("tosca_definitions_version"), TOPOLOGY_TEMPLATE("topology_template"), NODE_TYPES("node_types"), OCCURRENCES("occurrences"), NODE_TEMPLATES("node_templates"), GROUPS("groups"), INPUTS("inputs"), - SUBSTITUTION_MAPPINGS("substitution_mappings"), NODE_TYPE("node_type"), DIRECTIVES("directives"), + SUBSTITUTION_MAPPINGS("substitution_mappings"), NODE_TYPE("node_type"), DIRECTIVES("directives"), // Attributes ATTRIBUTES("attributes"), LABEL("label"), HIDDEN("hidden"), IMMUTABLE("immutable"), GET_INPUT("get_input"), ANNOTATIONS("annotations"); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/workers/Job.java b/common-be/src/main/java/org/openecomp/sdc/be/workers/Job.java index 68929aa61d..3ed2e5e83a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/workers/Job.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Job.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,6 +24,6 @@ package org.openecomp.sdc.be.workers; * Created by michael on 6/24/2016. */ public abstract class Job<E> { - public abstract E doWork(); + public abstract E doWork(); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/workers/Main.java b/common-be/src/main/java/org/openecomp/sdc/be/workers/Main.java index cf2bc54fb6..572cfe22e4 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/workers/Main.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Main.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,26 +25,26 @@ package org.openecomp.sdc.be.workers; */ public class Main { - public static void main(String[] args) { + public static void main(String[] args) { - Manager manger = new Manager(); - manger.init(2); - manger.addJob(new Job() { - @Override - public String doWork() { - return "go"; - } - }); - manger.addJob(new Job() { - @Override - public String doWork() { - return "go go"; - } - }); - // try { - System.out.println(manger.start()); - // } catch (InterruptedException e) { - // e.printStackTrace(); - // } - } + Manager manger = new Manager(); + manger.init(2); + manger.addJob(new Job() { + @Override + public String doWork() { + return "go"; + } + }); + manger.addJob(new Job() { + @Override + public String doWork() { + return "go go"; + } + }); + // try { + System.out.println(manger.start()); + // } catch (InterruptedException e) { + // e.printStackTrace(); + // } + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/workers/Manager.java b/common-be/src/main/java/org/openecomp/sdc/be/workers/Manager.java index d0e5f4297d..bb426979ee 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/workers/Manager.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Manager.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,64 +23,69 @@ package org.openecomp.sdc.be.workers; import com.google.common.util.concurrent.ThreadFactoryBuilder; import org.openecomp.sdc.common.log.wrappers.Logger; -import java.util.concurrent.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; /** * Created by michael on 6/24/2016. */ public class Manager<T extends Job, E> { - private static Logger log = Logger.getLogger(Manager.class.getName()); - private ExecutorService executor; - private LinkedBlockingQueue<T> inputQueue; - private LinkedBlockingQueue<E> outputQueue; - private int numberOfWorkers; + private static final int TERMINATION_TIMEAUT = 30; + private static Logger log = Logger.getLogger(Manager.class.getName()); + private ExecutorService executor; + private LinkedBlockingQueue<T> inputQueue; + private LinkedBlockingQueue<E> outputQueue; + private int numberOfWorkers; - public void init(int numberOfWorkers) { - log.debug("initializing workers, creating {} workers", numberOfWorkers); - this.numberOfWorkers = numberOfWorkers; - final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("Worker-%d").build(); - this.executor = Executors.newFixedThreadPool(numberOfWorkers, threadFactory); - this.inputQueue = new LinkedBlockingQueue<>(); - this.outputQueue = new LinkedBlockingQueue<>(); - } + public void init(int numberOfWorkers) { + log.debug("initializing workers, creating {} workers", numberOfWorkers); + this.numberOfWorkers = numberOfWorkers; + final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("Worker-%d").build(); + this.executor = Executors.newFixedThreadPool(numberOfWorkers, threadFactory); + this.inputQueue = new LinkedBlockingQueue<>(); + this.outputQueue = new LinkedBlockingQueue<>(); + } - public void addJob(T job) { - log.trace("job add to input queue"); - this.inputQueue.add(job); - } + public void addJob(T job) { + log.trace("job add to input queue"); + this.inputQueue.add(job); + } - public LinkedBlockingQueue<E> start() { - for (int i = 0; i < numberOfWorkers; i++) { - String workerName = "worker-" + i; - log.debug("starting worker:{}", workerName); - this.executor.submit(new Worker(workerName, this.inputQueue, this.outputQueue)); - } - executor.shutdown(); - try { - if (!executor.awaitTermination(30, TimeUnit.MINUTES)) { - log.error("timer elapsed while waiting for the worker's to finish. "); - } - log.debug("all workers finished"); - } catch (InterruptedException e) { - log.error("failed while waiting for", e); + public LinkedBlockingQueue<E> start() { + for (int i = 0; i < numberOfWorkers; i++) { + String workerName = "worker-" + i; + log.debug("starting worker:{}", workerName); + this.executor.submit(new Worker(workerName, this.inputQueue, this.outputQueue)); + } + executor.shutdown(); + try { + if (!executor.awaitTermination(TERMINATION_TIMEAUT, TimeUnit.MINUTES)) { + log.error("timer elapsed while waiting for the worker's to finish. "); + } + log.debug("all workers finished"); + } catch (InterruptedException e) { + log.error("failed while waiting for", e); Thread.currentThread().interrupt(); - } - return outputQueue; - } + } + return outputQueue; + } - // - // public static void main(String[] args) { - // ExecutorService executor = Executors.newFixedThreadPool(NTHREDS); - // for (int i = 0; i < 500; i++) { - // Runnable worker = new MyRunnable(10000000L + i); - // executor.execute(worker); - // } - // // This will make the executor accept no new threads - // // and finish all existing threads in the queue - // executor.shutdown(); - // // Wait until all threads are finish - // executor.awaitTermination(); - // System.out.println("Finished all threads"); - // } - // } + // + // public static void main(String[] args) { + // ExecutorService executor = Executors.newFixedThreadPool(NTHREDS); + // for (int i = 0; i < 500; i++) { + // Runnable worker = new MyRunnable(10000000L + i); + // executor.execute(worker); + // } + // // This will make the executor accept no new threads + // // and finish all existing threads in the queue + // executor.shutdown(); + // // Wait until all threads are finish + // executor.awaitTermination(); + // System.out.println("Finished all threads"); + // } + // } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java b/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java index cf2a6d0d6c..b5495760f2 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,39 +31,40 @@ import java.util.concurrent.TimeUnit; */ public class Worker<T extends Job<E>, E> implements Runnable { - private String workerName; - private LinkedBlockingQueue<T> inputQueue; + private static final int QUEUE_POLL_TIMEAUT = 500; + private String workerName; + private LinkedBlockingQueue<T> inputQueue; - private LinkedBlockingQueue<E> outputQueue; + private LinkedBlockingQueue<E> outputQueue; - private static Logger log = Logger.getLogger(Worker.class.getName()); + private static Logger log = Logger.getLogger(Worker.class.getName()); - public Worker(String workerName, LinkedBlockingQueue<T> inputQueue, LinkedBlockingQueue<E> outputQueue) { - this.workerName = workerName; - this.inputQueue = inputQueue; - this.outputQueue = outputQueue; - } + public Worker(String workerName, LinkedBlockingQueue<T> inputQueue, LinkedBlockingQueue<E> outputQueue) { + this.workerName = workerName; + this.inputQueue = inputQueue; + this.outputQueue = outputQueue; + } - @Override - public void run() { + @Override + public void run() { - try { - while (true) { - log.trace("worker:{} doing work", workerName); - T job = inputQueue.poll(500, TimeUnit.MILLISECONDS); - if (job == null) { + try { + while (true) { + log.trace("worker:{} doing work", workerName); + T job = inputQueue.poll(QUEUE_POLL_TIMEAUT, TimeUnit.MILLISECONDS); + if (job == null) { - log.debug("worker:{} nothing to do"); - break; - } - this.outputQueue.put(job.doWork()); - log.trace("worker:{} done with work", workerName); - } - } catch (Exception e) { - BeEcompErrorManager.getInstance().logInternalFlowError("executingJobFailed", - "failed during job execution worker" + workerName, BeEcompErrorManager.ErrorSeverity.ERROR); - log.debug("worker: {} nothing to do stoping", workerName,e); - } - } + log.debug("worker:{} nothing to do"); + break; + } + this.outputQueue.put(job.doWork()); + log.trace("worker:{} done with work", workerName); + } + } catch (Exception e) { + BeEcompErrorManager.getInstance().logInternalFlowError("executingJobFailed", + "failed during job execution worker" + workerName, BeEcompErrorManager.ErrorSeverity.ERROR); + log.debug("worker: {} nothing to do stoping", workerName, e); + } + } } |