@GET @Path("/execute/{name}") @Produces(MediaType.APPLICATION_JSON) public DataRowsProxy execute(@PathParam("name") String name) { StoredQuery sq = getQueriesMap().get(name); if (sq == null) throw new RuntimeException("not found"); StringBuilder out = new StringBuilder(); Map<String, String> httpQueryParams = new HashMap<String, String>(); if (context != null) { for (String k : context.getQueryParameters().keySet()) { String v = context.getQueryParameters().getFirst(k); httpQueryParams.put(k, v); } } sq.setHttpParams(httpQueryParams); if (httpQueryParams.containsKey("dateFormat")) { SimpleDateFormat sdf = new SimpleDateFormat(httpQueryParams.get("dateFormat")); castGraph.setDateFormat(sdf); } DataRowsProxy drows = DataRowsProxy.create(sq.execute(), castGraph); // drows.tableData = sq.execute(); // drows.castGr = castGraph; return drows; // out.append("execute "+name+"\n"); // // sq.setHttpParams(httpQueryParams); // TableData td = sq.execute(); // for( DataRow dr : td.getRows() ){ // } // // return // Response // .ok() // .type(MediaType.TEXT_PLAIN_TYPE) // .entity(out.toString()) // .build(); }
public static DataRowsProxy create(TableData td, BaseCastGraph cg) { DataRowsProxy res = new DataRowsProxy(); res.castGr = cg; res.tableData = td; return res; }