Example #1
0
  private boolean extractRoutesList() {
    // List<Route> routesList = new ArrayList<Route>();
    // Query query = entityManager.createQuery("SELECT e FROM Route e");
    // routesList = (ArrayList<Route>) query.getResultList();
    List<Route> routesList = entityManager.createQuery("SELECT r FROM Route r").getResultList();
    if (routesList != null) {
      for (Route route : routesList) {
        System.out.println(route.getId());
      }

      Gson gson = new Gson();
      String ret = gson.toJson(routesList);
      System.out.println("Marshalled routesList " + ret);
      routeResponse = ret;
      return true;
    }
    return false;
  }
Example #2
0
  private boolean extractRoute(long routeId) {

    Route route2 = entityManager.find(Route.class, routeId);

    if (route2 == null) {
      System.out.println("Entity extraction fail(route)");
      return false;
    }

    System.out.println(route2.getAuthor());
    System.out.println(route2.getMarkerMap().size());
    for (MarkerModel value : route2.getMarkerMap().values()) {
      // System.out.println("ID "+(MarkerModel)value.toString());
      System.out.println(value.getTitle());
    }

    Gson gson = new Gson();
    String ret = "";
    ret = gson.toJson(route2);
    System.out.println("Marshalled route : " + ret);

    routeResponse = ret;
    return true;
  }