Browse Source

KERNEL-216 JSON全部改为jackson实现

bugfix/10.0
richie 6 years ago
parent
commit
fb9d2f9644
  1. 4
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  2. 2
      designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java
  3. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java
  4. 26
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  5. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  6. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java
  7. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java
  8. 11
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java
  9. 12
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java
  10. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  11. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  12. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
  13. 18
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java

4
designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java

@ -104,7 +104,7 @@ public class PluginWebBridge {
for (String key : keySet) {
jsonObject.put(key, config.get(key).toString());
}
} catch (JSONException e) {
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return jsonObject.toString();
@ -349,7 +349,7 @@ public class PluginWebBridge {
try {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info)));
threadPoolExecutor.submit(task);
} catch (JSONException e) {
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}

2
designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java

@ -74,7 +74,7 @@ public class PluginsReaderFromStore {
plugins.add(pluginView);
}
}
} catch (JSONException e) {
} catch (Exception e) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Read_Plugin_List_Error"));
}
}

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java

@ -218,7 +218,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
break;
}
}
} catch (JSONException e) {
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
paramLocationComboBox.setSelectedIndex(index);

26
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -168,21 +168,17 @@ public class InformationCollector implements XMLReadable, XMLWriter {
JSONArray startStopArray = new JSONArray();
for (int i = 0; i < startStop.size(); i++) {
JSONObject jo = new JSONObject();
try {
jo.put(ATTR_START, startStop.get(i).getStartDate());
jo.put(ATTR_STOP, startStop.get(i).getStopDate());
startStopArray.put(jo);
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put(XML_START_STOP, startStopArray);
content.put(XML_UUID, envManager.getUUID());
content.put(XML_JAR, GeneralUtils.readBuildNO());
content.put(XML_VERSION, ProductConstants.RELEASE_VERSION);
content.put(XML_USERNAME, MarketConfig.getInstance().getBbsUsername());
content.put(XML_KEY, envManager.getActivationKey());
content.put(XML_OS, System.getProperty("os.name"));
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
jo.put(ATTR_START, startStop.get(i).getStartDate());
jo.put(ATTR_STOP, startStop.get(i).getStopDate());
startStopArray.put(jo);
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put(XML_START_STOP, startStopArray);
content.put(XML_UUID, envManager.getUUID());
content.put(XML_JAR, GeneralUtils.readBuildNO());
content.put(XML_VERSION, ProductConstants.RELEASE_VERSION);
content.put(XML_USERNAME, MarketConfig.getInstance().getBbsUsername());
content.put(XML_KEY, envManager.getActivationKey());
content.put(XML_OS, System.getProperty("os.name"));
}
return content;
}

10
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java

@ -53,13 +53,9 @@ public class ActionModel extends AlphaCellModel {
@Override
public JSONObject modelToJson() {
JSONObject object = JSONObject.create();
try {
JSONObject modelObject = JSONObject.create();
modelObject.put("className", getAction().getClass().getName()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue());
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
JSONObject modelObject = JSONObject.create();
modelObject.put("className", getAction().getClass().getName()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue());
return object;
}

10
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java

@ -42,13 +42,9 @@ public class DocumentModel extends AlphaCellModel {
@Override
public JSONObject modelToJson() {
JSONObject object = JSONObject.create();
try {
JSONObject modelObject = JSONObject.create();
modelObject.put("title", getName()).put("summary", getContent()).put("did", getDocumentId()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue());
} catch (JSONException e) {
FineLoggerFactory.getLogger().error("DocumentModel: " + e.getMessage());
}
JSONObject modelObject = JSONObject.create();
modelObject.put("title", getName()).put("summary", getContent()).put("did", getDocumentId()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue());
return object;
}

10
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java

@ -37,13 +37,9 @@ public class FileModel extends AlphaCellModel {
@Override
public JSONObject modelToJson() {
JSONObject object = JSONObject.create();
try {
JSONObject modelObject = JSONObject.create();
modelObject.put("filePath", getFilePath()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue());
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
JSONObject modelObject = JSONObject.create();
modelObject.put("filePath", getFilePath()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue());
return object;
}

11
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java

@ -87,14 +87,9 @@ public class PluginModel extends AlphaCellModel {
@Override
public JSONObject modelToJson() {
JSONObject object = JSONObject.create();
try {
JSONObject modelObject = JSONObject.create();
modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("id", getId()).put("pluginid", getPluginId()).put("type", getType().getTypeValue()).put("price", getPrice()).put("link", getLink()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue());
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
JSONObject modelObject = JSONObject.create();
modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("id", getId()).put("pluginid", getPluginId()).put("type", getType().getTypeValue()).put("price", getPrice()).put("link", getLink()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue());
return object;
}

12
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java

@ -55,7 +55,7 @@ public class RobotModel extends AlphaCellModel {
}
JSONObject jsonObject = new JSONObject(result);
return jsonObject.optString("msg");
} catch (JSONException | IOException e) {
} catch (Exception e) {
FineLoggerFactory.getLogger().error("get robotmodel content error: " + e.getMessage());
}
return null;
@ -69,13 +69,9 @@ public class RobotModel extends AlphaCellModel {
@Override
public JSONObject modelToJson() throws JSONException {
JSONObject object = JSONObject.create();
try {
JSONObject modelObject = JSONObject.create();
modelObject.put("title", getTitle()).put("content", getContent()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue());
} catch (JSONException e) {
FineLoggerFactory.getLogger().error("RobotModel: " + e.getMessage());
}
JSONObject modelObject = JSONObject.create();
modelObject.put("title", getTitle()).put("content", getContent()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue());
return object;
}

6
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -976,11 +976,7 @@ public class AlphaFineDialog extends UIDialog {
int resultKind = cellModel.getType().getTypeValue();
String resultValue = CellModelHelper.getResultValueFromModel(cellModel);
JSONObject object = JSONObject.create();
try {
object.put("uuid", uuid).put("activityKey", activityKey).put("username", username).put("createTime", createTime).put("key", key).put("resultKind", resultKind).put("resultValue", resultValue);
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
object.put("uuid", uuid).put("activityKey", activityKey).put("username", username).put("createTime", createTime).put("key", key).put("resultKind", resultKind).put("resultValue", resultValue);
final HashMap<String, String> para = new HashMap<>();
String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
para.put("token", CodeUtils.md5Encode(date, StringUtils.EMPTY, "MD5"));

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java

@ -81,10 +81,8 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
}
}
}
} catch (JSONException e) {
} catch (Exception e) {
FineLoggerFactory.getLogger().error("document search error: " + e.getMessage());
} catch (IOException e) {
FineLoggerFactory.getLogger().error("document search get result error: " + e.getMessage());
}
}
lessModelList.clear();

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java

@ -126,12 +126,8 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
}
}
}
} catch (JSONException e) {
FineLoggerFactory.getLogger().error("plugin search json error :" + e.getMessage());
} catch (UnsupportedEncodingException e) {
FineLoggerFactory.getLogger().error("plugin search encode error :" + e.getMessage());
} catch (IOException e) {
FineLoggerFactory.getLogger().error("plugin search get result error :" + e.getMessage());
} catch (Exception e) {
FineLoggerFactory.getLogger().error("plugin search error :" + e.getMessage());
}
}
if (searchResult.isEmpty()) {

18
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java

@ -100,17 +100,13 @@ public class ErrorInfo {
*/
public void saveAsJSON(){
JSONObject jo = JSONObject.create();
try {
jo.put("username", username);
jo.put("uuid", uuid);
jo.put("activekey", activekey);
jo.put("templateid", templateid);
jo.put("uploadtime", uploadtime);
jo.put("logid", logid);
jo.put("log", log);
} catch (JSONException ignore) {
}
jo.put("username", username);
jo.put("uuid", uuid);
jo.put("activekey", activekey);
jo.put("templateid", templateid);
jo.put("uploadtime", uploadtime);
jo.put("logid", logid);
jo.put("log", log);
saveFileToCache(jo);
}

Loading…
Cancel
Save