• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Process类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Process类属于org.camunda.bpm.model.bpmn.instance包,在下文中一共展示了Process类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createProcess

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
public static ProcessBuilder createProcess() {
  BpmnModelInstance modelInstance = INSTANCE.doCreateEmptyModel();
  Definitions definitions = modelInstance.newInstance(Definitions.class);
  definitions.setTargetNamespace(BPMN20_NS);
  definitions.getDomElement().registerNamespace("camunda", CAMUNDA_NS);
  modelInstance.setDefinitions(definitions);
  Process process = modelInstance.newInstance(Process.class);
  definitions.addChildElement(process);

  BpmnDiagram bpmnDiagram = modelInstance.newInstance(BpmnDiagram.class);

  BpmnPlane bpmnPlane = modelInstance.newInstance(BpmnPlane.class);
  bpmnPlane.setBpmnElement(process);

  bpmnDiagram.addChildElement(bpmnPlane);
  definitions.addChildElement(bpmnDiagram);

  return process.builder();
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:20,代码来源:Bpmn.java


示例2: createProcessWithParallelGateway

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
@Test
public void createProcessWithParallelGateway() {
  // create process
  Process process = createElement(definitions, "process-with-parallel-gateway", Process.class);

  // create elements
  StartEvent startEvent = createElement(process, "start", StartEvent.class);
  ParallelGateway fork = createElement(process, "fork", ParallelGateway.class);
  UserTask task1 = createElement(process, "task1", UserTask.class);
  ServiceTask task2 = createElement(process, "task2", ServiceTask.class);
  ParallelGateway join = createElement(process, "join", ParallelGateway.class);
  EndEvent endEvent = createElement(process, "end", EndEvent.class);

  // create flows
  createSequenceFlow(process, startEvent, fork);
  createSequenceFlow(process, fork, task1);
  createSequenceFlow(process, fork, task2);
  createSequenceFlow(process, task1, join);
  createSequenceFlow(process, task2, join);
  createSequenceFlow(process, join, endEvent);
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:22,代码来源:CreateModelTest.java


示例3: shouldImportProcess

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
@Test
@BpmnModelResource
public void shouldImportProcess() {

  ModelElementInstance modelElementById = bpmnModelInstance.getModelElementById("exampleProcessId");
  assertThat(modelElementById).isNotNull();

  Collection<RootElement> rootElements = bpmnModelInstance.getDefinitions().getRootElements();
  assertThat(rootElements).hasSize(1);
  org.camunda.bpm.model.bpmn.instance.Process process = (Process) rootElements.iterator().next();

  assertThat(process.getId()).isEqualTo("exampleProcessId");
  assertThat(process.getName()).isNull();
  assertThat(process.getProcessType()).isEqualTo(ProcessType.None);
  assertThat(process.isExecutable()).isFalse();
  assertThat(process.isClosed()).isFalse();



}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:21,代码来源:ProcessTest.java


示例4: testCreateEmptyProcess

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
@Test
public void testCreateEmptyProcess() {
  modelInstance = Bpmn.createProcess()
    .done();

  Definitions definitions = modelInstance.getDefinitions();
  assertThat(definitions).isNotNull();
  assertThat(definitions.getTargetNamespace()).isEqualTo(BPMN20_NS);

  Collection<ModelElementInstance> processes = modelInstance.getModelElementsByType(processType);
  assertThat(processes)
    .hasSize(1);

  Process process = (Process) processes.iterator().next();
  assertThat(process.getId()).isNotNull();
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:17,代码来源:ProcessBuilderTest.java


示例5: 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


示例6: testJavaDelegateModelExecutionContext

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
public void testJavaDelegateModelExecutionContext() {
  deploy();

  runtimeService.startProcessInstanceByKey(PROCESS_ID);

  BpmnModelInstance modelInstance = ModelExecutionContextServiceTask.modelInstance;
  assertNotNull(modelInstance);

  Model model = modelInstance.getModel();
  Collection<ModelElementInstance> events = modelInstance.getModelElementsByType(model.getType(Event.class));
  assertEquals(2, events.size());
  Collection<ModelElementInstance> tasks = modelInstance.getModelElementsByType(model.getType(Task.class));
  assertEquals(1, tasks.size());

  Process process = (Process) modelInstance.getDefinitions().getRootElements().iterator().next();
  assertEquals(PROCESS_ID, process.getId());
  assertTrue(process.isExecutable());

  ServiceTask serviceTask = ModelExecutionContextServiceTask.serviceTask;
  assertNotNull(serviceTask);
  assertEquals(ModelExecutionContextServiceTask.class.getName(), serviceTask.getCamundaClass());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:ServiceTaskBpmnModelExecutionContextTest.java


示例7: build

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
/**
 * @return start -> user -> end
 */
public static BpmnModelInstance build(String key, String versionTag) {
  BpmnModelInstance modelInstance = build(key);

  Collection<Process> modelElementsByType = modelInstance.getModelElementsByType(Process.class);
  Process process = modelElementsByType.iterator().next();
  process.setAttributeValueNs("http://camunda.org/schema/1.0/bpmn", "versionTag", versionTag);

  return modelInstance;
}
 
开发者ID:camunda,项目名称:camunda-bpm-migration,代码行数:13,代码来源:DummyProcessBuilder.java


示例8: registerType

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Participant.class, BPMN_ELEMENT_PARTICIPANT)
    .namespaceUri(BPMN20_NS)
    .extendsType(BaseElement.class)
    .instanceProvider(new ModelTypeInstanceProvider<Participant>() {
      public Participant newInstance(ModelTypeInstanceContext instanceContext) {
        return new ParticipantImpl(instanceContext);
      }
    });

  nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME)
    .build();

  processRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_PROCESS_REF)
    .qNameAttributeReference(Process.class)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  interfaceRefCollection = sequenceBuilder.elementCollection(InterfaceRef.class)
    .qNameElementReferenceCollection(Interface.class)
    .build();

  endPointRefCollection = sequenceBuilder.elementCollection(EndPointRef.class)
    .qNameElementReferenceCollection(EndPoint.class)
    .build();

  participantMultiplicityChild = sequenceBuilder.element(ParticipantMultiplicity.class)
    .build();

  typeBuilder.build();
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:33,代码来源:ParticipantImpl.java


示例9: createSequenceFlow

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
public SequenceFlow createSequenceFlow(Process process, FlowNode from, FlowNode to) {
  SequenceFlow sequenceFlow = createElement(process, from.getId() + "-" + to.getId(), SequenceFlow.class);
  process.addChildElement(sequenceFlow);
  sequenceFlow.setSource(from);
  from.getOutgoing().add(sequenceFlow);
  sequenceFlow.setTarget(to);
  to.getIncoming().add(sequenceFlow);
  return sequenceFlow;
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:10,代码来源:CreateModelTest.java


示例10: createProcessWithOneTask

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
@Test
public void createProcessWithOneTask() {
  // create process
  Process process = createElement(definitions, "process-with-one-task", Process.class);

  // create elements
  StartEvent startEvent = createElement(process, "start", StartEvent.class);
  UserTask task1 = createElement(process, "task1", UserTask.class);
  EndEvent endEvent = createElement(process, "end", EndEvent.class);

  // create flows
  createSequenceFlow(process, startEvent, task1);
  createSequenceFlow(process, task1, endEvent);
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:15,代码来源:CreateModelTest.java


示例11: validate

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
@Override
public void validate(Process process, ValidationResultCollector validationResultCollector) {
  Collection<StartEvent> startEvents = process.getChildElementsByType(StartEvent.class);
  int startEventCount = startEvents.size();

  if(startEventCount != 1) {
    validationResultCollector.addError(10, String.format("Process does not have exactly one start event. Got %d.", startEventCount));
  }
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:10,代码来源:ProcessStartEventValidator.java


示例12: shouldNotGenerateIdsOnRead

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
@Test
public void shouldNotGenerateIdsOnRead() {
  BpmnModelInstance modelInstance = Bpmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.bpmn"));
  Definitions definitions = modelInstance.getDefinitions();
  assertThat(definitions.getId()).isNull();

  Process process = modelInstance.getModelElementsByType(Process.class).iterator().next();
  assertThat(process.getId()).isNull();

  StartEvent startEvent = modelInstance.getModelElementsByType(StartEvent.class).iterator().next();
  assertThat(startEvent.getId()).isNull();

  UserTask userTask = modelInstance.getModelElementsByType(UserTask.class).iterator().next();
  assertThat(userTask.getId()).isNull();
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:16,代码来源:GenerateIdTest.java


示例13: shouldGenerateIdsOnCreate

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
@Test
public void shouldGenerateIdsOnCreate() {
  BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
  Definitions definitions = modelInstance.newInstance(Definitions.class);
  assertThat(definitions.getId()).isNotNull();

  Process process = modelInstance.newInstance(Process.class);
  assertThat(process.getId()).isNotNull();

  StartEvent startEvent = modelInstance.newInstance(StartEvent.class);
  assertThat(startEvent.getId()).isNotNull();

  UserTask userTask = modelInstance.newInstance(UserTask.class);
  assertThat(userTask.getId()).isNotNull();
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:16,代码来源:GenerateIdTest.java


示例14: getElementTypes

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
@BeforeClass
public static void getElementTypes() {
  Model model = Bpmn.createEmptyModel().getModel();
  taskType = model.getType(Task.class);
  gatewayType = model.getType(Gateway.class);
  eventType = model.getType(Event.class);
  processType = model.getType(Process.class);
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:9,代码来源:ProcessBuilderTest.java


示例15: testProcessCamundaExtensions

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
@Test
public void testProcessCamundaExtensions() {
  modelInstance = Bpmn.createProcess(PROCESS_ID)
    .camundaJobPriority("${somePriority}")
    .camundaTaskPriority(TEST_PROCESS_TASK_PRIORITY)
    .camundaHistoryTimeToLive(TEST_HISTORY_TIME_TO_LIVE)
    .startEvent()
    .endEvent()
    .done();

  Process process = modelInstance.getModelElementById(PROCESS_ID);
  assertThat(process.getCamundaJobPriority()).isEqualTo("${somePriority}");
  assertThat(process.getCamundaTaskPriority()).isEqualTo(TEST_PROCESS_TASK_PRIORITY);
  assertThat(process.getCamundaHistoryTimeToLive()).isEqualTo(TEST_HISTORY_TIME_TO_LIVE);
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:16,代码来源:ProcessBuilderTest.java


示例16: fromBpmnXml

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
public Collection<FlowDefinition> fromBpmnXml(InputStream bpmnStream) {
    BpmnModelInstance modelInstance = Bpmn.readModelFromStream(bpmnStream);
    Collection<Process> processes = modelInstance.getModelElementsByType(Process.class);

    List<FlowDefinition> flowDefinitions = new ArrayList<FlowDefinition>();

    for (Process process: processes) {
        flowDefinitions.add(new BpmnProcessFlowBuilder(process).getDefinition());
    }
    return flowDefinitions;
}
 
开发者ID:adrobisch,项目名称:brainslug,代码行数:12,代码来源:BpmnModelImporter.java


示例17: addDocumentation

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
public ModifiableBpmnModelInstance addDocumentation(String content) {
  Collection<Process> processes = modelInstance.getModelElementsByType(Process.class);
  Documentation documentation = modelInstance.newInstance(Documentation.class);
  documentation.setTextContent(content);
  for (Process process : processes) {
    process.addChildElement(documentation);
  }
  return this;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:10,代码来源:ModifiableBpmnModelInstance.java


示例18: assertModelInstance

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
private void assertModelInstance() {
  BpmnModelInstance modelInstance = ModelExecutionContextTaskListener.modelInstance;
  assertNotNull(modelInstance);

  Collection<ModelElementInstance> events = modelInstance.getModelElementsByType(modelInstance.getModel().getType(Event.class));
  assertEquals(2, events.size());

  Collection<ModelElementInstance> tasks = modelInstance.getModelElementsByType(modelInstance.getModel().getType(Task.class));
  assertEquals(1, tasks.size());

  Process process = (Process) modelInstance.getDefinitions().getRootElements().iterator().next();
  assertEquals(PROCESS_ID, process.getId());
  assertTrue(process.isExecutable());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:UserTaskBpmnModelExecutionContextTest.java


示例19: extractProcessDefinitionKeys

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
private static List<String> extractProcessDefinitionKeys(List<String> deployableFileNames) {
  ArrayList<String> keys = new ArrayList<String>();
  for (String file : deployableFileNames) {
    if(file.endsWith(".bpmn") || file.endsWith(".bpmn20.xml")) {
      BpmnModelInstance modelInstance = Bpmn.readModelFromFile(new File(file));
      Collection<Process> processes = modelInstance.getModelElementsByType(Process.class);
      for (Process process : processes) {
        if(process.isExecutable()) {
          keys.add(process.getId());
        }
      }
    }
  }
  return keys;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:16,代码来源:StartProcessInstancesInDirectory.java


示例20: main

import org.camunda.bpm.model.bpmn.instance.Process; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {

    final Properties properties = PerfTestProcessEngine.loadProperties();
    final ProcessEngine processEngine = PerfTestProcessEngine.getInstance();

    final LoadGeneratorConfiguration config = new LoadGeneratorConfiguration();
    config.setColor(Boolean.parseBoolean(properties.getProperty("loadGenerator.colorOutput", "false")));
    config.setNumberOfIterations(Integer.parseInt(properties.getProperty("loadGenerator.numberOfIterations", "10000")));

    final List<BpmnModelInstance> modelInstances = createProcesses(config.getNumberOfIterations());

    Runnable[] setupTasks = new Runnable[] {
        new DeployModelInstancesTask(processEngine, modelInstances)
    };
    config.setSetupTasks(setupTasks);

    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
    processEngineConfiguration.setMetricsEnabled(true);
    processEngineConfiguration.getDbMetricsReporter().setReporterId(REPORTER_ID);
    final Runnable[] workerRunnables = new Runnable[2];
    Process process = modelInstances.get(0).getModelElementsByType(Process.class).iterator().next();
    String processDefKey = process.getId();
    workerRunnables[0] = new StartProcessInstanceTask(processEngine, processDefKey);
    workerRunnables[1] = new GenerateMetricsTask(processEngine);
    config.setWorkerTasks(workerRunnables);

    new LoadGenerator(config).execute();

    System.out.println(processEngine.getHistoryService().createHistoricProcessInstanceQuery().count()+ " Process Instances in DB");
    processEngineConfiguration.setMetricsEnabled(false);
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:32,代码来源:DefaultLoadGenerator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JsonCodec类代码示例发布时间:2022-05-23
下一篇:
Java ShaderProgram类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap