use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-bpmn-model by camunda.
the class ProcessBuilderTest method testCreateProcessWithInclusiveGateway.
@Test
public void testCreateProcessWithInclusiveGateway() {
modelInstance = Bpmn.createProcess().startEvent().userTask().inclusiveGateway().condition("approved", "${approved}").serviceTask().endEvent().moveToLastGateway().condition("not approved", "${!approved}").scriptTask().endEvent().done();
ModelElementType inclusiveGwType = modelInstance.getModel().getType(InclusiveGateway.class);
assertThat(modelInstance.getModelElementsByType(eventType)).hasSize(3);
assertThat(modelInstance.getModelElementsByType(taskType)).hasSize(3);
assertThat(modelInstance.getModelElementsByType(inclusiveGwType)).hasSize(1);
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-bpmn-model by camunda.
the class ExtensionElementsImpl method addExtensionElement.
public ModelElementInstance addExtensionElement(String namespaceUri, String localName) {
ModelElementType extensionElementType = modelInstance.registerGenericType(namespaceUri, localName);
ModelElementInstance extensionElement = extensionElementType.newInstance(modelInstance);
addChildElement(extensionElement);
return extensionElement;
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-bpmn-model by camunda.
the class BaseElementImpl method getIncomingReferencesByType.
@SuppressWarnings("rawtypes")
public Collection<Reference> getIncomingReferencesByType(Class<? extends ModelElementInstance> referenceSourceTypeClass) {
Collection<Reference> references = new ArrayList<Reference>();
// we traverse all incoming references in reverse direction
for (Reference<?> reference : idAttribute.getIncomingReferences()) {
ModelElementType sourceElementType = reference.getReferenceSourceElementType();
Class<? extends ModelElementInstance> sourceInstanceType = sourceElementType.getInstanceType();
// if the referencing element (source element) is a BPMNDI element, dig deeper
if (referenceSourceTypeClass.isAssignableFrom(sourceInstanceType)) {
references.add(reference);
}
}
return references;
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-bpmn-model by camunda.
the class ModelTest method testBaseTypeCalculation.
@Test
public void testBaseTypeCalculation() {
BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel();
Model model = bpmnModelInstance.getModel();
Collection<ModelElementType> allBaseTypes = ModelUtil.calculateAllBaseTypes(model.getType(StartEvent.class));
assertThat(allBaseTypes).hasSize(5);
allBaseTypes = ModelUtil.calculateAllBaseTypes(model.getType(MessageEventDefinition.class));
assertThat(allBaseTypes).hasSize(3);
allBaseTypes = ModelUtil.calculateAllBaseTypes(model.getType(BaseElement.class));
assertThat(allBaseTypes).hasSize(0);
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-bpmn-model by camunda.
the class ModelTest method testExtendingTypeCalculation.
@Test
public void testExtendingTypeCalculation() {
BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel();
Model model = bpmnModelInstance.getModel();
List<ModelElementType> baseInstanceTypes = new ArrayList<ModelElementType>();
baseInstanceTypes.add(model.getType(Event.class));
baseInstanceTypes.add(model.getType(CatchEvent.class));
baseInstanceTypes.add(model.getType(ExtensionElements.class));
baseInstanceTypes.add(model.getType(EventDefinition.class));
Collection<ModelElementType> allExtendingTypes = ModelUtil.calculateAllExtendingTypes(bpmnModelInstance.getModel(), baseInstanceTypes);
assertThat(allExtendingTypes).hasSize(17);
}
Aggregations