Search in sources :

Example 1 with AttributeImpl

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

the class ElementReferenceCollectionBuilderImpl method performModelBuild.

@SuppressWarnings("unchecked")
public void performModelBuild(Model model) {
    ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl) model.getType(referenceTargetClass);
    ModelElementTypeImpl referenceSourceType = (ModelElementTypeImpl) model.getType(childElementType);
    elementReferenceCollectionImpl.setReferenceTargetElementType(referenceTargetType);
    elementReferenceCollectionImpl.setReferenceSourceElementType(referenceSourceType);
    // 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(elementReferenceCollectionImpl);
        elementReferenceCollectionImpl.setReferenceTargetAttribute(idAttribute);
    } else {
        throw new ModelException("Unable to find id attribute of " + referenceTargetClass);
    }
}
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 2 with AttributeImpl

use of org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl 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 3 with AttributeImpl

use of org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl 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

ModelException (org.camunda.bpm.model.xml.ModelException)3 ModelElementTypeImpl (org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl)3 AttributeImpl (org.camunda.bpm.model.xml.impl.type.attribute.AttributeImpl)3