From df0f9f26aa45c3fcc312cf4b23477367a7d5c835 Mon Sep 17 00:00:00 2001 From: Lvbo163 Date: Fri, 22 Sep 2017 17:15:50 +0800 Subject: Convert workflow json file Convert from json file to standard bpmn file Issue-ID: SDC-366 Change-Id: I0fc021d9779b5ebd6650a95b21e376e6affcd8d1 Signed-off-by: Lvbo163 --- sdc-workflow-designer-server/pom.xml | 34 +++++++++------ .../converter/Bpmn4Tosca2Bpmn.java | 50 ++++++++++++++++++++++ 2 files changed, 70 insertions(+), 14 deletions(-) create mode 100644 sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java diff --git a/sdc-workflow-designer-server/pom.xml b/sdc-workflow-designer-server/pom.xml index a04b5c94..d28ff81b 100644 --- a/sdc-workflow-designer-server/pom.xml +++ b/sdc-workflow-designer-server/pom.xml @@ -1,20 +1,14 @@ @@ -26,12 +20,14 @@ 4.0.0 + org.onap.sdc.sdc-workflow-designer sdc-workflow-designer-server sdc-workflow-designer-server 1.0.0-SNAPSHOT jar 1.7.25 + 2.9.1 @@ -39,5 +35,15 @@ slf4j-api ${slf4j.version} + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + 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 index 00000000..e7d48ace --- /dev/null +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java @@ -0,0 +1,50 @@ +/** + * 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 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + */ +package org.onap.sdc.workflowdesigner.converter; + +import java.io.IOException; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Bpmn4Tosca2Bpmn { + + private static Logger log = LoggerFactory.getLogger(Bpmn4Tosca2Bpmn.class); + + /** + * Transforms the given BPMN4Tosca Json management into a bpmn plan that can + * be excuted by activiti. + *

+ * + * @param srcBpmn4ToscaJsonFile + * @param targetBpmnArchive + */ + public void transform(URI srcBpmn4ToscaJsonFile, URI targetBpmnArchive) { + log.info("transform start"); + + // parse json object + + // transform bpmn template + + // write bpmn to file + log.info("transform end"); + } + + public static Path writeStringToFile(String content, Path targetPath) throws IOException { + return Files.write(targetPath, content.getBytes(), StandardOpenOption.CREATE_NEW); + } + +} -- cgit 1.2.3-korg