From 1f7c57414533b9886962ede7b19a29669fe7a59a Mon Sep 17 00:00:00 2001 From: mojahidi Date: Fri, 1 Mar 2019 17:50:15 +0530 Subject: Requirement and capabilities feature 1. Enhance Service/VF/PNF to support Req & Cap 2. Added Type fetch APIs to fetch types from global types Change-Id: I2b749ec9da34e488421b8ebe311ccf03c4b7c0fd Issue-ID: SDC-2142 Signed-off-by: mojahidi --- .../sdc/be/datatypes/elements/CapabilityDataDefinition.java | 2 +- .../datatypes/elements/RelationshipInstDataDefinition.java | 13 +++++++++++-- .../be/datatypes/elements/RequirementDataDefinition.java | 6 +++--- .../sdc/be/datatypes/enums/JsonPresentationFields.java | 3 ++- 4 files changed, 17 insertions(+), 7 deletions(-) (limited to 'common-be/src/main/java/org') diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java index fdd1386e48..2612e6f888 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java @@ -32,7 +32,7 @@ import java.util.List; */ public class CapabilityDataDefinition extends ToscaDataDefinition { - public static final String MIN_OCCURRENCES = "1"; + public static final String MIN_OCCURRENCES = "0"; public static final String MAX_OCCURRENCES = "UNBOUNDED"; /** diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java index 72d9c36bf6..2f995fd844 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RelationshipInstDataDefinition.java @@ -32,6 +32,7 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { this.setDescription(cdt.getDescription()); this.setType(cdt.getType()); this.setValidSourceTypes(cdt.getValidSourceTypes()); + this.setValidTargetTypes(cdt.getValidTargetTypes()); this.setVersion(cdt.getVersion()); this.setOriginUI(cdt.isOriginUI()); this.setCreationTime(cdt.getCreationTime()); @@ -54,11 +55,11 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { return (String) getToscaPresentationValue(JsonPresentationFields.REQUIREMENT); } public void setCapability(String capability) { - setToscaPresentationValue(JsonPresentationFields.CAPAPILITY, capability); + setToscaPresentationValue(JsonPresentationFields.CAPABILITY, capability); } public String getCapability() { - return (String) getToscaPresentationValue(JsonPresentationFields.CAPAPILITY); + return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY); } public void setToId(Object toId) { setToscaPresentationValue(JsonPresentationFields.TO_ID, toId); @@ -144,6 +145,14 @@ public class RelationshipInstDataDefinition extends ToscaDataDefinition { setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPES, validSourceTypes); } + public List getValidTargetTypes() { + return (List) getToscaPresentationValue(JsonPresentationFields.VALID_TARGET_TYPES); + } + + public void setValidTargetTypes(List validTargetTypes) { + setToscaPresentationValue(JsonPresentationFields.VALID_TARGET_TYPES, validTargetTypes); + } + public String getVersion() { return (String) getToscaPresentationValue(JsonPresentationFields.VERSION); } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java index 4ede93eaa6..0df5ba500d 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java @@ -31,7 +31,7 @@ import java.util.List; */ public class RequirementDataDefinition extends ToscaDataDefinition { - public static final String MIN_OCCURRENCES = "1"; + public static final String MIN_OCCURRENCES = "0"; public static final String MAX_OCCURRENCES = "UNBOUNDED"; public static final String MAX_DEFAULT_OCCURRENCES = "1"; @@ -107,11 +107,11 @@ public class RequirementDataDefinition extends ToscaDataDefinition { */ public String getCapability() { - return (String) getToscaPresentationValue(JsonPresentationFields.CAPAPILITY); + return (String) getToscaPresentationValue(JsonPresentationFields.CAPABILITY); } public void setCapability(String capability) { - setToscaPresentationValue(JsonPresentationFields.CAPAPILITY, capability); + setToscaPresentationValue(JsonPresentationFields.CAPABILITY, capability); } /** 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 7a4c3d4af7..a72984ab7d 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 @@ -129,10 +129,11 @@ public enum JsonPresentationFields { SOURCE("source", null), //Requirement - CAPAPILITY("capability", null), + CAPABILITY("capability", null), NODE("node", null), RELATIONSHIP("relationship", null), VALID_SOURCE_TYPES("validSourceTypes", null), + VALID_TARGET_TYPES("validTargetTypes", null), REQUIREMENT_ID("requirementId", null), PARENT_NAME("parentName", null), PREVIOUS_NAME("previousName", null), -- cgit 1.2.3-korg