Skip to content

Commit

Permalink
Made two dimensional arrays work with non-streaming serializer (IFC4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben de Laat authored and Ruben de Laat committed Mar 2, 2018
1 parent a2864d1 commit 2262900
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
1 change: 0 additions & 1 deletion BimServer/src/org/bimserver/database/DatabaseSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ private IdEObject convertByteArrayToObject(IdEObject idEObject, EClass originalQ
}
((IdEObjectImpl) idEObject).setRid(rid);
((IdEObjectImpl) idEObject).useInverses(false);


if (DEVELOPER_DEBUG && StorePackage.eINSTANCE == idEObject.eClass().getEPackage()) {
LOGGER.info("Read: " + idEObject.eClass().getName() + " pid=" + query.getPid() + " oid=" + oid + " rid=" + rid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,20 @@ public IfcModelInterface execute() throws UserException, BimserverLockConflictEx
// if (ref != null) {
// list.add(ref);
// }
} else if (refOid instanceof HashMapVirtualObject) {
HashMapVirtualObject hashMapVirtualObject = (HashMapVirtualObject)refOid;
IdEObject listObject = packageMetaData.create(hashMapVirtualObject.eClass());
List subList = (List<?>) hashMapVirtualObject.get("List");
List newList = (List<?>) listObject.eGet(listObject.eClass().getEStructuralFeature("List"));
for (Object o : subList) {
if (o instanceof HashMapWrappedVirtualObject) {
newList.add(convertWrapped(revision, ifcModel, (HashMapWrappedVirtualObject)o));
} else {
newList.add(o);
}
}
list.addUnique(listObject);
} else {
}
}
}
Expand All @@ -170,14 +184,9 @@ public IfcModelInterface execute() throws UserException, BimserverLockConflictEx
long refOid = (Long)r;
idEObject.eSet(eReference, ifcModel.get(refOid));
} else if (r instanceof HashMapWrappedVirtualObject) {
HashMapWrappedVirtualObject hashMapWrappedVirtualObject = (HashMapWrappedVirtualObject)r;
IdEObject embeddedObject = ifcModel.create(hashMapWrappedVirtualObject.eClass());
((IdEObjectImpl)embeddedObject).setOid(-1);
((IdEObjectImpl)embeddedObject).setPid(revision.getProject().getId());
idEObject.eSet(eReference, embeddedObject);
for (EAttribute eAttribute : hashMapWrappedVirtualObject.eClass().getEAllAttributes()) {
embeddedObject.eSet(eAttribute, hashMapWrappedVirtualObject.eGet(eAttribute));
}
idEObject.eSet(eReference, convertWrapped(revision, ifcModel, (HashMapWrappedVirtualObject) r));
} else if (r instanceof HashMapVirtualObject) {
} else {
}
}
}
Expand Down Expand Up @@ -279,6 +288,16 @@ public IfcModelInterface execute() throws UserException, BimserverLockConflictEx
// name = name.substring(0, name.length()-1);
// }
}

private IdEObject convertWrapped(Revision revision, IfcModelInterface ifcModel, HashMapWrappedVirtualObject hashMapWrappedVirtualObject) throws IfcModelInterfaceException {
IdEObject embeddedObject = ifcModel.create(hashMapWrappedVirtualObject.eClass());
((IdEObjectImpl)embeddedObject).setOid(-1);
((IdEObjectImpl)embeddedObject).setPid(revision.getProject().getId());
for (EAttribute eAttribute : hashMapWrappedVirtualObject.eClass().getEAllAttributes()) {
embeddedObject.eSet(eAttribute, hashMapWrappedVirtualObject.eGet(eAttribute));
}
return embeddedObject;
}

public int getProgress() {
return progress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected void processPossibleInclude(HashMapVirtualObject object, CanInclude pr
}
if (include.hasFields()) {
for (EStructuralFeature eStructuralFeature : include.getFields()) {
// TODO do we really have to iterate through the EAtrributes as well?
// TODO do we really have to iterate through the EAtrributes as well? You should not use fields for attributes anyways, so there should be none ...
object.addUseForSerialization(eStructuralFeature);
}
}
Expand Down

0 comments on commit 2262900

Please sign in to comment.