org.camunda.bpm.model.bpmn.instance.FlowNode Java Examples
The following examples show how to use
org.camunda.bpm.model.bpmn.instance.FlowNode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorkflowEngineService.java From wecube-platform with Apache License 2.0 | 6 votes |
protected void populateFlowNodes(ProcDefOutline outline, FlowNode flowNode) { ProcFlowNode pfn = outline.findFlowNode(flowNode.getId()); if (pfn == null) { pfn = buildProcFlowNode(flowNode); outline.addFlowNodes(pfn); } Collection<FlowNode> succeedingFlowNodes = flowNode.getSucceedingNodes().list(); for (FlowNode fn : succeedingFlowNodes) { ProcFlowNode childPfn = outline.findFlowNode(fn.getId()); boolean needPopulateChild = false; if (childPfn == null) { childPfn = buildProcFlowNode(fn); outline.addFlowNodes(childPfn); needPopulateChild = true; } pfn.addSucceedingFlowNodes(childPfn); if (needPopulateChild) { populateFlowNodes(outline, fn); } } }
Example #2
Source File: QueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@BeforeClass public static void createModelInstance() { modelInstance = Bpmn.createProcess() .startEvent().id("start") .userTask().id("user") .parallelGateway().id("gateway1") .serviceTask() .endEvent() .moveToLastGateway() .parallelGateway().id("gateway2") .userTask() .endEvent() .moveToLastGateway() .serviceTask() .endEvent() .moveToLastGateway() .scriptTask() .endEvent() .done(); startSucceeding = ((FlowNode) modelInstance.getModelElementById("start")).getSucceedingNodes(); gateway1Succeeding = ((FlowNode) modelInstance.getModelElementById("gateway1")).getSucceedingNodes(); gateway2Succeeding = ((FlowNode) modelInstance.getModelElementById("gateway2")).getSucceedingNodes(); }
Example #3
Source File: QueryTest.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
@BeforeClass public static void createModelInstance() { modelInstance = Bpmn.createProcess() .startEvent().id("start") .userTask().id("user") .parallelGateway().id("gateway1") .serviceTask() .endEvent() .moveToLastGateway() .parallelGateway().id("gateway2") .userTask() .endEvent() .moveToLastGateway() .serviceTask() .endEvent() .moveToLastGateway() .scriptTask() .endEvent() .done(); startSucceeding = ((FlowNode) modelInstance.getModelElementById("start")).getSucceedingNodes(); gateway1Succeeding = ((FlowNode) modelInstance.getModelElementById("gateway1")).getSucceedingNodes(); gateway2Succeeding = ((FlowNode) modelInstance.getModelElementById("gateway2")).getSucceedingNodes(); }
Example #4
Source File: PathCoverageExecutionListener.java From camunda-bpm-process-test-coverage with Apache License 2.0 | 6 votes |
/** * Events aren't reported like SequenceFlows and Activities, so we need * special handling. If a sequence flow has an event as the source or the * target, we add it to the coverage. It's pretty straight forward if a * sequence flow is active, then it's source has been covered anyway and it * will most definitely arrive at its target. * * @param transitionId * @param processDefinition * @param repositoryService */ private void handleEvent(String transitionId, ProcessDefinition processDefinition, RepositoryService repositoryService) { final BpmnModelInstance modelInstance = repositoryService.getBpmnModelInstance(processDefinition.getId()); final ModelElementInstance modelElement = modelInstance.getModelElementById(transitionId); if (modelElement.getElementType().getInstanceType() == SequenceFlow.class) { final SequenceFlow sequenceFlow = (SequenceFlow) modelElement; // If there is an event at the sequence flow source add it to the // coverage final FlowNode source = sequenceFlow.getSource(); addEventToCoverage(processDefinition, source); // If there is an event at the sequence flow target add it to the // coverage final FlowNode target = sequenceFlow.getTarget(); addEventToCoverage(processDefinition, target); } }
Example #5
Source File: ClassCoverage.java From camunda-bpm-process-test-coverage with Apache License 2.0 | 6 votes |
/** * Retrieves the class coverage percentage. * All covered test methods' elements are aggregated and checked against the * process definition elements. * * @return The coverage percentage. */ public double getCoveragePercentage() { // All deployments must be the same, so we take the first one final MethodCoverage anyDeployment = getAnyMethodCoverage(); final Set<FlowNode> definitionsFlowNodes = anyDeployment.getProcessDefinitionsFlowNodes(); final Set<SequenceFlow> definitionsSeqenceFlows = anyDeployment.getProcessDefinitionsSequenceFlows(); final Set<CoveredFlowNode> coveredFlowNodes = getCoveredFlowNodes(); final Set<CoveredSequenceFlow> coveredSequenceFlows = getCoveredSequenceFlows(); final double bpmnElementsCount = definitionsFlowNodes.size() + definitionsSeqenceFlows.size(); final double coveredElementsCount = coveredFlowNodes.size() + coveredSequenceFlows.size(); return coveredElementsCount / bpmnElementsCount; }
Example #6
Source File: BpmnProcessModelCustomizer.java From wecube-platform with Apache License 2.0 | 6 votes |
protected void enhanceSequenceFlow(SequenceFlow sf) { FlowNode srcFlowNode = sf.getSource(); if (sf.getConditionExpression() == null && "exclusiveGateway".equals(srcFlowNode.getElementType().getTypeName()) && srcFlowNode.getOutgoing().size() >= 2) { String sfName = sf.getName(); if (StringUtils.isBlank(sfName)) { log.warn("the name of squence flow {} is blank.", sf.getId()); throw new BpmnCustomizationException(String.format("The name of sequence flow %s cannot be blank.", sf.getId())); } List<SubProcess> preSubProcesses = srcFlowNode.getPreviousNodes().filterByType(SubProcess.class).list(); if (preSubProcesses.size() == 1) { log.debug("to add condition,sequenceFlowId={}", sf.getId()); SubProcess preSubProcess = preSubProcesses.get(0); ConditionExpression okCon = sf.getModelInstance().newInstance(ConditionExpression.class); okCon.setType(FORMAL_EXPR_TYPE); okCon.setTextContent( String.format("${ subProcRetCode_%s == '%s' }", preSubProcess.getId(), sfName.trim())); sf.builder().condition(okCon).done(); } } }
Example #7
Source File: BpmnProcessModelCustomizer.java From wecube-platform with Apache License 2.0 | 6 votes |
protected void enhanceSequenceFlows(BpmnModelInstance procModelInstance) { Collection<SequenceFlow> sequenceFlows = procModelInstance.getModelElementsByType(SequenceFlow.class); for (SequenceFlow sf : sequenceFlows) { FlowNode srcFlowNode = sf.getSource(); FlowNode dstFlowNode = sf.getTarget(); log.debug("validate sequence flow, id={},name={},srcType={},srcId={},srcOut={},dstId={},dstOut={} ", sf.getId(), sf.getName(), srcFlowNode.getElementType().getTypeName(), srcFlowNode.getId(), srcFlowNode.getOutgoing().size(), dstFlowNode.getId(), dstFlowNode.getOutgoing().size()); validateLeafNode(dstFlowNode); enhanceSequenceFlow(sf); } }
Example #8
Source File: FlowNodeImpl.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(FlowNode.class, BPMN_ELEMENT_FLOW_NODE) .namespaceUri(BPMN20_NS) .extendsType(FlowElement.class) .abstractType(); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); incomingCollection = sequenceBuilder.elementCollection(Incoming.class) .qNameElementReferenceCollection(SequenceFlow.class) .build(); outgoingCollection = sequenceBuilder.elementCollection(Outgoing.class) .qNameElementReferenceCollection(SequenceFlow.class) .build(); /** Camunda Attributes */ camundaAsyncAfter = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC_AFTER) .namespace(CAMUNDA_NS) .defaultValue(false) .build(); camundaAsyncBefore = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC_BEFORE) .namespace(CAMUNDA_NS) .defaultValue(false) .build(); camundaExclusive = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_EXCLUSIVE) .namespace(CAMUNDA_NS) .defaultValue(true) .build(); camundaJobPriority = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_JOB_PRIORITY) .namespace(CAMUNDA_NS) .build(); typeBuilder.build(); }
Example #9
Source File: WorkflowEngineService.java From wecube-platform with Apache License 2.0 | 5 votes |
protected void populateFlowNodeInsts(ProcInstOutline outline, FlowNode flowNode) { ProcFlowNodeInst pfn = outline.findProcFlowNodeInstByNodeId(flowNode.getId()); if (pfn == null) { pfn = new ProcFlowNodeInst(); pfn.setId(flowNode.getId()); pfn.setNodeType(flowNode.getElementType().getTypeName()); pfn.setNodeName(flowNode.getName() == null ? "" : flowNode.getName()); outline.addNodeInsts(pfn); } ServiceNodeStatusEntity nodeStatus = serviceNodeStatusRepository .findOneByProcInstanceIdAndNodeId(outline.getId(), pfn.getId()); if (nodeStatus != null) { pfn.setStartTime(nodeStatus.getStartTime()); pfn.setEndTime(nodeStatus.getEndTime()); pfn.setStatus(nodeStatus.getStatus().name()); } for (FlowNode fn : flowNode.getSucceedingNodes().list()) { ProcFlowNodeInst childPfn = outline.findProcFlowNodeInstByNodeId(fn.getId()); boolean needPopulateChild = false; if (childPfn == null) { childPfn = new ProcFlowNodeInst(); childPfn.setId(fn.getId()); childPfn.setNodeType(fn.getElementType().getTypeName()); childPfn.setNodeName(fn.getName() == null ? "" : fn.getName()); outline.addNodeInsts(childPfn); needPopulateChild = true; } pfn.addSucceedingFlowNodes(childPfn); if (needPopulateChild) { populateFlowNodeInsts(outline, fn); } } }
Example #10
Source File: FlowNodeImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public Query<FlowNode> getSucceedingNodes() { Collection<FlowNode> succeedingNodes = new HashSet<FlowNode>(); for (SequenceFlow sequenceFlow : getOutgoing()) { succeedingNodes.add(sequenceFlow.getTarget()); } return new QueryImpl<FlowNode>(succeedingNodes); }
Example #11
Source File: FlowNodeImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public Query<FlowNode> getPreviousNodes() { Collection<FlowNode> previousNodes = new HashSet<FlowNode>(); for (SequenceFlow sequenceFlow : getIncoming()) { previousNodes.add(sequenceFlow.getSource()); } return new QueryImpl<FlowNode>(previousNodes); }
Example #12
Source File: FlowNodeImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(FlowNode.class, BPMN_ELEMENT_FLOW_NODE) .namespaceUri(BPMN20_NS) .extendsType(FlowElement.class) .abstractType(); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); incomingCollection = sequenceBuilder.elementCollection(Incoming.class) .qNameElementReferenceCollection(SequenceFlow.class) .build(); outgoingCollection = sequenceBuilder.elementCollection(Outgoing.class) .qNameElementReferenceCollection(SequenceFlow.class) .build(); /** Camunda Attributes */ camundaAsyncAfter = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC_AFTER) .namespace(CAMUNDA_NS) .defaultValue(false) .build(); camundaAsyncBefore = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC_BEFORE) .namespace(CAMUNDA_NS) .defaultValue(false) .build(); camundaExclusive = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_EXCLUSIVE) .namespace(CAMUNDA_NS) .defaultValue(true) .build(); camundaJobPriority = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_JOB_PRIORITY) .namespace(CAMUNDA_NS) .build(); typeBuilder.build(); }
Example #13
Source File: EventImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Event.class, BPMN_ELEMENT_EVENT) .namespaceUri(BPMN20_NS) .extendsType(FlowNode.class) .abstractType(); SequenceBuilder sequence = typeBuilder.sequence(); propertyCollection = sequence.elementCollection(Property.class) .build(); typeBuilder.build(); }
Example #14
Source File: GatewayImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Gateway.class, BPMN_ELEMENT_GATEWAY) .namespaceUri(BPMN20_NS) .extendsType(FlowNode.class) .abstractType(); gatewayDirectionAttribute = typeBuilder.enumAttribute(BPMN_ATTRIBUTE_GATEWAY_DIRECTION, GatewayDirection.class) .defaultValue(GatewayDirection.Unspecified) .build(); typeBuilder.build(); }
Example #15
Source File: LaneImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Lane.class, BPMN_ELEMENT_LANE) .namespaceUri(BPMN20_NS) .extendsType(BaseElement.class) .instanceProvider(new ModelTypeInstanceProvider<Lane>() { public Lane newInstance(ModelTypeInstanceContext instanceContext) { return new LaneImpl(instanceContext); } }); nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME) .build(); partitionElementRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_PARTITION_ELEMENT_REF) .qNameAttributeReference(PartitionElement.class) .build(); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); partitionElementChild = sequenceBuilder.element(PartitionElement.class) .build(); flowNodeRefCollection = sequenceBuilder.elementCollection(FlowNodeRef.class) .idElementReferenceCollection(FlowNode.class) .build(); childLaneSetChild = sequenceBuilder.element(ChildLaneSet.class) .build(); typeBuilder.build(); }
Example #16
Source File: SequenceFlowImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(SequenceFlow.class, BPMN_ELEMENT_SEQUENCE_FLOW) .namespaceUri(BPMN20_NS) .extendsType(FlowElement.class) .instanceProvider(new ModelTypeInstanceProvider<SequenceFlow>() { public SequenceFlow newInstance(ModelTypeInstanceContext instanceContext) { return new SequenceFlowImpl(instanceContext); } }); sourceRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_SOURCE_REF) .required() .idAttributeReference(FlowNode.class) .build(); targetRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_TARGET_REF) .required() .idAttributeReference(FlowNode.class) .build(); isImmediateAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_IMMEDIATE) .build(); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); conditionExpressionCollection = sequenceBuilder.element(ConditionExpression.class) .build(); typeBuilder.build(); }
Example #17
Source File: WorkflowEngineService.java From wecube-platform with Apache License 2.0 | 5 votes |
protected ProcFlowNode buildProcFlowNode(FlowNode fn) { ProcFlowNode pfn = new ProcFlowNode(); pfn.setId(fn.getId()); pfn.setNodeName(fn.getName() == null ? "" : fn.getName()); pfn.setNodeType(fn.getElementType().getTypeName()); return pfn; }
Example #18
Source File: FlowNodeImpl.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
public Query<FlowNode> getSucceedingNodes() { Collection<FlowNode> succeedingNodes = new HashSet<FlowNode>(); for (SequenceFlow sequenceFlow : getOutgoing()) { succeedingNodes.add(sequenceFlow.getTarget()); } return new QueryImpl<FlowNode>(succeedingNodes); }
Example #19
Source File: FlowNodeImpl.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
public Query<FlowNode> getPreviousNodes() { Collection<FlowNode> previousNodes = new HashSet<FlowNode>(); for (SequenceFlow sequenceFlow : getIncoming()) { previousNodes.add(sequenceFlow.getSource()); } return new QueryImpl<FlowNode>(previousNodes); }
Example #20
Source File: EventImpl.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Event.class, BPMN_ELEMENT_EVENT) .namespaceUri(BPMN20_NS) .extendsType(FlowNode.class) .abstractType(); SequenceBuilder sequence = typeBuilder.sequence(); propertyCollection = sequence.elementCollection(Property.class) .build(); typeBuilder.build(); }
Example #21
Source File: GatewayImpl.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Gateway.class, BPMN_ELEMENT_GATEWAY) .namespaceUri(BPMN20_NS) .extendsType(FlowNode.class) .abstractType(); gatewayDirectionAttribute = typeBuilder.enumAttribute(BPMN_ATTRIBUTE_GATEWAY_DIRECTION, GatewayDirection.class) .defaultValue(GatewayDirection.Unspecified) .build(); typeBuilder.build(); }
Example #22
Source File: LaneImpl.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Lane.class, BPMN_ELEMENT_LANE) .namespaceUri(BPMN20_NS) .extendsType(BaseElement.class) .instanceProvider(new ModelTypeInstanceProvider<Lane>() { public Lane newInstance(ModelTypeInstanceContext instanceContext) { return new LaneImpl(instanceContext); } }); nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME) .build(); partitionElementRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_PARTITION_ELEMENT_REF) .qNameAttributeReference(PartitionElement.class) .build(); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); partitionElementChild = sequenceBuilder.element(PartitionElement.class) .build(); flowNodeRefCollection = sequenceBuilder.elementCollection(FlowNodeRef.class) .idElementReferenceCollection(FlowNode.class) .build(); childLaneSetChild = sequenceBuilder.element(ChildLaneSet.class) .build(); typeBuilder.build(); }
Example #23
Source File: ProcessCoverage.java From camunda-bpm-process-test-coverage with Apache License 2.0 | 5 votes |
private Set<FlowNode> getExecutableFlowNodes(final Collection<FlowNode> flowNodes) { final HashSet<FlowNode> result = new HashSet<FlowNode>(); for (final FlowNode node : flowNodes) { if (isExecutable(node)) { result.add(node); } } return result; }
Example #24
Source File: SequenceFlowImpl.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(SequenceFlow.class, BPMN_ELEMENT_SEQUENCE_FLOW) .namespaceUri(BPMN20_NS) .extendsType(FlowElement.class) .instanceProvider(new ModelTypeInstanceProvider<SequenceFlow>() { public SequenceFlow newInstance(ModelTypeInstanceContext instanceContext) { return new SequenceFlowImpl(instanceContext); } }); sourceRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_SOURCE_REF) .required() .idAttributeReference(FlowNode.class) .build(); targetRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_TARGET_REF) .required() .idAttributeReference(FlowNode.class) .build(); isImmediateAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_IMMEDIATE) .build(); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); conditionExpressionCollection = sequenceBuilder.element(ConditionExpression.class) .build(); typeBuilder.build(); }
Example #25
Source File: PathCoverageExecutionListener.java From camunda-bpm-process-test-coverage with Apache License 2.0 | 5 votes |
private void addEventToCoverage(ProcessDefinition processDefinition, FlowNode node) { if (node instanceof IntermediateThrowEvent) { final CoveredFlowNode coveredElement = new CoveredFlowNode(processDefinition.getKey(), node.getId()); // We consider entered throw elements as also ended coveredElement.setEnded(true); coverageTestRunState.addCoveredElement(coveredElement); } }
Example #26
Source File: BpmnProcessModelCustomizer.java From wecube-platform with Apache License 2.0 | 5 votes |
protected void validateLeafNode(FlowNode dstFlowNode) { if (dstFlowNode.getOutgoing().isEmpty()) { if ("endEvent".equals(dstFlowNode.getElementType().getTypeName())) { log.info("end event,id={}", dstFlowNode.getId()); } else { log.warn("the leaf node must be end event,id={}", dstFlowNode.getId()); throw new BpmnCustomizationException("The leaf node must be end event."); } } }
Example #27
Source File: LaneImpl.java From camunda-bpmn-model with Apache License 2.0 | 4 votes |
public Collection<FlowNode> getFlowNodeRefs() { return flowNodeRefCollection.getReferenceTargetElements(this); }
Example #28
Source File: LaneImpl.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public Collection<FlowNode> getFlowNodeRefs() { return flowNodeRefCollection.getReferenceTargetElements(this); }
Example #29
Source File: SequenceFlowImpl.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void setTarget(FlowNode target) { targetRefAttribute.setReferenceTargetElement(this, target); }
Example #30
Source File: SequenceFlowImpl.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public FlowNode getTarget() { return targetRefAttribute.getReferenceTargetElement(this); }