Convert workflow json file 35/14535/2
authorLvbo163 <lv.bo163@zte.com.cn>
Fri, 22 Sep 2017 09:15:50 +0000 (17:15 +0800)
committerLvbo163 <lv.bo163@zte.com.cn>
Mon, 25 Sep 2017 01:13:31 +0000 (09:13 +0800)
Convert from json file to standard bpmn file

Issue-ID: SDC-366

Change-Id: I0fc021d9779b5ebd6650a95b21e376e6affcd8d1
Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
sdc-workflow-designer-server/pom.xml
sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java [new file with mode: 0644]

index a04b5c9..d28ff81 100644 (file)
@@ -1,20 +1,14 @@
 <?xml version="1.0"?>
 <!--
+    Copyright (c) 2017 ZTE Corporation.
+    All rights reserved. This program and the accompanying materials
+    are made available under the terms of the Eclipse Public License v1.0
+    and the Apache License 2.0 which both accompany this distribution,
+    and are available at http://www.eclipse.org/legal/epl-v10.html
+    and http://www.apache.org/licenses/LICENSE-2.0
 
-    Copyright 2016-2017 ZTE Corporation.
-
-    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.
-
+    Contributors:
+        ZTE - initial API and implementation and/or initial documentation
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
+    <groupId>org.onap.sdc.sdc-workflow-designer</groupId>
     <artifactId>sdc-workflow-designer-server</artifactId>
     <name>sdc-workflow-designer-server</name>
     <version>1.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
     <properties>
         <slf4j.version>1.7.25</slf4j.version>
+        <jackson.version>2.9.1</jackson.version>
     </properties>
     <dependencies>
         <dependency>
             <artifactId>slf4j-api</artifactId>
             <version>${slf4j.version}</version>
         </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>${jackson.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>${jackson.version}</version>
+        </dependency>
     </dependencies>
 </project>
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java
new file mode 100644 (file)
index 0000000..e7d48ac
--- /dev/null
@@ -0,0 +1,50 @@
+/**\r
+ * Copyright (c) 2017 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * and the Apache License 2.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ *     ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+package org.onap.sdc.workflowdesigner.converter;\r
+\r
+import java.io.IOException;\r
+import java.net.URI;\r
+import java.nio.file.Files;\r
+import java.nio.file.Path;\r
+import java.nio.file.StandardOpenOption;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+public class Bpmn4Tosca2Bpmn {\r
+\r
+    private static Logger log = LoggerFactory.getLogger(Bpmn4Tosca2Bpmn.class);\r
+\r
+    /**\r
+     * Transforms the given BPMN4Tosca Json management into a bpmn plan that can\r
+     * be excuted by activiti.\r
+     * <p>\r
+     *\r
+     * @param srcBpmn4ToscaJsonFile\r
+     * @param targetBpmnArchive\r
+     */\r
+    public void transform(URI srcBpmn4ToscaJsonFile, URI targetBpmnArchive) {\r
+        log.info("transform start");\r
+\r
+        // parse json object\r
+\r
+        // transform bpmn template\r
+\r
+        // write bpmn to file\r
+        log.info("transform end");\r
+    }\r
+\r
+    public static Path writeStringToFile(String content, Path targetPath) throws IOException {\r
+        return Files.write(targetPath, content.getBytes(), StandardOpenOption.CREATE_NEW);\r
+    }\r
+\r
+}\r