aboutsummaryrefslogtreecommitdiffstats
path: root/common-be/src
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2020-12-15 16:12:59 +0000
committerMichael Morris <michael.morris@est.tech>2021-01-12 16:35:48 +0000
commit69779180f8f4e020606634f9bd8cac728daed2a2 (patch)
tree87167832f478509436365d07bd2e46a9c8970365 /common-be/src
parent1f4756dab7b29843a89fb42943ae3dc0ee8b1ae9 (diff)
Support for category specific metadata
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3412 Change-Id: I87392cc21dc25253b558bdc1d453d99659d049fa
Diffstat (limited to 'common-be/src')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/MetadataKeyDataDefinition.java44
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/SubCategoryDataDefinition.java105
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java5
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java1
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java4
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MetadataKeyEnum.java36
7 files changed, 104 insertions, 93 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 cf0117f74a..5758dbeaf5 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
@@ -40,6 +40,7 @@ public class CategoryDataDefinition extends ToscaDataDefinition {
private String uniqueId;
private List<String> icons;
private boolean useServiceSubstitutionForNestedServices = false;
+ private List<MetadataKeyDataDefinition> metadataKeys;
public CategoryDataDefinition(CategoryDataDefinition c) {
this.name = c.name;
@@ -47,6 +48,7 @@ public class CategoryDataDefinition extends ToscaDataDefinition {
this.uniqueId = c.uniqueId;
this.icons = c.icons;
this.useServiceSubstitutionForNestedServices = c.useServiceSubstitutionForNestedServices;
+ this.metadataKeys = c.metadataKeys;
}
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/MetadataKeyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/MetadataKeyDataDefinition.java
new file mode 100644
index 0000000000..4d8a197473
--- /dev/null
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/MetadataKeyDataDefinition.java
@@ -0,0 +1,44 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.be.datatypes.category;
+
+import java.util.List;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+
+@Getter
+@Setter
+@EqualsAndHashCode(callSuper = false)
+@ToString
+@NoArgsConstructor
+public class MetadataKeyDataDefinition extends ToscaDataDefinition {
+ private String name;
+ private List<String> validValues;
+ private boolean mandatory;
+
+ public MetadataKeyDataDefinition(MetadataKeyDataDefinition metadataKeyDataDefinition) {
+ this.name = metadataKeyDataDefinition.name;
+ this.validValues = metadataKeyDataDefinition.validValues;
+ this.mandatory = metadataKeyDataDefinition.mandatory;
+ }
+}
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 986f79fd4b..38d7027e49 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
@@ -21,113 +21,32 @@
package org.openecomp.sdc.be.datatypes.category;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
import java.util.List;
+@Getter
+@Setter
+@EqualsAndHashCode(callSuper = false)
+@ToString
+@NoArgsConstructor
public class SubCategoryDataDefinition extends ToscaDataDefinition {
private String name;
private String normalizedName;
private String uniqueId;
private List<String> icons;
-
- public SubCategoryDataDefinition() {
-
- }
+ private List<MetadataKeyDataDefinition> metadataKeys;
public SubCategoryDataDefinition(SubCategoryDataDefinition c) {
this.name = c.name;
this.normalizedName = c.normalizedName;
this.uniqueId = c.uniqueId;
this.icons = c.icons;
+ this.metadataKeys = c.metadataKeys;
}
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getNormalizedName() {
- return normalizedName;
- }
-
- public void setNormalizedName(String normalizedName) {
- this.normalizedName = normalizedName;
- }
-
- public String getUniqueId() {
- return uniqueId;
- }
-
- public void setUniqueId(String uniqueId) {
- this.uniqueId = uniqueId;
- }
-
- public List<String> getIcons() {
- return icons;
- }
-
- public void setIcons(List<String> icons) {
- this.icons = icons;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode());
- result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
- result = prime * result + ((icons == null) ? 0 : icons.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- SubCategoryDataDefinition other = (SubCategoryDataDefinition) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (normalizedName == null) {
- if (other.normalizedName != null) {
- return false;
- }
- } else if (!normalizedName.equals(other.normalizedName)) {
- return false;
- }
- if (uniqueId == null) {
- if (other.uniqueId != null) {
- return false;
- }
- } else if (!uniqueId.equals(other.uniqueId)) {
- return false;
- }
- if (icons == null) {
- return other.icons == null;
- } else {
- return icons.equals(other.icons);
- }
- }
-
- @Override
- public String toString() {
- return "SubCategoryDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId="
- + uniqueId + ", icons=" + icons + "]";
- }
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java
index e1d0d96d9a..96cccf62bb 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
@@ -131,6 +131,9 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
@Getter
@Setter
private Boolean isVspArchived = false;
+ @Getter
+ @Setter
+ private Map<String, String> categorySpecificMetadata;
public ComponentMetadataDataDefinition(ComponentMetadataDataDefinition other) {
this.uniqueId = other.getUniqueId();
@@ -157,6 +160,7 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
this.isArchived = other.isArchived;
this.isVspArchived = other.isVspArchived;
this.archiveTime = other.getArchiveTime();
+ this.categorySpecificMetadata = other.getCategorySpecificMetadata();
}
public ComponentMetadataDataDefinition(JsonPresentationFieldsExtractor extractor) {
@@ -245,4 +249,5 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
* @return
*/
public abstract String getActualComponentType();
+
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java
index 70f76030bd..44a0d23d1c 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java
@@ -54,6 +54,7 @@ public enum GraphPropertyEnum {
LAST_LOGIN_TIME("lastLoginTime", Long.class, false, false),
//used for category (old format, no json for categories)
ICONS("icons", String.class, false, false),
+ METADATA_KEYS("metadataKeys", String.class, false, false),
USE_SUBSTITUTION_FOR_NESTED_SERVICES("useServiceSubstitutionForNestedServices", Boolean.class, false, false),
DATA_TYPES("data_types", Map.class, false, false),
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
index 436f958893..34382df716 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
@@ -48,6 +48,10 @@ public enum JsonPresentationFields {
DERIVED_FROM("derivedFrom", null),
VENDOR_NAME("vendorName", null),
VENDOR_RELEASE("vendorRelease", null),
+ CATEGORY("category", null),
+ SUB_CATEGORY("subcategory", null),
+ RESOURCE_VENDOR("resourceVendor", null),
+ RESOURCE_VENDOR_RELEASE("resourceVendorRelease", null),
RESOURCE_VENDOR_MODEL_NUMBER("reourceVendorModelNumber", null),
SERVICE_TYPE("serviceType", null),
SERVICE_ROLE("serviceRole", null),
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MetadataKeyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MetadataKeyEnum.java
new file mode 100644
index 0000000000..0ed8eab720
--- /dev/null
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MetadataKeyEnum.java
@@ -0,0 +1,36 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.be.datatypes.enums;
+
+import lombok.Getter;
+
+public enum MetadataKeyEnum {
+ METADATA_KEYS("metadataKeys"),
+ NAME("name"),
+ MANDATORY("mandatory"),
+ VALID_VALUES("validValues");
+
+ @Getter
+ private final String name;
+
+ MetadataKeyEnum(final String name) {
+ this.name = name;
+ }
+
+}