public <T extends IdEObject> T create(Class<T> clazz) throws IfcModelInterfaceException { T object = model.create(clazz); if (object instanceof IfcRoot) { ((IfcRoot)object).setGlobalId(GuidCompressor.getNewIfcGloballyUniqueId()); if (defaultOwnerHistory != null) { ((IfcRoot)object).setOwnerHistory(defaultOwnerHistory); } } if (addOnCreate) { model.add(object.getOid(), object); } return object; }
converted.put(original, newObject); if (newObject.eClass().getEAnnotation("wrapped") == null) { target.add(newObject.getOid(), newObject);
IdEObject refObject = (IdEObject) model.create(model.getPackageMetaData().getEClassIncludingDependencies(refType), refOid); ((IdEObjectImpl)refObject).setLoadingState(State.OPPOSITE_SETTING); model.add(refObject.getOid(), refObject); addToList(eStructuralFeature, index, list, refObject); ((IdEObjectImpl)refObject).setLoadingState(State.TO_BE_LOADED); IdEObject refObject = (IdEObject) model.create(referenceEClass, refOid); ((IdEObjectImpl)refObject).setLoadingState(State.OPPOSITE_SETTING); model.add(refObject.getOid(), refObject); addToList(eStructuralFeature, index, list, refObject); ((IdEObjectImpl)refObject).setLoadingState(State.TO_BE_LOADED); IdEObject refObject = (IdEObject) model.create(model.getPackageMetaData().getEClassIncludingDependencies(refType), refOid); ((IdEObjectImpl)refObject).setLoadingState(State.OPPOSITE_SETTING); model.add(refObject.getOid(), refObject); object.eSet(eStructuralFeature, refObject); ((IdEObjectImpl)refObject).setLoadingState(State.TO_BE_LOADED); waitingList.updateNode(oid, eClass, object); model.add(object.getOid(), object); } else { LOGGER.info("_s expected");
targetModel.add(newObject.getOid(), newObject);
@SuppressWarnings("unchecked") public void copyDecomposes(IdEObject ifcObjectDefinition, IdEObject ownerHistory) throws IfcModelInterfaceException, ObjectAlreadyExistsException { IdEObject newObjectDefinition = copy(ifcObjectDefinition, false, skipRepresentation); EStructuralFeature decomposesFeature = newObjectDefinition.eClass().getEStructuralFeature("Decomposes"); for (IdEObject ifcRelDecomposes : (List<IdEObject>)ifcObjectDefinition.eGet(decomposesFeature)) { copy(ifcRelDecomposes, false, skipRepresentation); EStructuralFeature relatingObjectFeature = ifcRelDecomposes.eClass().getEStructuralFeature("RelatingObject"); IdEObject relatingObject = (IdEObject) ifcRelDecomposes.eGet(relatingObjectFeature); if (relatingObject != null) { copyDecomposes(relatingObject, ownerHistory); } } if (ifcObjectDefinition.eClass().getEPackage().getEClassifier("IfcElement").isInstance(ifcObjectDefinition)) { EStructuralFeature containedInStructureFeature = ifcObjectDefinition.eClass().getEStructuralFeature("ContainedInStructure"); for (IdEObject containedInStructure : (List<IdEObject>)ifcObjectDefinition.eGet(containedInStructureFeature)) { IdEObject newContainedInSpatialStructure = getTargetModel().create(containedInStructure.eClass()); newContainedInSpatialStructure.eSet(newContainedInSpatialStructure.eClass().getEStructuralFeature("GlobalId"), GuidCompressor.getNewIfcGloballyUniqueId()); newContainedInSpatialStructure.eSet(newContainedInSpatialStructure.eClass().getEStructuralFeature("OwnerHistory"), ownerHistory); EStructuralFeature relatedElementsFeature = newContainedInSpatialStructure.eClass().getEStructuralFeature("RelatedElements"); ((List<IdEObject>)newContainedInSpatialStructure.eGet(relatedElementsFeature)).add(newObjectDefinition); EStructuralFeature relatingStructureFeature = containedInStructure.eClass().getEStructuralFeature("RelatingStructure"); IdEObject newRelatingStructre = copy(((IdEObject)containedInStructure.eGet(relatingStructureFeature)), false, skipRepresentation); newContainedInSpatialStructure.eSet(relatingStructureFeature, newRelatingStructre); getTargetModel().add(oidProvider.newOid(newContainedInSpatialStructure.eClass()), newContainedInSpatialStructure); copyDecomposes((IdEObject)containedInStructure.eGet(relatingStructureFeature), ownerHistory); } } }
ifcModel.add(next.getOid(), newObject); next = queryObjectProvider.next();