|
@@ -191,6 +191,72 @@ public class RestUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static String desc(String param) {
|
|
|
+ JSONArray path = JSON.parseArray(param);
|
|
|
+ String[] valuePath = new String[path.size()];
|
|
|
+ for (int i = 0; i < path.size(); i++) {
|
|
|
+ valuePath[i] = path.getString(i);
|
|
|
+ }
|
|
|
+ Repository Repository = RepositoryBase.instance;
|
|
|
+ Object valueObject = ComputeUtil.getValueObject(Repository, valuePath);
|
|
|
+ String result;
|
|
|
+ if (valueObject instanceof SceneDataValue) {
|
|
|
+ SceneDataValue currData = (SceneDataValue) valueObject;
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ sb.append("SceneDataValue: ");
|
|
|
+ if (currData.parentObjectData != null) {
|
|
|
+ sb.append(currData.parentObjectData.myPropertyName);
|
|
|
+ sb.append("\t");
|
|
|
+ } else {
|
|
|
+ sb.append("null");
|
|
|
+ sb.append("\t");
|
|
|
+ }
|
|
|
+ sb.append(currData.myPropertyName);
|
|
|
+ sb.append("\t");
|
|
|
+ if (currData.value_array != null) {
|
|
|
+ sb.append(currData.value_array.getRowChange());
|
|
|
+ } else if (currData.value_object != null) {
|
|
|
+ sb.append(currData.value_object.getRowChange());
|
|
|
+ } else if (currData.value_prim != null) {
|
|
|
+ sb.append(currData.value_prim.getRowChange());
|
|
|
+ }
|
|
|
+ sb.append("(");
|
|
|
+ if (currData.rel_property != null) {
|
|
|
+ sb.append(currData.rel_property.propertyName);
|
|
|
+ }
|
|
|
+ sb.append(")");
|
|
|
+ result = sb.toString();
|
|
|
+ } else {
|
|
|
+ SceneDataObject currData = (SceneDataObject) valueObject;
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ sb.append("SceneDataObject: ");
|
|
|
+ if (currData.parentObjectData != null) {
|
|
|
+ sb.append(currData.parentObjectData.myPropertyName);
|
|
|
+ sb.append("\t");
|
|
|
+ } else {
|
|
|
+ sb.append("null");
|
|
|
+ sb.append("\t");
|
|
|
+ }
|
|
|
+ sb.append(currData.myPropertyName);
|
|
|
+ sb.append("\t");
|
|
|
+ if (currData.parentArrayData != null) {
|
|
|
+ sb.append(currData.parentArrayData.myPropertyName);
|
|
|
+ sb.append("\t");
|
|
|
+ } else {
|
|
|
+ sb.append("null");
|
|
|
+ sb.append("\t");
|
|
|
+ }
|
|
|
+ sb.append(currData.getRowChange());
|
|
|
+ sb.append("(");
|
|
|
+ if (currData.rel_object != null) {
|
|
|
+ sb.append(currData.rel_object);
|
|
|
+ }
|
|
|
+ sb.append(")");
|
|
|
+ result = sb.toString();
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
public static String show(String param) {
|
|
|
JSONObject json = JSON.parseObject(param);
|
|
|
JSONArray path = json.getJSONArray("path");
|
|
@@ -238,7 +304,7 @@ public class RestUtil {
|
|
|
return FastJsonUtil.toString(work_orders);
|
|
|
} else {
|
|
|
Object valueObject = ComputeUtil.getValueObject(Repository, valuePath);
|
|
|
- RecursiveUtil.refreshObject(Repository, valueObject);
|
|
|
+ // RecursiveUtil.refreshObject(Repository, valueObject);
|
|
|
Object valueJSON = ComputeUtil.getValueJSON(valueObject);
|
|
|
return FastJsonUtil.toString(valueJSON);
|
|
|
}
|
|
@@ -250,40 +316,40 @@ public class RestUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static String wrapper_post(String param) {
|
|
|
- JSONArray path = JSON.parseArray(param);
|
|
|
- String[] valuePath = new String[path.size()];
|
|
|
- for (int i = 0; i < path.size(); i++) {
|
|
|
- valuePath[i] = path.getString(i);
|
|
|
- }
|
|
|
- String result = RestUtil.wrapper_post(valuePath);
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- public static String wrapper_post(String[] valuePath) {
|
|
|
- Repository Repository = RepositoryBase.instance;
|
|
|
- JSONObject result = new JSONObject();
|
|
|
- try {
|
|
|
- Object valueObject = ComputeUtil.getValueObject(Repository, valuePath);
|
|
|
- Object valueJSON = ComputeUtil.getValueJSON(valueObject);
|
|
|
- if (valueJSON instanceof JSONArray) {
|
|
|
- JSONArray array = (JSONArray) valueJSON;
|
|
|
- result.put("Content", array);
|
|
|
- result.put("Count", array.size());
|
|
|
- } else {
|
|
|
- result.put("Item", valueJSON);
|
|
|
- }
|
|
|
- result.put("Result", "success");
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- String message = LogUtil.GetExceptionStackTrace(e);
|
|
|
- log.info(message);
|
|
|
- result.put("Result", "failure");
|
|
|
- result.put("ResultMsg", message);
|
|
|
- result.put("ResultCode", 250);
|
|
|
- }
|
|
|
- return result.toJSONString();
|
|
|
- }
|
|
|
+ // public static String wrapper_post(String param) {
|
|
|
+ // JSONArray path = JSON.parseArray(param);
|
|
|
+ // String[] valuePath = new String[path.size()];
|
|
|
+ // for (int i = 0; i < path.size(); i++) {
|
|
|
+ // valuePath[i] = path.getString(i);
|
|
|
+ // }
|
|
|
+ // String result = RestUtil.wrapper_post(valuePath);
|
|
|
+ // return result;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // public static String wrapper_post(String[] valuePath) {
|
|
|
+ // Repository Repository = RepositoryBase.instance;
|
|
|
+ // JSONObject result = new JSONObject();
|
|
|
+ // try {
|
|
|
+ // Object valueObject = ComputeUtil.getValueObject(Repository, valuePath);
|
|
|
+ // Object valueJSON = ComputeUtil.getValueJSON(valueObject);
|
|
|
+ // if (valueJSON instanceof JSONArray) {
|
|
|
+ // JSONArray array = (JSONArray) valueJSON;
|
|
|
+ // result.put("Content", array);
|
|
|
+ // result.put("Count", array.size());
|
|
|
+ // } else {
|
|
|
+ // result.put("Item", valueJSON);
|
|
|
+ // }
|
|
|
+ // result.put("Result", "success");
|
|
|
+ // } catch (Exception e) {
|
|
|
+ // e.printStackTrace();
|
|
|
+ // String message = LogUtil.GetExceptionStackTrace(e);
|
|
|
+ // log.info(message);
|
|
|
+ // result.put("Result", "failure");
|
|
|
+ // result.put("ResultMsg", message);
|
|
|
+ // result.put("ResultCode", 250);
|
|
|
+ // }
|
|
|
+ // return result.toJSONString();
|
|
|
+ // }
|
|
|
|
|
|
public static String post_filter_and_page(String param) {
|
|
|
JSONObject result = new JSONObject();
|
|
@@ -320,43 +386,43 @@ public class RestUtil {
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
|
|
|
- public static String wrapper_post_filter_and_page(String param) {
|
|
|
- JSONObject result = new JSONObject();
|
|
|
- try {
|
|
|
- JSONObject paramObject = JSON.parseObject(param);
|
|
|
- List<SceneDataObject> array = filter_and_page(paramObject);
|
|
|
- if (paramObject.containsKey("count")) {
|
|
|
- } else {
|
|
|
- int pageSize = Integer.MAX_VALUE;
|
|
|
- int pageIndex = 0;
|
|
|
- if (paramObject.containsKey("page")) {
|
|
|
- pageSize = (Integer) paramObject.get("pageSize");
|
|
|
- pageIndex = (Integer) paramObject.get("pageIndex");
|
|
|
- }
|
|
|
- SceneDataValue sdv = new SceneDataValue(null, null, null, null);
|
|
|
- sdv.value_array = new SceneDataSet(false);
|
|
|
- sdv.value_array.set = new ArrayList<SceneDataObject>();
|
|
|
- for (int i = pageSize * pageIndex; i < pageSize * (pageIndex + 1) && i < array.size(); i++) {
|
|
|
- sdv.value_array.set.add(array.get(i));
|
|
|
- }
|
|
|
- int read_level = 0;
|
|
|
- JSONArray content = (JSONArray) sdv.toJSON(true, read_level == 0 ? -1 : read_level);
|
|
|
-
|
|
|
- result.put("Content", content);
|
|
|
- result.put("Count", content.size());
|
|
|
- }
|
|
|
- result.put("TotalCount", array.size());
|
|
|
- result.put("Result", "success");
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- String message = LogUtil.GetExceptionStackTrace(e);
|
|
|
- log.info(message);
|
|
|
- result.put("Result", "failure");
|
|
|
- result.put("ResultMsg", message);
|
|
|
- result.put("ResultCode", 250);
|
|
|
- }
|
|
|
- return result.toJSONString();
|
|
|
- }
|
|
|
+ // public static String wrapper_post_filter_and_page(String param) {
|
|
|
+ // JSONObject result = new JSONObject();
|
|
|
+ // try {
|
|
|
+ // JSONObject paramObject = JSON.parseObject(param);
|
|
|
+ // List<SceneDataObject> array = filter_and_page(paramObject);
|
|
|
+ // if (paramObject.containsKey("count")) {
|
|
|
+ // } else {
|
|
|
+ // int pageSize = Integer.MAX_VALUE;
|
|
|
+ // int pageIndex = 0;
|
|
|
+ // if (paramObject.containsKey("page")) {
|
|
|
+ // pageSize = (Integer) paramObject.get("pageSize");
|
|
|
+ // pageIndex = (Integer) paramObject.get("pageIndex");
|
|
|
+ // }
|
|
|
+ // SceneDataValue sdv = new SceneDataValue(null, null, null, null);
|
|
|
+ // sdv.value_array = new SceneDataSet(false);
|
|
|
+ // sdv.value_array.set = new ArrayList<SceneDataObject>();
|
|
|
+ // for (int i = pageSize * pageIndex; i < pageSize * (pageIndex + 1) && i < array.size(); i++) {
|
|
|
+ // sdv.value_array.set.add(array.get(i));
|
|
|
+ // }
|
|
|
+ // int read_level = 0;
|
|
|
+ // JSONArray content = (JSONArray) sdv.toJSON(true, read_level == 0 ? -1 : read_level);
|
|
|
+ //
|
|
|
+ // result.put("Content", content);
|
|
|
+ // result.put("Count", content.size());
|
|
|
+ // }
|
|
|
+ // result.put("TotalCount", array.size());
|
|
|
+ // result.put("Result", "success");
|
|
|
+ // } catch (Exception e) {
|
|
|
+ // e.printStackTrace();
|
|
|
+ // String message = LogUtil.GetExceptionStackTrace(e);
|
|
|
+ // log.info(message);
|
|
|
+ // result.put("Result", "failure");
|
|
|
+ // result.put("ResultMsg", message);
|
|
|
+ // result.put("ResultCode", 250);
|
|
|
+ // }
|
|
|
+ // return result.toJSONString();
|
|
|
+ // }
|
|
|
|
|
|
private static List<SceneDataObject> filter_and_page(JSONObject paramObject) throws Exception {
|
|
|
Repository Repository = RepositoryBase.instance;
|
|
@@ -545,37 +611,37 @@ public class RestUtil {
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
|
|
|
- public static String wrapper_control(String param) {
|
|
|
- Repository Repository = RepositoryBase.instance;
|
|
|
- JSONObject result = new JSONObject();
|
|
|
- try {
|
|
|
- JSONObject paramObject = JSON.parseObject(param);
|
|
|
- JSONArray path = (JSONArray) paramObject.get("path");
|
|
|
- JSONObject infoValueSet = (JSONObject) paramObject.get("infoValueSet");
|
|
|
- String controlReason = (String) paramObject.get("controlReason");
|
|
|
- String controlRemark = (String) paramObject.get("controlRemark");
|
|
|
- log.info("path: " + path);
|
|
|
- log.info("infoValueSet: " + infoValueSet);
|
|
|
- log.info("controlReason: " + controlReason);
|
|
|
- log.info("controlRemark: " + controlRemark);
|
|
|
-
|
|
|
- String[] valuePath = new String[path.size()];
|
|
|
- for (int i = 0; i < path.size(); i++) {
|
|
|
- valuePath[i] = path.getString(i);
|
|
|
- }
|
|
|
- ControlUtil.set(Repository, path, valuePath, infoValueSet);
|
|
|
-
|
|
|
- result.put("Result", "success");
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- String message = LogUtil.GetExceptionStackTrace(e);
|
|
|
- log.info(message);
|
|
|
- result.put("Result", "failure");
|
|
|
- result.put("ResultMsg", message);
|
|
|
- result.put("ResultCode", 250);
|
|
|
- }
|
|
|
- return result.toJSONString();
|
|
|
- }
|
|
|
+ // public static String wrapper_control(String param) {
|
|
|
+ // Repository Repository = RepositoryBase.instance;
|
|
|
+ // JSONObject result = new JSONObject();
|
|
|
+ // try {
|
|
|
+ // JSONObject paramObject = JSON.parseObject(param);
|
|
|
+ // JSONArray path = (JSONArray) paramObject.get("path");
|
|
|
+ // JSONObject infoValueSet = (JSONObject) paramObject.get("infoValueSet");
|
|
|
+ // String controlReason = (String) paramObject.get("controlReason");
|
|
|
+ // String controlRemark = (String) paramObject.get("controlRemark");
|
|
|
+ // log.info("path: " + path);
|
|
|
+ // log.info("infoValueSet: " + infoValueSet);
|
|
|
+ // log.info("controlReason: " + controlReason);
|
|
|
+ // log.info("controlRemark: " + controlRemark);
|
|
|
+ //
|
|
|
+ // String[] valuePath = new String[path.size()];
|
|
|
+ // for (int i = 0; i < path.size(); i++) {
|
|
|
+ // valuePath[i] = path.getString(i);
|
|
|
+ // }
|
|
|
+ // ControlUtil.set(Repository, path, valuePath, infoValueSet);
|
|
|
+ //
|
|
|
+ // result.put("Result", "success");
|
|
|
+ // } catch (Exception e) {
|
|
|
+ // e.printStackTrace();
|
|
|
+ // String message = LogUtil.GetExceptionStackTrace(e);
|
|
|
+ // log.info(message);
|
|
|
+ // result.put("Result", "failure");
|
|
|
+ // result.put("ResultMsg", message);
|
|
|
+ // result.put("ResultCode", 250);
|
|
|
+ // }
|
|
|
+ // return result.toJSONString();
|
|
|
+ // }
|
|
|
|
|
|
public static String get_control_value(String param) {
|
|
|
JSONObject result = new JSONObject();
|