From 700e84d56afcdf66c06b1980782be54d9e57fa3e Mon Sep 17 00:00:00 2001 From: shrek2000 Date: Mon, 12 Mar 2018 15:35:54 +0200 Subject: Interface workflow data model Data Model for Interface workflow operation task Change-Id: Idb28f83a878db3aadeaafe165b6b03bd1fb5fa44 Issue-ID: SDC-1052 Signed-off-by: shrek2000 --- .../elements/InterfaceDataDefinition.java | 88 ++++++++++----------- .../elements/OperationDataDefinition.java | 91 ++++++++++------------ .../elements/OperationInputDefinition.java | 44 +++++++++++ .../be/datatypes/enums/JsonPresentationFields.java | 8 +- 4 files changed, 129 insertions(+), 102 deletions(-) create mode 100644 common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java (limited to 'common-be/src/main') 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 7afae8a799..56f7103f8b 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 @@ -7,9 +7,9 @@ * 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. @@ -20,102 +20,92 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME; +import com.fasterxml.jackson.annotation.JsonCreator; import java.io.Serializable; 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 InterfaceDataDefinition extends ToscaDataDefinition implements Serializable { - /** - * - */ - private static final long serialVersionUID = 2208369368489725049L; - - private String type; - - private String description; - - private String uniqueId; - - /** - * Timestamp of the resource (artifact) creation - */ - private Long creationDate; - - /** - * Timestamp of the last resource (artifact) creation - */ - private Long lastUpdateDate; - /** - * Defines an operation available to manage particular aspects of the Node - * Type. - */ - private Map operations = new HashMap(); - + @JsonCreator public InterfaceDataDefinition() { super(); + setOperations(new HashMap<>()); } public InterfaceDataDefinition(String type, String description) { - super(); - this.type = type; - this.description = description; + this(); + setType(type); + setDescription(description); } public InterfaceDataDefinition(InterfaceDataDefinition p) { - this.uniqueId = p.uniqueId; - this.type = p.type; - this.description = p.description; - + setUniqueId(p.getUniqueId()); + setType(p.getType()); + setDescription(p.getDescription()); + setToscaResourceName(p.getToscaResourceName()); + setOperations(p.getOperations()); } 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 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; + return (Long) getToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE); } public void setLastUpdateDate(Long lastUpdateDate) { - this.lastUpdateDate = lastUpdateDate; + setToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate); } public String getDescription() { - return description; + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); } public void setDescription(String description) { - this.description = description; + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); } - public Map getOperations() { - return operations; + + public Map getOperations() { + return (Map) + getToscaPresentationValue(JsonPresentationFields.INTERFACE_OPERATION); } public void setOperations(Map operations) { - this.operations = operations; + setToscaPresentationValue(JsonPresentationFields.INTERFACE_OPERATION, operations); + } + + public String getToscaResourceName() { + return (String) getToscaPresentationValue(TOSCA_RESOURCE_NAME); + } + + public void setToscaResourceName(String toscaResourceName) { + setToscaPresentationValue(TOSCA_RESOURCE_NAME, toscaResourceName); } } 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 cb09411337..40b1f31eda 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 @@ -7,9 +7,9 @@ * 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. @@ -20,101 +20,88 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - +import com.fasterxml.jackson.annotation.JsonCreator; import java.io.Serializable; -import java.util.Map; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class OperationDataDefinition extends ToscaDataDefinition implements Serializable { - /** - * - */ - private static final long serialVersionUID = 1951516966187326915L; - - private String uniqueId; - - /** - * Timestamp of the resource (artifact) creation - */ - private Long creationDate; - - /** - * Timestamp of the last resource (artifact) creation - */ - private Long lastUpdateDate; - - /** Description of the operation. */ - private String description; - /** 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 inputs; + + @JsonCreator public OperationDataDefinition() { super(); } public OperationDataDefinition(String description) { super(); - this.description = description; + setDescription(description); } public OperationDataDefinition(OperationDataDefinition p) { - this.uniqueId = p.uniqueId; - this.description = p.description; - this.implementation = p.implementation; - this.inputs = p.inputs; + setDescription(p.getDescription()); + setImplementation(p.getImplementation()); + setInputs(p.getInputs()); + setName(p.getName()); + setUniqueId(p.getUniqueId()); } + 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 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; + return (Long) getToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE); } public void setLastUpdateDate(Long lastUpdateDate) { - this.lastUpdateDate = lastUpdateDate; + setToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate); } public String getDescription() { - return description; + return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION); } public void setDescription(String description) { - this.description = description; + setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description); } + public ArtifactDataDefinition getImplementation() { - return implementation; + return (ArtifactDataDefinition) getToscaPresentationValue(JsonPresentationFields.OPERATION_IMPLEMENTATION); } public void setImplementation(ArtifactDataDefinition implementation) { - this.implementation = implementation; + setToscaPresentationValue(JsonPresentationFields.OPERATION_IMPLEMENTATION, implementation); + } + + public ListDataDefinition getInputs() { + return (ListDataDefinition) + getToscaPresentationValue(JsonPresentationFields.OPERATION_INPUT); + } + + public void setInputs(ListDataDefinition inputs) { + setToscaPresentationValue(JsonPresentationFields.OPERATION_INPUT,inputs); } - public Map getInputs() { - return inputs; + public String getName() { + return (String) getToscaPresentationValue(JsonPresentationFields.NAME); } - public void setInputs(Map inputs) { - this.inputs = inputs; + public void setName(String name) { + setToscaPresentationValue(JsonPresentationFields.NAME, name); } } 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 new file mode 100644 index 0000000000..e18127dc2e --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java @@ -0,0 +1,44 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ +package org.openecomp.sdc.be.datatypes.elements; + + + +import com.fasterxml.jackson.annotation.JsonCreator; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; + + +public class OperationInputDefinition extends InputDataDefinition { + + @JsonCreator + public OperationInputDefinition() { + super(); + } + + public OperationInputDefinition(String name, InputDataDefinition inputDefinition) { + super(inputDefinition); + setName(name); + } + + public String getLabel() { + return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL); + } + + public void setLabel(String name) { + setToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL, name); + } + +} 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 083f8dd544..d0cb48efdd 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 @@ -202,7 +202,13 @@ public enum JsonPresentationFields { WO_INPUT_PARAMETERS ("inputParams",null), WO_OUTPUT_PARAMETERS ("outputParams",null), WO_PARAM_NAME("paramName", null), - WO_PARAM_ID("paramId", null) + WO_PARAM_ID("paramId", null), + + //Interface + INTERFACE ("interface", null), + INTERFACE_OPERATION ("operation", null), + OPERATION_IMPLEMENTATION("operationImplementation",null), + OPERATION_INPUT("operationInput",null) ; -- cgit 1.2.3-korg