Search in sources :

Example 31 with ModelElementType

use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.

the class ReferenceTest method copyModelInstance.

@Before
@SuppressWarnings("unchecked")
public void copyModelInstance() {
    modelInstance = cloneModelInstance();
    tweety = modelInstance.getModelElementById("tweety");
    daffy = modelInstance.getModelElementById("daffy");
    daisy = modelInstance.getModelElementById("daisy");
    plucky = modelInstance.getModelElementById("plucky");
    birdo = modelInstance.getModelElementById("birdo");
    animalType = modelInstance.getModel().getType(Animal.class);
    // QName attribute reference
    fatherReference = (QNameAttributeReferenceImpl<Animal>) animalType.getAttribute("father").getOutgoingReferences().iterator().next();
    // ID attribute reference
    motherReference = (AttributeReferenceImpl<Animal>) animalType.getAttribute("mother").getOutgoingReferences().iterator().next();
    // ID element reference
    flightPartnerRefsColl = FlyingAnimal.flightPartnerRefsColl;
    ModelElementType flightPartnerRefType = modelInstance.getModel().getType(FlightPartnerRef.class);
    flightPartnerRef = (FlightPartnerRef) modelInstance.getModelElementsByType(flightPartnerRefType).iterator().next();
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType) Before(org.junit.Before)

Example 32 with ModelElementType

use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.

the class ModelInstanceImpl method getModelElementsByType.

public Collection<ModelElementInstance> getModelElementsByType(ModelElementType type) {
    Collection<ModelElementType> extendingTypes = type.getAllExtendingTypes();
    List<ModelElementInstance> instances = new ArrayList<ModelElementInstance>();
    for (ModelElementType modelElementType : extendingTypes) {
        if (!modelElementType.isAbstract()) {
            instances.addAll(modelElementType.getInstances(this));
        }
    }
    return instances;
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType) ModelElementInstance(org.camunda.bpm.model.xml.instance.ModelElementInstance) ArrayList(java.util.ArrayList)

Example 33 with ModelElementType

use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.

the class ModelInstanceImpl method registerGenericType.

public ModelElementType registerGenericType(String namespaceUri, String localName) {
    ModelElementType elementType = model.getTypeForName(namespaceUri, localName);
    if (elementType == null) {
        elementType = modelBuilder.defineGenericType(localName, namespaceUri);
        model = (ModelImpl) modelBuilder.build();
    }
    return elementType;
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType)

Example 34 with ModelElementType

use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.

the class ModelElementTypeImpl method getAllAttributes.

/**
 * Returns a list of all attributes, including the attributes of all base types.
 *
 * @return the list of all attributes
 */
public Collection<Attribute<?>> getAllAttributes() {
    List<Attribute<?>> allAttributes = new ArrayList<Attribute<?>>();
    allAttributes.addAll(getAttributes());
    Collection<ModelElementType> baseTypes = ModelUtil.calculateAllBaseTypes(this);
    for (ModelElementType baseType : baseTypes) {
        allAttributes.addAll(baseType.getAttributes());
    }
    return allAttributes;
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType) Attribute(org.camunda.bpm.model.xml.type.attribute.Attribute) ArrayList(java.util.ArrayList)

Aggregations

ModelElementType (org.camunda.bpm.model.xml.type.ModelElementType)34 Test (org.junit.Test)11 ArrayList (java.util.ArrayList)9 ModelElementInstance (org.camunda.bpm.model.xml.instance.ModelElementInstance)8 Model (org.camunda.bpm.model.xml.Model)3 TestModelTest (org.camunda.bpm.model.xml.testmodel.TestModelTest)3 ModelException (org.camunda.bpm.model.xml.ModelException)2 ModelInstanceImpl (org.camunda.bpm.model.xml.impl.ModelInstanceImpl)2 ModelElementTypeImpl (org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl)2 DomElement (org.camunda.bpm.model.xml.instance.DomElement)2 Before (org.junit.Before)2 PlanItemDefinition (org.camunda.bpm.model.cmmn.instance.PlanItemDefinition)1 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)1 ModelBuildOperation (org.camunda.bpm.model.xml.impl.ModelBuildOperation)1 QName (org.camunda.bpm.model.xml.impl.util.QName)1 AnimalTest (org.camunda.bpm.model.xml.testmodel.instance.AnimalTest)1 Attribute (org.camunda.bpm.model.xml.type.attribute.Attribute)1 Reference (org.camunda.bpm.model.xml.type.reference.Reference)1