private boolean superTypeIsWrapped(EClass eType) { if (eType.getEAnnotation("wrapped") != null) { return true; } for (EClass superClass : eType.getESuperTypes()) { if (superTypeIsWrapped(superClass)) { return true; } } return false; }
private void clean() { Iterator<EClassifier> iterator = schemaPack.getEClassifiers().iterator(); while (iterator.hasNext()) { EClassifier eClassifier = iterator.next(); if (eClassifier instanceof EClass) { EClass eClass = (EClass) eClassifier; if (eClass.getEAnnotation("wrapped") != null) { if (eClass.getESuperTypes().size() == 1) { // iterator.remove(); } } } } }
@Override public void change(Database database, DatabaseSession databaseSession) throws BimserverDatabaseException { boolean transactional = !(ePackage == Ifc2x3tc1Package.eINSTANCE || ePackage == Ifc4Package.eINSTANCE || ePackage == GeometryPackage.eINSTANCE); LOGGER.info("Creating " + eClasses.size() + " " + (transactional ? "transactional" : "non transactional") + " tables for package " + ePackage.getName()); for (EClass eClass : eClasses) { String tableName = eClass.getEPackage().getName() + "_" + eClass.getName(); if (eClass.getEAnnotation("nodatabase") == null) { try { boolean created = database.createTable(eClass, databaseSession, transactional); if (!created) { throw new BimserverDatabaseException("Could not create table " + tableName); } // for (EStructuralFeature eStructuralFeature : eClass.getEAllStructuralFeatures()) { // if (eStructuralFeature.getEAnnotation("index") != null) { // database.createIndexTable(eClass, eStructuralFeature, databaseSession); // } // } } catch (BimserverLockConflictException e) { LOGGER.error("", e); } } } }
@Override public void change(Database database, DatabaseSession databaseSession) throws BimserverDatabaseException { String tableName = getEClass().getEPackage().getName() + "_" + getEClass().getName(); if (eClass.getEAnnotation("nodatabase") == null) { boolean transactional = !(eClass.getEPackage() == Ifc2x3tc1Package.eINSTANCE || eClass.getEPackage() == Ifc4Package.eINSTANCE || eClass.getEPackage() == GeometryPackage.eINSTANCE); LOGGER.info("Creating " + (transactional ? "transactional" : "non transactional") + " table: " + tableName); try { boolean created = database.createTable(getEClass(), databaseSession, transactional); if (!created) { throw new BimserverDatabaseException("Could not create table " + tableName); } // for (EStructuralFeature eStructuralFeature : eClass.getEAllStructuralFeatures()) { // if (eStructuralFeature.getEAnnotation("index") != null) { // database.createIndexTable(eClass, eStructuralFeature, databaseSession); // } // } } catch (BimserverLockConflictException e) { LOGGER.error("", e); } } }
public void getMap(IfcModelInterface ifcModel, QueryInterface query) throws BimserverDatabaseException { checkOpen(); TodoList todoList = new TodoList(); if (query.getOidCounters() != null) { for (EClass eClass : query.getOidCounters().keySet()) { if (Thread.currentThread().isInterrupted()) { throw new BimserverDatabaseException("Thread interrupted"); } if (eClass.getEAnnotation("nolazyload") == null && eClass.getEAnnotation("nodatabase") == null) { if (query.shouldIncludeClass(eClass)) { getMap(eClass, ifcModel, query, todoList); } } } } else { LOGGER.info("Inefficient getMap"); for (EClass eClass : database.getClasses()) { if (Thread.currentThread().isInterrupted()) { throw new BimserverDatabaseException("Thread interrupted"); } if (eClass.getEAnnotation("nolazyload") == null && eClass.getEAnnotation("nodatabase") == null) { if (query.shouldIncludeClass(eClass)) { getMap(eClass, ifcModel, query, todoList); } } } } processTodoList(ifcModel, todoList, query); }
@Override public boolean write(OutputStream outputStream, ProgressReporter progressReporter) throws SerializerException { if (getMode() == Mode.BODY) { PrintWriter out = new PrintWriter(outputStream); for (EObject eObject : model.getObjects().values()) { if (eObject.eClass().getEAnnotation("hidden") == null) { writeTable(out, eObject); } } out.flush(); setMode(Mode.FINISHED); return true; } else if (getMode() == Mode.FINISHED) { return false; } return false; }
if (eType.getEPackage() == ePackage) { for (EClass eClass2 : packageMetaData.getAllSubClassesIncludingSelf(eType)) { if (eClass2.getEAnnotation("wrapped") == null) { process(eClass2); includesNode.add(eClass2.getName());
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; }
if (subClass.getEAnnotation("nodatabase") == null) { String indexTableName = subClass.getEPackage().getName() + "_" + subClass.getName() + "_" + eStructuralFeature.getName(); boolean transactional = !(subClass.getEPackage() == Ifc4Package.eINSTANCE || subClass.getEPackage() == Ifc2x3tc1Package.eINSTANCE);
throw new IfcModelInterfaceException("This object (" + eObject + ") already belongs to a Model: " + ((IdEObjectImpl) eObject).getModel() + ", not this " + this); if (oid == -1 || eObject.eClass().getEAnnotation("wrapped") != null) { unidentifiedObjects.add(eObject); } else {
if (query.isDeep() && object.eClass().getEAnnotation("wrapped") == null) { if (feature.getEAnnotation("nolazyload") == null) { todoList.add(newObject); if (object.eClass().getEAnnotation("wrapped") == null) { try { model.addAllowMultiModel(oid, newObject);
} else if (Ifc2x3tc1Package.eINSTANCE.getIfcRelationship().isSuperTypeOf(eClass)) { subMap = revisionSummaryContainerRelations; } else if (eClass.getEAnnotation("wrapped") != null) { subMap = revisionSummaryContainerPrimitives; } else {
} else if (((EClass) packageMetaData.getEPackage().getEClassifier("IfcRelationship")).isSuperTypeOf(eClass)) { subMap = revisionSummaryContainerRelations; } else if (eClass.getEAnnotation("wrapped") != null) { subMap = revisionSummaryContainerPrimitives; } else {
private void write(IdEObject object) throws IOException { if (object.eClass().getEAnnotation("wrapped") != null) { EStructuralFeature wrappedFeature = object.eClass().getEStructuralFeature("wrappedValue"); print("{"); print("\"_t\":\"" + object.eClass().getName() + "\","); print("\"_v\":"); writePrimitive(wrappedFeature, object.eGet(wrappedFeature)); print("}"); } else { print("" + object.getOid()); } }
} else { IdEObject listObject = (IdEObject) o; if (listObject.eClass().getEAnnotation("wrapped") != null || listObject.eClass().getEStructuralFeature("wrappedValue") != null) { writeWrappedValue(object.getPid(), object.getRid(), listObject, buffer, packageMetaData); } else if (feature.getEAnnotation("twodimensionalarray") != null) {
@SuppressWarnings("rawtypes") private void checkDoubleOidsPlusReferences(BiMap<IdEObject, Long> done, IdEObject idEObject) { if (idEObject == null) { return; } if (idEObject.eClass().getEAnnotation("wrapped") != null) { return; } if (done.containsKey(idEObject)) { return; } if (done.containsValue(idEObject.getOid())) { showBackReferences(idEObject); IdEObject existing = done.inverse().get(idEObject.getOid()); showBackReferences(existing); throw new RuntimeException("Double oid: " + idEObject.getOid() + " " + idEObject + ", " + existing); } done.put(idEObject, idEObject.getOid()); for (EReference eReference : idEObject.eClass().getEAllReferences()) { if (eReference.isMany()) { List list = (List) idEObject.eGet(eReference); for (Object o : list) { checkDoubleOidsPlusReferences(done, (IdEObject) o); } } else { checkDoubleOidsPlusReferences(done, (IdEObject) idEObject.eGet(eReference)); } } }
IdEObject cachedObject = objectCache.get(keyOid); if (cachedObject != null && ((IdEObjectImpl)cachedObject).getLoadingState() == State.LOADED) { if (!model.contains(keyOid) && cachedObject.eClass().getEAnnotation("wrapped") == null) { try { model.addAllowMultiModel(keyOid, cachedObject);
} else if (eObject.eClass().getEAnnotation("wrapped") != null) { VirtualObject wrappedValue = (VirtualObject) val; EStructuralFeature wrappedValueFeature = wrappedValue.eClass().getEStructuralFeature("wrappedValue");
public long store(IdEObject object, int pid, int rid) throws BimserverDatabaseException { checkOpen(); if ((objectsToCommit == null || !objectsToCommit.containsObject(object)) && (objectsToDelete == null || !objectsToDelete.contains(object))) { objectCache.put(object.getOid(), object); boolean wrappedValue = object.eClass().getEAnnotation("wrapped") != null; if (!wrappedValue) { if (object.getOid() == -1) { long newOid = newOid(object.eClass()); ((IdEObjectImpl) object).setOid(newOid); } object.load(); ((IdEObjectImpl) object).setPid(pid); if (rid == Integer.MAX_VALUE) { ((IdEObjectImpl) object).setRid(object.getRid() + 1); } else { ((IdEObjectImpl) object).setRid(rid); } addToObjectsToCommit(object); } } return object.getOid(); }
refSize += getExactSize(eObject, packageMetaData, false); return refSize; } else if (eObject.eClass().getEAnnotation("wrapped") != null) { IdEObject wrappedValue = (IdEObject) val; EStructuralFeature wrappedValueFeature = wrappedValue.eClass().getEStructuralFeature("wrappedValue");