aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2018-03-29 10:37:45 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-04-09 13:13:31 +0000
commit558d8d0d2d958ff3b18fb2f6e04cab14d8ff2da3 (patch)
tree16a103002fa9655a78c8be46d1e9eba1a114cb21 /catalog-be/src/main
parentad8669b1b40e199a4b39832d81203d16f720941c (diff)
Added new files requied for operation
Added new files requied for workflow operation Change-Id: I561185415a7e82aa75772c6c0b4b1a206b547699 Issue-ID: SDC-1060 Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java69
1 files changed, 69 insertions, 0 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
new file mode 100644
index 0000000000..7885ab1bd2
--- /dev/null
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java
@@ -0,0 +1,69 @@
+/*
+ * 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.datamodel.utils;
+
+import org.openecomp.sdc.be.datatypes.elements.InterfaceOperationDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.InterfaceOperationParamDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition;
+import org.openecomp.sdc.be.model.Operation;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class InterfaceUIDataConverter {
+
+ private InterfaceUIDataConverter () {
+
+ }
+ public static Operation convertInterfaceDataToOperationData(InterfaceOperationDataDefinition interfaceOperation){
+
+ ListDataDefinition<InterfaceOperationParamDataDefinition> inputParams = interfaceOperation.getInputParams();
+ ListDataDefinition<OperationInputDefinition> inputs = new ListDataDefinition<>();
+ if (inputParams != null) {
+ List<OperationInputDefinition> inputList = inputParams.getListToscaDataDefinition().stream()
+ .map(a -> new OperationInputDefinition(a.getParamName(), a.getParamId())).collect(Collectors.toList());
+ inputList.forEach(inputs::add);
+ }
+ Operation operationData = new Operation();
+ operationData.setDescription(interfaceOperation.getDescription());
+ operationData.setName(interfaceOperation.getOperationType());
+ operationData.setUniqueId(interfaceOperation.getUniqueId());
+ operationData.setInputs(inputs);
+
+ return operationData;
+ }
+
+ public static InterfaceOperationDataDefinition convertOperationDataToInterfaceData(Operation operationData){
+
+ ListDataDefinition<OperationInputDefinition> inputs = operationData.getInputs();
+ List<InterfaceOperationParamDataDefinition> inputParamList = inputs.getListToscaDataDefinition().stream().map(a -> new InterfaceOperationParamDataDefinition(a.getName(), a.getInputId())).collect(
+ Collectors.toList());
+ ListDataDefinition<InterfaceOperationParamDataDefinition> inputParams = new ListDataDefinition<>();
+ inputParamList.forEach(inputParams::add);
+
+ InterfaceOperationDataDefinition interfaceOperationDataDefinition = new InterfaceOperationDataDefinition();
+ interfaceOperationDataDefinition.setUniqueId(operationData.getUniqueId());
+ interfaceOperationDataDefinition.setOperationType(operationData.getName());
+ interfaceOperationDataDefinition.setDescription(operationData.getDescription());
+ interfaceOperationDataDefinition.setInputParams(inputParams);
+ interfaceOperationDataDefinition.setWorkflowId(operationData.getImplementation().getArtifactUUID());
+
+ return interfaceOperationDataDefinition;
+ }
+
+}