org.camunda.bpm.model.bpmn.Bpmn.convertToString()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(229)

本文整理了Java中org.camunda.bpm.model.bpmn.Bpmn.convertToString()方法的一些代码示例,展示了Bpmn.convertToString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bpmn.convertToString()方法的具体详情如下:
包路径:org.camunda.bpm.model.bpmn.Bpmn
类名称:Bpmn
方法名:convertToString

Bpmn.convertToString介绍

[英]Allows the conversion of a BpmnModelInstance to an String. It will be validated before conversion.
[中]允许将BpmnModelInstance转换为字符串。转换前将对其进行验证。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

private InputStream createMockDeploymentResourceBpmnDataNonExecutableProcess() {
 // do not close the input stream, will be done in implementation
 String model = Bpmn.convertToString(Bpmn.createProcess().startEvent().endEvent().done());
 InputStream inputStream = new ByteArrayInputStream(model.getBytes());
 return inputStream;
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Deployment
public static WebArchive createProcessApplication() {
 return initWebArchiveDeployment()
   .addAsResource(new StringAsset(Bpmn.convertToString(Bpmn.createExecutableProcess(TEST_PROCESS).done())), "testProcess.bpmn20.xml");
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText) {
 BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID)
  .startEvent()
  .scriptTask()
   .scriptFormat(scriptFormat)
   .scriptText(scriptText)
   .userTask()
  .endEvent()
  .done();
 return new StringAsset(Bpmn.convertToString(modelInstance));
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText, String pdk) {
 BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(pdk)
  .startEvent()
  .scriptTask()
   .scriptFormat(scriptFormat)
   .scriptText(scriptText)
   .userTask()
  .endEvent()
  .done();
 return new StringAsset(Bpmn.convertToString(modelInstance));
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText, String pdk) {
 BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(pdk)
  .startEvent()
  .scriptTask()
   .scriptFormat(scriptFormat)
   .scriptText(scriptText)
   .userTask()
  .endEvent()
  .done();
 return new StringAsset(Bpmn.convertToString(modelInstance));
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Deployment
public static WebArchive createProcessApplication() {
 BpmnModelInstance process = Bpmn.createExecutableProcess(TEST_PROCESS)
   .startEvent()
   .serviceTask()
    .camundaDelegateExpression("${bpmnElementRetrievalDelegate}")
  .done();
 return initWebArchiveDeployment()
   .addClass(BpmnElementRetrievalDelegate.class)
   .addAsResource(new StringAsset(Bpmn.convertToString(process)), "testProcess.bpmn20.xml");
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText) {
 BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID)
  .startEvent()
  .scriptTask()
   .scriptFormat(scriptFormat)
   .scriptText(scriptText)
   .camundaResultVariable(RESULT_VARIABLE)
  .userTask()
  .endEvent()
  .done();
 return new StringAsset(Bpmn.convertToString(modelInstance));
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText) {
 BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID)
  .startEvent()
  .scriptTask()
   .scriptFormat(scriptFormat)
   .scriptText(scriptText)
   .camundaResultVariable("scriptValue")
   .userTask()
  .endEvent()
  .done();
 return new StringAsset(Bpmn.convertToString(modelInstance));
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testUTF8DeploymentMethod() throws IOException {
 //given utf8 charset
 Charset utf8Charset = Charset.forName("UTF-8");
 Charset defaultCharset = processEngineConfiguration.getDefaultCharset();
 processEngineConfiguration.setDefaultCharset(utf8Charset);
 //and model instance with umlauts
 String umlautsString = "äöüÄÖÜß";
 String resourceName = "deployment.bpmn";
 BpmnModelInstance instance = Bpmn.createExecutableProcess("umlautsProcess").startEvent(umlautsString).done();
 String instanceAsString = Bpmn.convertToString(instance);
 //when instance is deployed via addString method
 org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment()
                                       .addString(resourceName, instanceAsString)
                                       .deploy();
 //then bytes are saved in utf-8 format
 InputStream inputStream = repositoryService.getResourceAsStream(deployment.getId(), resourceName);
 byte[] utf8Bytes = instanceAsString.getBytes(utf8Charset);
 checkDeployedBytes(inputStream, utf8Bytes);
 repositoryService.deleteDeployment(deployment.getId());
 //when model instance is deployed via addModelInstance method
 deployment = repositoryService.createDeployment().addModelInstance(resourceName, instance).deploy();
 //then also the bytes are saved in utf-8 format
 inputStream = repositoryService.getResourceAsStream(deployment.getId(), resourceName);
 checkDeployedBytes(inputStream, utf8Bytes);
 repositoryService.deleteDeployment(deployment.getId());
 processEngineConfiguration.setDefaultCharset(defaultCharset);
}

代码示例来源:origin: com.camunda.consulting.util/camunda-util-demo-data-generator

String xmlString = Bpmn.convertToString(bpmn);
tweakedModels.put(processDefinitionKey + ".bpmn", xmlString);
LOG.debug("-----TWEAKED-----\n-----TWEAKED-----\n-----\n" + xmlString + "\n------");

代码示例来源:origin: org.camunda.bpm/camunda-engine

public void testUTF8DeploymentMethod() throws IOException {
 //given utf8 charset
 Charset utf8Charset = Charset.forName("UTF-8");
 Charset defaultCharset = processEngineConfiguration.getDefaultCharset();
 processEngineConfiguration.setDefaultCharset(utf8Charset);
 //and model instance with umlauts
 String umlautsString = "äöüÄÖÜß";
 String resourceName = "deployment.bpmn";
 BpmnModelInstance instance = Bpmn.createExecutableProcess("umlautsProcess").startEvent(umlautsString).done();
 String instanceAsString = Bpmn.convertToString(instance);
 //when instance is deployed via addString method
 org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment()
                                       .addString(resourceName, instanceAsString)
                                       .deploy();
 //then bytes are saved in utf-8 format
 InputStream inputStream = repositoryService.getResourceAsStream(deployment.getId(), resourceName);
 byte[] utf8Bytes = instanceAsString.getBytes(utf8Charset);
 checkDeployedBytes(inputStream, utf8Bytes);
 repositoryService.deleteDeployment(deployment.getId());
 //when model instance is deployed via addModelInstance method
 deployment = repositoryService.createDeployment().addModelInstance(resourceName, instance).deploy();
 //then also the bytes are saved in utf-8 format
 inputStream = repositoryService.getResourceAsStream(deployment.getId(), resourceName);
 checkDeployedBytes(inputStream, utf8Bytes);
 repositoryService.deleteDeployment(deployment.getId());
 processEngineConfiguration.setDefaultCharset(defaultCharset);
}

相关文章