use of nl.tue.buildingsmart.schema.EntityDefinition in project BIMserver by opensourceBIM.
the class TracingGarbageCollector method mark.
@SuppressWarnings("rawtypes")
public void mark(Set<? extends IdEObject> rootObjects) {
referencedObjects.addAll(rootObjects);
SchemaDefinition schema = ifcModel.getPackageMetaData().getSchemaDefinition();
for (IdEObject rootObject : rootObjects) {
for (EReference eReference : rootObject.eClass().getEAllReferences()) {
Attribute attributeBNWithSuper = null;
if (schema != null) {
EntityDefinition entityBN = schema.getEntityBN(rootObject.eClass().getName());
if (entityBN == null) {
LOGGER.info(rootObject.eClass().getName() + " not found");
} else {
attributeBNWithSuper = entityBN.getAttributeBNWithSuper(eReference.getName());
if (attributeBNWithSuper == null) {
LOGGER.info(eReference.getName() + " not found");
}
}
}
if (schema == null || !(attributeBNWithSuper instanceof InverseAttribute)) {
Object referredObject = rootObject.eGet(eReference);
if (eReference.isMany()) {
List list = (List) referredObject;
for (Object o : list) {
if (!referencedObjects.contains(o)) {
mark(makeSet((IdEObject) o));
}
}
} else {
IdEObject referredIdEObject = (IdEObject) referredObject;
if (referredIdEObject != null) {
if (!referencedObjects.contains(referredObject)) {
mark(makeSet(referredIdEObject));
}
}
}
}
}
}
}
use of nl.tue.buildingsmart.schema.EntityDefinition in project BIMserver by opensourceBIM.
the class AbstractObjectIDM method isInverse.
protected boolean isInverse(EStructuralFeature eStructuralFeature) throws ObjectIDMException {
if (eStructuralFeature instanceof EReference && eStructuralFeature.getEContainingClass().getEAnnotation("wrapped") == null) {
if (eStructuralFeature.getEAnnotation("hidden") == null && eStructuralFeature.getEContainingClass().getEAnnotation("hidden") == null) {
EntityDefinition entityBN = packageMetaData.getSchemaDefinition().getEntityBN(eStructuralFeature.getEContainingClass().getName());
if (entityBN == null) {
throw new ObjectIDMException(eStructuralFeature.getEContainingClass().getName() + " not found");
}
Attribute attribute = entityBN.getAttributeBNWithSuper(eStructuralFeature.getName());
return attribute instanceof InverseAttribute;
} else {
return false;
}
}
return false;
}
Aggregations