use of nl.tue.buildingsmart.schema.SchemaDefinition 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));
}
}
}
}
}
}
}
Aggregations