use of org.bimserver.database.queries.om.JsonQueryObjectModelConverter in project BIMserver by opensourceBIM.
the class BimServerClient method query.
public long query(Query query, long roid, long serializerOid) throws ServerException, UserException, PublicInterfaceNotFoundException {
ObjectNode queryNode = new JsonQueryObjectModelConverter(query.getPackageMetaData()).toJson(query);
Long topicId = getServiceInterface().download(Collections.singleton(roid), queryNode.toString(), serializerOid, false);
return topicId;
}
use of org.bimserver.database.queries.om.JsonQueryObjectModelConverter in project BIMserver by opensourceBIM.
the class ClientIfcModel method getAllWithSubTypes.
@Override
public <T extends IdEObject> List<T> getAllWithSubTypes(EClass eClass) {
if (!loadedClasses.contains(eClass.getName()) && modelState != ModelState.FULLY_LOADED) {
try {
modelState = ModelState.LOADING;
Query query = new Query(getPackageMetaData());
QueryPart queryPart = query.createQueryPart();
queryPart.addType(eClass, true);
if (includeGeometry && getPackageMetaData().getEClass("IfcProduct").isSuperTypeOf(eClass)) {
Include include = queryPart.createInclude();
include.addType(eClass, true);
include.addField("geometry");
}
JsonQueryObjectModelConverter converter = new JsonQueryObjectModelConverter(getPackageMetaData());
long topicId = bimServerClient.getServiceInterface().download(Collections.singleton(roid), converter.toJson(query).toString(), getJsonSerializerOid(), false);
waitForDonePreparing(topicId);
processDownload(topicId);
bimServerClient.getServiceInterface().cleanupLongAction(topicId);
for (EClass subClass : bimServerClient.getMetaDataManager().getPackageMetaData(eClass.getEPackage().getName()).getAllSubClasses(eClass)) {
loadedClasses.add(subClass.getName());
rebuildIndexPerClass(eClass);
}
loadedClasses.add(eClass.getName());
modelState = ModelState.NONE;
loadGeometry();
} catch (Exception e) {
LOGGER.error("", e);
}
}
return super.getAllWithSubTypes(eClass);
}
use of org.bimserver.database.queries.om.JsonQueryObjectModelConverter in project BIMserver by opensourceBIM.
the class ClientIfcModel method loadDeep.
private void loadDeep() throws ServerException, UserException, PublicInterfaceNotFoundException, QueryException {
if (modelState != ModelState.FULLY_LOADED && modelState != ModelState.LOADING) {
modelState = ModelState.LOADING;
Query query = new Query("test", getPackageMetaData());
QueryPart queryPart = query.createQueryPart();
queryPart.setIncludeAllFields(true);
ObjectNode queryNode = new JsonQueryObjectModelConverter(query.getPackageMetaData()).toJson(query);
Long topicId = bimServerClient.getServiceInterface().download(Collections.singleton(roid), queryNode.toString(), getJsonSerializerOid(), false);
waitForDonePreparing(topicId);
try {
processDownload(topicId);
bimServerClient.getServiceInterface().cleanupLongAction(topicId);
modelState = ModelState.FULLY_LOADED;
loadGeometry();
} catch (IfcModelInterfaceException | IOException e) {
LOGGER.error("", e);
} catch (QueryException e) {
LOGGER.error("", e);
} catch (GeometryException e) {
LOGGER.error("", e);
}
}
}
Aggregations