diff options
author | Michael Lando <ml636r@att.com> | 2017-06-09 03:19:04 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2017-06-09 03:19:04 +0300 |
commit | ed64b5edff15e702493df21aa3230b81593e6133 (patch) | |
tree | a4cb01fdaccc34930a8db403a3097c0d1e40914b /common-be/src/main/java | |
parent | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (diff) |
[SDC-29] catalog 1707 rebase commit.
Change-Id: I43c3dc5cf44abf5da817649bc738938a3e8388c1
Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'common-be/src/main/java')
56 files changed, 3445 insertions, 611 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java index 754721a5a6..943c1191e5 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java @@ -23,7 +23,9 @@ package org.openecomp.sdc.be.datatypes.category; import java.io.Serializable; import java.util.List; -public class CategoryDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class CategoryDataDefinition extends ToscaDataDefinition implements Serializable { /** * diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java index 87924e99d4..1483a0aa1b 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/GroupingDataDefinition.java @@ -22,7 +22,9 @@ package org.openecomp.sdc.be.datatypes.category; import java.io.Serializable; -public class GroupingDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class GroupingDataDefinition extends ToscaDataDefinition implements Serializable { /** * */ diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java index 2774fe4e40..21d3abaf4b 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java @@ -23,7 +23,9 @@ package org.openecomp.sdc.be.datatypes.category; import java.io.Serializable; import java.util.List; -public class SubCategoryDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class SubCategoryDataDefinition extends ToscaDataDefinition implements Serializable { /** * */ diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java index 4af7a279a3..102c7dde6e 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java @@ -26,7 +26,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public abstract class ComponentMetadataDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinition implements Serializable { /** * @@ -51,6 +54,8 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { private List<String> tags; + private String conformanceLevel; + private String icon; private String UUID; @@ -75,6 +80,69 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { private String invariantUUID; + protected ComponentTypeEnum componentType; + + // USER + private String creatorUserId; + + private String creatorFullName; + + private String lastUpdaterUserId; + + private String lastUpdaterFullName; + + public Boolean getIsHighestVersion() { + return isHighestVersion; + } + + public void setIsHighestVersion(Boolean isHighestVersion) { + this.isHighestVersion = isHighestVersion; + } + + public ComponentTypeEnum getComponentType() { + return componentType; + } + + public void setComponentType(ComponentTypeEnum componentType) { + this.componentType = componentType; + } + + public String getCreatorUserId() { + return creatorUserId; + } + + public void setCreatorUserId(String creatorUserId) { + this.creatorUserId = creatorUserId; + } + + public String getCreatorFullName() { + return creatorFullName; + } + + public void setCreatorFullName(String creatorFullName) { + this.creatorFullName = creatorFullName; + } + + public String getLastUpdaterUserId() { + return lastUpdaterUserId; + } + + public void setLastUpdaterUserId(String lastUpdaterUserId) { + this.lastUpdaterUserId = lastUpdaterUserId; + } + + public String getLastUpdaterFullName() { + return lastUpdaterFullName; + } + + public void setLastUpdaterFullName(String lastUpdaterFullName) { + this.lastUpdaterFullName = lastUpdaterFullName; + } + + public Boolean getIsDeleted() { + return isDeleted; + } + public ComponentMetadataDataDefinition() { } @@ -101,6 +169,7 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { this.csarVersion = other.csarVersion; this.importedToscaChecksum = other.getImportedToscaChecksum(); this.invariantUUID = other.getInvariantUUID(); + } public String getUniqueId() { @@ -270,16 +339,27 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { public void setImportedToscaChecksum(String importedToscaChecksum) { this.importedToscaChecksum = importedToscaChecksum; } + + public String getConformanceLevel() { + return conformanceLevel; + } + + public void setConformanceLevel(String conformanceLevel) { + this.conformanceLevel = conformanceLevel; + } @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 + "]"; + + lastUpdateDate + ", description=" + description + ", state=" + state + ", tags=" + tags + + ", conformanceLevel=" + conformanceLevel + ", icon=" + icon + ", UUID=" + UUID + ", normalizedName=" + + normalizedName + ", systemName=" + systemName + ", contactId=" + contactId + ", allVersions=" + + allVersions + ", isDeleted=" + isDeleted + ", projectCode=" + projectCode + ", csarUUID=" + csarUUID + + ", csarVersion=" + csarVersion + ", importedToscaChecksum=" + importedToscaChecksum + + ", invariantUUID=" + invariantUUID + ", componentType=" + componentType + ", creatorUserId=" + + creatorUserId + ", creatorFullName=" + creatorFullName + ", lastUpdaterUserId=" + lastUpdaterUserId + + ", lastUpdaterFullName=" + lastUpdaterFullName + "]"; } @Override @@ -288,25 +368,31 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { int result = 1; result = prime * result + ((UUID == null) ? 0 : UUID.hashCode()); result = prime * result + ((allVersions == null) ? 0 : allVersions.hashCode()); + result = prime * result + ((componentType == null) ? 0 : componentType.hashCode()); + result = prime * result + ((conformanceLevel == null) ? 0 : conformanceLevel.hashCode()); result = prime * result + ((contactId == null) ? 0 : contactId.hashCode()); result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode()); + result = prime * result + ((creatorFullName == null) ? 0 : creatorFullName.hashCode()); + result = prime * result + ((creatorUserId == null) ? 0 : creatorUserId.hashCode()); + result = prime * result + ((csarUUID == null) ? 0 : csarUUID.hashCode()); + result = prime * result + ((csarVersion == null) ? 0 : csarVersion.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((icon == null) ? 0 : icon.hashCode()); + result = prime * result + ((importedToscaChecksum == null) ? 0 : importedToscaChecksum.hashCode()); + result = prime * result + ((invariantUUID == null) ? 0 : invariantUUID.hashCode()); result = prime * result + ((isDeleted == null) ? 0 : isDeleted.hashCode()); result = prime * result + ((isHighestVersion == null) ? 0 : isHighestVersion.hashCode()); result = prime * result + ((lastUpdateDate == null) ? 0 : lastUpdateDate.hashCode()); + result = prime * result + ((lastUpdaterFullName == null) ? 0 : lastUpdaterFullName.hashCode()); + result = prime * result + ((lastUpdaterUserId == null) ? 0 : lastUpdaterUserId.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); + result = prime * result + ((projectCode == null) ? 0 : projectCode.hashCode()); result = prime * result + ((state == null) ? 0 : state.hashCode()); result = prime * result + ((systemName == null) ? 0 : systemName.hashCode()); result = prime * result + ((tags == null) ? 0 : tags.hashCode()); result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); result = prime * result + ((version == null) ? 0 : version.hashCode()); - 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; } @@ -329,6 +415,13 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { return false; } else if (!allVersions.equals(other.allVersions)) return false; + if (componentType != other.componentType) + return false; + if (conformanceLevel == null) { + if (other.conformanceLevel != null) + return false; + } else if (!conformanceLevel.equals(other.conformanceLevel)) + return false; if (contactId == null) { if (other.contactId != null) return false; @@ -339,6 +432,26 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { return false; } else if (!creationDate.equals(other.creationDate)) return false; + if (creatorFullName == null) { + if (other.creatorFullName != null) + return false; + } else if (!creatorFullName.equals(other.creatorFullName)) + return false; + if (creatorUserId == null) { + if (other.creatorUserId != null) + return false; + } else if (!creatorUserId.equals(other.creatorUserId)) + return false; + if (csarUUID == null) { + if (other.csarUUID != null) + return false; + } else if (!csarUUID.equals(other.csarUUID)) + return false; + if (csarVersion == null) { + if (other.csarVersion != null) + return false; + } else if (!csarVersion.equals(other.csarVersion)) + return false; if (description == null) { if (other.description != null) return false; @@ -349,6 +462,16 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { return false; } else if (!icon.equals(other.icon)) return false; + if (importedToscaChecksum == null) { + if (other.importedToscaChecksum != null) + return false; + } else if (!importedToscaChecksum.equals(other.importedToscaChecksum)) + return false; + if (invariantUUID == null) { + if (other.invariantUUID != null) + return false; + } else if (!invariantUUID.equals(other.invariantUUID)) + return false; if (isDeleted == null) { if (other.isDeleted != null) return false; @@ -364,6 +487,16 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { return false; } else if (!lastUpdateDate.equals(other.lastUpdateDate)) return false; + if (lastUpdaterFullName == null) { + if (other.lastUpdaterFullName != null) + return false; + } else if (!lastUpdaterFullName.equals(other.lastUpdaterFullName)) + return false; + if (lastUpdaterUserId == null) { + if (other.lastUpdaterUserId != null) + return false; + } else if (!lastUpdaterUserId.equals(other.lastUpdaterUserId)) + return false; if (name == null) { if (other.name != null) return false; @@ -374,6 +507,11 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { return false; } else if (!normalizedName.equals(other.normalizedName)) return false; + if (projectCode == null) { + if (other.projectCode != null) + return false; + } else if (!projectCode.equals(other.projectCode)) + return false; if (state == null) { if (other.state != null) return false; @@ -399,31 +537,7 @@ public abstract class ComponentMetadataDataDefinition implements Serializable { 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 index 2eb5e23352..7b112ce129 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ResourceMetadataDataDefinition.java @@ -23,6 +23,7 @@ package org.openecomp.sdc.be.datatypes.components; import java.io.Serializable; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java index 2ebbadcdaf..4f3486e457 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java @@ -22,15 +22,22 @@ package org.openecomp.sdc.be.datatypes.components; import java.io.Serializable; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { /** * */ private static final long serialVersionUID = -7661001892509435120L; + public static final String EMPTY_STR = ""; private String distributionStatus; + private Boolean ecompGeneratedNaming = true; + + private String namingPolicy = EMPTY_STR; + public ServiceMetadataDataDefinition() { super(); } @@ -47,10 +54,27 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti this.distributionStatus = distributionStatus; } + public Boolean isEcompGeneratedNaming() { + return ecompGeneratedNaming; + } + + public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) { + this.ecompGeneratedNaming = ecompGeneratedNaming; + } + + public String getNamingPolicy() { + return namingPolicy; + } + + public void setNamingPolicy(String namingPolicy) { + this.namingPolicy = namingPolicy; + } + @Override public String toString() { - return "ServiceMetadataDataDefinition [ distributionStatus=" + distributionStatus + ", parent=" - + super.toString() + "]"; + return "ServiceMetadataDataDefinition [ distributionStatus=" + distributionStatus + + ", ecompGeneratedNaming=" + ecompGeneratedNaming + ", namingPolicy=" + namingPolicy + + ", parent=" + super.toString() + "]"; } @Override @@ -58,6 +82,8 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti final int prime = 31; int result = super.hashCode(); result = prime * result + ((distributionStatus == null) ? 0 : distributionStatus.hashCode()); + result = prime * result + ((ecompGeneratedNaming == null) ? 0 : ecompGeneratedNaming.hashCode()); + result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode()); return result; } @@ -81,6 +107,16 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti return false; } else if (!distributionStatus.equals(other.distributionStatus)) return false; + if (ecompGeneratedNaming == null) { + if (other.ecompGeneratedNaming != null) + return false; + } else if (!ecompGeneratedNaming.equals(other.ecompGeneratedNaming)) + return false; + if (namingPolicy == null) { + if (other.namingPolicy != null) + return false; + } else if (!namingPolicy.equals(other.namingPolicy)) + return false; 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 index 4c062e3fab..f618458edf 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterDataDefinition.java @@ -21,8 +21,11 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; +import java.util.List; -public class AdditionalInfoParameterDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class AdditionalInfoParameterDataDefinition extends ToscaDataDefinition implements Serializable { /** * @@ -37,6 +40,8 @@ public class AdditionalInfoParameterDataDefinition implements Serializable { private Integer lastCreatedCounter = 0; + private List<AdditionalInfoParameterInfo> parameters; + public AdditionalInfoParameterDataDefinition() { } @@ -46,6 +51,7 @@ public class AdditionalInfoParameterDataDefinition implements Serializable { this.creationTime = p.creationTime; this.modificationTime = p.modificationTime; this.lastCreatedCounter = p.lastCreatedCounter; + this.parameters = p.parameters; } public String getUniqueId() { @@ -79,7 +85,13 @@ public class AdditionalInfoParameterDataDefinition implements Serializable { public void setLastCreatedCounter(Integer lastCreatedCounter) { this.lastCreatedCounter = lastCreatedCounter; } + public List<AdditionalInfoParameterInfo> getParameters() { + return parameters; + } + public void setParameters(List<AdditionalInfoParameterInfo> parameters) { + this.parameters = parameters; + } @Override public String toString() { return "AdditionalInfoParameterDataDefinition [uniqueId=" + uniqueId + ", creationTime=" + creationTime diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java new file mode 100644 index 0000000000..cdfe75d156 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/AdditionalInfoParameterInfo.java @@ -0,0 +1,84 @@ +/*- + * ============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.tosca.ToscaDataDefinition; + +public class AdditionalInfoParameterInfo extends ToscaDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 2066876282722907709L; + + String uniqueId; + String key; + String value; + + public AdditionalInfoParameterInfo() { + super(); + } + + public AdditionalInfoParameterInfo(String key, String value) { + super(); + this.key = key; + this.value = value; + } + + public AdditionalInfoParameterInfo(String uniqueId, String key, String value) { + super(); + this.uniqueId = uniqueId; + this.key = key; + this.value = value; + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public String toString() { + return "AdditionalInfoParameterInfo [uniqueId=" + uniqueId + ", key=" + key + ", value=" + value + "]"; + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java index 4baf09ea68..49c13a09cd 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ArtifactDataDefinition.java @@ -20,397 +20,387 @@ package org.openecomp.sdc.be.datatypes.elements; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; -import java.io.Serializable; - -public class ArtifactDataDefinition implements Serializable { +//import com.google.gson.reflect.TypeToken; +public class ArtifactDataDefinition extends ToscaDataDefinition 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; + public ArtifactDataDefinition() { + super(); + setArtifactVersion("0"); + } + + public ArtifactDataDefinition(Map<String, Object> art) { + super(art); + setArtifactVersion("0"); + } - /** - * 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; + public ArtifactDataDefinition(ArtifactDataDefinition a ) { + super(); + this.setUniqueId(a.getUniqueId()); + this.setArtifactType(a.getArtifactType()); + this.setArtifactRef( a.getArtifactRef()); + this.setArtifactName( a.getArtifactName()); + this.setArtifactRepository( a.getArtifactRepository()); + this.setArtifactChecksum( a.getArtifactChecksum()); + this.setUserIdCreator( a.getUserIdCreator()); + this.setUserIdLastUpdater( a.getUserIdLastUpdater()); + this.setCreatorFullName( a.getCreatorFullName()); + this.setUpdaterFullName( a.getUpdaterFullName()); + this.setCreationDate ( a.getCreationDate()); + this.setLastUpdateDate ( a.getLastUpdateDate()); + this.setDescription ( a.getDescription()); + this.setEsId ( a.getEsId()); + this.setArtifactLabel( a.getArtifactLabel()); + this.setArtifactCreator( a.getArtifactCreator()); + this.setMandatory ( a.getMandatory()); + this.setArtifactDisplayName( a.getArtifactDisplayName()); + this.setApiUrl( a.getApiUrl()); + this.setServiceApi ( a.getServiceApi()); + this.setArtifactGroupType ( a.getArtifactGroupType()); + this.setTimeout ( a.getTimeout()); + this.setArtifactVersion( a.getArtifactVersion()); + this.setArtifactUUID ( a.getArtifactUUID()); + this.setPayloadUpdateDate ( a.getPayloadUpdateDate()); + this.setHeatParamsUpdateDate ( a.getHeatParamsUpdateDate()); this.setGenerated(a.getGenerated()); - if (a.requiredArtifacts != null) - this.requiredArtifacts = new ArrayList<>(a.getRequiredArtifacts()); + this.setDuplicated(a.getDuplicated()); + if (a.getRequiredArtifacts() != null) + this.setRequiredArtifacts(new ArrayList<>(a.getRequiredArtifacts())); + if (a.getHeatParameters() != null) + this.setHeatParameters(new ArrayList<>(a.getHeatParameters())); + this.setGeneratedFromId( a.getGeneratedFromId()); + + } public String getArtifactName() { - return artifactName != null ? artifactName : artifactRef; + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } public String getArtifactType() { - return artifactType; + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE); } - public void setArtifactType(String artifactType) { - this.artifactType = artifactType; + public void setArtifactType(String artifactType) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE, artifactType); + } - public String getArtifactRef() { - return artifactRef; + public String getArtifactRef() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF); + } public void setArtifactRef(String artifactRef) { - this.artifactRef = artifactRef; + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF, artifactRef); } - public String getArtifactRepository() { - return artifactRepository; + public String getArtifactRepository() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY); + } public void setArtifactRepository(String artifactRepository) { - this.artifactRepository = artifactRepository; + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY, artifactRepository); } public void setArtifactName(String artifactName) { - this.artifactName = artifactName; + setToscaPresentationValue(JsonPresentationFields.NAME, artifactName); + } - public String getArtifactChecksum() { - return artifactChecksum; + public String getArtifactChecksum() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CHECKSUM); } public void setArtifactChecksum(String artifactChecksum) { - this.artifactChecksum = artifactChecksum; + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_CHECKSUM, artifactChecksum); } public String getUserIdCreator() { - return userIdCreator; + + return (String) getToscaPresentationValue(JsonPresentationFields.USER_ID_CREATOR); } public void setUserIdCreator(String userIdCreator) { - this.userIdCreator = userIdCreator; + setToscaPresentationValue(JsonPresentationFields.USER_ID_CREATOR, userIdCreator); } public String getUserIdLastUpdater() { - return userIdLastUpdater; + return (String) getToscaPresentationValue(JsonPresentationFields.USER_ID_LAST_UPDATER); } public void setUserIdLastUpdater(String userIdLastUpdater) { - this.userIdLastUpdater = userIdLastUpdater; + setToscaPresentationValue(JsonPresentationFields.USER_ID_LAST_UPDATER, userIdLastUpdater); } public String getCreatorFullName() { - return creatorFullName; + return (String) getToscaPresentationValue(JsonPresentationFields.CREATOR_FULL_NAME); } public void setCreatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; + setToscaPresentationValue(JsonPresentationFields.CREATOR_FULL_NAME, creatorFullName); } - public String getUpdaterFullName() { - return updaterFullName; + public String getUpdaterFullName() { + return (String) getToscaPresentationValue(JsonPresentationFields.UPDATER_FULL_NAME); } public void setUpdaterFullName(String updaterFullName) { - this.updaterFullName = updaterFullName; + setToscaPresentationValue(JsonPresentationFields.UPDATER_FULL_NAME, updaterFullName); } public Long getCreationDate() { - return creationDate; + return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_DATE); } public void setCreationDate(Long creationDate) { - this.creationDate = creationDate; + setToscaPresentationValue(JsonPresentationFields.CREATION_DATE, creationDate); } - public Long getLastUpdateDate() { - return lastUpdateDate; + public Long getLastUpdateDate() { + return (Long) getToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE); } public void setLastUpdateDate(Long lastUpdateDate) { - this.lastUpdateDate = lastUpdateDate; + setToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate); } public String getUniqueId() { - return uniqueId; + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); } public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); } public String getDescription() { - return description; + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); } public void setDescription(String description) { - this.description = description; + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); } public String getArtifactLabel() { - return artifactLabel; + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL); } public void setArtifactLabel(String artifactLabel) { - this.artifactLabel = artifactLabel; + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL, artifactLabel); } public String getEsId() { - return esId; + return (String) getToscaPresentationValue(JsonPresentationFields.ES_ID); } public void setEsId(String esId) { - this.esId = esId; + setToscaPresentationValue(JsonPresentationFields.ES_ID, esId); } public String getArtifactCreator() { - return artifactCreator; + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CREATOR); } public void setArtifactCreator(String artifactCreator) { - this.artifactCreator = artifactCreator; + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_CREATOR, artifactCreator); } - public Boolean getMandatory() { - return mandatory; + public Boolean getMandatory() { + Boolean isMandatory = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_ABSTRACT); + return isMandatory == null? Boolean.FALSE: isMandatory; } public void setMandatory(Boolean mandatory) { - this.mandatory = mandatory; + setToscaPresentationValue(JsonPresentationFields.IS_ABSTRACT, mandatory); } - public String getArtifactDisplayName() { - return artifactDisplayName; + public String getArtifactDisplayName() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_DISPLAY_NAME); } public void setArtifactDisplayName(String artifactDisplayName) { - this.artifactDisplayName = artifactDisplayName; + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_DISPLAY_NAME, artifactDisplayName); } - public String getApiUrl() { - return apiUrl; + public String getApiUrl() { + return (String) getToscaPresentationValue(JsonPresentationFields.API_URL); } public void setApiUrl(String apiUrl) { - this.apiUrl = apiUrl; + setToscaPresentationValue(JsonPresentationFields.API_URL, apiUrl); } public Boolean getServiceApi() { - return serviceApi; + Boolean serviceApi = (Boolean) getToscaPresentationValue(JsonPresentationFields.SERVICE_API); + return serviceApi == null? Boolean.FALSE: serviceApi; } public void setServiceApi(Boolean serviceApi) { - this.serviceApi = serviceApi; + setToscaPresentationValue(JsonPresentationFields.SERVICE_API, serviceApi); } public ArtifactGroupTypeEnum getArtifactGroupType() { + ArtifactGroupTypeEnum artifactGroupType = null; + String groupType = (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_GROUP_TYPE); + if (groupType != null && !groupType.isEmpty()) { + + artifactGroupType = ArtifactGroupTypeEnum.findType(groupType); + } return artifactGroupType; } public void setArtifactGroupType(ArtifactGroupTypeEnum artifactGroupType) { - this.artifactGroupType = artifactGroupType; + if(artifactGroupType != null) + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_GROUP_TYPE, artifactGroupType.getType()); } - public Integer getTimeout() { - return timeout; + public Integer getTimeout() { + return (Integer) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TIMEOUT); } public void setTimeout(Integer timeout) { - this.timeout = timeout; + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_TIMEOUT, timeout); } - public String getArtifactVersion() { - return artifactVersion; + public String getArtifactVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_VERSION); } public void setArtifactVersion(String artifactVersion) { - this.artifactVersion = artifactVersion; + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_VERSION, artifactVersion); } public String getArtifactUUID() { - return artifactUUID; + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_UUID); } public void setArtifactUUID(String artifactUUID) { - this.artifactUUID = artifactUUID; + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_UUID, artifactUUID); } - public Long getPayloadUpdateDate() { - return payloadUpdateDate; + public Long getPayloadUpdateDate() { + return (Long) getToscaPresentationValue(JsonPresentationFields.PAYLOAD_UPDATE_DATE); } public void setPayloadUpdateDate(Long payloadUpdateDate) { - this.payloadUpdateDate = payloadUpdateDate; + setToscaPresentationValue(JsonPresentationFields.PAYLOAD_UPDATE_DATE, payloadUpdateDate); } public Long getHeatParamsUpdateDate() { - return heatParamsUpdateDate; + return (Long) getToscaPresentationValue(JsonPresentationFields.HEAT_PARAMS_UPDATE_DATE); } public void setHeatParamsUpdateDate(Long heatParamsUpdateDate) { - this.heatParamsUpdateDate = heatParamsUpdateDate; + setToscaPresentationValue(JsonPresentationFields.HEAT_PARAMS_UPDATE_DATE, heatParamsUpdateDate); } public List<String> getRequiredArtifacts() { - return requiredArtifacts; + return (List<String>) getToscaPresentationValue(JsonPresentationFields.REQUIRED_ARTIFACTS); } public void setRequiredArtifacts(List<String> requiredArtifacts) { - this.requiredArtifacts = requiredArtifacts; + setToscaPresentationValue(JsonPresentationFields.REQUIRED_ARTIFACTS, requiredArtifacts); } - public Boolean getGenerated() { - return generated; + public Boolean getGenerated() { + Boolean generated = (Boolean) getToscaPresentationValue(JsonPresentationFields.GENERATED); + return generated == null ? Boolean.FALSE: generated; } public void setGenerated(Boolean generated) { - this.generated = generated; + setToscaPresentationValue(JsonPresentationFields.GENERATED, generated); + } + + public Boolean getDuplicated() { + Boolean duplicated = (Boolean) getToscaPresentationValue(JsonPresentationFields.DUPLICATED); + return duplicated == null ? Boolean.FALSE: duplicated; + } + + public void setDuplicated(Boolean duplicated) { + setToscaPresentationValue(JsonPresentationFields.DUPLICATED, duplicated); } + + public List<HeatParameterDataDefinition> getHeatParameters() { + return (List<HeatParameterDataDefinition>) getToscaPresentationValue(JsonPresentationFields.HEAT_PARAMETERS); + } + + public void setHeatParameters(List<HeatParameterDataDefinition> properties) { + setToscaPresentationValue(JsonPresentationFields.HEAT_PARAMETERS, properties); + } + + public String getGeneratedFromId() { + return (String) getToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID); + } + + public void setGeneratedFromId(String generatedFromId) { + setToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID, generatedFromId); + } + @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 + "]"; + return "ArtifactDataDefinition [uniqueId=" + getUniqueId() + ", artifactType=" + getArtifactType() + ", artifactRef=" + getArtifactRef() + ", artifactName=" + getArtifactName() + ", artifactRepository=" + getArtifactRepository() + ", artifactChecksum=" + + getArtifactChecksum() + ", userIdCreator=" + getUserIdCreator() + ", userIdLastUpdater=" + getUserIdLastUpdater() + ", creatorFullName=" + getCreatorFullName() + ", updaterFullName=" + getUpdaterFullName() + ", creationDate=" + getCreationDate() + + ", lastUpdateDate=" + getLastUpdateDate() + ", esId=" + getEsId() + ", artifactLabel=" + getArtifactLabel() + ", artifactCreator=" + getArtifactCreator() + ", description=" + getDescription() + ", mandatory=" + getMandatory() + ", artifactDisplayName=" + + getArtifactDisplayName() + ", apiUrl=" + getApiUrl() + ", serviceApi=" + getServiceApi() + ", artifactGroupType=" + getArtifactGroupType() + ", timeout=" + getTimeout() + ", artifactVersion=" + getArtifactVersion() + ", artifactUUID=" + getArtifactUUID() + + ", payloadUpdateDate=" + getPayloadUpdateDate() + ", heatParamsUpdateDate=" + getHeatParamsUpdateDate() + ", requiredArtifacts=" + getRequiredArtifacts() + "]"; } @Override public int hashCode() { final int prime = 31; int result = 1; + + String apiUrl = getApiUrl(); + String artifactChecksum = getArtifactChecksum(); + String artifactCreator = getArtifactCreator(); + String artifactDisplayName = getArtifactDisplayName(); + ArtifactGroupTypeEnum artifactGroupType = getArtifactGroupType(); + String artifactLabel = getArtifactLabel(); + String artifactName = getArtifactName(); + String artifactRef = getArtifactRef(); + String artifactRepository = getArtifactRepository(); + String artifactType = getArtifactType(); + + String artifactUUID = getArtifactUUID(); + String artifactVersion = getArtifactVersion(); + String userIdCreator = getUserIdCreator(); + String userIdLastUpdater = getUserIdLastUpdater(); + Long creationDate = getCreationDate(); + + String creatorFullName = getCreatorFullName(); + String description = getDescription(); + String esId = getEsId(); + Long heatParamsUpdateDate = getHeatParamsUpdateDate(); + Long lastUpdateDate = getLastUpdateDate(); + Boolean mandatory = getMandatory(); + + Long payloadUpdateDate = getPayloadUpdateDate(); + List<String> requiredArtifacts = getRequiredArtifacts(); + Boolean serviceApi = getServiceApi(); + Integer timeout = getTimeout(); + String uniqueId = getUniqueId(); + String updaterFullName = getUpdaterFullName(); + result = prime * result + ((apiUrl == null) ? 0 : apiUrl.hashCode()); result = prime * result + ((artifactChecksum == null) ? 0 : artifactChecksum.hashCode()); result = prime * result + ((artifactCreator == null) ? 0 : artifactCreator.hashCode()); @@ -450,137 +440,137 @@ public class ArtifactDataDefinition implements Serializable { if (getClass() != obj.getClass()) return false; ArtifactDataDefinition other = (ArtifactDataDefinition) obj; - if (apiUrl == null) { - if (other.apiUrl != null) + if (getApiUrl() == null) { + if (other.getApiUrl() != null) return false; - } else if (!apiUrl.equals(other.apiUrl)) + } else if (!getApiUrl().equals(other.getApiUrl())) return false; - if (artifactChecksum == null) { - if (other.artifactChecksum != null) + if (getArtifactChecksum() == null) { + if (other.getArtifactChecksum() != null) return false; - } else if (!artifactChecksum.equals(other.artifactChecksum)) + } else if (!getArtifactChecksum().equals(other.getArtifactChecksum())) return false; - if (artifactCreator == null) { - if (other.artifactCreator != null) + if (getArtifactCreator() == null) { + if (other.getArtifactCreator() != null) return false; - } else if (!artifactCreator.equals(other.artifactCreator)) + } else if (!getArtifactCreator().equals(other.getArtifactCreator())) return false; - if (artifactDisplayName == null) { - if (other.artifactDisplayName != null) + if (getArtifactDisplayName() == null) { + if (other.getArtifactDisplayName() != null) return false; - } else if (!artifactDisplayName.equals(other.artifactDisplayName)) + } else if (!getArtifactDisplayName().equals(other.getArtifactDisplayName())) return false; - if (artifactGroupType != other.artifactGroupType) + if (getArtifactGroupType() != other.getArtifactGroupType()) return false; - if (artifactLabel == null) { - if (other.artifactLabel != null) + if (getArtifactLabel() == null) { + if (other.getArtifactLabel() != null) return false; - } else if (!artifactLabel.equals(other.artifactLabel)) + } else if (!getArtifactLabel().equals(other.getArtifactLabel())) return false; - if (artifactName == null) { - if (other.artifactName != null) + if (getArtifactName() == null) { + if (other.getArtifactName() != null) return false; - } else if (!artifactName.equals(other.artifactName)) + } else if (!getArtifactName().equals(other.getArtifactName())) return false; - if (artifactRef == null) { - if (other.artifactRef != null) + if (getArtifactRef() == null) { + if (other.getArtifactRef() != null) return false; - } else if (!artifactRef.equals(other.artifactRef)) + } else if (!getArtifactRef().equals(other.getArtifactRef())) return false; - if (artifactRepository == null) { - if (other.artifactRepository != null) + if (getArtifactRepository() == null) { + if (other.getArtifactRepository() != null) return false; - } else if (!artifactRepository.equals(other.artifactRepository)) + } else if (!getArtifactRepository().equals(other.getArtifactRepository())) return false; - if (artifactType == null) { - if (other.artifactType != null) + if (getArtifactType() == null) { + if (other.getArtifactType() != null) return false; - } else if (!artifactType.equals(other.artifactType)) + } else if (!getArtifactType().equals(other.getArtifactType())) return false; - if (artifactUUID == null) { - if (other.artifactUUID != null) + if (getArtifactUUID() == null) { + if (other.getArtifactUUID() != null) return false; - } else if (!artifactUUID.equals(other.artifactUUID)) + } else if (!getArtifactUUID().equals(other.getArtifactUUID())) return false; - if (artifactVersion == null) { - if (other.artifactVersion != null) + if (getArtifactVersion() == null) { + if (other.getArtifactVersion() != null) return false; - } else if (!artifactVersion.equals(other.artifactVersion)) + } else if (!getArtifactVersion().equals(other.getArtifactVersion())) return false; - if (userIdCreator == null) { - if (other.userIdCreator != null) + if (getUserIdCreator() == null) { + if (other.getUserIdCreator() != null) return false; - } else if (!userIdCreator.equals(other.userIdCreator)) + } else if (!getUserIdCreator().equals(other.getUserIdCreator())) return false; - if (userIdLastUpdater == null) { - if (other.userIdLastUpdater != null) + if (getUserIdLastUpdater() == null) { + if (other.getUserIdLastUpdater() != null) return false; - } else if (!userIdLastUpdater.equals(other.userIdLastUpdater)) + } else if (!getUserIdLastUpdater().equals(other.getUserIdLastUpdater())) return false; - if (creationDate == null) { - if (other.creationDate != null) + if (getCreationDate() == null) { + if (other.getCreationDate() != null) return false; - } else if (!creationDate.equals(other.creationDate)) + } else if (!getCreationDate().equals(other.getCreationDate())) return false; - if (creatorFullName == null) { - if (other.creatorFullName != null) + if (getCreatorFullName() == null) { + if (other.getCreatorFullName() != null) return false; - } else if (!creatorFullName.equals(other.creatorFullName)) + } else if (!getCreatorFullName().equals(other.getCreatorFullName())) return false; - if (description == null) { - if (other.description != null) + if (getDescription() == null) { + if (other.getDescription() != null) return false; - } else if (!description.equals(other.description)) + } else if (!getDescription().equals(other.getDescription())) return false; - if (esId == null) { - if (other.esId != null) + if (getEsId() == null) { + if (other.getEsId() != null) return false; - } else if (!esId.equals(other.esId)) + } else if (!getEsId().equals(other.getEsId())) return false; - if (heatParamsUpdateDate == null) { - if (other.heatParamsUpdateDate != null) + if (getHeatParamsUpdateDate() == null) { + if (other.getHeatParamsUpdateDate() != null) return false; - } else if (!heatParamsUpdateDate.equals(other.heatParamsUpdateDate)) + } else if (!getHeatParamsUpdateDate().equals(other.getHeatParamsUpdateDate())) return false; - if (lastUpdateDate == null) { - if (other.lastUpdateDate != null) + if (getLastUpdateDate() == null) { + if (other.getLastUpdateDate() != null) return false; - } else if (!lastUpdateDate.equals(other.lastUpdateDate)) + } else if (!getLastUpdateDate().equals(other.getLastUpdateDate())) return false; - if (mandatory == null) { - if (other.mandatory != null) + if (getMandatory() == null) { + if (other.getMandatory() != null) return false; - } else if (!mandatory.equals(other.mandatory)) + } else if (!getMandatory().equals(other.getMandatory())) return false; - if (payloadUpdateDate == null) { - if (other.payloadUpdateDate != null) + if (getPayloadUpdateDate() == null) { + if (other.getPayloadUpdateDate() != null) return false; - } else if (!payloadUpdateDate.equals(other.payloadUpdateDate)) + } else if (!getPayloadUpdateDate().equals(other.getPayloadUpdateDate())) return false; - if (requiredArtifacts == null) { - if (other.requiredArtifacts != null) + if (getRequiredArtifacts() == null) { + if (other.getRequiredArtifacts() != null) return false; - } else if (!requiredArtifacts.equals(other.requiredArtifacts)) + } else if (!getRequiredArtifacts().equals(other.getRequiredArtifacts())) return false; - if (serviceApi == null) { - if (other.serviceApi != null) + if (getServiceApi() == null) { + if (other.getServiceApi() != null) return false; - } else if (!serviceApi.equals(other.serviceApi)) + } else if (!getServiceApi().equals(other.getServiceApi())) return false; - if (timeout == null) { - if (other.timeout != null) + if (getTimeout() == null) { + if (other.getTimeout() != null) return false; - } else if (!timeout.equals(other.timeout)) + } else if (!getTimeout().equals(other.getTimeout())) return false; - if (uniqueId == null) { - if (other.uniqueId != null) + if (getUniqueId() == null) { + if (other.getUniqueId() != null) return false; - } else if (!uniqueId.equals(other.uniqueId)) + } else if (!getUniqueId().equals(other.getUniqueId())) return false; - if (updaterFullName == null) { - if (other.updaterFullName != null) + if (getUpdaterFullName() == null) { + if (other.getUpdaterFullName() != null) return false; - } else if (!updaterFullName.equals(other.updaterFullName)) + } else if (!getUpdaterFullName().equals(other.getUpdaterFullName())) 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 index b52824697a..a753270bbd 100644 --- 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 @@ -23,13 +23,16 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; import java.util.Objects; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + /** * Represents AttributeDataDefinition * * @author mshitrit * */ -public class AttributeDataDefinition implements Serializable { +public class AttributeDataDefinition extends ToscaDataDefinition implements Serializable { /** * @@ -183,4 +186,24 @@ public class AttributeDataDefinition implements Serializable { public void setValue(String value) { this.value = value; } + + @Override + public Object getToscaPresentationValue(JsonPresentationFields field) { + switch (field) { + case NAME: + return name; + case UNIQUE_ID: + return uniqueId; + case TYPE: + return type; + case DESCRIPTION: + return description; + case VALUE: + return value; + case DEFAULT_VALUE: + return defaultValue; + default: + return super.getToscaPresentationValue(field); + } + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java new file mode 100644 index 0000000000..0a98a2abda --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java @@ -0,0 +1,310 @@ +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.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + + + +public class CapabilityDataDefinition extends ToscaDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 7544984873506188920L; + public final static String MIN_OCCURRENCES = "1"; // occurrences + public final static String MAX_OCCURRENCES = "UNBOUNDED"; + + + public CapabilityDataDefinition() { + super(); + this.setMinOccurrences( MIN_OCCURRENCES ); + this.setMaxOccurrences( MAX_OCCURRENCES); + this.setLeftOccurrences( MAX_OCCURRENCES); + } + + public CapabilityDataDefinition(CapabilityDataDefinition a) { + super(); + this.setUniqueId(a.getUniqueId()); + this.setType(a.getType()); + this.setDescription ( a.getDescription()); + this.setName( a.getName()); + this.setValidSourceTypes( a.getValidSourceTypes()); + this.setCapabilitySources( a.getCapabilitySources()); + this.setOwnerId( a.getOwnerId()); + this.setOwnerName( a.getOwnerName()); + this.setMinOccurrences( a.getMinOccurrences()); + this.setMaxOccurrences( a.getMaxOccurrences()); + this.setLeftOccurrences(a.getLeftOccurrences()); + this.setPath(a.getPath()); + this.setSource(a.getSource()); + + } + + + + public String getOwnerId() { + return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); + } + + public void setOwnerId(String ownerId) { + setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); + } + + public String getOwnerName() { + return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_NAME); + } + + public void setOwnerName(String ownerName) { + setToscaPresentationValue(JsonPresentationFields.OWNER_NAME, ownerName); + } + + public String getMinOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES); + } + + public void setMinOccurrences(String minOccurrences) { + setToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES, minOccurrences); + } + + public String getMaxOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES); + } + + public void setMaxOccurrences(String maxOccurrences) { + setToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES, maxOccurrences); + } + public String getLeftOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES); + } + + public void setLeftOccurrences(String leftOccurrences) { + setToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES, leftOccurrences); + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + + public String getType() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public void setType(String type) { + setToscaPresentationValue(JsonPresentationFields.TYPE, type); + } + + public List<String> getValidSourceTypes() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE); + } + + public void setValidSourceTypes(List<String> validSourceTypes) { + setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE, validSourceTypes); + } + + public List<String> getCapabilitySources() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_SOURCES); + } + + public void setCapabilitySources(List<String> capabilitySources) { + setToscaPresentationValue(JsonPresentationFields.CAPABILITY_SOURCES, capabilitySources); + } + + public void setPath(List<String> path){ + setToscaPresentationValue(JsonPresentationFields.PATH, path); + } + public List<String> getPath() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH); + } + public void setSource(String source){ + setToscaPresentationValue(JsonPresentationFields.SOURCE, source); + } + public String getSource() { + return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE); + } + public void addToPath(String elementInPath){ + List<String> path = getPath(); + if ( path == null ){ + path = new ArrayList<>(); + } + path.add(elementInPath); + setPath(path); + } + + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + + String uniqueId = this.getUniqueId(); + String description = this.getDescription(); + String name = this.getName(); + String type = this.getType(); + List<String> validSourceTypes = this.getValidSourceTypes(); + List<String> capabilitySources = this.getCapabilitySources(); + List<String> path = this.getPath(); + + String ownerId = this.getOwnerId(); + String ownerName = this.getOwnerName(); + String minOccurrences = this.getMinOccurrences(); + String maxOccurrences = this.getMaxOccurrences(); + String leftOccurrences = getLeftOccurrences(); + String source = getSource(); + + result = prime * result + ((capabilitySources == null) ? 0 : capabilitySources.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((maxOccurrences == null) ? 0 : maxOccurrences.hashCode()); + result = prime * result + ((minOccurrences == null) ? 0 : minOccurrences.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); + result = prime * result + ((ownerName == null) ? 0 : ownerName.hashCode()); + + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + result = prime * result + ((validSourceTypes == null) ? 0 : validSourceTypes.hashCode()); + result = prime * result + ((leftOccurrences == null) ? 0 : leftOccurrences.hashCode()); + result = prime * result + ((path == null) ? 0 : path.hashCode()); + result = prime * result + ((source == null) ? 0 : source.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + + String uniqueId = this.getUniqueId(); + String description = this.getDescription(); + String name = this.getName(); + String type = this.getType(); + List<String> validSourceTypes = this.getValidSourceTypes(); + List<String> capabilitySources = this.getCapabilitySources(); + String ownerId = this.getOwnerId(); + String ownerName = this.getOwnerName(); + String minOccurrences = this.getMinOccurrences(); + String maxOccurrences = this.getMaxOccurrences(); + String leftOccurrences = getLeftOccurrences(); + List<String> path = this.getPath(); + String source = getSource(); + + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CapabilityDataDefinition other = (CapabilityDataDefinition) obj; + if (capabilitySources == null) { + if (other.getCapabilitySources() != null) + return false; + } else if (!capabilitySources.equals(other.getCapabilitySources())) + return false; + if (description == null) { + if (other.getDescription() != null) + return false; + } else if (!description.equals(other.getDescription())) + return false; + if (maxOccurrences == null) { + if (other.getMaxOccurrences() != null) + return false; + } else if (!maxOccurrences.equals(other.getMaxOccurrences())) + return false; + if (minOccurrences == null) { + if (other.getMinOccurrences() != null) + return false; + } else if (!minOccurrences.equals(other.getMinOccurrences())) + return false; + if (name == null) { + if (other.getName() != null) + return false; + } else if (!name.equals(other.getName())) + return false; + if (ownerId == null) { + if (other.getOwnerId() != null) + return false; + } else if (!ownerId.equals(other.getOwnerId())) + return false; + if (ownerName == null) { + if (other.getOwnerName() != null) + return false; + } else if (!ownerName.equals(other.getOwnerName())) + return false; + if (type == null) { + if (other.getType() != null) + return false; + } else if (!type.equals(other.getType())) + return false; + if (uniqueId == null) { + if (other.getUniqueId() != null) + return false; + } else if (!uniqueId.equals(other.getUniqueId())) + return false; + if (validSourceTypes == null) { + if (other.getValidSourceTypes() != null) + return false; + } else if (!validSourceTypes.equals(other.getValidSourceTypes())) + return false; + if (leftOccurrences == null) { + if (other.getLeftOccurrences() != null) + return false; + } else if (!leftOccurrences.equals(other.getLeftOccurrences())) + return false; + if (path == null) { + if (other.getPath() != null) + return false; + } else if (!path.equals(other.getPath())) + return false; + if (source == null) { + if (other.getSource() != null) + return false; + } else if (!source.equals(other.getSource())) + return false; + return true; + } + + @Override + public String toString() { + String uniqueId = this.getUniqueId(); + String description = this.getDescription(); + String name = this.getName(); + String type = this.getType(); + List<String> validSourceTypes = this.getValidSourceTypes(); + List<String> capabilitySources = this.getCapabilitySources(); + List<String> path = this.getPath(); + String ownerId = this.getOwnerId(); + String ownerName = this.getOwnerName(); + String minOccurrences = this.getMinOccurrences(); + String maxOccurrences = this.getMaxOccurrences(); + String source = this.getSource(); + + + return "CapabilityDefinition [uniqueId=" + uniqueId + ", description=" + description + ", name=" + name + + ", type=" + type + ", validSourceTypes=" + validSourceTypes + ", capabilitySources=" + + capabilitySources + ", ownerId=" + ownerId + ", ownerName=" + ownerName + + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + maxOccurrences + ", path=" + path+ ", source=" + source + "]"; + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java index f4de5b8c9d..110e08852b 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityTypeDataDefinition.java @@ -23,103 +23,102 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; import java.util.List; -public class CapabilityTypeDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class CapabilityTypeDataDefinition extends ToscaDataDefinition 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(); + this.setUniqueId(cdt.getUniqueId()); + this.setDescription ( cdt.getDescription()); + this.setType(cdt.getType()); + this.setValidSourceTypes( cdt.getValidSourceTypes()); + this.setVersion( cdt.getVersion()); + this.setCreationTime (cdt.getCreationTime()); + this.setModificationTime (cdt.getModificationTime()); + } public CapabilityTypeDataDefinition() { - + super(); } public String getUniqueId() { - return uniqueId; + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); } public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); } public String getDescription() { - return description; + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); } public void setDescription(String description) { - this.description = description; + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); } public String getType() { - return type; + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); } public void setType(String type) { - this.type = type; + setToscaPresentationValue(JsonPresentationFields.TYPE, type); } public List<String> getValidSourceTypes() { - return validSourceTypes; + return (List<String> ) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE); } public void setValidSourceTypes(List<String> validSourceTypes) { - this.validSourceTypes = validSourceTypes; + setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE, validSourceTypes); } public String getVersion() { - return version; + return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } public void setVersion(String version) { - this.version = version; + setToscaPresentationValue(JsonPresentationFields.VERSION, version); } public Long getCreationTime() { - return creationTime; + return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); } public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; + setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); } public Long getModificationTime() { - return modificationTime; + return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); } public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; + setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); } @Override public String toString() { + String uniqueId = getUniqueId(); + String description = getDescription(); + String type = getType(); + List<String> validSourceTypes = getValidSourceTypes(); + String version = getVersion(); + Long creationTime = getCreationTime(); + Long modificationTime = getModificationTime(); + return "CapabilityTypeDataDefinition [uniqueId=" + uniqueId + ", description=" + description + ", type=" + type + ", validSourceTypes=" + validSourceTypes + ", version=" + version + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]"; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java index c9a9516f21..e236fcb963 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java @@ -23,17 +23,22 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -public class ComponentInstanceDataDefinition implements Serializable { +public class ComponentInstanceDataDefinition extends ToscaDataDefinition implements Serializable { /** * */ + private static final long serialVersionUID = 7215033872921497743L; + private String icon; + private String uniqueId; private String name; + private String normalizedName; private String componentUid; @@ -51,12 +56,17 @@ public class ComponentInstanceDataDefinition implements Serializable { private Integer attributeValueCounter; private Integer inputValueCounter = 1; private OriginTypeEnum originType; - + private String customizationUUID; + private String componentName; + private String componentVersion; + private String toscaComponentName; + public ComponentInstanceDataDefinition() { super(); } public ComponentInstanceDataDefinition(ComponentInstanceDataDefinition dataDefinition) { + this.icon = dataDefinition.icon; this.uniqueId = dataDefinition.uniqueId; this.name = dataDefinition.name; this.componentUid = dataDefinition.componentUid; @@ -68,9 +78,19 @@ public class ComponentInstanceDataDefinition implements Serializable { this.propertyValueCounter = dataDefinition.propertyValueCounter; this.normalizedName = dataDefinition.normalizedName; this.originType = dataDefinition.originType; - + this.customizationUUID = dataDefinition.customizationUUID; + this.componentName = dataDefinition.componentName; + this.componentVersion = dataDefinition.componentVersion; + this.toscaComponentName = dataDefinition.toscaComponentName; + } + + public String getIcon() { + return icon; } + public void setIcon(String icon) { + this.icon = icon; + } public String getUniqueId() { return uniqueId; } @@ -159,15 +179,6 @@ public class ComponentInstanceDataDefinition implements Serializable { 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; } @@ -184,4 +195,43 @@ public class ComponentInstanceDataDefinition implements Serializable { this.inputValueCounter = inputValueCounter; } + public String getCustomizationUUID() { + return customizationUUID; + } + + public void setCustomizationUUID(String customizationUUID) { + this.customizationUUID = customizationUUID; + } + + public String getComponentName() { + return componentName; + } + + public void setComponentName(String resourceName) { + this.componentName = resourceName; + } + + public String getComponentVersion() { + return componentVersion; + } + + public String getToscaComponentName() { + return toscaComponentName; + } + + public void setToscaComponentName(String toscaComponentName) { + this.toscaComponentName = toscaComponentName; + } + + public void setComponentVersion(String resourceVersion) { + this.componentVersion = resourceVersion; + } + + @Override + public String toString() { + return "ComponentInstanceDataDefinition [icon=" + icon + ", uniqueId=" + uniqueId + ", name=" + name + ", normalizedName=" + normalizedName + ", componentUid=" + componentUid + ", creationTime=" + creationTime + ", modificationTime=" + + modificationTime + ", description=" + description + ", posX=" + posX + ", posY=" + posY + ", propertyValueCounter=" + propertyValueCounter + ", attributeValueCounter=" + attributeValueCounter + ", inputValueCounter=" + + inputValueCounter + ", originType=" + originType + ", customizationUUID=" + customizationUUID + ", componentName=" + componentName + ", componentVersion=" + componentVersion + ", toscaComponentName=" + toscaComponentName + "]"; + } + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java new file mode 100644 index 0000000000..2ba460b9ab --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CompositionDataDefinition.java @@ -0,0 +1,40 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.HashMap; +import java.util.Map; + +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class CompositionDataDefinition extends ToscaDataDefinition { + + public Map<String, ComponentInstanceDataDefinition> getComponentInstances() { + return (Map<String, ComponentInstanceDataDefinition>) getToscaPresentationValue(JsonPresentationFields.COMPONENT_INSTANCES); + } + public void setComponentInstances(Map<String, ComponentInstanceDataDefinition> componentInstances) { + setToscaPresentationValue(JsonPresentationFields.COMPONENT_INSTANCES, componentInstances); + } + public Map<String, RelationshipInstDataDefinition> getRelations() { + return (Map<String, RelationshipInstDataDefinition>) getToscaPresentationValue(JsonPresentationFields.RELATIONS); + } + public void setRelations(Map<String, RelationshipInstDataDefinition> relations) { + setToscaPresentationValue(JsonPresentationFields.RELATIONS, relations); + } + public void addInstance( String key, ComponentInstanceDataDefinition instance ){ + Map<String, ComponentInstanceDataDefinition> instances = getComponentInstances(); + if (instances == null ){ + instances = new HashMap<>(); + setToscaPresentationValue(JsonPresentationFields.COMPONENT_INSTANCES, instances ); + } + instances.put(key, instance); + } + + public void addRelation( String key, RelationshipInstDataDefinition relation ){ + Map<String, RelationshipInstDataDefinition> relations = getRelations(); + if (relations == null ){ + relations = new HashMap<>(); + setToscaPresentationValue(JsonPresentationFields.RELATIONS, relations ); + } + relations.put(key, relation); + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java index 6cd7d6c0fb..143c28d068 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinition.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.be.datatypes.elements; -public class ConsumerDataDefinition { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class ConsumerDataDefinition extends ToscaDataDefinition { // ECOMP Consumer Name - UTF-8 string up to 255 characters containing the // following characters : ( maybe to limit 4-64 chars ? ) diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java index bfcfefc433..a048ceb096 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java @@ -22,7 +22,9 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; -public class DataTypeDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class DataTypeDataDefinition extends ToscaDataDefinition implements Serializable { /** * diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java new file mode 100644 index 0000000000..c913eaf0cb --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GetInputValueDataDefinition.java @@ -0,0 +1,166 @@ +/*- + * ============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.Map; + +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class GetInputValueDataDefinition extends ToscaDataDefinition implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 5466910697527037975L; + private String propName; + private String inputName; + private String inputId; + private Integer indexValue; + private GetInputValueDataDefinition getInputIndex; + + boolean isList = false; + + public GetInputValueDataDefinition(){ + super(); + } + + public GetInputValueDataDefinition(Map<String, Object> pr) { + super(pr); + + } + + public GetInputValueDataDefinition(GetInputValueDataDefinition p) { + + + super(); + this.setPropName(p.getPropName()); + this.setInputName( p.getInputName()); + this.setInputId( p.getInputId()); + this.setIndexValue ( p.getIndexValue()); + this.setGetInputIndex ( p.getGetInputIndex()); + this.setList ( p.isList()); + + + } + + public String getPropName() { + return propName; + } + + public void setPropName(String propName) { + this.propName = propName; + } + + public String getInputName() { + return inputName; + } + + public void setInputName(String inputName) { + this.inputName = inputName; + } + + public Integer getIndexValue() { + return indexValue; + } + + public void setIndexValue(Integer indexValue) { + this.indexValue = indexValue; + } + + public GetInputValueDataDefinition getGetInputIndex() { + return getInputIndex; + } + + public void setGetInputIndex(GetInputValueDataDefinition getInputIndex) { + this.getInputIndex = getInputIndex; + } + + public boolean isList() { + return isList; + } + + public void setList(boolean isList) { + this.isList = isList; + } + + + public String getInputId() { + return inputId; + } + + public void setInputId(String inputId) { + this.inputId = inputId; + } + + @Override + public String toString() { + return "GetInputValueDataDefinition [propName=" + propName + ", inputName=" + inputName + ", indexValue=" + indexValue + ", getInputIndex=" + getInputIndex + ", isList=" + isList + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getInputIndex == null) ? 0 : getInputIndex.hashCode()); + result = prime * result + ((indexValue == null) ? 0 : indexValue.hashCode()); + result = prime * result + ((inputName == null) ? 0 : inputName.hashCode()); + result = prime * result + (isList ? 1231 : 1237); + result = prime * result + ((propName == null) ? 0 : propName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + GetInputValueDataDefinition other = (GetInputValueDataDefinition) obj; + if (getInputIndex == null) { + if (other.getInputIndex != null) + return false; + } else if (!getInputIndex.equals(other.getInputIndex)) + return false; + if (indexValue == null) { + if (other.indexValue != null) + return false; + } else if (!indexValue.equals(other.indexValue)) + return false; + if (inputName == null) { + if (other.inputName != null) + return false; + } else if (!inputName.equals(other.inputName)) + return false; + if (isList != other.isList) + return false; + if (propName == null) { + if (other.propName != null) + return false; + } else if (!propName.equals(other.propName)) + return false; + return true; + } + + + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java index be3dd8c0ed..d4981a72ae 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupDataDefinition.java @@ -21,89 +21,107 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; -public class GroupDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + + +public class GroupDataDefinition extends ToscaDataDefinition 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 String typeUid; private Integer propertyValueCounter = 0; public GroupDataDefinition() { + super(); + + } + + public GroupDataDefinition(Map<String, Object> gr) { + super(gr); + propertyValueCounter = 0; + } + + public GroupDataDefinition(GroupDataDefinition other) { + this.setName(other.getName()); + this.setUniqueId(other.getUniqueId()); + this.setType(other.getType()); + this.setVersion(other.getVersion()); + this.setInvariantUUID(other.getInvariantUUID()); + this.setDescription(other.getDescription()); + this.propertyValueCounter = other.propertyValueCounter; + this.setGroupUUID(other.getGroupUUID()); + + if (other.getMembers() != null) { + this.setMembers(new HashMap<String, String>(other.getMembers())); + } + if (other.getArtifacts() != null) { + this.setArtifacts(new ArrayList<String>(other.getArtifacts())); + } + if (other.getArtifactsUuid() != null) { + this.setArtifactsUuid( new ArrayList<String>(other.getArtifactsUuid())); + } + this.setTypeUid(other.typeUid); + this.setProperties(other.getProperties()); } + public String getName() { - return name; + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); } public void setName(String name) { - this.name = name; + setToscaPresentationValue(JsonPresentationFields.NAME, name); } public String getUniqueId() { - return uniqueId; + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); } public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); } public String getType() { - return type; + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); } public void setType(String type) { - this.type = type; + setToscaPresentationValue(JsonPresentationFields.TYPE, type); } public String getVersion() { - return version; + return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } public void setVersion(String version) { - this.version = version; + setToscaPresentationValue(JsonPresentationFields.VERSION, version); } public String getInvariantUUID() { - return invariantUUID; + return (String) getToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID); } public void setInvariantUUID(String invariantUUID) { - this.invariantUUID = invariantUUID; + setToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID, invariantUUID); } public String getDescription() { - return description; + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); } public void setDescription(String description) { - this.description = description; + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); } public Integer getPropertyValueCounter() { @@ -115,28 +133,63 @@ public class GroupDataDefinition implements Serializable { } public String getGroupUUID() { - return groupUUID; + return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UUID); } public void setGroupUUID(String groupUUID) { - this.groupUUID = groupUUID; + setToscaPresentationValue(JsonPresentationFields.GROUP_UUID, 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; + public Map<String, String> getMembers() { + return (Map<String, String>) getToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER); + } + + public void setMembers(Map<String, String> members) { + setToscaPresentationValue(JsonPresentationFields.GROUP_MEMBER, members); + } + + public List<String> getArtifacts() { + return (List<String> ) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS); + } + + public void setArtifacts(List<String> artifacts) { + setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS, artifacts); + } + + public List<String> getArtifactsUuid() { + return (List<String> ) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID); + } + + public void setArtifactsUuid(List<String> artifactsUuid) { + setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID, artifactsUuid); + } + + public List<PropertyDataDefinition> getProperties() { + return (List<PropertyDataDefinition> ) getToscaPresentationValue(JsonPresentationFields.GROUP_PROPERTIES); + } + + public void setProperties(List<PropertyDataDefinition> properties) { + setToscaPresentationValue(JsonPresentationFields.GROUP_PROPERTIES, properties); + } + + public String getTypeUid() { + return typeUid; + } + + public void setTypeUid(String typeUid) { + this.typeUid = typeUid; } @Override public String toString() { - return "GroupDataDefinition [name=" + name + ", uniqueId=" + uniqueId + ", type=" + type + ", version=" - + version + ", invariantUUID=" + invariantUUID + ", description=" + description - + ", propertyValueCounter=" + propertyValueCounter + ", groupUUID=" + groupUUID + "]"; + return "GroupDataDefinition [propertyValueCounter=" + propertyValueCounter + ", toscaPresentation=" + toscaPresentation + ", getName()=" + getName() + ", getUniqueId()=" + getUniqueId() + ", getType()=" + getType() + ", getVersion()=" + + getVersion() + ", getInvariantUUID()=" + getInvariantUUID() + ", getDescription()=" + getDescription() + ", getPropertyValueCounter()=" + getPropertyValueCounter() + ", getGroupUUID()=" + getGroupUUID() + ", getMembers()=" + + getMembers() + ", getArtifacts()=" + getArtifacts() + ", getArtifactsUuid()=" + getArtifactsUuid() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + ", toString()=" + + super.toString() + "]"; } + + + + + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java new file mode 100644 index 0000000000..03e8cc34bb --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupInstanceDataDefinition.java @@ -0,0 +1,246 @@ +/*- + * ============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 java.util.Map; + +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class GroupInstanceDataDefinition extends ToscaDataDefinition implements Serializable { + + private static final long serialVersionUID = -4231181556686542208L; + + public GroupInstanceDataDefinition() { + super(); + } + public GroupInstanceDataDefinition(Map<String, Object> gi) { + super(gi); + } + public GroupInstanceDataDefinition(GroupInstanceDataDefinition other) { + this.setUniqueId(other.getUniqueId()); + this.setName(other.getName()); + this.setGroupUid(other.getGroupUid()); + this.setCreationTime(other.getCreationTime()); + this.setModificationTime(other.getModificationTime()); + this.setPosX(other.getPosX()); + this.setPosY(other.getPosY()); + this.setPropertyValueCounter(other.getPropertyValueCounter()); + this.setNormalizedName(other.getNormalizedName()); + this.setCustomizationUUID(other.getCustomizationUUID()); + this.setGroupName(other.getGroupName()); + this.setInvariantUUID(other.getInvariantUUID()); + this.setType(other.getType()); + this.setGroupUUID(other.getGroupUUID()); + this.setVersion(other.getVersion()); + this.setDescription(other.getDescription()); + if(other.getArtifacts() != null) + this.setArtifacts(new ArrayList<>(other.getArtifacts())); + if(other.getArtifactsUuid() != null) + this.setArtifactsUuid(new ArrayList<>(other.getArtifactsUuid())); + if(other.getGroupInstanceArtifacts() != null) + this.setGroupInstanceArtifacts(new ArrayList<>(other.getGroupInstanceArtifacts())); + if(other.getGroupInstanceArtifactsUuid() != null) + this.setGroupInstanceArtifactsUuid(new ArrayList<>(other.getGroupInstanceArtifactsUuid())); + if(other.getProperties() != null) + this.setProperties(new ArrayList<>(other.getProperties())); + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + + public String getNormalizedName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME); + } + + public void setNormalizedName(String normalizedName) { + setToscaPresentationValue(JsonPresentationFields.NORMALIZED_NAME, normalizedName); + } + + public String getGroupUid() { + return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UNIQUE_ID); + } + + public void setGroupUid(String groupUid) { + setToscaPresentationValue(JsonPresentationFields.GROUP_UNIQUE_ID, groupUid); + } + + public Long getCreationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); + } + + public void setCreationTime(Long creationTime) { + setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); + } + + public Long getModificationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); + } + + public void setModificationTime(Long modificationTime) { + setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); + } + + public String getPosX() { + return (String) getToscaPresentationValue(JsonPresentationFields.POS_X); + } + + public void setPosX(String posX) { + setToscaPresentationValue(JsonPresentationFields.POS_X, posX); + } + + public String getPosY() { + return (String) getToscaPresentationValue(JsonPresentationFields.POS_Y); + } + + public void setPosY(String posY) { + setToscaPresentationValue(JsonPresentationFields.POS_Y, posY); + } + + public Integer getPropertyValueCounter() { + return (Integer) getToscaPresentationValue(JsonPresentationFields.PROPERTY_VALUE_COUNTER); + } + + public void setPropertyValueCounter(Integer propertyValueCounter) { + setToscaPresentationValue(JsonPresentationFields.PROPERTY_VALUE_COUNTER, propertyValueCounter); + } + + public String getCustomizationUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID); + } + + public void setCustomizationUUID(String customizationUUID) { + setToscaPresentationValue(JsonPresentationFields.CUSTOMIZATION_UUID, customizationUUID); + } + + public String getGroupName() { + return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_NAME); + } + + public void setGroupName(String groupName) { + setToscaPresentationValue(JsonPresentationFields.GROUP_NAME, groupName); + } + + public String getInvariantUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID); + } + + public void setInvariantUUID(String invariantUUID) { + setToscaPresentationValue(JsonPresentationFields.INVARIANT_UUID, invariantUUID); + } + + public String getType() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public void setType(String type) { + setToscaPresentationValue(JsonPresentationFields.TYPE, type); + } + + public String getGroupUUID() { + return (String) getToscaPresentationValue(JsonPresentationFields.GROUP_UUID); + } + + public void setGroupUUID(String groupUUID) { + setToscaPresentationValue(JsonPresentationFields.GROUP_UUID, groupUUID); + } + + public String getVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); + } + + public void setVersion(String version) { + setToscaPresentationValue(JsonPresentationFields.VERSION, version); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + @SuppressWarnings("unchecked") + public List<String> getArtifacts() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS); + } + + public void setArtifacts(List<String> artifacts) { + setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS, artifacts); + } + + @SuppressWarnings("unchecked") + public List<String> getArtifactsUuid() { + return (List<String> ) getToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID); + } + + public void setArtifactsUuid(List<String> artifactsUuid) { + setToscaPresentationValue(JsonPresentationFields.GROUP_ARTIFACTS_UUID, artifactsUuid); + } + + @SuppressWarnings("unchecked") + public List<String> getGroupInstanceArtifacts() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS); + } + + public void setGroupInstanceArtifacts(List<String> groupInstanceArtifacts) { + setToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS, groupInstanceArtifacts); + } + + @SuppressWarnings("unchecked") + public List<String> getGroupInstanceArtifactsUuid() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS_UUID); + } + + public void setGroupInstanceArtifactsUuid(List<String> groupInstanceArtifactsUuid) { + setToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_ARTIFACTS_UUID, groupInstanceArtifactsUuid); + } + + @SuppressWarnings("unchecked") + public List<PropertyDataDefinition> getProperties() { + return (List<PropertyDataDefinition>) getToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_PROPERTIES); + } + + public void setProperties(List<PropertyDataDefinition> properties) { + setToscaPresentationValue(JsonPresentationFields.GROUP_INSTANCE_PROPERTIES, properties); + } + + public static long getSerialversionuid() { + return serialVersionUID; + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java index 1642d17252..a250ac4308 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/GroupTypeDataDefinition.java @@ -24,7 +24,9 @@ import java.io.Serializable; import java.util.List; import java.util.Map; -public class GroupTypeDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class GroupTypeDataDefinition extends ToscaDataDefinition implements Serializable { /** * diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java index a84485bef6..33091473cf 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/HeatParameterDataDefinition.java @@ -22,7 +22,9 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; -public class HeatParameterDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class HeatParameterDataDefinition extends ToscaDataDefinition implements Serializable { /** * diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java new file mode 100644 index 0000000000..fd69127ed3 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java @@ -0,0 +1,63 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.Map; + +public class InputDataDefinition extends PropertyDataDefinition{ + + /** + * + */ + private static final long serialVersionUID = 8913646848974511031L; + String label; + Boolean hidden; + Boolean immutable; + + public InputDataDefinition(){ + super(); + } + + public InputDataDefinition(Map<String, Object> pr) { + super(pr); + + } + + public InputDataDefinition(InputDataDefinition p) { + + super(p); + this.setLabel(p.getLabel()); + this.setHidden( p.isHidden()); + this.setImmutable( p.isImmutable()); + + + } + + public InputDataDefinition(PropertyDataDefinition p) { + + super(p); + } + + public Boolean isHidden() { + return hidden; + } + + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + + public Boolean isImmutable() { + return immutable; + } + + public void setImmutable(Boolean immutable) { + this.immutable = immutable; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java index 87c163a3ae..b54c960cf2 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputsValueDataDefinition.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.be.datatypes.elements; -public class InputsValueDataDefinition { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class InputsValueDataDefinition extends ToscaDataDefinition { private String name; private String value; private String uniqueId; @@ -33,7 +35,6 @@ public class InputsValueDataDefinition { public InputsValueDataDefinition() { super(); - // TODO Auto-generated constructor stub } public String getUniqueId() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java index 46c1ede031..301d888bd2 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java @@ -24,7 +24,9 @@ import java.io.Serializable; import java.util.HashMap; import java.util.Map; -public class InterfaceDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class InterfaceDataDefinition extends ToscaDataDefinition implements Serializable { /** * @@ -46,10 +48,14 @@ public class InterfaceDataDefinition implements Serializable { * Timestamp of the last resource (artifact) creation */ private Long lastUpdateDate; - + /** + * Defines an operation available to manage particular aspects of the Node + * Type. + */ + private Map<String, OperationDataDefinition> operations = new HashMap<String, OperationDataDefinition>(); + public InterfaceDataDefinition() { super(); - // TODO Auto-generated constructor stub } public InterfaceDataDefinition(String type, String description) { @@ -105,5 +111,11 @@ public class InterfaceDataDefinition implements Serializable { public void setDescription(String description) { this.description = description; } + public Map<String, OperationDataDefinition> getOperations() { + return operations; + } + public void setOperations(Map<String, OperationDataDefinition> operations) { + this.operations = operations; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java new file mode 100644 index 0000000000..3057c72c67 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListCapabilityDataDefinition.java @@ -0,0 +1,42 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + +public class ListCapabilityDataDefinition extends ListDataDefinition<CapabilityDataDefinition> { + + public ListCapabilityDataDefinition(ListCapabilityDataDefinition cdt) { + super(cdt); + + } + + @JsonCreator + public ListCapabilityDataDefinition(List< CapabilityDataDefinition > listToscaDataDefinition) { + super(listToscaDataDefinition); + } + public ListCapabilityDataDefinition() { + super(); + + } + @JsonValue + @Override + public List<CapabilityDataDefinition> getListToscaDataDefinition() { + return listToscaDataDefinition; + } + + + public void setListToscaDataDefinition(List<CapabilityDataDefinition> listToscaDataDefinition) { + this.listToscaDataDefinition = listToscaDataDefinition; + } + + public ListCapabilityDataDefinition mergeListItemsByName(ListCapabilityDataDefinition other){ + Map<String, CapabilityDataDefinition> mapByName = listToMapByName(); + Map<String, CapabilityDataDefinition> mapOtherByName = other.listToMapByName(); + mapByName.putAll(mapOtherByName); + return new ListCapabilityDataDefinition(mapByName.values().stream().collect(Collectors.toList())); + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java new file mode 100644 index 0000000000..2eb8dcad2e --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java @@ -0,0 +1,69 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + + +public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaDataDefinition { + + protected List<T> listToscaDataDefinition; + + public ListDataDefinition(ListDataDefinition<T> cdt) { + super(); + listToscaDataDefinition = cdt.listToscaDataDefinition; + + } + + @JsonCreator + public ListDataDefinition(List<T> listToscaDataDefinition) { + super(); + this.listToscaDataDefinition = listToscaDataDefinition; + } + + public ListDataDefinition() { + super(); + } + + public List<T> getListToscaDataDefinition() { + return listToscaDataDefinition; + } + + public void add(T value) { + if (listToscaDataDefinition == null) { + listToscaDataDefinition = new ArrayList<T>(); + } + listToscaDataDefinition.add(value); + } + + public void delete(T value) { + if (listToscaDataDefinition != null) { + listToscaDataDefinition.remove(value); + } + } + + @Override + public void setOwnerIdIfEmpty(String ownerId) { + if (listToscaDataDefinition != null) { + listToscaDataDefinition.forEach(e -> e.setOwnerIdIfEmpty(ownerId)); + } + } + + + public Map<String, T> listToMapByName() { + Map<String, T> mapByName = new HashMap<>(); + listToscaDataDefinition.forEach(e -> mapByName.put((String)e.getToscaPresentationValue(JsonPresentationFields.NAME), e)); + return mapByName; + } + + + + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java new file mode 100644 index 0000000000..e611666d3e --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListMapPropertiesDataDefinition.java @@ -0,0 +1,36 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.List; +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + +public class ListMapPropertiesDataDefinition extends ListDataDefinition<MapPropertiesDataDefinition> { + + public ListMapPropertiesDataDefinition(ListMapPropertiesDataDefinition cdt) { + super(cdt); + + } + + @JsonCreator + public ListMapPropertiesDataDefinition(List< MapPropertiesDataDefinition > listToscaDataDefinition) { + super(listToscaDataDefinition); + } + public ListMapPropertiesDataDefinition() { + super(); + + } + @JsonValue + @Override + public List<MapPropertiesDataDefinition> getListToscaDataDefinition() { + return listToscaDataDefinition; + } + + + public void setMapToscaDataDefinition(List<MapPropertiesDataDefinition> listToscaDataDefinition) { + this.listToscaDataDefinition = listToscaDataDefinition; + } + + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java new file mode 100644 index 0000000000..4c69958e62 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListRequirementDataDefinition.java @@ -0,0 +1,43 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + +public class ListRequirementDataDefinition extends ListDataDefinition<RequirementDataDefinition> { + + public ListRequirementDataDefinition(ListRequirementDataDefinition cdt) { + super(cdt); + + } + + @JsonCreator + public ListRequirementDataDefinition(List< RequirementDataDefinition > listToscaDataDefinition) { + super(listToscaDataDefinition); + } + public ListRequirementDataDefinition() { + super(); + + } + @JsonValue + @Override + public List<RequirementDataDefinition> getListToscaDataDefinition() { + return listToscaDataDefinition; + } + + + public void setListToscaDataDefinition(List<RequirementDataDefinition> listToscaDataDefinition) { + this.listToscaDataDefinition = listToscaDataDefinition; + } + + public ListRequirementDataDefinition mergeListItemsByName(ListRequirementDataDefinition other){ + Map<String, RequirementDataDefinition> mapByName = listToMapByName(); + Map<String, RequirementDataDefinition> mapOtherByName = other.listToMapByName(); + mapByName.putAll(mapOtherByName); + return new ListRequirementDataDefinition(mapByName.values().stream().collect(Collectors.toList())); + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java new file mode 100644 index 0000000000..4c61dd2b81 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapArtifactDataDefinition.java @@ -0,0 +1,45 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + +public class MapArtifactDataDefinition extends MapDataDefinition<ArtifactDataDefinition>{ + + private String parentName; + + public MapArtifactDataDefinition(MapDataDefinition cdt, String parentName) { + super(cdt); + this.parentName = parentName; + } + + @JsonCreator + public MapArtifactDataDefinition(Map<String, ArtifactDataDefinition > mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + public MapArtifactDataDefinition() { + super(); + + } + @JsonValue + @Override + public Map<String, ArtifactDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + + public void setMapToscaDataDefinition(Map<String, ArtifactDataDefinition> mapToscaDataDefinition) { + this.mapToscaDataDefinition = mapToscaDataDefinition; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapAttributesDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapAttributesDataDefinition.java new file mode 100644 index 0000000000..817fbebd5c --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapAttributesDataDefinition.java @@ -0,0 +1,45 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + +public class MapAttributesDataDefinition extends MapDataDefinition<AttributeDataDefinition>{ + + private String parentName; + + public MapAttributesDataDefinition(MapDataDefinition cdt, String parentName) { + super(cdt); + this.parentName = parentName; + } + + @JsonCreator + public MapAttributesDataDefinition(Map<String, AttributeDataDefinition > mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + public MapAttributesDataDefinition() { + super(); + + } + @JsonValue + @Override + public Map<String, AttributeDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + + public void setMapToscaDataDefinition(Map<String, AttributeDataDefinition> mapToscaDataDefinition) { + this.mapToscaDataDefinition = mapToscaDataDefinition; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabiltyProperty.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabiltyProperty.java new file mode 100644 index 0000000000..42d3f49a7d --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapCapabiltyProperty.java @@ -0,0 +1,27 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + +public class MapCapabiltyProperty extends MapDataDefinition<MapPropertiesDataDefinition> { + @JsonCreator + public MapCapabiltyProperty(Map<String, MapPropertiesDataDefinition > mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + public MapCapabiltyProperty() { + super(); + + } + @JsonValue + @Override + public Map<String, MapPropertiesDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + public void setMapToscaDataDefinition(Map<String, MapPropertiesDataDefinition> mapToscaDataDefinition) { + this.mapToscaDataDefinition = mapToscaDataDefinition; + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java new file mode 100644 index 0000000000..69eecf45c4 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java @@ -0,0 +1,60 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.HashMap; +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDataDefinition { + + protected Map<String, T > mapToscaDataDefinition; + + public MapDataDefinition(MapDataDefinition<T> cdt) { + super(); + mapToscaDataDefinition = cdt.mapToscaDataDefinition; + + } + @JsonCreator + public MapDataDefinition(Map<String, T > mapToscaDataDefinition) { + super(); + this.mapToscaDataDefinition = mapToscaDataDefinition; + } + + public MapDataDefinition() { + super(); + } + @JsonValue + public Map<String, T > getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + public void put(String key, T value){ + if(mapToscaDataDefinition == null){ + mapToscaDataDefinition = new HashMap<String, T>(); + } + mapToscaDataDefinition.put(key, value); + } + + public void delete(String key){ + if(mapToscaDataDefinition != null && mapToscaDataDefinition.containsKey(key)){ + mapToscaDataDefinition.remove(key); + } + } + + public T findByKey(String key){ + T value = null; + if(mapToscaDataDefinition != null && mapToscaDataDefinition.containsKey(key)){ + value = mapToscaDataDefinition.get(key); + } + return value; + } + @Override + public void setOwnerIdIfEmpty(String ownerId) { + if ( mapToscaDataDefinition != null ){ + mapToscaDataDefinition.entrySet().forEach(e -> e.getValue().setOwnerIdIfEmpty(ownerId)); + } + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java new file mode 100644 index 0000000000..acd1a182a6 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapGroupsDataDefinition.java @@ -0,0 +1,45 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + +public class MapGroupsDataDefinition extends MapDataDefinition<GroupInstanceDataDefinition>{ + + private String parentName; + + public MapGroupsDataDefinition(MapDataDefinition<GroupInstanceDataDefinition> cdt, String parentName) { + super(cdt); + this.parentName = parentName; + } + + @JsonCreator + public MapGroupsDataDefinition(Map<String, GroupInstanceDataDefinition> mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + public MapGroupsDataDefinition() { + super(); + + } + @JsonValue + @Override + public Map<String, GroupInstanceDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + + public void setMapToscaDataDefinition(Map<String, GroupInstanceDataDefinition> mapToscaDataDefinition) { + this.mapToscaDataDefinition = mapToscaDataDefinition; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinition.java new file mode 100644 index 0000000000..3053f99ab2 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListCapabiltyDataDefinition.java @@ -0,0 +1,49 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.HashMap; +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + +public class MapListCapabiltyDataDefinition extends MapDataDefinition<ListCapabilityDataDefinition> { + + public MapListCapabiltyDataDefinition(MapListCapabiltyDataDefinition cdt) { + super(cdt); + + } + + @JsonCreator + public MapListCapabiltyDataDefinition(Map<String, ListCapabilityDataDefinition> mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + + public MapListCapabiltyDataDefinition() { + super(); + + } + + @JsonValue + @Override + public Map<String, ListCapabilityDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + public void add(String key, CapabilityDataDefinition value) { + if (mapToscaDataDefinition == null) { + mapToscaDataDefinition = new HashMap<>(); + ListCapabilityDataDefinition newList = new ListCapabilityDataDefinition(); + newList.add(value); + put(key, newList); + } else { + ListCapabilityDataDefinition existValue = mapToscaDataDefinition.get(key); + if (existValue == null) { + ListCapabilityDataDefinition newList = new ListCapabilityDataDefinition(); + newList.add(value); + put(key, newList); + } else { + existValue.getListToscaDataDefinition().add(value); + } + } + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java new file mode 100644 index 0000000000..80c2060333 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapListRequirementDataDefinition.java @@ -0,0 +1,50 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.HashMap; +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + +public class MapListRequirementDataDefinition extends MapDataDefinition<ListRequirementDataDefinition> { + + public MapListRequirementDataDefinition(MapListRequirementDataDefinition cdt) { + super(cdt); + + } + + @JsonCreator + public MapListRequirementDataDefinition(Map<String, ListRequirementDataDefinition> mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + + public MapListRequirementDataDefinition() { + super(); + + } + + @JsonValue + @Override + public Map<String, ListRequirementDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + public void add(String key, RequirementDataDefinition value) { + if (mapToscaDataDefinition == null) { + mapToscaDataDefinition = new HashMap<>(); + ListRequirementDataDefinition newList = new ListRequirementDataDefinition(); + newList.add(value); + put(key, newList); + } else { + ListRequirementDataDefinition existValue = mapToscaDataDefinition.get(key); + if (existValue == null) { + ListRequirementDataDefinition newList = new ListRequirementDataDefinition(); + newList.add(value); + put(key, newList); + } else { + existValue.getListToscaDataDefinition().add(value); + } + } + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java new file mode 100644 index 0000000000..e90fc916e8 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapPropertiesDataDefinition.java @@ -0,0 +1,45 @@ +package org.openecomp.sdc.be.datatypes.elements; + +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + +public class MapPropertiesDataDefinition extends MapDataDefinition<PropertyDataDefinition>{ + + private String parentName; + + public MapPropertiesDataDefinition(MapDataDefinition cdt, String parentName) { + super(cdt); + this.parentName = parentName; + } + + @JsonCreator + public MapPropertiesDataDefinition(Map<String, PropertyDataDefinition > mapToscaDataDefinition) { + super(mapToscaDataDefinition); + } + public MapPropertiesDataDefinition() { + super(); + + } + @JsonValue + @Override + public Map<String, PropertyDataDefinition> getMapToscaDataDefinition() { + return mapToscaDataDefinition; + } + + + public void setMapToscaDataDefinition(Map<String, PropertyDataDefinition> mapToscaDataDefinition) { + this.mapToscaDataDefinition = mapToscaDataDefinition; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java index 12c069b142..09370f8311 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java @@ -21,8 +21,11 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; +import java.util.Map; -public class OperationDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class OperationDataDefinition extends ToscaDataDefinition implements Serializable { /** * @@ -43,22 +46,29 @@ public class OperationDataDefinition implements Serializable { /** Description of the operation. */ private String description; + /** Implementation artifact for the interface. */ + private ArtifactDataDefinition implementation; + /** + * This OPTIONAL property contains a list of one or more input parameter + * definitions. + */ + // @JsonDeserialize(contentUsing = OperationParameterDeserializer.class) + private Map<String, PropertyDataDefinition> inputs; 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; - + this.implementation = p.implementation; + this.inputs = p.inputs; } public String getUniqueId() { @@ -92,5 +102,19 @@ public class OperationDataDefinition implements Serializable { public void setDescription(String description) { this.description = description; } + public ArtifactDataDefinition getImplementation() { + return implementation; + } + public void setImplementation(ArtifactDataDefinition implementation) { + this.implementation = implementation; + } + + public Map<String, PropertyDataDefinition> getInputs() { + return inputs; + } + + public void setInputs(Map<String, PropertyDataDefinition> inputs) { + this.inputs = inputs; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java index 9b2b0659b1..8f73764234 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTypeDataDefinition.java @@ -24,7 +24,9 @@ import java.io.Serializable; import java.util.List; import java.util.Map; -public class PolicyTypeDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class PolicyTypeDataDefinition extends ToscaDataDefinition implements Serializable { /** * diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java index 3f044c1d46..11ad219df3 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java index c522f3e0e9..ed94ce0d87 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java @@ -21,8 +21,17 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; -public class PropertyDataDefinition implements Serializable { +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +import fj.data.Either; + + +public class PropertyDataDefinition extends ToscaDataDefinition implements Serializable { /** * @@ -34,7 +43,7 @@ public class PropertyDataDefinition implements Serializable { // "boolean", "string", "float", "integer", "version" }) private String type; - private Boolean required; + private Boolean required = Boolean.FALSE; protected boolean definition = false; @@ -46,18 +55,81 @@ public class PropertyDataDefinition implements Serializable { private boolean password; + private String name; + + private String value; + + private String label; + private Boolean hidden = Boolean.FALSE;; + private Boolean immutable = Boolean.FALSE; + + private String inputPath; + + + + /** + * The resource id which this property belongs to + */ + private String parentUniqueId; + + + private List<GetInputValueDataDefinition> getInputValues; + public PropertyDataDefinition() { + super(); + } + + public PropertyDataDefinition(Map<String, Object> pr) { + super(pr); } 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; + + super(); + this.setUniqueId(p.getUniqueId()); + this.setRequired(p.isRequired()); + this.setDefaultValue(p.getDefaultValue()); + this.setDescription(p.getDescription()); + this.setSchema(p.getSchema()); + this.setPassword(p.isPassword()); + this.setType(p.getType()); + this.setName(p.getName()); + this.setValue(p.getValue()); + this.setRequired(p.isRequired()); + this.setHidden(p.isHidden()); + this.setLabel(p.getLabel()); + this.setImmutable(p.isImmutable()); + this.setParentUniqueId(p.getParentUniqueId()); + this.setOwnerId(p.getOwnerId()); + this.setGetInputValues(p.getInputValues); + this.setInputPath(p.getInputPath()); + + } + + public String getInputPath() { + return inputPath; + } + + public void setInputPath(String inputPath) { + this.inputPath = inputPath; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; } // @Override @@ -125,11 +197,50 @@ public class PropertyDataDefinition implements Serializable { this.schema = entrySchema; } + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public Boolean isHidden() { + return hidden; + } + + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + + public Boolean isImmutable() { + return immutable; + } + + public void setImmutable(Boolean immutable) { + this.immutable = immutable; + } + + + public String getParentUniqueId() { + return getOwnerId(); + } + + public void setParentUniqueId(String parentUniqueId) { + setOwnerId(parentUniqueId); + } + + + public List<GetInputValueDataDefinition> getGetInputValues() { + return getInputValues; + } + + public void setGetInputValues(List<GetInputValueDataDefinition> getInputValues) { + this.getInputValues = getInputValues; + } @Override public String toString() { - return "PropertyDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", required=" + required - + ", defaultValue=" + defaultValue + ", description=" + description + ", entrySchema=" + schema - + ", password=" + password + "]"; + return "PropertyDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", required=" + required + ", defaultValue=" + defaultValue + ", description=" + description + ", entrySchema=" + schema + ", parentUniqueId=" + parentUniqueId + ", password=" + password + "]"; } @Override @@ -144,6 +255,7 @@ public class PropertyDataDefinition implements Serializable { result = prime * result + ((schema == null) ? 0 : schema.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + result = prime * result + ((parentUniqueId == null) ? 0 : parentUniqueId.hashCode()); return result; } @@ -185,6 +297,11 @@ public class PropertyDataDefinition implements Serializable { return false; } else if (!type.equals(other.type)) return false; + if (parentUniqueId == null) { + if (other.parentUniqueId != null) + return false; + } else if (!parentUniqueId.equals(other.parentUniqueId)) + return false; if (uniqueId == null) { if (other.uniqueId != null) return false; @@ -192,4 +309,57 @@ public class PropertyDataDefinition implements Serializable { return false; return true; } + + @Override + public Object getToscaPresentationValue(JsonPresentationFields field) { + switch (field) { + case NAME: + return name; + case UNIQUE_ID: + return uniqueId; + case PASSWORD: + return password; + case TYPE: + return type; + case DEFINITION: + return definition; + case VALUE: + return value; + case DEFAULT_VALUE: + return defaultValue; + default: + return super.getToscaPresentationValue(field); + } + } + + protected <T extends PropertyDataDefinition> T overrideDataDefinition(T other, boolean allowDefaultValueOverride){ + if(this.getType().equals(other.getType())){ + other.setOwnerId(getOwnerId()); + if(allowDefaultValueOverride) + other.setDefaultValue(getDefaultValue()); + return other; + } + return null; + } + + + //return Either.right(propertyName) if an illegal merge was attempted (overriding data type is forbidden) + public static <T extends PropertyDataDefinition> Either<Map<String, T>, String> mergeProperties(Map<String, T> derivedProps, Map<String, T> importedProps, boolean allowDefaultValueOverride){ + for(T property : importedProps.values()){ + derivedProps.merge(property.getName(), property, (derivedProp, importedProp) -> derivedProp.overrideDataDefinition(importedProp, allowDefaultValueOverride)); + //validate merge success + if(!derivedProps.containsKey(property.getName())) + return Either.right(property.getName()); + } + return Either.left(derivedProps); + } + + + + public static <T extends PropertyDataDefinition> Map<String, T> listToMapByName(List<T> propertiesList) { + return propertiesList.stream() + .collect(Collectors.toMap(p -> p.getName(), p -> p)); + } + + } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java index c9ef85ac66..c5297e273a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyRule.java @@ -23,8 +23,9 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; import java.util.List; import org.codehaus.jackson.annotate.JsonIgnore; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -public class PropertyRule implements Serializable { +public class PropertyRule extends ToscaDataDefinition implements Serializable { /** * diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java new file mode 100644 index 0000000000..de9127d08c --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java @@ -0,0 +1,193 @@ +/*- + * ============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.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class RelationshipInstDataDefinition extends ToscaDataDefinition implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1104043358598884458L; + + public RelationshipInstDataDefinition(RelationshipInstDataDefinition cdt) { + super(); + this.setUniqueId(cdt.getUniqueId()); + this.setDescription(cdt.getDescription()); + this.setType(cdt.getType()); + this.setValidSourceTypes(cdt.getValidSourceTypes()); + this.setVersion(cdt.getVersion()); + this.setCreationTime(cdt.getCreationTime()); + this.setModificationTime(cdt.getModificationTime()); + this.setCapabilityOwnerId(cdt.getCapabilityOwnerId()); + this.setRequirementOwnerId(cdt.getRequirementOwnerId()); + this.setCapabiltyId(cdt.getCapabiltyId()); + this.setRequirementId(cdt.getRequirementId()); + this.setFromId(cdt.getFromId()); + this.setToId(cdt.getToId()); + this.setRequirement(cdt.getRequirement()); + this.setCapability(cdt.getCapabilty()); + + } + + public void setRequirement(String requirement) { + setToscaPresentationValue(JsonPresentationFields.REQUIREMENT, requirement); + } + + public String getRequirement() { + return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT); + } + public void setCapability(String capabilty) { + setToscaPresentationValue(JsonPresentationFields.CAPAPILITY, capabilty); + } + + public String getCapabilty() { + return (String) getToscaPresentationValue(JsonPresentationFields.CAPAPILITY); + } + public void setToId(Object toId) { + setToscaPresentationValue(JsonPresentationFields.TO_ID, toId); + } + + public void setFromId(Object fromId) { + setToscaPresentationValue(JsonPresentationFields.FROM_ID, fromId); + } + + public String getToId() { + return (String) getToscaPresentationValue(JsonPresentationFields.TO_ID); + } + + public String getFromId() { + return (String) getToscaPresentationValue(JsonPresentationFields.FROM_ID); + } + + public void setRequirementId(Object requirementId) { + setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID, requirementId); + } + + public void setCapabiltyId(Object capabiltyId) { + setToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID, capabiltyId); + } + + public String getRequirementId() { + return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_ID); + } + + public String getCapabiltyId() { + return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_ID); + } + + public void setRequirementOwnerId(Object requirementOwnerId) { + setToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID, requirementOwnerId); + } + + public String getRequirementOwnerId() { + return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT_OWNER_ID); + } + + public void setCapabilityOwnerId(Object capabilityOwnerId) { + setToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID, capabilityOwnerId); + } + + public String getCapabilityOwnerId() { + return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILTY_OWNER_ID); + } + + public RelationshipInstDataDefinition() { + } + + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getDescription() { + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); + } + + public void setDescription(String description) { + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); + } + + /** Identifies the type of the capability. */ + public String getType() { + return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); + } + + public void setType(String type) { + setToscaPresentationValue(JsonPresentationFields.TYPE, type); + } + + public List<String> getValidSourceTypes() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPES); + } + + public void setValidSourceTypes(List<String> validSourceTypes) { + setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPES, validSourceTypes); + } + + public String getVersion() { + return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); + } + + public void setVersion(String version) { + setToscaPresentationValue(JsonPresentationFields.VERSION, version); + } + + public Long getCreationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_TIME); + + } + + public void setCreationTime(Long creationTime) { + setToscaPresentationValue(JsonPresentationFields.CREATION_TIME, creationTime); + } + + public Long getModificationTime() { + return (Long) getToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME); + } + + public void setModificationTime(Long modificationTime) { + setToscaPresentationValue(JsonPresentationFields.MODIFICATION_TIME, modificationTime); + } + + @Override + public String toString() { + String uniqueId = getUniqueId(); + String description = getDescription(); + String type = getType(); + List<String> validSourceTypes = getValidSourceTypes(); + String version = getVersion(); + Long creationTime = getCreationTime(); + Long modificationTime = getModificationTime(); + + return "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/RelationshipTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipTypeDataDefinition.java deleted file mode 100644 index 0f7c56842f..0000000000 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipTypeDataDefinition.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ============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/RequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java new file mode 100644 index 0000000000..7defd1df3c --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java @@ -0,0 +1,308 @@ +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.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + +public class RequirementDataDefinition extends ToscaDataDefinition implements Serializable { + /** + * + */ + public final static String MIN_OCCURRENCES = "1"; + public final static String MAX_OCCURRENCES = "UNBOUNDED"; + public final static String MAX_DEFAULT_OCCURRENCES = "1"; + + private static final long serialVersionUID = -8840549489409274532L; + + public RequirementDataDefinition() { + super(); + this.setMinOccurrences( MIN_OCCURRENCES ); + this.setMaxOccurrences( MAX_OCCURRENCES); + this.setLeftOccurrences( MAX_OCCURRENCES); + } + + public RequirementDataDefinition(RequirementDataDefinition other) { + this.setUniqueId(other.getUniqueId()); + this.setName(other.getName()); + this.setCapability(other.getCapability()); + this.setNode(other.getNode()); + this.setRelationship(other.getRelationship()); + this.setOwnerId(other.getOwnerId()); + this.setOwnerName(other.getOwnerName()); + this.setMinOccurrences(other.getMinOccurrences()); + this.setMaxOccurrences(other.getMaxOccurrences()); + this.setLeftOccurrences(other.getLeftOccurrences()); + this.setPath(other.getPath()); + this.setSource(other.getSource()); + + } + + /** + * Unique id of the requirement + */ + public String getUniqueId() { + return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); + } + + public void setUniqueId(String uniqueId) { + setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId); + } + + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); + } + + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); + } + + /** + * specify the capability type + */ + + public String getCapability() { + return (String) getToscaPresentationValue(JsonPresentationFields.CAPAPILITY); + } + + public void setCapability(String capability) { + setToscaPresentationValue(JsonPresentationFields.CAPAPILITY, capability); + } + + /** + * specify the node type(Optional by tosca) + */ + public String getNode() { + return (String) getToscaPresentationValue(JsonPresentationFields.NODE); + } + + public void setNode(String node) { + setToscaPresentationValue(JsonPresentationFields.NODE, node); + } + + /** + * specify the relationship type(Optional by tosca) + */ + public String getRelationship() { + return (String) getToscaPresentationValue(JsonPresentationFields.RELATIONSHIP); + } + + public void setRelationship(String relationship) { + setToscaPresentationValue(JsonPresentationFields.RELATIONSHIP, relationship); + } + + // public RequirementImplDef getRequirementImpl() { + // return requirementImpl; + // } + // + // public void setRequirementImpl(RequirementImplDef requirementImpl) { + // this.requirementImpl = requirementImpl; + // } + + // specifies the resource instance holding this requirement + public String getOwnerId() { + return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); + } + + public void setOwnerId(String ownerId) { + setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); + } + + public String getOwnerName() { + return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_NAME); + } + + public void setOwnerName(String ownerName) { + setToscaPresentationValue(JsonPresentationFields.OWNER_NAME, ownerName); + } + + public String getMinOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES); + } + + public void setMinOccurrences(String minOccurrences) { + setToscaPresentationValue(JsonPresentationFields.MIN_OCCURRENCES, minOccurrences); + } + + public String getLeftOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES); + } + + public void setLeftOccurrences(String leftOccurrences) { + setToscaPresentationValue(JsonPresentationFields.LEFT_OCCURRENCES, leftOccurrences); + } + + public String getMaxOccurrences() { + return (String) getToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES); + } + + public void setMaxOccurrences(String maxOccurrences) { + setToscaPresentationValue(JsonPresentationFields.MAX_OCCURRENCES, maxOccurrences); + } + + public void setPath(List<String> path) { + setToscaPresentationValue(JsonPresentationFields.PATH, path); + } + + public List<String> getPath() { + return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH); + } + + public void setSource(String source) { + setToscaPresentationValue(JsonPresentationFields.SOURCE, source); + } + + public String getSource() { + return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE); + } + + public void addToPath(String elementInPath) { + List<String> path = getPath(); + if (path == null) { + path = new ArrayList<>(); + } + path.add(elementInPath); + setPath(path); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + String name = getUniqueId(); + String uniqueId = getUniqueId(); + String capability = getCapability(); + String node = getNode(); + String relationship = getRelationship(); + String ownerId = getOwnerId(); + String ownerName = getOwnerName(); + String minOccurrences = getMinOccurrences(); + String maxOccurrences = getMaxOccurrences(); + String leftOccurrences = getLeftOccurrences(); + + List<String> path = this.getPath(); + String source = getSource(); + + result = prime * result + ((capability == null) ? 0 : capability.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((node == null) ? 0 : node.hashCode()); + result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); + result = prime * result + ((ownerName == null) ? 0 : ownerName.hashCode()); + result = prime * result + ((relationship == null) ? 0 : relationship.hashCode()); + result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); + result = prime * result + ((minOccurrences == null) ? 0 : minOccurrences.hashCode()); + result = prime * result + ((maxOccurrences == null) ? 0 : maxOccurrences.hashCode()); + result = prime * result + ((leftOccurrences == null) ? 0 : leftOccurrences.hashCode()); + result = prime * result + ((path == null) ? 0 : path.hashCode()); + result = prime * result + ((source == null) ? 0 : source.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + RequirementDataDefinition other = (RequirementDataDefinition) obj; + + String name = getUniqueId(); + String uniqueId = getUniqueId(); + String capability = getCapability(); + String node = getNode(); + String relationship = getRelationship(); + String ownerId = getOwnerId(); + String ownerName = getOwnerName(); + String minOccurrences = getMinOccurrences(); + String maxOccurrences = getMaxOccurrences(); + String leftOccurrences = getLeftOccurrences(); + List<String> path = this.getPath(); + String source = getSource(); + + if (capability == null) { + if (other.getCapability() != null) + return false; + } else if (!capability.equals(other.getCapability())) + return false; + if (name == null) { + if (other.getName() != null) + return false; + } else if (!name.equals(other.getName())) + return false; + if (node == null) { + if (other.getNode() != null) + return false; + } else if (!node.equals(other.getNode())) + return false; + if (ownerId == null) { + if (other.getOwnerId() != null) + return false; + } else if (!ownerId.equals(other.getOwnerId())) + return false; + if (ownerName == null) { + if (other.getOwnerName() != null) + return false; + } else if (!ownerName.equals(other.getOwnerName())) + return false; + if (relationship == null) { + if (other.getRelationship() != null) + return false; + } else if (!relationship.equals(other.getRelationship())) + return false; + if (uniqueId == null) { + if (other.getUniqueId() != null) + return false; + } else if (!uniqueId.equals(other.getUniqueId())) + return false; + if (minOccurrences == null) { + if (other.getMinOccurrences() != null) + return false; + } else if (!minOccurrences.equals(other.getMinOccurrences())) + return false; + if (maxOccurrences == null) { + if (other.getMaxOccurrences() != null) + return false; + } else if (!maxOccurrences.equals(other.getMaxOccurrences())) + return false; + if (leftOccurrences == null) { + if (other.getLeftOccurrences() != null) + return false; + } else if (!leftOccurrences.equals(other.getLeftOccurrences())) + return false; + if (path == null) { + if (other.getPath() != null) + return false; + } else if (!path.equals(other.getPath())) + return false; + if (source == null) { + if (other.getSource() != null) + return false; + } else if (!source.equals(other.getSource())) + return false; + return true; + } + + @Override + public String toString() { + String name = getUniqueId(); + String uniqueId = getUniqueId(); + String capability = getCapability(); + String node = getNode(); + String relationship = getRelationship(); + String ownerId = getOwnerId(); + String ownerName = getOwnerName(); + String minOccurrences = getMinOccurrences(); + String maxOccurrences = getMaxOccurrences(); + String leftOccurrences = getLeftOccurrences(); + List<String> path = this.getPath(); + String source = getSource(); + + return "RequirementDefinition [uniqueId=" + uniqueId + ", name=" + name + ", capability=" + capability + ", node=" + node + ", relationship=" + relationship + ", ownerId=" + ownerId + ", ownerName=" + ownerName + ", minOccurrences=" + + minOccurrences + ", maxOccurrences=" + maxOccurrences + ",leftOccurrences=" + leftOccurrences + ", path=" + path + ", source=" + source + "]"; + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java index 3845a706b1..bc24efa411 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java @@ -21,34 +21,44 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; +import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; + /** * Schema allows to create new types that can be used along TOSCA definitions. */ -public class SchemaDefinition implements Serializable { +public class SchemaDefinition extends ToscaDataDefinition 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() { + super(); } public SchemaDefinition(String derivedFrom, List<String> constraints, Map<String, PropertyDataDefinition> properties) { - this.derivedFrom = derivedFrom; - this.constraints = constraints; - this.properties = properties; + super(); + + this.setDerivedFrom(derivedFrom); + this.setConstraints( constraints); + this.setProperties( properties); + } public String getDerivedFrom() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java new file mode 100644 index 0000000000..78261ff07a --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentFieldsEnum.java @@ -0,0 +1,51 @@ +package org.openecomp.sdc.be.datatypes.enums; + +public enum ComponentFieldsEnum { + + PROPERTIES("properties"), + INPUTS("inputs"), + USERS("users"), + GROUPS("groups"), + COMPONENT_INSTANCES("componentInstances"), + COMPONENT_INSTANCES_PROPERTIES("componentInstancesProperties"), + CAPABILITIES("capabilities"), + REQUIREMENTS("requirements"), + ALL_VERSIONS("allVersions"), + ADDITIONAL_INFORMATION("additionalInformation"), + ARTIFACTS("artifacts"), + INTERFACES("interfaces"), + DERIVED_FROM("derivedFrom"), + ATTRIBUTES("attributes"), + COMPONENT_INSTANCES_ATTRIBUTES("componentInstancesAttributes"), + COMPONENT_INSTANCE_INPUTS("componentInstancesInputs"), + COMPONENT_INSTANCE_RELATION("componentInstancesRelations"), + DEPLOYMENT_ARTIFACTS("deploymentArtifacts"), + TOSCA_ARTIFACTS("toscaArtifacts"), + SERVICE_API_ARTIFACTS("serviceApiArtifacts"), + METADATA("metadata"), + CATEGORIES("categories"), + INSTANCE_CAPABILTY_PROPERTIES("instanceCapabiltyProperties"); + + + private String value; + + private ComponentFieldsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + + public static ComponentFieldsEnum findByValue(String value) { + ComponentFieldsEnum ret = null; + for (ComponentFieldsEnum curr : ComponentFieldsEnum.values()) { + if (curr.getValue().equals(value)) { + ret = curr; + return ret; + } + } + 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 index 9da0b81d3b..dbaab71c53 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java @@ -21,7 +21,11 @@ package org.openecomp.sdc.be.datatypes.enums; public enum ComponentTypeEnum { - RESOURCE("Resource"), SERVICE("Service"), RESOURCE_INSTANCE("Resource Instance"), PRODUCT("Product"), SERVICE_INSTANCE("Service Instance"); + RESOURCE("Resource"), + SERVICE("Service"), + RESOURCE_INSTANCE("Resource Instance"), + PRODUCT("Product"), + SERVICE_INSTANCE("Service Instance"); private String value; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java index bf8ae79467..38d297a893 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.stream.Collectors; public enum FilterKeyEnum { - SUB_CATEGORY("subCategory"), CATEGORY("category"), DISTRIBUTION_STATUS("distributionStatus"); + RESOURCE_TYPE("resourceType"), SUB_CATEGORY("subCategory"), CATEGORY("category"), DISTRIBUTION_STATUS("distributionStatus"), NAME_FRAGMENT("nameFragment"); private String name; @@ -44,9 +44,9 @@ public enum FilterKeyEnum { public static List<String> getValidFiltersByAssetType(ComponentTypeEnum assetType) { switch (assetType) { case RESOURCE: - return getAllFilters().subList(0, 2); + return getAllFilters().subList(0, 3); case SERVICE: - return getAllFilters().subList(1, 3); + return getAllFilters().subList(2, 4); default: return null; } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java new file mode 100644 index 0000000000..5a7b2d40f3 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java @@ -0,0 +1,103 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import java.util.ArrayList; +import java.util.List; + + + +public enum GraphPropertyEnum { +// field name class type unique indexed +// stored in graph index + UNIQUE_ID ("uid", String.class, true, true), + LABEL ("nodeLabel", String.class, false, true), + JSON ("json", String.class, false, false), + METADATA ("metadata", String.class, false, false), + VERSION ("version", String.class, false, true), + STATE ("state", String.class, false, true), + IS_HIGHEST_VERSION ("highestVersion", Boolean.class, false, true), + IS_DELETED ("deleted", Boolean.class, false, true), + NORMALIZED_NAME ("normalizedName", String.class, false, true), + NAME ("name", String.class, false, true), + TOSCA_RESOURCE_NAME ("toscaResourceName", String.class, false, true), + DISTRIBUTION_STATUS ("distributionStatus", String.class, false, false), + RESOURCE_TYPE ("resourceType", String.class, false, true), + COMPONENT_TYPE ("componentType", String.class, false, true), + UUID ("uuid", String.class, false, true), + SYSTEM_NAME ("systemName", String.class, false, true), + IS_ABSTRACT ("abstract", Boolean.class, false, true), + INVARIANT_UUID ("invariantUuid", String.class, false, true), + CSAR_UUID ("csarUuid", String.class, false, true), + //used for user (old format, no json for users) + USERID ("userId", String.class, true, true), + ROLE ("role", String.class, false, false), + FIRST_NAME ("firstName", String.class, false, false), + LAST_NAME ("lastName", String.class, false, false), + EMAIL ("email", String.class, false, false), + LAST_LOGIN_TIME ("lastLoginTime", Long.class, false, false), + //used for category (old format, no json for categories) + ICONS ("icons", String.class, false, false); + + private String property; + private Class clazz; + private boolean unique; + private boolean indexed; + + GraphPropertyEnum(String property, Class clazz, boolean unique, boolean indexed) { + this.property = property; + this.clazz = clazz; + this.unique = unique; + this.indexed = indexed; + } + + public static GraphPropertyEnum getByProperty(String property){ + for(GraphPropertyEnum currProperty :GraphPropertyEnum.values()){ + if(currProperty.getProperty().equals(property)){ + return currProperty; + } + } + return null; + } + + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + public Class getClazz() { + return clazz; + } + + public void setClazz(Class clazz) { + this.clazz = clazz; + } + + public boolean isUnique() { + return unique; + } + + public void setUnique(boolean unique) { + this.unique = unique; + } + + public boolean isIndexed() { + return indexed; + } + + public void setIndexed(boolean indexed) { + this.indexed = indexed; + } + + public static List<String> getAllProperties() { + + List<String> arrayList = new ArrayList<String>(); + + for (GraphPropertyEnum graphProperty : GraphPropertyEnum.values()) { + arrayList.add(graphProperty.getProperty()); + } + + return arrayList; + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java new file mode 100644 index 0000000000..6004e65949 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java @@ -0,0 +1,192 @@ +package org.openecomp.sdc.be.datatypes.enums; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonValue; + + +//@JsonDeserialize(using = MyDeserializer.class) + +public enum JsonPresentationFields { + UNIQUE_ID ("uniqueId", GraphPropertyEnum.UNIQUE_ID), + HIGHEST_VERSION ("highestVersion", GraphPropertyEnum.IS_HIGHEST_VERSION), + LIFECYCLE_STATE ("lifecycleState", GraphPropertyEnum.STATE), + CREATION_DATE ("creationDate", null), + LAST_UPDATE_DATE ("lastUpdateDate", null), + SYSTEM_NAME ("systemName", GraphPropertyEnum.SYSTEM_NAME), + NAME ("name", GraphPropertyEnum.NAME), + VERSION ("version", GraphPropertyEnum.VERSION), + NORMALIZED_NAME ("normalizedName", GraphPropertyEnum.NORMALIZED_NAME), + UUID ("UUID", GraphPropertyEnum.UUID), + RESOURCE_TYPE ("resourceType", GraphPropertyEnum.RESOURCE_TYPE), + COMPONENT_TYPE ("componentType", GraphPropertyEnum.COMPONENT_TYPE), + IS_DELETED ("isDeleted", GraphPropertyEnum.IS_DELETED), + ECOMP_GENERATED_NAMING ("ecompGeneratedNaming", null), + NAMING_POLICY ("namingPolicy", null), + TOSCA_RESOURCE_NAME ("toscaResourceName", GraphPropertyEnum.TOSCA_RESOURCE_NAME), + DESCRIPTION ("description", null), + TYPE ("type", null), + DERIVED_FROM ("derivedFrom", null), + VENDOR_NAME ("vendorName", null), + VENDOR_RELEASE ("vendorRelease", null), + CONFORMANCE_LEVEL ("conformanceLevel", null), + ICON ("icon", null), + TAGS ("tags", null), + INVARIANT_UUID ("invariantUuid", GraphPropertyEnum.INVARIANT_UUID), + CSAR_UUID ("csarUuid", GraphPropertyEnum.CSAR_UUID), + CSAR_VERSION ("csarVersion", null), + IMPORTED_TOSCA_CHECKSUM ("importedToscaChecksum", null), + CONTACT_ID ("contactId", null), + PROJECT_CODE ("projectCode", null), + DISTRIBUTION_STATUS ("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS), + DERIVED_FROM_GENERIC_TYPE("derivedFromGenericType", null), + DERIVED_FROM_GENERIC_VERSION("derivedFromGenericVersion", null), + + ////Artifact + ARTIFACT_TYPE ("artifactType", null), + ARTIFACT_REF ("artifactRef", null), + ARTIFACT_REPOSITORY ("artifactRepository", null), + ARTIFACT_CHECKSUM ("artifactChecksum", null), + ARTIFACT_CREATOR ("artifactCreator", null), + USER_ID_CREATOR ("userIdCreator", null), + USER_ID_LAST_UPDATER ("userIdLastUpdater", null), + CREATOR_FULL_NAME ("creatorFullName", null), + UPDATER_FULL_NAME ("updaterFullName", null), + + ES_ID ("esId", null), + ARTIFACT_LABEL ("artifactLabel", null), + IS_ABSTRACT ("mandatory", null), + ARTIFACT_DISPLAY_NAME ("artifactDisplayName", null), + API_URL ("apiUrl", null), + SERVICE_API ("serviceApi", null), + ARTIFACT_VERSION ("artifactVersion", null), + ARTIFACT_UUID ("artifactUUID", null), + PAYLOAD_UPDATE_DATE ("payloadUpdateDate", null), + HEAT_PARAMS_UPDATE_DATE ("heatParamsUpdateDate", null), + GENERATED ("generated", null), + ARTIFACT_GROUP_TYPE ("artifactGroupType", null), + ARTIFACT_TIMEOUT ("timeout", null), + REQUIRED_ARTIFACTS ("requiredArtifacts", null), + DUPLICATED ("duplicated", null), + HEAT_PARAMETERS ("heatParameters", null), + GENERATED_FROM_ID ("generatedFromId", null), + + + // end artifacts + + + //property + DEFINITION ("definition", null), + DEFAULT_VALUE ("defaultValue", null), + REQUIRED ("required", null), + PASSWORD ("password", null), + CONSTRAINTS ("constraints", null), + PROPERTIES ("properties", null), + PROPERTY ("property", null), + SCHEMA ("schema", null), + VALUE ("value", null), + PARENT_UNIQUE_ID ("parentUniqueId", null), + + COMPONENT_INSTANCES ("componentInstances", null), + RELATIONS ("relations", null), + + + //capability + VALID_SOURCE_TYPE ("validSourceTypes", null), + CREATION_TIME ("creationTime", null), + MODIFICATION_TIME ("modificationTime", null), + CAPABILITY_SOURCES ("capabilitySources", null), + MAX_OCCURRENCES ("maxOccurrences", null), + MIN_OCCURRENCES ("minOccurrences", null), + OWNER_NAME ("ownerName", null), + OWNER_ID ("ownerId", null), + LEFT_OCCURRENCES ("leftOccurences", null), + CAPABILITY_ID ("capabiltyId", null), + PATH ("path", null), + SOURCE ("source", null), + + //Requirement + CAPAPILITY ("capability", null), + NODE ("node", null), + RELATIONSHIP ("relationship", null), + VALID_SOURCE_TYPES ("validSourceTypes", null), + REQUIREMENT_ID ("requirementId", null), + + //Relation + CAPABILTY_OWNER_ID ("capabilityOwnerId", null), + REQUIREMENT_OWNER_ID ("requirementOwnerId", null), + FROM_ID ("fromId", null), + TO_ID ("toId", null), + REQUIREMENT ("requirement", null), + + //Groups + + GROUP_INVARIANT_UUID ("invariantUUID", null), + GROUP_UUID ("groupUUID", null), + GROUP_MEMBER ("members", null), + GROUP_ARTIFACTS ("artifacts", null), + GROUP_ARTIFACTS_UUID (" artifactsUuid", null), + GROUP_PROPERTIES (" properties", null), + GROUP_UNIQUE_ID (" groupUid", null), + POS_X (" posX", null), + POS_Y (" posY", null), + PROPERTY_VALUE_COUNTER (" propertyValueCounter", null), + CUSTOMIZATION_UUID (" customizationUUID", null), + GROUP_NAME (" groupName", null), + GROUP_INSTANCE_ARTIFACTS (" groupInstanceArtifacts", null), + GROUP_INSTANCE_ARTIFACTS_UUID (" groupInstanceArtifactsUuid", null), + GROUP_INSTANCE_PROPERTIES (" groupInstancesProperties", null), + + ; + + + private String presentation; + private GraphPropertyEnum storedAs; + + JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) { + this.presentation = presentation; + this.storedAs = storedAs; + } + + @JsonValue + public String getPresentation() { + return presentation; + } + + public void setPresentation(String presentation) { + this.presentation = presentation; + } + + public GraphPropertyEnum getStoredAs() { + return storedAs; + } + + public void setStoredAs(GraphPropertyEnum storedAs) { + this.storedAs = storedAs; + } + + public static String getPresentationByGraphProperty(GraphPropertyEnum property) { + for(JsonPresentationFields currPresentation : JsonPresentationFields.values()){ + if(currPresentation.getStoredAs() == property){ + return currPresentation.getPresentation(); + } + } + return null; + } + + @Override + public String toString() { + // TODO Auto-generated method stub + return presentation; + } + + @JsonCreator + public static JsonPresentationFields getByPresentation(String presentation) { + for (JsonPresentationFields inst : JsonPresentationFields.values()) { + if (inst.getPresentation().equals(presentation)) { + return inst; + } + } + return null; + } + +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java index 2938b4576a..a2ca46cff4 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/NodeTypeEnum.java @@ -60,7 +60,8 @@ public enum NodeTypeEnum { PolicyType("policyType"), Group("group"), UserFunctionalMenu("userFunctionalMenu"), - Input("input"); + Input("input"), + GroupInstance("groupInstance"), ; private String name; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java index 14b3e4ef86..0d837762e2 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java @@ -23,10 +23,11 @@ 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), + 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); + VL("VL", "VL (Virtual Link)", "resource instance", ComponentTypeEnum.RESOURCE), + VFCMT("VFCMT", "VFCMT (VFC Monitoring Template)", "resource instance", ComponentTypeEnum.RESOURCE); private String value; private String displayValue; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java index 7864a2cf5f..d3652c238f 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ResourceTypeEnum.java @@ -20,14 +20,17 @@ package org.openecomp.sdc.be.datatypes.enums; +/** + * Resource Type Enum + * @author mshitrit + * + */ public enum ResourceTypeEnum { - VFC("VFC (Virtual Function Component)"), - VF("VF"/* (Virtual Function)" */), - CP("CP (Connection Point)"), - VL("VL (Virtual Link)"); + VFC("VFC (Virtual Function Component)"), VF("VF"/* (Virtual Function)" */), CP("CP (Connection Point)"), + VL( "VL (Virtual Link)"), VFCMT("VFCMT (VFC Monitoring Template)"), ABSTRACT("Abstract (Generic VFC/VF/Service Type)"); - String value; + private String value; private ResourceTypeEnum(String value) { this.value = value; @@ -36,8 +39,43 @@ public enum ResourceTypeEnum { public String getValue() { return value; } - - public static boolean contains(String type) { + + public static ResourceTypeEnum getType(String type) { + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().equals(type)) { + return e; + } + } + return null; + } + + public static ResourceTypeEnum getTypeByName(String type) { + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().equalsIgnoreCase(type)) { + return e; + } + } + return null; + } +/** + * Returns ResourceTypeEnum matching to received String ignore case + * @param type + * @return + */ + public static ResourceTypeEnum getTypeIgnoreCase(String type) { + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().toLowerCase().equals(type.toLowerCase())) { + return e; + } + } + return null; + } + /** + * Checks if enum exist with given type + * @param type + * @return + */ + public static boolean containsName(String type) { for (ResourceTypeEnum e : ResourceTypeEnum.values()) { if (e.name().equals(type)) { @@ -46,4 +84,18 @@ public enum ResourceTypeEnum { } return false; } + /** + * Checks if enum exist with given type ignare case + * @param type + * @return + */ + public static boolean containsIgnoreCase(String type) { + + for (ResourceTypeEnum e : ResourceTypeEnum.values()) { + if (e.name().toLowerCase().equals(type.toLowerCase())) { + return true; + } + } + return false; + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java new file mode 100644 index 0000000000..d0f480b588 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java @@ -0,0 +1,50 @@ +package org.openecomp.sdc.be.datatypes.tosca; + +import java.util.HashMap; +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonValue; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; + +public abstract class ToscaDataDefinition { + + protected Map<String, Object> toscaPresentation; + + + public ToscaDataDefinition(){ + toscaPresentation = new HashMap<String, Object>(); + } + @JsonCreator + public ToscaDataDefinition(Map<String, Object> art){ + toscaPresentation = art; + } + @JsonValue + public Object getToscaPresentationValue(JsonPresentationFields name) { + if (toscaPresentation != null && toscaPresentation.containsKey(name.getPresentation())) { + return toscaPresentation.get(name.getPresentation()); + } + return null; + } + + public void setToscaPresentationValue(JsonPresentationFields name, Object value) { + if (toscaPresentation == null && value !=null) { + toscaPresentation = new HashMap<String, Object>(); + } + toscaPresentation.put(name.getPresentation(), value); + + } + public void setOwnerIdIfEmpty(String ownerId){ + if ( getOwnerId() == null ){ + setOwnerId(ownerId); + } + } + public void setOwnerId(String ownerId){ + setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); + } + + public String getOwnerId(){ + return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); + } +} diff --git a/common-be/src/main/java/org/openecomp/sdc/be/utils/CommonBeUtils.java b/common-be/src/main/java/org/openecomp/sdc/be/utils/CommonBeUtils.java index 54a55811e3..8ad45a31f1 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/utils/CommonBeUtils.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/utils/CommonBeUtils.java @@ -24,19 +24,15 @@ 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. + * 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> + * 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("\\."); @@ -54,6 +50,39 @@ public class CommonBeUtils { } } + + /** + * Compares two version strings. + * + * Use this instead of String.compareTo() for a non-lexicographical + * comparison that works for version strings. e.g. "1.10".compareTo("1.6"). + * + * @note It does not work if "1.10" is supposed to be equal to "1.10.0". + * + * @param str1 a string of ordinal numbers separated by decimal points. + * @param str2 a string of ordinal numbers separated by decimal points. + * @return The result is a negative integer if str1 is _numerically_ less than str2. + * The result is a positive integer if str1 is _numerically_ greater than str2. + * The result is zero if the strings are _numerically_ equal. + */ + public static int conformanceLevelCompare(String str1, String str2) { + String[] vals1 = str1.split("\\."); + String[] vals2 = str2.split("\\."); + int i = 0; + // set index to first non-equal ordinal or length of shortest version string + while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) { + i++; + } + // compare first non-equal ordinal number + if (i < vals1.length && i < vals2.length) { + int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i])); + return Integer.signum(diff); + } + // the strings are equal or one string is a substring of the other + // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" + return Integer.signum(vals1.length - vals2.length); + } + public static String generateToscaResourceName(String resourceType, String resourceSystemName) { return Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX + resourceType.toLowerCase() + "." + resourceSystemName; } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java b/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java index 83be4b2ee5..9fb81d0e12 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/workers/Worker.java @@ -63,7 +63,7 @@ public class Worker<T extends Job<E>, E> implements Runnable { } 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); + log.debug("worker: {} nothing to do stoping", workerName,e); } } |