当前位置: 首页>>代码示例>>Java>>正文


Java Process.setId方法代码示例

本文整理汇总了Java中org.camunda.bpm.model.bpmn.instance.Process.setId方法的典型用法代码示例。如果您正苦于以下问题:Java Process.setId方法的具体用法?Java Process.setId怎么用?Java Process.setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.camunda.bpm.model.bpmn.instance.Process的用法示例。


在下文中一共展示了Process.setId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createModel

import org.camunda.bpm.model.bpmn.instance.Process; //导入方法依赖的package包/类
@Before
public void createModel() {
  testBpmnModelInstance = Bpmn.createEmptyModel();
  Definitions definitions = testBpmnModelInstance.newInstance(Definitions.class);
  testBpmnModelInstance.setDefinitions(definitions);

  message = testBpmnModelInstance.newInstance(Message.class);
  message.setId("message-id");
  definitions.getRootElements().add(message);

  Process process = testBpmnModelInstance.newInstance(Process.class);
  process.setId("process-id");
  definitions.getRootElements().add(process);

  startEvent = testBpmnModelInstance.newInstance(StartEvent.class);
  startEvent.setId("start-event-id");
  process.getFlowElements().add(startEvent);

  messageEventDefinition = testBpmnModelInstance.newInstance(MessageEventDefinition.class);
  messageEventDefinition.setId("msg-def-id");
  messageEventDefinition.setMessage(message);
  startEvent.getEventDefinitions().add(messageEventDefinition);

  startEvent.getEventDefinitionRefs().add(messageEventDefinition);
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:26,代码来源:ReferenceTest.java

示例2: shouldAddChildElementsInCorrectOrder

import org.camunda.bpm.model.bpmn.instance.Process; //导入方法依赖的package包/类
@Test
public void shouldAddChildElementsInCorrectOrder() {
  // create an empty model
  BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel();

  // add definitions
  Definitions definitions = bpmnModelInstance.newInstance(Definitions.class);
  definitions.setTargetNamespace("Examples");
  bpmnModelInstance.setDefinitions(definitions);

  // create a Process element and add it to the definitions
  Process process = bpmnModelInstance.newInstance(Process.class);
  process.setId("some-process-id");
  definitions.getRootElements().add(process);

  // create an Import element and add it to the definitions
  Import importElement = bpmnModelInstance.newInstance(Import.class);
  importElement.setNamespace("Imports");
  importElement.setLocation("here");
  importElement.setImportType("example");
  definitions.getImports().add(importElement);

  // create another Process element and add it to the definitions
  process = bpmnModelInstance.newInstance(Process.class);
  process.setId("another-process-id");
  definitions.getRootElements().add(process);

  // create another Import element and add it to the definitions
  importElement = bpmnModelInstance.newInstance(Import.class);
  importElement.setNamespace("Imports");
  importElement.setLocation("there");
  importElement.setImportType("example");
  definitions.getImports().add(importElement);

  // validate model
  try {
    Bpmn.validateModel(bpmnModelInstance);
  }
  catch (ModelValidationException e) {
    Assert.fail();
  }
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:43,代码来源:DefinitionsTest.java

示例3: shouldNotAffectComments

import org.camunda.bpm.model.bpmn.instance.Process; //导入方法依赖的package包/类
@Test
@BpmnModelResource
public void shouldNotAffectComments() throws IOException {
  Definitions definitions = bpmnModelInstance.getDefinitions();
  assertThat(definitions).isNotNull();

  // create another Process element and add it to the definitions
  Process process = bpmnModelInstance.newInstance(Process.class);
  process.setId("another-process-id");
  definitions.getRootElements().add(process);

  // create another Import element and add it to the definitions
  Import importElement = bpmnModelInstance.newInstance(Import.class);
  importElement.setNamespace("Imports");
  importElement.setLocation("there");
  importElement.setImportType("example");
  definitions.getImports().add(importElement);

  // validate model
  try {
    Bpmn.validateModel(bpmnModelInstance);
  }
  catch (ModelValidationException e) {
    Assert.fail();
  }

  // convert the model to the XML string representation
  OutputStream outputStream = new ByteArrayOutputStream();
  Bpmn.writeModelToStream(outputStream, bpmnModelInstance);
  InputStream inputStream = IoUtil.convertOutputStreamToInputStream(outputStream);
  String modelString = IoUtil.getStringFromInputStream(inputStream);
  IoUtil.closeSilently(outputStream);
  IoUtil.closeSilently(inputStream);

  // read test process from file as string
  inputStream = getClass().getResourceAsStream("DefinitionsTest.shouldNotAffectCommentsResult.bpmn");
  String fileString = IoUtil.getStringFromInputStream(inputStream);
  IoUtil.closeSilently(inputStream);

  // compare strings
  assertThat(modelString).endsWith(fileString);
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:43,代码来源:DefinitionsTest.java

示例4: shouldAddParentChildElementInCorrectOrder

import org.camunda.bpm.model.bpmn.instance.Process; //导入方法依赖的package包/类
@Test
public void shouldAddParentChildElementInCorrectOrder() {
  // create empty model
  BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel();

  // add definitions to model
  Definitions definitions = bpmnModelInstance.newInstance(Definitions.class);
  definitions.setTargetNamespace("Examples");
  bpmnModelInstance.setDefinitions(definitions);

  // add process
  Process process = bpmnModelInstance.newInstance(Process.class);
  process.setId("messageEventDefinition");
  definitions.getRootElements().add(process);

  // add start event
  StartEvent startEvent = bpmnModelInstance.newInstance(StartEvent.class);
  startEvent.setId("theStart");
  process.getFlowElements().add(startEvent);

  // create and add message
  Message message = bpmnModelInstance.newInstance(Message.class);
  message.setId("start-message-id");
  definitions.getRootElements().add(message);

  // add message event definition to start event
  MessageEventDefinition startEventMessageEventDefinition = bpmnModelInstance.newInstance(MessageEventDefinition.class);
  startEventMessageEventDefinition.setMessage(message);
  startEvent.getEventDefinitions().add(startEventMessageEventDefinition);

  // add property after message event definition
  Property property = bpmnModelInstance.newInstance(Property.class);
  startEvent.getProperties().add(property);

  // finally add an extensions element
  ExtensionElements extensionElements = bpmnModelInstance.newInstance(ExtensionElements.class);
  process.setExtensionElements(extensionElements);

  // validate model
  try {
    Bpmn.validateModel(bpmnModelInstance);
  }
  catch (ModelValidationException e) {
    Assert.fail();
  }
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:47,代码来源:DefinitionsTest.java


注:本文中的org.camunda.bpm.model.bpmn.instance.Process.setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。