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; }
@SuppressWarnings({ "unchecked", "rawtypes" }) private void updateReferences() { for (IdEObject idEObject : newModel.getValues()) { if (idEObject instanceof IfcRoot) { String guid = ((IfcRoot) idEObject).getGlobalId(); IfcRoot oldObject = (IfcRoot) resultModel.getByGuid(guid); for (EReference eReference : idEObject.eClass().getEAllReferences()) { Object referencedObject = idEObject.eGet(eReference); if (referencedObject instanceof IfcRoot) { String referencedGuid = ((IfcRoot) referencedObject).getGlobalId(); IfcRoot newObject = (IfcRoot) resultModel.getByGuid(referencedGuid); oldObject.eSet(eReference, newObject); // LOGGER.info("Fixing reference from " + guid + " to " + referencedGuid); } else if (referencedObject instanceof List) { List referencedList = (List) referencedObject; List oldReferencedList = (List) oldObject.eGet(eReference); for (Object object : referencedList) { if (object instanceof IfcRoot) { IfcRoot referencedItem = (IfcRoot) object; String itemGuid = referencedItem.getGlobalId(); oldReferencedList.add(resultModel.getByGuid(itemGuid)); // LOGGER.info("Fixing list reference from " + guid + " to " + itemGuid); } } } } } } }
private void copyAttributesGuidObjectsAndAddNewObjects() throws IfcModelInterfaceException, ObjectAlreadyExistsException { for (IdEObject idEObject : newModel.getValues()) { if (idEObject instanceof IfcRoot) { IfcRoot ifcRoot = (IfcRoot) idEObject; String guid = ifcRoot.getGlobalId(); if (resultModel.containsGuid(guid)) { // LOGGER.info("Updating attributes for object " + idEObject.eClass().getName() + " " + guid); IfcRoot oldObject = (IfcRoot) resultModel.getByGuid(guid); for (EAttribute eAttribute : idEObject.eClass().getEAllAttributes()) { Object newValue = idEObject.eGet(eAttribute); oldObject.eSet(eAttribute, newValue); } } else { // LOGGER.info("Adding new GUID object " + idEObject.eClass().getName() + " " + guid); IdEObject newObject = (IdEObject) idEObject.eClass().getEPackage().getEFactoryInstance().create(idEObject.eClass()); ((IdEObjectImpl)newObject).setOid(idEObject.getOid()); ((IfcRoot) newObject).setGlobalId(newGuid(guid)); for (EAttribute eAttribute : newObject.eClass().getEAllAttributes()) { newObject.eSet(eAttribute, idEObject.eGet(eAttribute)); } resultModel.add(newObject.getOid(), newObject); } } } }
if (eObject instanceof IfcRoot) { IfcRoot ifcRoot = (IfcRoot)eObject; String guid = ifcRoot.getGlobalId() != null ? ifcRoot.getGlobalId() : ""; String name = ifcRoot.getName() != null ? ifcRoot.getName() : ""; dataObject = StoreFactory.eINSTANCE.createDataObject(); dataObject.setType(eObject.eClass().getName());
for (IdEObject idEObject : newModel.getValues()) { if (idEObject instanceof IfcRoot) { String guid = ((IfcRoot) idEObject).getGlobalId(); for (EReference eReference : idEObject.eClass().getEAllReferences()) { if (eReference.isMany()) { for (Object o : oldList) { if (o instanceof IfcRoot) { String referredGuid = ((IfcRoot) o).getGlobalId(); if (newModel.containsGuid(referredGuid)) { boolean found = false; for (Object q : list) { if (q instanceof IfcRoot) { String qGuid = ((IfcRoot) q).getGlobalId(); if (qGuid.equals(referredGuid)) { found = true; if (eGet != null) { if (eGet instanceof IfcRoot) { String oldGuid = ((IfcRoot) eGet).getGlobalId(); if (newModel.containsGuid(oldGuid)) {
if (eObject instanceof IfcRoot) { IfcRoot ifcRoot = (IfcRoot)eObject; String guid = ifcRoot.getGlobalId() != null ? ifcRoot.getGlobalId() : ""; String name = ifcRoot.getName() != null ? ifcRoot.getName() : ""; dataObject = StoreFactory.eINSTANCE.createDataObject(); dataObject.setType(eObject.eClass().getName());
if (item instanceof IfcRoot) { IfcRoot ifcRoot = (IfcRoot)item; String guid = ifcRoot.getGlobalId(); referenceDataValue.setGuid(guid); if (eObject2 instanceof IfcRoot) { IfcRoot ifcRoot = (IfcRoot)eObject2; String guid = ifcRoot.getGlobalId(); reference.setGuid(guid);
if (eObject instanceof IfcRoot) { IfcRoot ifcRoot = (IfcRoot) eObject; String guid = ifcRoot.getGlobalId() != null ? ifcRoot.getGlobalId() : ""; String name = ifcRoot.getName() != null ? ifcRoot.getName() : ""; dataObject = StoreFactory.eINSTANCE.createDataObject(); dataObject.setType(eObject.eClass().getName());
for (IdEObject idEObject : newModel.getValues()) { if (idEObject instanceof IfcRoot) { String guid = ((IfcRoot) idEObject).getGlobalId(); for (EReference eReference : idEObject.eClass().getEAllReferences()) { Object referencedObject = idEObject.eGet(eReference);