diff options
Diffstat (limited to 'common-be/src/main/java')
37 files changed, 4936 insertions, 0 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 new file mode 100644 index 0000000000..754721a5a6 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java @@ -0,0 +1,130 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.category; + +import java.io.Serializable; +import java.util.List; + +public class CategoryDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 2882352060242714427L; + + 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 + "]"; + } + +} 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 new file mode 100644 index 0000000000..87924e99d4 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.category; + +import java.io.Serializable; + +public class GroupingDataDefinition implements Serializable { + /** + * + */ + private static final long serialVersionUID = 2641475929148843849L; + + 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 + + "]"; + } + +} 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 new file mode 100644 index 0000000000..2774fe4e40 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.category; + +import java.io.Serializable; +import java.util.List; + +public class SubCategoryDataDefinition implements Serializable { + /** + * + */ + private static final long serialVersionUID = 8279397988497086676L; + + 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 + "]"; + } +} 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 new file mode 100644 index 0000000000..4af7a279a3 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java @@ -0,0 +1,429 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.components; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public abstract class ComponentMetadataDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -9114770126086263552L; + + private String uniqueId; + + private String name; // archiveName + + private String version; // archiveVersion + + private Boolean isHighestVersion; + + private Long creationDate; + + private Long lastUpdateDate; + + private String description; + + private String state; + + private List<String> tags; + + private String icon; + + private String UUID; + + private String normalizedName; + + private String systemName; + + private String contactId; + + private Map<String, String> allVersions; + + private Boolean isDeleted; + + private String projectCode; + + private String csarUUID; + + private String csarVersion; + + private String importedToscaChecksum; + + private String invariantUUID; + + 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<String>(other.getTags()); + this.icon = other.getIcon(); + this.contactId = other.getContactId(); + this.UUID = other.getUUID(); + this.normalizedName = other.getNormalizedName(); + this.systemName = other.getSystemName(); + this.allVersions = new HashMap<String, String>(other.getAllVersions()); + this.isDeleted = other.isDeleted(); + this.projectCode = other.getProjectCode(); + this.csarUUID = other.getCsarUUID(); + this.csarVersion = other.csarVersion; + this.importedToscaChecksum = other.getImportedToscaChecksum(); + this.invariantUUID = other.getInvariantUUID(); + } + + 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 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) { + 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) { + 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; + } + + @Override + public String toString() { + return "ComponentMetadataDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", version=" + version + + ", isHighestVersion=" + isHighestVersion + ", creationDate=" + creationDate + ", lastUpdateDate=" + + lastUpdateDate + ", description=" + description + ", state=" + state + ", tags=" + tags + ", icon=" + + icon + ", UUID=" + UUID + ", normalizedName=" + normalizedName + ", systemName=" + systemName + + ", contactId=" + contactId + ", allVersions=" + allVersions + ", isDeleted=" + isDeleted + + ", projectCode=" + projectCode + ", csarUUID=" + csarUUID + ", csarversion=" + csarVersion + + ", importedToscaChecksum=" + importedToscaChecksum + ", invariantUUID=" + invariantUUID + "]"; + } + + @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 + ((contactId == null) ? 0 : contactId.hashCode()); + result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((icon == null) ? 0 : icon.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 + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((normalizedName == null) ? 0 : normalizedName.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()); + result = prime * result + ((projectCode == null) ? 0 : projectCode.hashCode()); + result = prime * result + ((csarUUID == null) ? 0 : csarUUID.hashCode()); + result = prime * result + ((csarVersion == null) ? 0 : csarVersion.hashCode()); + result = prime * result + ((importedToscaChecksum == null) ? 0 : importedToscaChecksum.hashCode()); + result = prime * result + ((invariantUUID == null) ? 0 : invariantUUID.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 (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 (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 (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 (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 (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; + if (projectCode == null) { + if (other.projectCode != null) + return false; + } else if (!projectCode.equals(other.projectCode)) + 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 (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; + return true; + } +} 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 new file mode 100644 index 0000000000..2eb5e23352 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java @@ -0,0 +1,176 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.components; + +import java.io.Serializable; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; + +public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1142973528643758481L; + + private String vendorName; + private String vendorRelease; + private ResourceTypeEnum resourceType = ResourceTypeEnum.VFC; // ResourceType.VFC + // is + // default + private Boolean isAbstract; + private String cost; + private String licenseType; + private String toscaResourceName; + + public ResourceMetadataDataDefinition() { + super(); + } + + public ResourceMetadataDataDefinition(ResourceMetadataDataDefinition other) { + super(other); + this.vendorName = other.getVendorName(); + this.vendorRelease = other.getVendorRelease(); + 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 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 + + ", 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()); + 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; + + return super.equals(obj); + } + +} 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 new file mode 100644 index 0000000000..2ebbadcdaf --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java @@ -0,0 +1,87 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.components; + +import java.io.Serializable; + +public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -7661001892509435120L; + + private String distributionStatus; + + public ServiceMetadataDataDefinition() { + super(); + } + + public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) { + super(other); + } + + public String getDistributionStatus() { + return distributionStatus; + } + + public void setDistributionStatus(String distributionStatus) { + this.distributionStatus = distributionStatus; + } + + @Override + public String toString() { + return "ServiceMetadataDataDefinition [ distributionStatus=" + distributionStatus + ", parent=" + + super.toString() + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((distributionStatus == null) ? 0 : distributionStatus.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; + return super.equals(obj); + } + +} 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 new file mode 100644 index 0000000000..4c062e3fab --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; + +public class AdditionalInfoParameterDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -565365728516901670L; + + private String uniqueId; + + private Long creationTime; + + private Long modificationTime; + + private Integer lastCreatedCounter = 0; + + public AdditionalInfoParameterDataDefinition() { + + } + + public AdditionalInfoParameterDataDefinition(AdditionalInfoParameterDataDefinition p) { + this.uniqueId = p.uniqueId; + this.creationTime = p.creationTime; + this.modificationTime = p.modificationTime; + this.lastCreatedCounter = p.lastCreatedCounter; + } + + 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; + } + + public Integer getLastCreatedCounter() { + return lastCreatedCounter; + } + + public void setLastCreatedCounter(Integer lastCreatedCounter) { + this.lastCreatedCounter = lastCreatedCounter; + } + + @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/ArtifactDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java new file mode 100644 index 0000000000..4baf09ea68 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java @@ -0,0 +1,587 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; + +import java.io.Serializable; + +public class ArtifactDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -1691343090754083941L; + + /** + * The unique id of the artifact + */ + private String uniqueId; + + /** + * Tosca logical name + */ + // private String logicalName; + + /** This attribute specifies the type of this artifact. */ + private String artifactType; + + /** Specifies the reference of the artifact. uri to the SWIFT */ + private String artifactRef; + + /** Specifies the display name of the artifact. */ + private String artifactName; + + /** + * Non TOSCA compliant property + */ + private String artifactRepository; + + /** + * Checksum value of the uploaded artifact file retrieved from "Content-MD5"? + * header of the HTTP POST/PUT request. Should be updated each time when the + * artifact file is updated. + */ + private String artifactChecksum; + + /** + * artifact creator + */ + private String userIdCreator; + + /** + * USER ID of the last resource (artifact) updater + */ + private String userIdLastUpdater; + + /** + * Full name of artifact creator + */ + private String creatorFullName; + + /** + * Full name of the last resource (artifact) updater + */ + private String updaterFullName; + + /** + * Timestamp of the resource (artifact) creation + */ + private Long creationDate; + + /** + * Timestamp of the last resource (artifact) creation + */ + private Long lastUpdateDate; + + /** + * Id of artifact data in ES + */ + private String esId; + + /** + * Logical artifact name. Used by TOSCA + */ + private String artifactLabel; + + private String artifactCreator; + + private String description; + + private Boolean mandatory = Boolean.FALSE; + + private String artifactDisplayName; + + private String apiUrl; + + private Boolean serviceApi = Boolean.FALSE; + + /** + * Flag that set to TRUE if generated from AI&I Artifact generator to + * distinguish between manually uploaded and generated artifacts + */ + private Boolean generated = Boolean.FALSE; + + private ArtifactGroupTypeEnum artifactGroupType; + private Integer timeout; + private String artifactVersion; + private String artifactUUID; + private Long payloadUpdateDate; + private Long heatParamsUpdateDate; + + private List<String> requiredArtifacts; + + public ArtifactDataDefinition() { + artifactVersion = "0"; + } + + public ArtifactDataDefinition(ArtifactDataDefinition a) { + this.uniqueId = a.uniqueId; + this.artifactType = a.artifactType; + this.artifactRef = a.artifactRef; + this.artifactName = a.artifactName; + this.artifactRepository = a.artifactRepository; + this.artifactChecksum = a.artifactChecksum; + this.userIdCreator = a.userIdCreator; + this.userIdLastUpdater = a.userIdLastUpdater; + this.creatorFullName = a.creatorFullName; + this.updaterFullName = a.updaterFullName; + this.creationDate = a.creationDate; + this.lastUpdateDate = a.lastUpdateDate; + this.description = a.description; + this.esId = a.esId; + this.artifactLabel = a.artifactLabel; + this.artifactCreator = a.artifactCreator; + this.mandatory = a.mandatory; + this.artifactDisplayName = a.artifactDisplayName; + this.apiUrl = a.apiUrl; + this.serviceApi = a.serviceApi; + this.artifactGroupType = a.artifactGroupType; + this.timeout = a.timeout; + this.artifactVersion = a.artifactVersion; + this.artifactUUID = a.artifactUUID; + this.payloadUpdateDate = a.payloadUpdateDate; + this.heatParamsUpdateDate = a.heatParamsUpdateDate; + this.setGenerated(a.getGenerated()); + if (a.requiredArtifacts != null) + this.requiredArtifacts = new ArrayList<>(a.getRequiredArtifacts()); + } + + public String getArtifactName() { + return artifactName != null ? artifactName : artifactRef; + } + + public String getArtifactType() { + return artifactType; + } + + public void setArtifactType(String artifactType) { + this.artifactType = artifactType; + } + + public String getArtifactRef() { + return artifactRef; + } + + public void setArtifactRef(String artifactRef) { + this.artifactRef = artifactRef; + } + + public String getArtifactRepository() { + return artifactRepository; + } + + public void setArtifactRepository(String artifactRepository) { + this.artifactRepository = artifactRepository; + } + + public void setArtifactName(String artifactName) { + this.artifactName = artifactName; + } + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + public String getUserIdCreator() { + return userIdCreator; + } + + public void setUserIdCreator(String userIdCreator) { + this.userIdCreator = userIdCreator; + } + + public String getUserIdLastUpdater() { + return userIdLastUpdater; + } + + public void setUserIdLastUpdater(String userIdLastUpdater) { + this.userIdLastUpdater = userIdLastUpdater; + } + + public String getCreatorFullName() { + return creatorFullName; + } + + public void setCreatorFullName(String creatorFullName) { + this.creatorFullName = creatorFullName; + } + + public String getUpdaterFullName() { + return updaterFullName; + } + + public void setUpdaterFullName(String updaterFullName) { + this.updaterFullName = updaterFullName; + } + + 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 getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getArtifactLabel() { + return artifactLabel; + } + + public void setArtifactLabel(String artifactLabel) { + this.artifactLabel = artifactLabel; + } + + public String getEsId() { + return esId; + } + + public void setEsId(String esId) { + this.esId = esId; + } + + public String getArtifactCreator() { + return artifactCreator; + } + + public void setArtifactCreator(String artifactCreator) { + this.artifactCreator = artifactCreator; + } + + public Boolean getMandatory() { + return mandatory; + } + + public void setMandatory(Boolean mandatory) { + this.mandatory = mandatory; + } + + public String getArtifactDisplayName() { + return artifactDisplayName; + } + + public void setArtifactDisplayName(String artifactDisplayName) { + this.artifactDisplayName = artifactDisplayName; + } + + public String getApiUrl() { + return apiUrl; + } + + public void setApiUrl(String apiUrl) { + this.apiUrl = apiUrl; + } + + public Boolean getServiceApi() { + return serviceApi; + } + + public void setServiceApi(Boolean serviceApi) { + this.serviceApi = serviceApi; + } + + public ArtifactGroupTypeEnum getArtifactGroupType() { + return artifactGroupType; + } + + public void setArtifactGroupType(ArtifactGroupTypeEnum artifactGroupType) { + this.artifactGroupType = artifactGroupType; + } + + public Integer getTimeout() { + return timeout; + } + + public void setTimeout(Integer timeout) { + this.timeout = timeout; + } + + public String getArtifactVersion() { + return artifactVersion; + } + + public void setArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + } + + public String getArtifactUUID() { + return artifactUUID; + } + + public void setArtifactUUID(String artifactUUID) { + this.artifactUUID = artifactUUID; + } + + public Long getPayloadUpdateDate() { + return payloadUpdateDate; + } + + public void setPayloadUpdateDate(Long payloadUpdateDate) { + this.payloadUpdateDate = payloadUpdateDate; + } + + public Long getHeatParamsUpdateDate() { + return heatParamsUpdateDate; + } + + public void setHeatParamsUpdateDate(Long heatParamsUpdateDate) { + this.heatParamsUpdateDate = heatParamsUpdateDate; + } + + public List<String> getRequiredArtifacts() { + return requiredArtifacts; + } + + public void setRequiredArtifacts(List<String> requiredArtifacts) { + this.requiredArtifacts = requiredArtifacts; + } + + public Boolean getGenerated() { + return generated; + } + + public void setGenerated(Boolean generated) { + this.generated = generated; + } + + @Override + public String toString() { + return "ArtifactDataDefinition [uniqueId=" + uniqueId + ", artifactType=" + artifactType + ", artifactRef=" + + artifactRef + ", artifactName=" + artifactName + ", artifactRepository=" + artifactRepository + + ", artifactChecksum=" + artifactChecksum + ", userIdCreator=" + userIdCreator + ", userIdLastUpdater=" + + userIdLastUpdater + ", creatorFullName=" + creatorFullName + ", updaterFullName=" + updaterFullName + + ", creationDate=" + creationDate + ", lastUpdateDate=" + lastUpdateDate + ", esId=" + esId + + ", artifactLabel=" + artifactLabel + ", artifactCreator=" + artifactCreator + ", description=" + + description + ", mandatory=" + mandatory + ", artifactDisplayName=" + artifactDisplayName + + ", apiUrl=" + apiUrl + ", serviceApi=" + serviceApi + ", artifactGroupType=" + artifactGroupType + + ", timeout=" + timeout + ", artifactVersion=" + artifactVersion + ", artifactUUID=" + artifactUUID + + ", payloadUpdateDate=" + payloadUpdateDate + ", heatParamsUpdateDate=" + heatParamsUpdateDate + + ", requiredArtifacts=" + requiredArtifacts + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + 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 (apiUrl == null) { + if (other.apiUrl != null) + return false; + } else if (!apiUrl.equals(other.apiUrl)) + return false; + if (artifactChecksum == null) { + if (other.artifactChecksum != null) + return false; + } else if (!artifactChecksum.equals(other.artifactChecksum)) + return false; + if (artifactCreator == null) { + if (other.artifactCreator != null) + return false; + } else if (!artifactCreator.equals(other.artifactCreator)) + return false; + if (artifactDisplayName == null) { + if (other.artifactDisplayName != null) + return false; + } else if (!artifactDisplayName.equals(other.artifactDisplayName)) + return false; + if (artifactGroupType != other.artifactGroupType) + return false; + if (artifactLabel == null) { + if (other.artifactLabel != null) + return false; + } else if (!artifactLabel.equals(other.artifactLabel)) + return false; + if (artifactName == null) { + if (other.artifactName != null) + return false; + } else if (!artifactName.equals(other.artifactName)) + return false; + if (artifactRef == null) { + if (other.artifactRef != null) + return false; + } else if (!artifactRef.equals(other.artifactRef)) + return false; + if (artifactRepository == null) { + if (other.artifactRepository != null) + return false; + } else if (!artifactRepository.equals(other.artifactRepository)) + return false; + if (artifactType == null) { + if (other.artifactType != null) + return false; + } else if (!artifactType.equals(other.artifactType)) + return false; + if (artifactUUID == null) { + if (other.artifactUUID != null) + return false; + } else if (!artifactUUID.equals(other.artifactUUID)) + return false; + if (artifactVersion == null) { + if (other.artifactVersion != null) + return false; + } else if (!artifactVersion.equals(other.artifactVersion)) + return false; + if (userIdCreator == null) { + if (other.userIdCreator != null) + return false; + } else if (!userIdCreator.equals(other.userIdCreator)) + return false; + if (userIdLastUpdater == null) { + if (other.userIdLastUpdater != null) + return false; + } else if (!userIdLastUpdater.equals(other.userIdLastUpdater)) + 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 (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (esId == null) { + if (other.esId != null) + return false; + } else if (!esId.equals(other.esId)) + return false; + if (heatParamsUpdateDate == null) { + if (other.heatParamsUpdateDate != null) + return false; + } else if (!heatParamsUpdateDate.equals(other.heatParamsUpdateDate)) + return false; + if (lastUpdateDate == null) { + if (other.lastUpdateDate != null) + return false; + } else if (!lastUpdateDate.equals(other.lastUpdateDate)) + return false; + if (mandatory == null) { + if (other.mandatory != null) + return false; + } else if (!mandatory.equals(other.mandatory)) + return false; + if (payloadUpdateDate == null) { + if (other.payloadUpdateDate != null) + return false; + } else if (!payloadUpdateDate.equals(other.payloadUpdateDate)) + return false; + if (requiredArtifacts == null) { + if (other.requiredArtifacts != null) + return false; + } else if (!requiredArtifacts.equals(other.requiredArtifacts)) + return false; + if (serviceApi == null) { + if (other.serviceApi != null) + return false; + } else if (!serviceApi.equals(other.serviceApi)) + return false; + if (timeout == null) { + if (other.timeout != null) + return false; + } else if (!timeout.equals(other.timeout)) + return false; + if (uniqueId == null) { + if (other.uniqueId != null) + return false; + } else if (!uniqueId.equals(other.uniqueId)) + return false; + if (updaterFullName == null) { + if (other.updaterFullName != null) + return false; + } else if (!updaterFullName.equals(other.updaterFullName)) + return false; + return true; + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java new file mode 100644 index 0000000000..b52824697a --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AttributeDataDefinition.java @@ -0,0 +1,186 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; +import java.util.Objects; + +/** + * Represents AttributeDataDefinition + * + * @author mshitrit + * + */ +public class AttributeDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3046831950009259569L; + + private String uniqueId; + private String name; + private String type; + private String description; + + private String defaultValue; + private String value; + + private String status; + private SchemaDefinition schema; + + public AttributeDataDefinition() { + // Used From Attribute Defenition + } + + /** + * Clone Constructor + * + * @param attribute + */ + public AttributeDataDefinition(AttributeDataDefinition attribute) { + this.uniqueId = attribute.uniqueId; + this.name = attribute.name; + this.type = attribute.type; + this.description = attribute.description; + this.defaultValue = attribute.defaultValue; + this.value = attribute.value; + this.status = attribute.status; + this.schema = attribute.schema; + } + + 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 getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public SchemaDefinition getSchema() { + return schema; + } + + public void setSchema(SchemaDefinition entrySchema) { + this.schema = entrySchema; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode()); + result = prime * result + ((value == null) ? 0 : value.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()); + result = prime * result + ((status == null) ? 0 : status.hashCode()); + result = prime * result + ((schema == null) ? 0 : schema.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + boolean equals = true; + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + AttributeDataDefinition other = (AttributeDataDefinition) obj; + if (!Objects.equals(defaultValue, other.defaultValue)) { + equals = false; + } else if (!Objects.equals(value, other.value)) { + equals = false; + } else if (!Objects.equals(description, other.description)) { + equals = false; + } else if (!Objects.equals(name, other.name)) { + equals = false; + } else if (!Objects.equals(type, other.type)) { + equals = false; + } else if (!Objects.equals(uniqueId, other.uniqueId)) { + equals = false; + } else if (!Objects.equals(status, other.status)) { + equals = false; + } else if (!Objects.equals(schema, other.schema)) { + equals = false; + } + return equals; + } + + @Override + public String toString() { + return "AttributeDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", type=" + type + ", description=" + + description + ", defaultValue=" + defaultValue + ", value=" + value + ", status=" + status + + ", entrySchema=" + schema + "]"; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} 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 new file mode 100644 index 0000000000..f4de5b8c9d --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; +import java.util.List; + +public class CapabilityTypeDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 3242123405337612089L; + + private String uniqueId; + + private String description; + + /** Identifies the type of the capability. */ + private String type; + + private List<String> validSourceTypes; + + private String version; + + private Long creationTime; + + private Long modificationTime; + + // private String derivedFrom; + + public CapabilityTypeDataDefinition(CapabilityTypeDataDefinition cdt) { + super(); + this.uniqueId = cdt.getUniqueId(); + this.description = cdt.getDescription(); + this.type = cdt.getType(); + this.validSourceTypes = cdt.getValidSourceTypes(); + this.version = cdt.getVersion(); + this.creationTime = cdt.getCreationTime(); + this.modificationTime = cdt.getModificationTime(); + } + + public CapabilityTypeDataDefinition() { + + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List<String> getValidSourceTypes() { + return validSourceTypes; + } + + public void setValidSourceTypes(List<String> validSourceTypes) { + this.validSourceTypes = validSourceTypes; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + 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 "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 new file mode 100644 index 0000000000..c9a9516f21 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java @@ -0,0 +1,187 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; + +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; + +public class ComponentInstanceDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 7215033872921497743L; + + private String uniqueId; + + private String name; + private String normalizedName; + + private String componentUid; + + private Long creationTime; + + private Long modificationTime; + + private String description; + + private String posX; + + private String posY; + private Integer propertyValueCounter = 1; + private Integer attributeValueCounter; + private Integer inputValueCounter = 1; + private OriginTypeEnum originType; + + public ComponentInstanceDataDefinition() { + super(); + } + + public ComponentInstanceDataDefinition(ComponentInstanceDataDefinition dataDefinition) { + this.uniqueId = dataDefinition.uniqueId; + this.name = dataDefinition.name; + this.componentUid = dataDefinition.componentUid; + this.creationTime = dataDefinition.creationTime; + this.modificationTime = dataDefinition.modificationTime; + this.description = dataDefinition.description; + this.posX = dataDefinition.posX; + this.posY = dataDefinition.posY; + this.propertyValueCounter = dataDefinition.propertyValueCounter; + this.normalizedName = dataDefinition.normalizedName; + this.originType = dataDefinition.originType; + + } + + 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; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getPosX() { + return posX; + } + + public void setPosX(String posX) { + this.posX = posX; + } + + public String getPosY() { + return posY; + } + + public void setPosY(String posY) { + this.posY = posY; + } + + public String getComponentUid() { + return componentUid; + } + + public void setComponentUid(String resourceUid) { + this.componentUid = resourceUid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getPropertyValueCounter() { + return propertyValueCounter; + } + + public void setPropertyValueCounter(Integer propertyValueCounter) { + this.propertyValueCounter = propertyValueCounter; + } + + public String getNormalizedName() { + return normalizedName; + } + + public void setNormalizedName(String normalizedName) { + this.normalizedName = normalizedName; + } + + public OriginTypeEnum getOriginType() { + return originType; + } + + public void setOriginType(OriginTypeEnum originType) { + this.originType = originType; + } + + @Override + public String toString() { + return "ComponentInstanceDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", normalizedName=" + + normalizedName + ", componentUid=" + componentUid + ", creationTime=" + creationTime + + ", modificationTime=" + modificationTime + ", description=" + description + ", posX=" + posX + + ", posY=" + posY + ", propertyValueCounter=" + propertyValueCounter + ", originType=" + originType + + "]"; + } + + public Integer getAttributeValueCounter() { + return attributeValueCounter; + } + + public void setAttributeValueCounter(Integer attributeValueCounter) { + this.attributeValueCounter = attributeValueCounter; + } + + public Integer getInputValueCounter() { + return inputValueCounter; + } + + public void setInputValueCounter(Integer inputValueCounter) { + this.inputValueCounter = inputValueCounter; + } + +} 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 new file mode 100644 index 0000000000..6cd7d6c0fb --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java @@ -0,0 +1,204 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +public class ConsumerDataDefinition { + + // 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; + } + +} 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 new file mode 100644 index 0000000000..bfcfefc433 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java @@ -0,0 +1,119 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; + +public class DataTypeDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1751768352205892172L; + + private String name; + + private String uniqueId; + + // "boolean", "string", "float", "integer", "version" }) + private String derivedFromName; + + private String description; + + /** + * Timestamp of data type creation + */ + private Long creationTime; + + /** + * Timestamp of the data type last update + */ + private Long modificationTime; + + 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 String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDerivedFromName() { + return derivedFromName; + } + + public void setDerivedFromName(String derivedFromName) { + this.derivedFromName = derivedFromName; + } + + 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 "DataTypeDataDefinition [name=" + name + ", uniqueId=" + uniqueId + ", derivedFromName=" + + derivedFromName + ", description=" + description + ", creationTime=" + creationTime + + ", modificationTime=" + modificationTime + "]"; + } + +} 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 new file mode 100644 index 0000000000..be3dd8c0ed --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java @@ -0,0 +1,142 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; + +public class GroupDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1565606165279109427L; + + private String name; + + // the id is unique per group instance on graph. + private String uniqueId; + + private String type; + + // version should be changed when there is a change to the group's metadata + // or to the groups members + // (not necessarily when the VF version is changed). This field cannot be + // updated by user + private String version; + + // this id is constant and does not changed (also not when changing + // version). This field cannot be updated by user + private String invariantUUID; + + // the group UUID should be changed when one of the artifacts/component + // instances has been changed. + private String groupUUID; + + private String description; + + private Integer propertyValueCounter = 0; + + public GroupDataDefinition() { + + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getInvariantUUID() { + return invariantUUID; + } + + public void setInvariantUUID(String invariantUUID) { + this.invariantUUID = invariantUUID; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Integer getPropertyValueCounter() { + return propertyValueCounter; + } + + public void setPropertyValueCounter(Integer propertyValueCounter) { + this.propertyValueCounter = propertyValueCounter; + } + + public String getGroupUUID() { + return groupUUID; + } + + public void setGroupUUID(String groupUUID) { + this.groupUUID = groupUUID; + } + + public GroupDataDefinition(GroupDataDefinition other) { + this.name = other.name; + this.uniqueId = other.uniqueId; + this.type = other.type; + this.version = other.version; + this.invariantUUID = other.invariantUUID; + this.description = other.description; + this.propertyValueCounter = other.propertyValueCounter; + this.groupUUID = other.groupUUID; + } + + @Override + public String toString() { + return "GroupDataDefinition [name=" + name + ", uniqueId=" + uniqueId + ", type=" + type + ", version=" + + version + ", invariantUUID=" + invariantUUID + ", description=" + description + + ", propertyValueCounter=" + propertyValueCounter + ", groupUUID=" + groupUUID + "]"; + } +} 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 new file mode 100644 index 0000000000..1642d17252 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java @@ -0,0 +1,163 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +public class GroupTypeDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -7001817818907172496L; + + private String uniqueId; + + private String type; + + private String version; + + private String derivedFrom; + + private List<String> members; + + private Map<String, String> metadata; + + private String description; + + /** + * Timestamp of data type creation + */ + private Long creationTime; + + /** + * Timestamp of the data type last update + */ + private Long modificationTime; + + private boolean highestVersion; + + public GroupTypeDataDefinition() { + + } + + public GroupTypeDataDefinition(GroupTypeDataDefinition p) { + this.uniqueId = p.uniqueId; + this.type = p.type; + this.version = p.version; + this.members = p.members; + this.metadata = p.metadata; + // this.derivedFromName = p.derivedFromName; + this.description = p.description; + this.creationTime = p.creationTime; + this.modificationTime = p.modificationTime; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + 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=" + type + ", 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 new file mode 100644 index 0000000000..a84485bef6 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java @@ -0,0 +1,162 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; + +public class HeatParameterDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 8995421762148502848L; + + 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; + } +} 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 new file mode 100644 index 0000000000..87c163a3ae --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +public class InputsValueDataDefinition { + private String name; + private String value; + private String uniqueId; + + public InputsValueDataDefinition(String name, String value) { + super(); + this.name = name; + this.value = value; + } + + public InputsValueDataDefinition() { + super(); + // TODO Auto-generated constructor stub + } + + 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 getValue() { + return 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 new file mode 100644 index 0000000000..46c1ede031 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +public class InterfaceDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 2208369368489725049L; + + private String type; + + private String description; + + private String uniqueId; + + /** + * Timestamp of the resource (artifact) creation + */ + private Long creationDate; + + /** + * Timestamp of the last resource (artifact) creation + */ + private Long lastUpdateDate; + + public InterfaceDataDefinition() { + super(); + // TODO Auto-generated constructor stub + } + + public InterfaceDataDefinition(String type, String description) { + super(); + this.type = type; + this.description = description; + + } + + public InterfaceDataDefinition(InterfaceDataDefinition p) { + this.uniqueId = p.uniqueId; + this.type = p.type; + this.description = p.description; + + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + 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; + } + +} 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 new file mode 100644 index 0000000000..12c069b142 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java @@ -0,0 +1,96 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; + +public class OperationDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1951516966187326915L; + + private String uniqueId; + + /** + * Timestamp of the resource (artifact) creation + */ + private Long creationDate; + + /** + * Timestamp of the last resource (artifact) creation + */ + private Long lastUpdateDate; + + /** Description of the operation. */ + private String description; + + public OperationDataDefinition() { + super(); + // TODO Auto-generated constructor stub + } + + public OperationDataDefinition(String description) { + super(); + this.description = description; + + } + + public OperationDataDefinition(OperationDataDefinition p) { + this.uniqueId = p.uniqueId; + this.description = p.description; + + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + 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; + } + +} 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 new file mode 100644 index 0000000000..9b2b0659b1 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java @@ -0,0 +1,163 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +public class PolicyTypeDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3783390539788578388L; + + private String uniqueId; + + private String type; + + private String version; + + private String derivedFrom; + + private List<String> targets; + + private Map<String, String> metadata; + + private String description; + + /** + * Timestamp of data type creation + */ + private Long creationTime; + + /** + * Timestamp of the data type last update + */ + private Long modificationTime; + + private boolean highestVersion; + + public PolicyTypeDataDefinition() { + + } + + public PolicyTypeDataDefinition(PolicyTypeDataDefinition p) { + this.uniqueId = p.uniqueId; + this.type = p.type; + this.version = p.version; + this.targets = p.targets; + this.metadata = p.metadata; + // this.derivedFromName = p.derivedFromName; + this.description = p.description; + this.creationTime = p.creationTime; + this.modificationTime = p.modificationTime; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public List<String> getTargets() { + return targets; + } + + public void setTargets(List<String> members) { + this.targets = 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 "PolicyTypeDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", version=" + version + + ", targets=" + targets + ", 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/ProductMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java new file mode 100644 index 0000000000..3f044c1d46 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; + +public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -1877577227290771160L; + + 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 == isActive) { + if (other.isActive != null) + return false; + } else if (!isActive.equals(other.isActive)) + return false; + return super.equals(obj); + } +} 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 new file mode 100644 index 0000000000..c522f3e0e9 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java @@ -0,0 +1,195 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; + +public class PropertyDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 5798685557528432389L; + + private String uniqueId; + + // "boolean", "string", "float", "integer", "version" }) + private String type; + + private Boolean required; + + protected boolean definition = false; + + private String defaultValue; + + private String description; + + private SchemaDefinition schema; + + private boolean password; + + public PropertyDataDefinition() { + + } + + public PropertyDataDefinition(PropertyDataDefinition p) { + this.uniqueId = p.uniqueId; + this.required = p.required; + this.defaultValue = p.defaultValue; + this.description = p.description; + this.schema = p.schema; + this.password = p.password; + this.type = p.type; + } + + // @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 setSchema(SchemaDefinition entrySchema) { + this.schema = entrySchema; + } + + @Override + public String toString() { + return "PropertyDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", required=" + required + + ", defaultValue=" + defaultValue + ", description=" + description + ", entrySchema=" + schema + + ", password=" + password + "]"; + } + + @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()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PropertyDataDefinition other = (PropertyDataDefinition) obj; + if (defaultValue == null) { + if (other.defaultValue != null) + return false; + } else if (!defaultValue.equals(other.defaultValue)) + return false; + if (definition != other.definition) + return false; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (password != other.password) + return false; + if (required == null) { + if (other.required != null) + return false; + } else if (!required.equals(other.required)) + return false; + if (schema == null) { + if (other.schema != null) + return false; + } else if (!schema.equals(other.schema)) + 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; + } +} 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 new file mode 100644 index 0000000000..c9ef85ac66 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java @@ -0,0 +1,136 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; +import java.util.List; +import org.codehaus.jackson.annotate.JsonIgnore; + +public class PropertyRule implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3357933382124599996L; + + public static String FORCE_ALL = "FORCE_ALL"; + public static String ALL = "ALL"; + public 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 || false == 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/RelationshipTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipTypeDataDefinition.java new file mode 100644 index 0000000000..0f7c56842f --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipTypeDataDefinition.java @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; +import java.util.List; + +public class RelationshipTypeDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1104043358598884458L; + + private String uniqueId; + + private String description; + + /** Identifies the type of the capability. */ + private String type; + + private List<String> validSourceTypes; + + private String version; + + private Long creationTime; + + private Long modificationTime; + + // private String derivedFrom; + + public RelationshipTypeDataDefinition(RelationshipTypeDataDefinition cdt) { + super(); + this.uniqueId = cdt.getUniqueId(); + this.description = cdt.getDescription(); + this.type = cdt.getType(); + this.validSourceTypes = cdt.getValidSourceTypes(); + this.version = cdt.getVersion(); + this.creationTime = cdt.getCreationTime(); + this.modificationTime = cdt.getModificationTime(); + } + + public RelationshipTypeDataDefinition() { + + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List<String> getValidSourceTypes() { + return validSourceTypes; + } + + public void setValidSourceTypes(List<String> validSourceTypes) { + this.validSourceTypes = validSourceTypes; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + 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 "RelationshipTypeDataDefinition [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/SchemaDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java new file mode 100644 index 0000000000..3845a706b1 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java @@ -0,0 +1,139 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.elements; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * Schema allows to create new types that can be used along TOSCA definitions. + */ +public class SchemaDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 7117891081909380577L; + + 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.derivedFrom = derivedFrom; + this.constraints = constraints; + this.properties = 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 + ']'; + } +} 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 new file mode 100644 index 0000000000..e130671572 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/AssetTypeEnum.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.enums; + +public enum AssetTypeEnum { + RESOURCES("resources", "Resource"), SERVICES("services", "Service"), PRODUCTS("products", "Product"); + + private String value; + + public String getValue() { + return value; + } + + public String getCorrespondingComponent() { + return correspondingComponent; + } + + private String correspondingComponent; + + private 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); + } + } + + return ret; + } +} 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 new file mode 100644 index 0000000000..9da0b81d3b --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.enums; + +public enum ComponentTypeEnum { + RESOURCE("Resource"), SERVICE("Service"), RESOURCE_INSTANCE("Resource Instance"), PRODUCT("Product"), SERVICE_INSTANCE("Service Instance"); + + private String value; + + private ComponentTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + // Those values cannot be another field in enum, because they are needed + // as constants for Swagger allowedValues param + public static final String RESOURCE_PARAM_NAME = "resources"; + public static final String SERVICE_PARAM_NAME = "services"; + public static final String PRODUCT_PARAM_NAME = "products"; + + public NodeTypeEnum getNodeType() { + + switch (this) { + case RESOURCE: + return NodeTypeEnum.Resource; + case SERVICE: + return NodeTypeEnum.Service; + case PRODUCT: + return NodeTypeEnum.Product; + case RESOURCE_INSTANCE: + return NodeTypeEnum.ResourceInstance; + default: + throw new UnsupportedOperationException("No nodeType is defined for: " + this.getValue()); + } + } + + public static ComponentTypeEnum findByValue(String value) { + ComponentTypeEnum ret = null; + for (ComponentTypeEnum curr : ComponentTypeEnum.values()) { + if (curr.getValue().equals(value)) { + ret = curr; + return ret; + } + } + return ret; + } + + public static ComponentTypeEnum findByParamName(String paramName) { + ComponentTypeEnum ret = null; + switch (paramName) { + case RESOURCE_PARAM_NAME: + ret = RESOURCE; + break; + case SERVICE_PARAM_NAME: + ret = SERVICE; + break; + case PRODUCT_PARAM_NAME: + ret = PRODUCT; + break; + default: + break; + } + return ret; + } + + public static String findParamByType(ComponentTypeEnum type) { + String ret = null; + switch (type) { + case RESOURCE: + ret = RESOURCE_PARAM_NAME; + break; + case SERVICE: + ret = SERVICE_PARAM_NAME; + break; + case PRODUCT: + ret = PRODUCT_PARAM_NAME; + break; + default: + break; + } + return ret; + } +} 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 new file mode 100644 index 0000000000..bf8ae79467 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.enums; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +public enum FilterKeyEnum { + SUB_CATEGORY("subCategory"), CATEGORY("category"), DISTRIBUTION_STATUS("distributionStatus"); + + 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(f -> f.getName()).collect(Collectors.toList()); + } + + public static List<String> getValidFiltersByAssetType(ComponentTypeEnum assetType) { + switch (assetType) { + case RESOURCE: + return getAllFilters().subList(0, 2); + case SERVICE: + return getAllFilters().subList(1, 3); + default: + return null; + } + + } +} 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 new file mode 100644 index 0000000000..e5783e4a28 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GroupTypeEnum.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.enums; + +public enum GroupTypeEnum { + VF_MODULE("org.openecomp.groups.VfModule"), HEAT_STACK("org.openecomp.groups.HeatStack"); + + private String groupTypeName; + + GroupTypeEnum(String groupTypeName) { + this.groupTypeName = groupTypeName; + } + + public String getGroupTypeName() { + return groupTypeName; + } +} 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 new file mode 100644 index 0000000000..2938b4576a --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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"), + Input("input"); + + private String name; + + NodeTypeEnum(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public static NodeTypeEnum getByName(String name) { + for (NodeTypeEnum inst : NodeTypeEnum.values()) { + if (inst.getName().equals(name)) { + return inst; + } + } + return null; + } + + public static NodeTypeEnum getByNameIgnoreCase(String name) { + for (NodeTypeEnum inst : NodeTypeEnum.values()) { + if (inst.getName().equalsIgnoreCase(name)) { + return inst; + } + } + return null; + } +} 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 new file mode 100644 index 0000000000..14b3e4ef86 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.enums; + +public enum OriginTypeEnum { + PRODUCT("Product", "Product", "product instance", ComponentTypeEnum.PRODUCT), + SERVICE("Service", "Service", "service instance", ComponentTypeEnum.SERVICE), + VF("VF", "VF (Virtual Function)", "resource instance", ComponentTypeEnum.RESOURCE), + VFC("VFC", "VFC (Virtual Function Component)","resource instance",ComponentTypeEnum.RESOURCE), + CP("CP", "CP (Connection Point)", "resource instance", ComponentTypeEnum.RESOURCE), + VL("VL", "VL (Virtual Link)", "resource instance", ComponentTypeEnum.RESOURCE); + + private String value; + private String displayValue; + private String instanceType; + private ComponentTypeEnum componentType; + + private OriginTypeEnum(String value, String displayValue, String instanceType, ComponentTypeEnum componentType) { + this.value = value; + this.displayValue = displayValue; + this.instanceType = instanceType; + this.componentType = componentType; + } + + public String getValue() { + return value; + } + + public String getDisplayValue() { + return displayValue; + } + + public String getInstanceType() { + return instanceType; + } + + 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; + } +} 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 new file mode 100644 index 0000000000..7864a2cf5f --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.datatypes.enums; + +public enum ResourceTypeEnum { + + VFC("VFC (Virtual Function Component)"), + VF("VF"/* (Virtual Function)" */), + CP("CP (Connection Point)"), + VL("VL (Virtual Link)"); + + String value; + + private ResourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static boolean contains(String type) { + + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().equals(type)) { + return true; + } + } + return false; + } +} 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 new file mode 100644 index 0000000000..54a55811e3 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/utils/CommonBeUtils.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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); + } + } + + 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/workers/Job.java b/common-be/src/main/java/org/openecomp/sdc/be/workers/Job.java new file mode 100644 index 0000000000..68929aa61d --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Job.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.workers; + +/** + * Created by michael on 6/24/2016. + */ +public abstract class Job<E> { + 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 new file mode 100644 index 0000000000..cf2bc54fb6 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Main.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.workers; + +/** + * Created by michael on 6/24/2016. + */ +public class Main { + + 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(); + // } + } +} 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 new file mode 100644 index 0000000000..76d2cc5a6d --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Manager.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.workers; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.util.concurrent.*; + +/** + * Created by michael on 6/24/2016. + */ +public class Manager<T extends Job, E> { + private static Logger log = LoggerFactory.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<T>(); + this.outputQueue = new LinkedBlockingQueue<E>(); + } + + 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); + } + 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"); + // } + // } +} 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 new file mode 100644 index 0000000000..83be4b2ee5 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.workers; + +import org.openecomp.sdc.be.config.BeEcompErrorManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; + +/** + * Created by michael on 6/24/2016. + */ +public class Worker<T extends Job<E>, E> implements Runnable { + + private String workerName; + private LinkedBlockingQueue<T> inputQueue; + + private LinkedBlockingQueue<E> outputQueue; + + private static Logger log = LoggerFactory.getLogger(Worker.class.getName()); + + public Worker(String workerName, LinkedBlockingQueue<T> inputQueue, LinkedBlockingQueue<E> outputQueue) { + this.workerName = workerName; + this.inputQueue = inputQueue; + this.outputQueue = outputQueue; + } + + @Override + public void run() { + + try { + while (true) { + log.trace("worker:{} doing work", workerName); + T job = inputQueue.poll(500, 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:" + workerName + " nothing to do stoping", e); + } + } + +} |