Package com.wordpress.salaboy.context.tracking.json

Examples of com.wordpress.salaboy.context.tracking.json.QueryResult


        method.setRequestEntity(new StringRequestEntity(content, "application/json", "UTF-8"));
        client.executeMethod(method);
       
        Gson gson = new Gson();

    QueryResult result = gson.fromJson(method.getResponseBodyAsString(),
        new TypeToken<QueryResult>() {
        }.getType());

    System.out.println("results: " + result);
    Assert.assertEquals(2, result.getData().size());
    for (List<ResponseNode> data : result.getData()) {
      Map<String, String> props = data.get(0).getData();
      for (String key : props.keySet()) {
        System.out.println("Property ("+key+"): "+props.get(key));
      }
    }

        client = new HttpClient();
        method = new PostMethod("http://localhost:7575/db/data/ext/CypherPlugin/graphdb/execute_query");
        method.setRequestHeader("Content-type", "application/json");
        method.setRequestHeader("Accept", "application/json");
        content = "{\"query\": \"start v=(vehicles, 'vehicleId:" + vehicle.getId() + "')  match (v) <-[USE]- (w)    return w\"}";
        method.setRequestEntity(new StringRequestEntity(content, "application/json", "UTF-8"));
        client.executeMethod(method);
       
        gson = new Gson();

    result = gson.fromJson(method.getResponseBodyAsString(),
        new TypeToken<QueryResult>() {
        }.getType());
               
    System.out.println("results: " + result);
    Assert.assertEquals(1, result.getData().size());
    for (List<ResponseNode> data : result.getData()) {
      Map<String, String> props = data.get(0).getData();
      for (String key : props.keySet()) {
        System.out.println("Property ("+key+"): "+props.get(key));
      }
    }
View Full Code Here


            method.setRequestEntity(new StringRequestEntity(content, "application/json", "UTF-8"));
            client.executeMethod(method);

            Gson gson = new Gson();

            QueryResult result = gson.fromJson(method.getResponseBodyAsString(),
                    new TypeToken<QueryResult>() {
                    }.getType());
            //TODO CHECK THIS WITH A TEST!
            return result.getData().get(0).get(0).getData().get("procedureId");

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

            method.setRequestEntity(new StringRequestEntity(content, "application/json", "UTF-8"));
            client.executeMethod(method);

            Gson gson = new Gson();

            QueryResult result = gson.fromJson(method.getResponseBodyAsString(),
                    new TypeToken<QueryResult>() {
                    }.getType());
            //TODO CHECK THIS WITH A TEST!
           
            if (result.getData().isEmpty()){
                //No results
                return null;
            }
           
            return result.getData().get(0).get(0).getData().get("callId");

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

            method.setRequestEntity(new StringRequestEntity(content, "application/json", "UTF-8"));
            client.executeMethod(method);

            Gson gson = new Gson();

            QueryResult result = gson.fromJson(method.getResponseBodyAsString(),
                    new TypeToken<QueryResult>() {
                    }.getType());
            //TODO CHECK THIS WITH A TEST!
           
            if (result.getData().isEmpty()){
                //No results
                return null;
            }
            return result.getData().get(0).get(0).getData().get("emergencyId");

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

TOP

Related Classes of com.wordpress.salaboy.context.tracking.json.QueryResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.