diff options
7 files changed, 81 insertions, 38 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java index 98a49b023d..f0cdf3ec70 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java @@ -37,16 +37,23 @@ public class InterfaceUIDataConverter { ListDataDefinition<OperationInputDefinition> inputs = new ListDataDefinition<>(); if (inputParams != null) { List<OperationInputDefinition> inputList = inputParams.getListToscaDataDefinition().stream() - .map(interfaceOperationParamDataDefinition -> new OperationInputDefinition(interfaceOperationParamDataDefinition.getParamName(), - interfaceOperationParamDataDefinition.getParamId())).collect(Collectors.toList()); + .map(interfaceOperationParamDataDefinition -> new OperationInputDefinition( + interfaceOperationParamDataDefinition.getName(), + interfaceOperationParamDataDefinition.getProperty(), + interfaceOperationParamDataDefinition.getMandatory(), + interfaceOperationParamDataDefinition.getType() + )).collect(Collectors.toList()); inputList.forEach(inputs::add); } ListDataDefinition<InterfaceOperationParamDataDefinition> outputParams = interfaceOperation.getOutputParams(); ListDataDefinition<OperationOutputDefinition> outputs = new ListDataDefinition<>(); if(outputParams != null) { List<OperationOutputDefinition> outputList = outputParams.getListToscaDataDefinition().stream() - .map(interfaceOperationParamDataDefinition -> new OperationOutputDefinition(interfaceOperationParamDataDefinition.getParamName(), - interfaceOperationParamDataDefinition.getParamId())).collect(Collectors.toList()); + .map(interfaceOperationParamDataDefinition -> new OperationOutputDefinition( + interfaceOperationParamDataDefinition.getName(), + interfaceOperationParamDataDefinition.getMandatory(), + interfaceOperationParamDataDefinition.getType() + )).collect(Collectors.toList()); outputList.forEach(outputs::add); } @@ -67,7 +74,9 @@ public class InterfaceUIDataConverter { ListDataDefinition<OperationInputDefinition> inputs = operationData.getInputs(); List<InterfaceOperationParamDataDefinition> inputParamList = inputs.getListToscaDataDefinition().stream() .map(operationInputDefinition -> new InterfaceOperationParamDataDefinition(operationInputDefinition.getName(), - operationInputDefinition.getInputId())).collect( + operationInputDefinition.getInputId(), + operationInputDefinition.isRequired(), + operationInputDefinition.getType())).collect( Collectors.toList()); ListDataDefinition<InterfaceOperationParamDataDefinition> inputParams = new ListDataDefinition<>(); inputParamList.forEach(inputParams::add); @@ -75,7 +84,8 @@ public class InterfaceUIDataConverter { ListDataDefinition<OperationOutputDefinition> outputs = operationData.getOutputs(); List<InterfaceOperationParamDataDefinition> outputParamList = outputs.getListToscaDataDefinition() .stream().map(operationOutputDefinition -> new InterfaceOperationParamDataDefinition(operationOutputDefinition.getName(), - operationOutputDefinition.getInputId())).collect(Collectors.toList()); + operationOutputDefinition.isRequired(), + operationOutputDefinition.getType())).collect(Collectors.toList()); ListDataDefinition<InterfaceOperationParamDataDefinition> outputParams = new ListDataDefinition<>(); outputParamList.forEach(outputParams::add); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java index 0044ffaf60..e2de5f0d64 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java @@ -21,8 +21,10 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import java.io.Serializable; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_PARAM_ID; -import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_PARAM_NAME; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_MANDATORY; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_PROPERTY; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_NAME; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_TYPE; public class InterfaceOperationParamDataDefinition extends ToscaDataDefinition implements Serializable { @@ -33,28 +35,53 @@ public class InterfaceOperationParamDataDefinition extends ToscaDataDefinition i public InterfaceOperationParamDataDefinition(InterfaceOperationParamDataDefinition iopdd) { super(); - setParamName(iopdd.getParamName()); - setParamId(iopdd.getParamId()); + setName(iopdd.getName()); + setProperty(iopdd.getProperty()); + setMandatory(iopdd.getMandatory()); + setType(iopdd.getType()); } - public InterfaceOperationParamDataDefinition(String paramName, String paramId) { + public InterfaceOperationParamDataDefinition(String paramName, String paramId, boolean mandatory, String type) { super(); - setParamName(paramName); - setParamId(paramId); + setName(paramName); + setProperty(paramId); + setMandatory(mandatory); + setType(type); } - public String getParamName() { - return (String) getToscaPresentationValue(IO_PARAM_NAME); + //used for OperationOutputDefinition + public InterfaceOperationParamDataDefinition(String paramName, boolean mandatory, String type) { + super(); + setName(paramName); + setMandatory(mandatory); + setType(type); + } + + public String getName() { + return (String) getToscaPresentationValue(IO_NAME); + } + public void setName(String paramName) { + setToscaPresentationValue(IO_NAME, paramName); } - public void setParamName(String paramName) { - setToscaPresentationValue(IO_PARAM_NAME, paramName); + + public String getProperty() { + return (String) getToscaPresentationValue(IO_PROPERTY); + } + public void setProperty(String paramId) { + setToscaPresentationValue(IO_PROPERTY, paramId); } - public String getParamId() { - return (String) getToscaPresentationValue(IO_PARAM_ID); + public Boolean getMandatory() { + return (Boolean) getToscaPresentationValue(IO_MANDATORY); } - public void setParamId(String paramId) { - setToscaPresentationValue(IO_PARAM_ID, paramId); + public void setMandatory(Boolean mandatory) { + setToscaPresentationValue(IO_MANDATORY, mandatory); } + public String getType() { + return (String) getToscaPresentationValue(IO_TYPE); + } + public void setType(String type) { + setToscaPresentationValue(IO_TYPE, type); + } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java index 0228492bb6..4c941574ae 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java @@ -33,10 +33,12 @@ public class OperationInputDefinition extends InputDataDefinition { setName(name); } - public OperationInputDefinition(String paramName, String paramId) { + public OperationInputDefinition(String paramName, String paramId, Boolean mandatory, String type) { super(); setName(paramName); setInputId(paramId); + setRequired(mandatory); + setType(type); } public String getLabel() { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationOutputDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationOutputDefinition.java index af046eaa17..82607d765d 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationOutputDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationOutputDefinition.java @@ -30,10 +30,11 @@ public class OperationOutputDefinition extends InputDataDefinition { super(definition); setName(name); } - public OperationOutputDefinition(String paramName, String paramId) { + public OperationOutputDefinition(String name, Boolean mandatory, String type) { super(); - setName(paramName); - setInputId(paramId); + setName(name); + setRequired(mandatory); + setType(type); } public String getLabel() { return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java index 912e3d94b1..689deec4c8 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 @@ -214,13 +214,16 @@ public enum JsonPresentationFields { ARCHIVE_TIME("archiveTime", GraphPropertyEnum.ARCHIVE_TIME), IS_VSP_ARCHIVED("isVspArchived", GraphPropertyEnum.IS_VSP_ARCHIVED), CI_IS_ORIGIN_ARCHIVED("isOriginArchived", null), - //Interface Operation - IO_OPERATION_TYPE("operationType",null), - IO_INPUT_PARAMETERS("inputParams",null), - IO_OUTPUT_PARAMETERS("outputParams",null), - IO_PARAM_NAME("paramName", null), - IO_PARAM_ID("paramId", null), - IO_WORKFLOW_ID("workflowId", null), + + //Interface Operation + IO_OPERATION_TYPE("operationType",null), + IO_INPUT_PARAMETERS("inputParams",null), + IO_OUTPUT_PARAMETERS("outputParams",null), + IO_NAME("name", null), + IO_MANDATORY("mandatory", null), + IO_TYPE("type", null), + IO_PROPERTY("property", null), + IO_WORKFLOW_ID("workflowId", null), IO_WORKFLOW_VERSION_ID("workflowVersionId", null), //Interface diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java index d4f3161ed7..e25adb3c2f 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java @@ -16,7 +16,7 @@ public class InterfaceOperationParamDataDefinitionTest { // default test testSubject = createTestSubject(); new InterfaceOperationParamDataDefinition(testSubject); - new InterfaceOperationParamDataDefinition("", ""); + new InterfaceOperationParamDataDefinition("", "",true, ""); } @Test @@ -26,7 +26,7 @@ public class InterfaceOperationParamDataDefinitionTest { // default test testSubject = createTestSubject(); - result = testSubject.getParamName(); + result = testSubject.getName(); } @Test @@ -36,7 +36,7 @@ public class InterfaceOperationParamDataDefinitionTest { // default test testSubject = createTestSubject(); - testSubject.setParamName(paramName); + testSubject.setName(paramName); } @Test @@ -46,7 +46,7 @@ public class InterfaceOperationParamDataDefinitionTest { // default test testSubject = createTestSubject(); - result = testSubject.getParamId(); + result = testSubject.getProperty(); } @Test @@ -56,6 +56,6 @@ public class InterfaceOperationParamDataDefinitionTest { // default test testSubject = createTestSubject(); - testSubject.setParamId(paramId); + testSubject.setProperty(paramId); } }
\ No newline at end of file diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinitionTest.java index 4dc0194f7b..533008ee9b 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinitionTest.java @@ -15,7 +15,7 @@ public class OperationInputDefinitionTest { // default test testSubject = createTestSubject(); - new OperationInputDefinition("", ""); + new OperationInputDefinition("", "", true, ""); new OperationInputDefinition("stam", testSubject); } |