Search in sources :

Example 6 with ModelElementTypeImpl

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

the class AttributeReferenceBuilderImpl method performModelBuild.

@SuppressWarnings("unchecked")
public void performModelBuild(Model model) {
    // register declaring type as a referencing type of referenced type
    ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl) model.getType(referenceTargetElement);
    // the actual referenced type
    attributeReferenceImpl.setReferenceTargetElementType(referenceTargetType);
    // the referenced attribute may be declared on a base type of the referenced type.
    AttributeImpl<String> idAttribute = (AttributeImpl<String>) referenceTargetType.getAttribute("id");
    if (idAttribute != null) {
        idAttribute.registerIncoming(attributeReferenceImpl);
        attributeReferenceImpl.setReferenceTargetAttribute(idAttribute);
    } else {
        throw new ModelException("Element type " + referenceTargetType.getTypeNamespace() + ":" + referenceTargetType.getTypeName() + " has no id attribute");
    }
}
Also used : ModelException(org.camunda.bpm.model.xml.ModelException) AttributeImpl(org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl) ModelElementTypeImpl(org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl)

Example 7 with ModelElementTypeImpl

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

the class AttributeReferenceCollectionBuilderImpl method performModelBuild.

@SuppressWarnings("unchecked")
public void performModelBuild(Model model) {
    // register declaring type as a referencing type of referenced type
    ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl) model.getType(referenceTargetElement);
    // the actual referenced type
    attributeReferenceCollection.setReferenceTargetElementType(referenceTargetType);
    // the referenced attribute may be declared on a base type of the referenced type.
    AttributeImpl<String> idAttribute = (AttributeImpl<String>) referenceTargetType.getAttribute("id");
    if (idAttribute != null) {
        idAttribute.registerIncoming(attributeReferenceCollection);
        attributeReferenceCollection.setReferenceTargetAttribute(idAttribute);
    } else {
        throw new ModelException("Element type " + referenceTargetType.getTypeNamespace() + ":" + referenceTargetType.getTypeName() + " has no id attribute");
    }
}
Also used : ModelException(org.camunda.bpm.model.xml.ModelException) AttributeImpl(org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl) ModelElementTypeImpl(org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl)

Aggregations

ModelElementTypeImpl (org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl)7 ModelException (org.camunda.bpm.model.xml.ModelException)3 AttributeImpl (org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl)3 ModelElementType (org.camunda.bpm.model.xml.type.ModelElementType)2 Model (org.camunda.bpm.model.xml.Model)1 ModelElementInstance (org.camunda.bpm.model.xml.instance.ModelElementInstance)1