diff options
-rw-r--r-- | sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java index fc3a2b37..317d59d4 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/resources/WorkflowModelerResource.java @@ -105,13 +105,8 @@ public class WorkflowModelerResource { URI srcUri = Paths.get(".", WORKFLOW_JSON_TEMP_FILE_NAME).toUri(); String processName = "plan_" + UUID.randomUUID().toString(); - Bpmn4ToscaJsonParser parser = new Bpmn4ToscaJsonParser(); - Process process = parser.parse(processName, srcUri); - - // transform bpmn template - BpmnPlanArtefactWriter writer = new BpmnPlanArtefactWriter(process); - String bpmn = writer.completePlanTemplate(); - + String bpmn = buildBPMN(srcUri, processName); + FileCommonUtils.write(WORKFLOW_XML_TEMP_FILE_NAME, bpmn); return Response.status(Response.Status.OK).entity(json).build(); @@ -124,4 +119,21 @@ public class WorkflowModelerResource { } } + /** + * + * @param srcUri + * @param processName + * @return + * @throws IOException + * @throws Exception + */ + private String buildBPMN(URI srcUri, String processName) throws IOException, Exception { + Bpmn4ToscaJsonParser parser = new Bpmn4ToscaJsonParser(); + Process process = parser.parse(processName, srcUri); + + // transform bpmn template + BpmnPlanArtefactWriter writer = new BpmnPlanArtefactWriter(process); + return writer.completePlanTemplate(); + } + } |