From de5748dc931aea9ee258ad0704731723a17e1421 Mon Sep 17 00:00:00 2001 From: YuanHu Date: Wed, 21 Mar 2018 11:02:54 +0800 Subject: Insert Json to BPMN. Insert Json to BPMN. Issue-ID: SDC-1004 Change-Id: Iaa72cb5c44b1846bcfc2124c371f0a8433cd7ce1 Signed-off-by: YuanHu --- sdc-workflow-designer-server/pom.xml | 9 ++++- .../resources/WorkflowModelerResource.java | 41 ++++++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/sdc-workflow-designer-server/pom.xml b/sdc-workflow-designer-server/pom.xml index b47f8453..0871c5a9 100644 --- a/sdc-workflow-designer-server/pom.xml +++ b/sdc-workflow-designer-server/pom.xml @@ -1,6 +1,6 @@ \n"); + return sb.toString(); + } + + /** + * + * @return + * @throws DocumentException + */ + protected String readJsonfromBPMNFile(String bpmn) throws DocumentException { + Document doc = DocumentHelper.parseText(bpmn); + List elementList = doc.content(); + for (Object object : elementList) { + if (object instanceof Comment) { + Comment comment = (Comment) object; + return comment.getText().trim(); + } + } + + return null; + } /** @@ -150,7 +185,7 @@ public class WorkflowModelerResource { * @throws IOException * @throws Exception */ - private String buildBPMN(URI srcUri, String processName) throws IOException, Exception { + protected String buildBPMN(URI srcUri, String processName) throws IOException, Exception { Bpmn4ToscaJsonParser parser = new Bpmn4ToscaJsonParser(); Process process = parser.parse(processName, srcUri); -- cgit 1.2.3-korg