Search in sources :

Example 6 with QueryException

use of org.bimserver.database.queries.om.QueryException in project BIMserver by opensourceBIM.

the class QueryObjectProvider method fromJsonNode.

public static QueryObjectProvider fromJsonNode(DatabaseSession databaseSession, BimServer bimServer, JsonNode fullQuery, Set<Long> roids, PackageMetaData packageMetaData) throws JsonParseException, JsonMappingException, IOException, QueryException {
    if (fullQuery instanceof ObjectNode) {
        JsonQueryObjectModelConverter converter = new JsonQueryObjectModelConverter(packageMetaData);
        Query query = converter.parseJson("query", (ObjectNode) fullQuery);
        return new QueryObjectProvider(databaseSession, bimServer, query, roids, packageMetaData);
    } else {
        throw new QueryException("Query root must be of type object");
    }
}
Also used : QueryException(org.bimserver.database.queries.om.QueryException) JsonQueryObjectModelConverter(org.bimserver.database.queries.om.JsonQueryObjectModelConverter) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Query(org.bimserver.database.queries.om.Query)

Example 7 with QueryException

use of org.bimserver.database.queries.om.QueryException 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);
        }
    }
}
Also used : IfcModelInterfaceException(org.bimserver.emf.IfcModelInterfaceException) QueryException(org.bimserver.database.queries.om.QueryException) JsonQueryObjectModelConverter(org.bimserver.database.queries.om.JsonQueryObjectModelConverter) Query(org.bimserver.database.queries.om.Query) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) QueryPart(org.bimserver.database.queries.om.QueryPart) IOException(java.io.IOException)

Aggregations

QueryException (org.bimserver.database.queries.om.QueryException)7 IOException (java.io.IOException)5 Query (org.bimserver.database.queries.om.Query)5 UserException (org.bimserver.shared.exceptions.UserException)5 JsonQueryObjectModelConverter (org.bimserver.database.queries.om.JsonQueryObjectModelConverter)4 IfcModelInterfaceException (org.bimserver.emf.IfcModelInterfaceException)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 HashMap (java.util.HashMap)3 OldQuery (org.bimserver.database.OldQuery)3 QueryPart (org.bimserver.database.queries.om.QueryPart)3 PackageMetaData (org.bimserver.emf.PackageMetaData)3 Revision (org.bimserver.models.store.Revision)3 HashMapVirtualObject (org.bimserver.shared.HashMapVirtualObject)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 QueryObjectProvider (org.bimserver.database.queries.QueryObjectProvider)2 IdEObject (org.bimserver.emf.IdEObject)2 IdEObjectImpl (org.bimserver.emf.IdEObjectImpl)2 Project (org.bimserver.models.store.Project)2