use of org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl in project camunda-xml-model by camunda.
the class ModelUtil method calculateAllBaseTypes.
/**
* Calculate a collection of all base types for the given type
*/
public static Collection<ModelElementType> calculateAllBaseTypes(ModelElementType type) {
List<ModelElementType> baseTypes = new ArrayList<ModelElementType>();
ModelElementTypeImpl typeImpl = (ModelElementTypeImpl) type;
typeImpl.resolveBaseTypes(baseTypes);
return baseTypes;
}
use of org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl 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);
}
}
use of org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl in project camunda-xml-model by camunda.
the class ModelUtil method getModelElement.
protected static ModelElementTypeImpl getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, String namespaceUri) {
String localName = domElement.getLocalName();
ModelElementTypeImpl modelType = (ModelElementTypeImpl) modelInstance.getModel().getTypeForName(namespaceUri, localName);
if (modelType == null) {
Model model = modelInstance.getModel();
String actualNamespaceUri = model.getActualNamespace(namespaceUri);
if (actualNamespaceUri != null) {
modelType = getModelElement(domElement, modelInstance, actualNamespaceUri);
} else {
modelType = (ModelElementTypeImpl) modelInstance.registerGenericType(namespaceUri, localName);
}
}
return modelType;
}
use of org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl in project camunda-xml-model by camunda.
the class ModelUtil method getModelElement.
/**
* Returns the {@link ModelElementInstanceImpl ModelElement} for a DOM element.
* If the model element does not yet exist, it is created and linked to the DOM.
*
* @param domElement the child element to create a new {@link ModelElementInstanceImpl ModelElement} for
* @return the child model element
*/
public static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance) {
ModelElementInstance modelElement = domElement.getModelElementInstance();
if (modelElement == null) {
ModelElementTypeImpl modelType = getModelElement(domElement, modelInstance, domElement.getNamespaceURI());
modelElement = modelType.newInstance(modelInstance, domElement);
domElement.setModelElementInstance(modelElement);
}
return modelElement;
}
use of org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl in project camunda-xml-model by camunda.
the class ModelUtil method calculateAllExtendingTypes.
/**
* Calculate a collection of all extending types for the given base types
*
* @param baseTypes the collection of types to calculate the union of all extending types
*/
public static Collection<ModelElementType> calculateAllExtendingTypes(Model model, Collection<ModelElementType> baseTypes) {
Set<ModelElementType> allExtendingTypes = new HashSet<ModelElementType>();
for (ModelElementType baseType : baseTypes) {
ModelElementTypeImpl modelElementTypeImpl = (ModelElementTypeImpl) model.getType(baseType.getInstanceType());
modelElementTypeImpl.resolveExtendingTypes(allExtendingTypes);
}
return allExtendingTypes;
}
Aggregations