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


Java StartEvent类代码示例

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


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

示例1: startEvent

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的package包/类
public StartEventBuilder startEvent(String id) {
  StartEvent start = createChild(StartEvent.class, id);

  BpmnShape startShape = createBpmnShape(start);
  BpmnShape subProcessShape = findBpmnShape(getElement());

  if (subProcessShape != null) {
    Bounds subProcessBounds = subProcessShape.getBounds();
    Bounds startBounds = startShape.getBounds();

    double subProcessX = subProcessBounds.getX();
    double subProcessY = subProcessBounds.getY();
    double subProcessHeight = subProcessBounds.getHeight();
    double startHeight = startBounds.getHeight();

    startBounds.setX(subProcessX + SPACE);
    startBounds.setY(subProcessY + subProcessHeight / 2 - startHeight / 2);
  }

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

示例2: startEvent

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的package包/类
public StartEventBuilder startEvent(String id) {
  StartEvent start = subProcessBuilder.createChild(StartEvent.class, id);

  BpmnShape startShape = subProcessBuilder.createBpmnShape(start);
  BpmnShape subProcessShape = subProcessBuilder.findBpmnShape(subProcessBuilder.getElement());

  if (subProcessShape != null) {
    Bounds subProcessBounds = subProcessShape.getBounds();
    Bounds startBounds = startShape.getBounds();

    double subProcessX = subProcessBounds.getX();
    double subProcessY = subProcessBounds.getY();
    double subProcessHeight = subProcessBounds.getHeight();
    double startHeight = startBounds.getHeight();

    startBounds.setX(subProcessX + SPACE);
    startBounds.setY(subProcessY + subProcessHeight / 2 - startHeight / 2);
  }

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

示例3: addFlowNode

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的package包/类
private FlowDefinition addFlowNode(FlowDefinition flowDefinition, FlowElement flowElement, List<SequenceFlow> sequenceFlows) {
    if (flowElement instanceof StartEvent) {
        start(event(id(flowElement.getId())).display(flowElement.getName()));
    } else if (flowElement instanceof Task) {
      handleTask(flowDefinition, (Task) flowElement);
    } else if (flowElement instanceof IntermediateCatchEvent) {
      flowDefinition.addNode(event(id(flowElement.getId())).display(flowElement.getName()).with(new IntermediateEvent()));
    } else if (flowElement instanceof EndEvent) {
      flowDefinition.addNode(event(id(flowElement.getId())).display(flowElement.getName()).with(new brainslug.flow.node.event.EndEvent()));
    } else if (flowElement instanceof SequenceFlow) {
        sequenceFlows.add((SequenceFlow) flowElement);
    } else if (flowElement instanceof ExclusiveGateway) {
        flowDefinition.addNode(new ChoiceDefinition(flowDefinition).id(flowElement.getId()).display(flowElement.getName()));
    } else if (flowElement instanceof ParallelGateway) {
        // TODO: evaluate flowElement.getGatewayDirection
        if (((ParallelGateway) flowElement).getPreviousNodes().count() < 2) {
          flowDefinition.addNode(new ParallelDefinition(flowDefinition).id(flowElement.getId()).display(flowElement.getName()));
        } else {
          flowDefinition.addNode(new JoinDefinition().id(flowElement.getId()).display(flowElement.getName()));
        }
    } else {
        throw new IllegalArgumentException("can't handle flow element: " + flowElement);
    }

    return flowDefinition;
}
 
开发者ID:adrobisch,项目名称:brainslug,代码行数:27,代码来源:BpmnModelImporter.java

示例4: testRepositoryService

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的package包/类
@Deployment(resources = "org/camunda/bpm/engine/test/repository/one.bpmn20.xml")
public void testRepositoryService() {
  String processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_KEY).singleResult().getId();

  BpmnModelInstance modelInstance = repositoryService.getBpmnModelInstance(processDefinitionId);
  assertNotNull(modelInstance);

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

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

  StartEvent startEvent = modelInstance.getModelElementById("start");
  assertNotNull(startEvent);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:BpmnModelInstanceCmdTest.java

示例5: testModelApiBug

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的package包/类
@Test
public void testModelApiBug() {
  BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
  Definitions definitions = modelInstance.newInstance(Definitions.class);
  definitions.setTargetNamespace("http://camunda.org/examples");
  modelInstance.setDefinitions(definitions);
  org.camunda.bpm.model.bpmn.instance.Process process = modelInstance.newInstance(org.camunda.bpm.model.bpmn.instance.Process.class);
  process.setId("test");
  process.setExecutable(true);
  definitions.addChildElement(process);

  StartEvent startEvent = modelInstance.newInstance(StartEvent.class);
  startEvent.setAttributeValue("id", "startEvent1", true);
  process.addChildElement(startEvent);

  ServiceTask serviceTask = modelInstance.newInstance(ServiceTask.class);
  serviceTask.setAttributeValue("id", "serviceTask1", true);
  serviceTask.setCamundaClass(null);
  // TODO: Wait for https://app.camunda.com/jira/browse/CAM-4178 and set to
  // null!
  // serviceTask.setCamundaDelegateExpression(null);
  serviceTask.setCamundaExpression("#{true}"); // Noop
  process.addChildElement(serviceTask);

  createSequenceFlow(process, startEvent, serviceTask);

  repositoryService().createDeployment().addModelInstance("test.bpmn", modelInstance).deploy();
  runtimeService().startProcessInstanceByKey("test");
}
 
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:30,代码来源:DemoDataGeneratorTest.java

示例6: canStart

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的package包/类
public static boolean canStart(BpmnModelInstance modelInstance, UserDetails user) {
    Collection<StartEvent> startEvents = modelInstance.getModelElementsByType(StartEvent.class);
    eq(startEvents.size(), 1, () -> new BadArgument("wrong number of start events"));

    StartEvent event = startEvents.iterator().next();

    ExtensionElements extensionElements = event.getExtensionElements();
    if (extensionElements != null) {
        List<CamundaProperties> propertiesList = extensionElements.getElementsQuery()
                .filterByType(CamundaProperties.class)
                .list();

        if (propertiesList.size() > 0) {
            CamundaProperties properties = propertiesList.get(0);

            for (CamundaProperty property : properties.getCamundaProperties()) {
                if (property.getCamundaName().equals("authority")) {
                    // if no user specified and authority required, then starting is not allowed
                    if (user == null) {
                        return false;
                    }

                    String authority = property.getCamundaValue();
                    if (!hasAuthority(user, authority)) {
                        return false;
                    }
                }
            }
        }
    }

    return true;
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:34,代码来源:BpmUtils.java

示例7: registerType

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的package包/类
public static void registerType(ModelBuilder modelBuilder) {

    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(StartEvent.class, BPMN_ELEMENT_START_EVENT)
      .namespaceUri(BPMN20_NS)
      .extendsType(CatchEvent.class)
      .instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<StartEvent>() {
        public StartEvent newInstance(ModelTypeInstanceContext instanceContext) {
          return new StartEventImpl(instanceContext);
        }
      });

    isInterruptingAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_INTERRUPTING)
      .defaultValue(true)
      .build();

    /** camunda extensions */

    camundaAsyncAttribute = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC)
      .namespace(CAMUNDA_NS)
      .defaultValue(false)
      .build();

    camundaFormHandlerClassAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_FORM_HANDLER_CLASS)
      .namespace(CAMUNDA_NS)
      .build();

    camundaFormKeyAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_FORM_KEY)
      .namespace(CAMUNDA_NS)
      .build();

    camundaInitiatorAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_INITIATOR)
      .namespace(CAMUNDA_NS)
      .build();

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

示例8: validate

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的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

示例9: shouldNotGenerateIdsOnRead

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的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

示例10: shouldGenerateIdsOnCreate

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的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

示例11: startEvent

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的package包/类
public StartEventBuilder startEvent(String id) {
  StartEvent start = createChild(StartEvent.class, id);
  BpmnShape bpmnShape = createBpmnShape(start);
  setCoordinates(bpmnShape);
  return start.builder();
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:7,代码来源:ProcessBuilder.java

示例12: AbstractStartEventBuilder

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的package包/类
protected AbstractStartEventBuilder(BpmnModelInstance modelInstance, StartEvent element, Class<?> selfType) {
  super(modelInstance, element, selfType);
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:4,代码来源:AbstractStartEventBuilder.java

示例13: StartEventBuilder

import org.camunda.bpm.model.bpmn.instance.StartEvent; //导入依赖的package包/类
public StartEventBuilder(BpmnModelInstance modelInstance, StartEvent element) {
  super(modelInstance, element, StartEventBuilder.class);
}
 
开发者ID:camunda,项目名称:camunda-bpmn-model,代码行数:4,代码来源:StartEventBuilder.java


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