Skip to content

Commit 8624bd0

Browse files
committed
Server:初步实现通过配置Request表来级联删除评论(连同子评论);新增Structure.java校验和填充结构;disallowColumns全部改为disallow,necessaryColumns全部改为necessary;删除多余的ExceptionUtil
1 parent c2e5845 commit 8624bd0

15 files changed

Lines changed: 742 additions & 392 deletions

File tree

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
package zuo.biao.apijson;
2+
3+
import java.util.LinkedHashSet;
4+
import java.util.Map.Entry;
5+
import java.util.Set;
6+
7+
import javax.activation.UnsupportedDataTypeException;
8+
9+
import com.alibaba.fastjson.JSONArray;
10+
import com.alibaba.fastjson.JSONObject;
11+
12+
public abstract class OnParseCallback {
13+
14+
15+
16+
/**
17+
* @param key
18+
* @param to
19+
* @param ro
20+
* @return false ? continue
21+
* @throws Exception
22+
*/
23+
protected boolean onParse(String key, Object to, Object ro) throws Exception {
24+
// int operate = getOperate(key);
25+
// if (operate <= 0) {
26+
// return true;
27+
// }
28+
//
29+
// if (to instanceof JSONObject == false) {
30+
// throw new UnsupportedDataTypeException("服务器Request表配置错误!");
31+
// }
32+
// if (ro instanceof JSONObject == false) {
33+
// throw new UnsupportedDataTypeException(key + ":value 中 value不是JSONObject!");
34+
// }
35+
//
36+
// if (operate == OPERATE_PUT) {
37+
// ((JSONObject) ro).putAll((JSONObject) to);
38+
// return false;
39+
// }
40+
//
41+
// Set<Entry<String, Object>> set = new LinkedHashSet<>(((JSONObject) to).entrySet());
42+
// String k;
43+
// for (Entry<String, Object> e : set) {
44+
// k = e == null ? null : e.getKey();
45+
// if (k == null) {
46+
// continue;
47+
// }
48+
//
49+
// if (operate == OPERATE_VERIFY) {//TODO {}, $, <>
50+
//
51+
//
52+
// } else {
53+
// if (((JSONObject) ro).containsKey(k)) {
54+
// switch (operate) {
55+
// case OPERATE_REPLACE:
56+
// ((JSONObject) ro).put(k, e.getValue());
57+
// break;
58+
// case OPERATE_REMOVE:
59+
// ((JSONObject) ro).remove(k);
60+
// break;
61+
// }
62+
// } else {
63+
// if (operate == OPERATE_ADD) {
64+
// ((JSONObject) ro).put(k, e.getValue());
65+
// }
66+
// }
67+
// }
68+
// }
69+
//
70+
//
71+
// return false;
72+
return true;
73+
}
74+
75+
/**
76+
* @param key
77+
* @param to
78+
* @param ro
79+
* @return
80+
* @throws Exception
81+
*/
82+
protected Object onParseObject(String key, Object to, Object ro) throws Exception {
83+
return ro;
84+
}
85+
86+
/**
87+
* @param key
88+
* @param tobj
89+
* @param robj
90+
* @return
91+
* @throws Exception
92+
*/
93+
protected JSONObject onParseJSONObject(String key, JSONObject tobj, JSONObject robj) throws Exception {
94+
return robj;
95+
}
96+
97+
/**
98+
* @param key
99+
* @param tarray
100+
* @param rarray
101+
* @return
102+
* @throws Exception
103+
*/
104+
protected JSONArray onParseJSONArray(String key, JSONArray tarray, JSONArray rarray) throws Exception {
105+
return rarray;
106+
}
107+
108+
}

0 commit comments

Comments
 (0)