@@ -155,10 +155,10 @@ public String getRequestURL() {
155
155
return getRequestBaseURL () + getRequestPath ();
156
156
}
157
157
158
- // @Override
159
- // public Parser<Long> newParser(HttpSession session, RequestMethod method) {
160
- // return super.newParser(session, method).setNeedVerify(false);
161
- // }
158
+ // @Override
159
+ // public Parser<Long> newParser(HttpSession session, RequestMethod method) {
160
+ // return super.newParser(session, method).setNeedVerify(false);
161
+ // }
162
162
163
163
/**增删改查统一的类 RESTful API 入口,牺牲一点路由解析性能来提升一些开发效率
164
164
* @param method
@@ -2189,127 +2189,7 @@ public String execute(@RequestBody String request, HttpSession session) {
2189
2189
2190
2190
result .put ("time:start|duration|end|parse|sql" , startTime + "|" + duration + "|" + endTime + "|" + parseDuration + "|" + sqlDuration );
2191
2191
2192
- if (DemoSQLExecutor .DATABASE_NEBULA .equalsIgnoreCase (database ) == false ) {
2193
- return result .toJSONString ();
2194
- }
2195
-
2196
- return com .alibaba .fastjson .JSON .toJSONString (result , new ValueFilter () {
2197
- @ Override
2198
- public Object process (Object o , String key , Object val ) {
2199
- // if (val instanceof ValueWrapper) {
2200
- // return process(o, key, ((ValueWrapper) val).getValue());
2201
- // }
2202
- //
2203
- // if (val instanceof Value) {
2204
- // return process(o, key, ((Value) val).getFieldValue());
2205
- // }
2206
- //
2207
- // if (val instanceof Vertex) {
2208
- // JSONObject obj = new JSONObject(true);
2209
- // obj.put("vid", new String(((Vertex) val).getVid().getSVal()));
2210
- // obj.put("str", val.toString());
2211
- //
2212
- // List<Tag> tags = ((Vertex) val).getTags();
2213
- //
2214
- // if (tags != null) {
2215
- // JSONArray arr = new JSONArray();
2216
- // for (int i = 0; i < tags.size(); i++) {
2217
- // arr.add(process(o, String.valueOf(i), tags.get(i)));
2218
- // }
2219
- // obj.put("tags", arr);
2220
- // }
2221
- //
2222
- // return obj;
2223
- // }
2224
- //
2225
- // if (val instanceof Tag) {
2226
- // JSONObject obj = new JSONObject(true);
2227
- // obj.put("name", new String(((Tag) val).getName()));
2228
- // obj.put("str", val.toString());
2229
- //
2230
- // Map<byte[], Value> props = ((Tag) val).getProps();
2231
- //
2232
- // if (props != null) {
2233
- // JSONObject propsObj = new JSONObject(true);
2234
- // props.forEach(new BiConsumer<byte[], Value>() {
2235
- // @Override
2236
- // public void accept(byte[] bytes, Value value) {
2237
- // String k = new String(bytes);
2238
- // propsObj.put(k, process(propsObj, k, value));
2239
- // }
2240
- // });
2241
- // obj.put("props", propsObj);
2242
- // }
2243
- //
2244
- // return obj;
2245
- // }
2246
- //
2247
- // if (val instanceof Edge) {
2248
- // JSONObject obj = new JSONObject(true);
2249
- // obj.put("name", new String(((Edge) val).getName()));
2250
- // obj.put("str", val.toString());
2251
- //
2252
- // Map<byte[], Value> props = ((Edge) val).getProps();
2253
- //
2254
- // if (props != null) {
2255
- // JSONObject propsObj = new JSONObject(true);
2256
- // props.forEach(new BiConsumer<byte[], Value>() {
2257
- // @Override
2258
- // public void accept(byte[] bytes, Value value) {
2259
- // String k = new String(bytes);
2260
- // propsObj.put(k, process(propsObj, k, value));
2261
- // }
2262
- // });
2263
- // obj.put("props", propsObj);
2264
- // }
2265
- //
2266
- // return obj;
2267
- // }
2268
- //
2269
- // if (val instanceof NullType) {
2270
- // return null;
2271
- // }
2272
- //
2273
- // if (val instanceof DateWrapper) {
2274
- // return ((DateWrapper) val).toString();
2275
- // }
2276
- //
2277
- // if (val instanceof TimeWrapper) {
2278
- // return ((TimeWrapper) val).getLocalTimeStr();
2279
- // }
2280
- //
2281
- // if (val instanceof DateTimeWrapper) {
2282
- // return ((DateTimeWrapper) val).getLocalDateTimeStr();
2283
- // }
2284
- //
2285
- // if (val instanceof DurationWrapper) {
2286
- // return ((DurationWrapper) val).getMicroseconds();
2287
- // }
2288
- //
2289
- // if (val instanceof Date) {
2290
- // Date d = (Date) val;
2291
- // return new java.sql.Date(d.getYear() - 1900, d.getMonth(), d.getDay()).toString();
2292
- // }
2293
- //
2294
- // if (val instanceof Time) {
2295
- // Time t = (Time) val;
2296
- // return new java.sql.Time(t.getHour(), t.getMinute(), t.getSec()).toString();
2297
- // }
2298
- //
2299
- // if (val instanceof DateTime) {
2300
- // DateTime dt = (DateTime) val;
2301
- // // return new java.util.Date(dt.getYear(), dt.getNonth(), dt.getDayO, dt.getHour(), dt.getMinute(), dt.getSec0).toGnTString();
2302
- // return new java.sql.Date(dt.getYear() - 1988, dt.getMonth(), dt.getDay())
2303
- // + " " + new java.sql.Time(dt.getHour(), dt.getMinute(), dt.getSec());
2304
- // }
2305
- //
2306
- // if (val instanceof Duration) {
2307
- // return ((Duration) val).getMicroseconds();
2308
- // }
2309
-
2310
- return val ;
2311
- }
2312
- }, SerializerFeature .WriteMapNullValue );
2192
+ return result .toJSONString ();
2313
2193
} catch (Exception e ) {
2314
2194
JSONObject result = DemoParser .newErrorResult (e );
2315
2195
result .put ("throw" , e .getClass ().getName ());
0 commit comments