summaryrefslogtreecommitdiffstats
path: root/common-be/src
diff options
context:
space:
mode:
Diffstat (limited to 'common-be/src')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java88
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java91
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationInputDefinition.java44
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java8
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java24
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinitionTest.java30
6 files changed, 155 insertions, 130 deletions
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<String, OperationDataDefinition> operations = new HashMap<String, OperationDataDefinition>();
-
+ @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<String, OperationDataDefinition> getOperations() {
- return operations;
+
+ public Map<String, OperationDataDefinition> getOperations() {
+ return (Map<String, OperationDataDefinition>)
+ getToscaPresentationValue(JsonPresentationFields.INTERFACE_OPERATION);
}
public void setOperations(Map<String, OperationDataDefinition> 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<String, PropertyDataDefinition> 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<OperationInputDefinition> getInputs() {
+ return (ListDataDefinition<OperationInputDefinition>)
+ getToscaPresentationValue(JsonPresentationFields.OPERATION_INPUT);
+ }
+
+ public void setInputs(ListDataDefinition<OperationInputDefinition> inputs) {
+ setToscaPresentationValue(JsonPresentationFields.OPERATION_INPUT,inputs);
}
- public Map<String, PropertyDataDefinition> getInputs() {
- return inputs;
+ public String getName() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.NAME);
}
- public void setInputs(Map<String, PropertyDataDefinition> 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)
;
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java
index 9681ee0e22..1bf03b15dd 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java
@@ -11,7 +11,7 @@ public class InterfaceDataDefinitionTest {
return new InterfaceDataDefinition();
}
-
+
@Test
public void testGetUniqueId() throws Exception {
InterfaceDataDefinition testSubject;
@@ -22,7 +22,7 @@ public class InterfaceDataDefinitionTest {
result = testSubject.getUniqueId();
}
-
+
@Test
public void testSetUniqueId() throws Exception {
InterfaceDataDefinition testSubject;
@@ -33,7 +33,7 @@ public class InterfaceDataDefinitionTest {
testSubject.setUniqueId(uniqueId);
}
-
+
@Test
public void testGetType() throws Exception {
InterfaceDataDefinition testSubject;
@@ -44,7 +44,7 @@ public class InterfaceDataDefinitionTest {
result = testSubject.getType();
}
-
+
@Test
public void testSetType() throws Exception {
InterfaceDataDefinition testSubject;
@@ -55,7 +55,7 @@ public class InterfaceDataDefinitionTest {
testSubject.setType(type);
}
-
+
@Test
public void testGetCreationDate() throws Exception {
InterfaceDataDefinition testSubject;
@@ -66,7 +66,7 @@ public class InterfaceDataDefinitionTest {
result = testSubject.getCreationDate();
}
-
+
@Test
public void testSetCreationDate() throws Exception {
InterfaceDataDefinition testSubject;
@@ -77,7 +77,7 @@ public class InterfaceDataDefinitionTest {
testSubject.setCreationDate(creationDate);
}
-
+
@Test
public void testGetLastUpdateDate() throws Exception {
InterfaceDataDefinition testSubject;
@@ -88,7 +88,7 @@ public class InterfaceDataDefinitionTest {
result = testSubject.getLastUpdateDate();
}
-
+
@Test
public void testSetLastUpdateDate() throws Exception {
InterfaceDataDefinition testSubject;
@@ -99,7 +99,7 @@ public class InterfaceDataDefinitionTest {
testSubject.setLastUpdateDate(lastUpdateDate);
}
-
+
@Test
public void testGetDescription() throws Exception {
InterfaceDataDefinition testSubject;
@@ -110,7 +110,7 @@ public class InterfaceDataDefinitionTest {
result = testSubject.getDescription();
}
-
+
@Test
public void testSetDescription() throws Exception {
InterfaceDataDefinition testSubject;
@@ -121,7 +121,7 @@ public class InterfaceDataDefinitionTest {
testSubject.setDescription(description);
}
-
+
@Test
public void testGetOperations() throws Exception {
InterfaceDataDefinition testSubject;
@@ -132,7 +132,7 @@ public class InterfaceDataDefinitionTest {
result = testSubject.getOperations();
}
-
+
@Test
public void testSetOperations() throws Exception {
InterfaceDataDefinition testSubject;
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinitionTest.java
index dc31a73c7c..59fd79b731 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinitionTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinitionTest.java
@@ -1,7 +1,5 @@
package org.openecomp.sdc.be.datatypes.elements;
-import java.util.Map;
-
import org.junit.Test;
@@ -11,7 +9,7 @@ public class OperationDataDefinitionTest {
return new OperationDataDefinition();
}
-
+
@Test
public void testGetUniqueId() throws Exception {
OperationDataDefinition testSubject;
@@ -22,7 +20,7 @@ public class OperationDataDefinitionTest {
result = testSubject.getUniqueId();
}
-
+
@Test
public void testSetUniqueId() throws Exception {
OperationDataDefinition testSubject;
@@ -33,7 +31,7 @@ public class OperationDataDefinitionTest {
testSubject.setUniqueId(uniqueId);
}
-
+
@Test
public void testGetCreationDate() throws Exception {
OperationDataDefinition testSubject;
@@ -44,7 +42,7 @@ public class OperationDataDefinitionTest {
result = testSubject.getCreationDate();
}
-
+
@Test
public void testSetCreationDate() throws Exception {
OperationDataDefinition testSubject;
@@ -55,7 +53,7 @@ public class OperationDataDefinitionTest {
testSubject.setCreationDate(creationDate);
}
-
+
@Test
public void testGetLastUpdateDate() throws Exception {
OperationDataDefinition testSubject;
@@ -66,7 +64,7 @@ public class OperationDataDefinitionTest {
result = testSubject.getLastUpdateDate();
}
-
+
@Test
public void testSetLastUpdateDate() throws Exception {
OperationDataDefinition testSubject;
@@ -77,7 +75,7 @@ public class OperationDataDefinitionTest {
testSubject.setLastUpdateDate(lastUpdateDate);
}
-
+
@Test
public void testGetDescription() throws Exception {
OperationDataDefinition testSubject;
@@ -88,7 +86,7 @@ public class OperationDataDefinitionTest {
result = testSubject.getDescription();
}
-
+
@Test
public void testSetDescription() throws Exception {
OperationDataDefinition testSubject;
@@ -99,7 +97,7 @@ public class OperationDataDefinitionTest {
testSubject.setDescription(description);
}
-
+
@Test
public void testGetImplementation() throws Exception {
OperationDataDefinition testSubject;
@@ -110,7 +108,7 @@ public class OperationDataDefinitionTest {
result = testSubject.getImplementation();
}
-
+
@Test
public void testSetImplementation() throws Exception {
OperationDataDefinition testSubject;
@@ -121,22 +119,22 @@ public class OperationDataDefinitionTest {
testSubject.setImplementation(implementation);
}
-
+
@Test
public void testGetInputs() throws Exception {
OperationDataDefinition testSubject;
- Map<String, PropertyDataDefinition> result;
+ ListDataDefinition<OperationInputDefinition> result;
// default test
testSubject = createTestSubject();
result = testSubject.getInputs();
}
-
+
@Test
public void testSetInputs() throws Exception {
OperationDataDefinition testSubject;
- Map<String, PropertyDataDefinition> inputs = null;
+ ListDataDefinition<OperationInputDefinition> inputs = null;
// default test
testSubject = createTestSubject();