private void processDownload(Long topicId) throws UserException, ServerException, PublicInterfaceNotFoundException, IfcModelInterfaceException, IOException { InputStream inputStream = bimServerClient.getDownloadData(topicId); if (inputStream == null) { throw new IfcModelInterfaceException("No InputStream to read from for topicId " + topicId); } InputStream downloadData = new org.bimserver.utils.CountingInputStream(inputStream) { public void close() throws IOException { ClientIfcModel.this.clientDebugInfo.incBytesOverTheLine(getCount()); super.close(); } }; try { new SharedJsonDeserializer(false).read(downloadData, this, false); } catch (DeserializeException e) { throw new IfcModelInterfaceException(e); } catch (Exception e) { throw new IfcModelInterfaceException(e); } finally { if (downloadData != null) { downloadData.close(); } } }
Object e = readPrimitive(jsonReader, eStructuralFeature); list.add(e); if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEDouble()) { if (peek == JsonToken.NUMBER) { long refOid = jsonReader.nextLong(); processRef(model, waitingList, object, eStructuralFeature, index, list, refOid); } else if(eStructuralFeature.getEAnnotation("twodimensionalarray")!=null) { IdEObjectImpl listObject = model.create(((EReference) eStructuralFeature).getEReferenceType()); addToList(eStructuralFeature, index, list, listObject); EStructuralFeature listFeature = listObject.eClass().getEStructuralFeature("List"); jsonReader.beginArray(); if(listFeature instanceof EAttribute){ while (jsonReader.hasNext()) { innerList.add(readPrimitive(jsonReader, listFeature)); if(jsonReader.nextName().equals("_v")){ EStructuralFeature wv = wrappedObject.eClass().getEStructuralFeature("wrappedValue"); wrappedObject.eSet(wv, readPrimitive(jsonReader, wv)); innerList.add(wrappedObject); if (jsonReader.nextName().equals("_v")) { EStructuralFeature wv = wrappedObject.eClass().getEStructuralFeature("wrappedValue"); wrappedObject.eSet(wv, readPrimitive(jsonReader, wv)); list.add(wrappedObject); } else { ((IdEObjectImpl)refObject).setLoadingState(State.OPPOSITE_SETTING);
while (jsonReader.hasNext()) { nrObjects++; processObject(model, waitingList, jsonReader, null); IfcHeader ifcHeader = (IfcHeader) processObject(model, waitingList, jsonReader, StorePackage.eINSTANCE.getIfcHeader()); model.getModelMetaData().setIfcHeader(ifcHeader);
@SuppressWarnings({ "unchecked", "rawtypes" }) private void processRef(IfcModelInterface model, WaitingList<Long> waitingList, IdEObjectImpl object, EStructuralFeature eStructuralFeature, int index, AbstractEList list, long refOid) throws DeserializeException { EntityDefinition entityBN = model.getPackageMetaData().getSchemaDefinition().getEntityBN(object.eClass().getName()); Attribute attributeBN = entityBN.getAttributeBNWithSuper(eStructuralFeature.getName()); if (skipInverses && attributeBN instanceof InverseAttribute && ((EReference)eStructuralFeature).getEOpposite() != null) { // skip } else { if (model.contains(refOid)) { EObject referencedObject = model.get(refOid); if (referencedObject != null) { addToList(eStructuralFeature, index, list, referencedObject); } } else { waitingList.add(refOid, new ListWaitingObject(-1, object, (EReference) eStructuralFeature, index)); } } }