aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLvbo163 <lv.bo163@zte.com.cn>2017-09-27 10:37:23 +0800
committerLvbo163 <lv.bo163@zte.com.cn>2017-09-27 10:37:23 +0800
commit836867d7ae5c90c72072e7b0ffe5c43c8c5be120 (patch)
tree239dcbea3f608d9227ec1e0fbf1ed771c3947ab0
parent49d669b567cfb3024c9a40bb962809f73455ff11 (diff)
Integrate json object convert and template convert
Issue-ID: SDC-405 Change-Id: Idf03ac5064805c2ac9b1df5b4e51bd6b59161f9b Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
-rw-r--r--sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/converter/Bpmn4Tosca2Bpmn.java12
1 files changed, 11 insertions, 1 deletions
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
index e7d48ace..ab1c5fa5 100644
--- 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
@@ -15,8 +15,12 @@ import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
+import org.onap.sdc.workflowdesigner.model.Process;
+import org.onap.sdc.workflowdesigner.parser.Bpmn4ToscaJsonParser;
+import org.onap.sdc.workflowdesigner.writer.BpmnPlanArtefactWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,15 +35,21 @@ public class Bpmn4Tosca2Bpmn {
*
* @param srcBpmn4ToscaJsonFile
* @param targetBpmnArchive
+ * @throws Exception
*/
- public void transform(URI srcBpmn4ToscaJsonFile, URI targetBpmnArchive) {
+ public void transform(String processId, URI srcBpmn4ToscaJsonFile, URI targetBpmnArchive) throws Exception {
log.info("transform start");
// parse json object
+ Bpmn4ToscaJsonParser parser = new Bpmn4ToscaJsonParser();
+ Process process = parser.parse(processId, srcBpmn4ToscaJsonFile);
// transform bpmn template
+ BpmnPlanArtefactWriter writer = new BpmnPlanArtefactWriter(process);
+ String workflowString = writer.completePlanTemplate();
// write bpmn to file
+ writeStringToFile(workflowString, Paths.get(targetBpmnArchive));
log.info("transform end");
}