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();
}
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;
}
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;
}
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;
}
Aggregations