public void setQueryInterface(QueryInterface queryInterface) { this.queryInterface = queryInterface; if (queryInterface == null || queryInterface.isDeep()) { setLoadingState(State.NO_LAZY_LOADING); } else { setLoadingState(State.TO_BE_LOADED); } }
SearchingRecordIterator recordIterator = null; String tableName = eClass.getEPackage().getName() + "_" + eClass.getName(); if (query.getOidCounters() != null) { if (!query.getOidCounters().containsKey(eClass)) { return; long startOid = query.getOidCounters().get(eClass); ByteBuffer tmp = ByteBuffer.allocate(12); tmp.putInt(query.getPid()); tmp.putLong(startOid + 1); recordIterator = database.getKeyValueStore().getRecordIterator(tableName, BinUtils.intToByteArray(query.getPid()), tmp.array(), this); } else { recordIterator = database.getKeyValueStore().getRecordIterator(tableName, BinUtils.intToByteArray(query.getPid()), BinUtils.intToByteArray(query.getPid()), this); if (map == GetResult.CONTINUE_WITH_NEXT_OID) { nextKeyStart.position(0); nextKeyStart.putInt(query.getPid()); nextKeyStart.putLong(keyOid + 1); record = recordIterator.next(nextKeyStart.array());
public IfcModelInterface createModel(QueryInterface queryInterface) { HashMap<Integer, Long> map = new HashMap<Integer, Long>(); map.put(queryInterface.getPid(), queryInterface.getRoid()); return new ServerIfcModel(queryInterface.getPackageMetaData(), map, this); }
newObject.setPid(Database.STORE_PROJECT_ID); } else { newObject.setPid(query.getPid()); newObject.setRid(query.getRid()); try { newObject.setModel(model); if (query.isDeep() && object.eClass().getEAnnotation("wrapped") == null) { if (feature.getEAnnotation("nolazyload") == null) { todoList.add(newObject);
private GetResult getMap(EClass originalQueryClass, EClass eClass, IfcModelInterface model, ByteBuffer buffer, int keyPid, long keyOid, int keyRid, QueryInterface query, TodoList todoList) throws BimserverDatabaseException { checkOpen(); if (keyPid == query.getPid()) { if (keyRid <= query.getRid() && keyRid >= query.getStopRid()) { IdEObject cachedObject = objectCache.get(keyOid); if (cachedObject != null && ((IdEObjectImpl)cachedObject).getLoadingState() == State.LOADED) {
mustStartWith.putInt(query.getPid()); mustStartWith.putLong(oid); ByteBuffer startSearchWith = ByteBuffer.wrap(new byte[16]); startSearchWith.putInt(query.getPid()); startSearchWith.putLong(oid); startSearchWith.putInt(-query.getRid()); if (keyRid <= query.getRid()) { if (idEObject != null && idEObject.getRid() == Integer.MAX_VALUE) { ((IdEObjectImpl) idEObject).setRid(keyRid);
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); }
ByteBuffer mustStartWith = createKeyBuffer(query.getPid(), oid); ByteBuffer key = createKeyBuffer(query.getPid(), oid, -query.getStopRid()); SearchingRecordIterator recordIterator = database.getKeyValueStore().getRecordIterator(eClass.getEPackage().getName() + "_" + eClass.getName(), mustStartWith.array(), key.array(), this); if (map == GetResult.CONTINUE_WITH_NEXT_OID) { nextKeyStart.position(0); nextKeyStart.putInt(query.getPid()); nextKeyStart.putLong(keyOid + 1); record = recordIterator.next(nextKeyStart.array());
((IdEObjectImpl) idEObject).setPid(query.getPid()); if (rid == Integer.MAX_VALUE) { throw new BimserverDatabaseException("Database corrupt, rid cannot be " + Integer.MAX_VALUE); if (!query.shouldFollowReference(originalQueryClass, eClass, feature)) {
} else if (classifier.getName().equals("Tristate")) { int ordinal = buffer.getInt(); EEnum tristateEnum = query.getPackageMetaData().getEEnum("Tristate"); return tristateEnum.getEEnumLiteral(ordinal).getInstance(); } else if (classifier instanceof EEnum) {
private void processTodoList(IfcModelInterface model, TodoList todoList, QueryInterface query) throws BimserverDatabaseException { IdEObject idEObject = todoList.poll(); while (idEObject != null) { IdEObject result = get(idEObject, idEObject.getOid(), model, query, todoList); if (result == null) { throw new BimserverDatabaseException("Object not found: " + query.getPid() + " " + query.getRid() + " " + idEObject.getOid() + " " + idEObject.eClass().getName()); } if (!model.contains(result.getOid())) { try { model.addAllowMultiModel(result.getOid(), result); } catch (IfcModelInterfaceException e) { throw new BimserverDatabaseException(e); } } idEObject = todoList.poll(); } }