From 03713f55e67f3ea0ee2a344558c0d17ca5af8947 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 23 May 2017 09:25:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/cell/CellModelHelper.java | 14 ++------------ .../alphafine/cell/cellModel/ActionModel.java | 5 +++++ .../alphafine/cell/cellModel/AlphaCellModel.java | 1 + .../alphafine/cell/cellModel/DocumentModel.java | 7 +++++-- .../alphafine/cell/cellModel/FileModel.java | 8 ++++++-- .../alphafine/cell/cellModel/PluginModel.java | 7 +++++-- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java index 993803407..9a5a7e4d2 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/CellModelHelper.java @@ -12,6 +12,7 @@ import com.fr.json.JSONObject; * Created by XiaXiang on 2017/5/17. */ public class CellModelHelper { + private static final String RESULT = "result"; public static AlphaCellModel jsonToModel(JSONObject object) { int cellType = object.optInt("cellType"); switch (CellType.parse(cellType)) { @@ -30,17 +31,6 @@ public class CellModelHelper { } public static String getResultValueFromModel(AlphaCellModel cellModel) { - switch (cellModel.getType()) { - case ACTION: - return ((ActionModel)cellModel).getActionName(); - case DOCUMENT: - return ((DocumentModel)cellModel).getInformationUrl(); - case FILE: - return ((FileModel)cellModel).getFilePath(); - case REUSE: - case PLUGIN: - return ((PluginModel)cellModel).getInformationUrl(); - } - return null; + return cellModel.getStoreInformation(); } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java index 2e8a4510b..26cf95bcf 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/ActionModel.java @@ -59,6 +59,11 @@ public class ActionModel extends AlphaCellModel implements Serializable { return object; } + @Override + public String getStoreInformation() { + return getActionName(); + } + public String getActionName() { return getAction().getClass().getName(); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java index d39c7210d..8055c8812 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/AlphaCellModel.java @@ -62,5 +62,6 @@ public abstract class AlphaCellModel { abstract public JSONObject ModelToJson() throws JSONException; + abstract public String getStoreInformation(); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java index b5d29edc4..047bea152 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/DocumentModel.java @@ -46,10 +46,13 @@ public class DocumentModel extends AlphaCellModel { return object; } + @Override + public String getStoreInformation() { + return getInformationUrl(); + } + @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof DocumentModel)) return false; DocumentModel that = (DocumentModel) o; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java index aa295a04c..bdcc57daf 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/FileModel.java @@ -5,6 +5,7 @@ import com.fr.design.mainframe.alphafine.CellType; import com.fr.general.FRLogger; import com.fr.json.JSONException; import com.fr.json.JSONObject; +import org.apache.xerces.impl.xpath.regex.REUtil; /** * Created by XiaXiang on 2017/4/20. @@ -41,11 +42,14 @@ public class FileModel extends AlphaCellModel{ return object; } + @Override + public String getStoreInformation() { + return getFilePath(); + } + @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof FileModel)) return false; FileModel fileModel = (FileModel) o; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java index b9df4ab67..76225c827 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java @@ -109,11 +109,14 @@ public class PluginModel extends AlphaCellModel { return object; } + @Override + public String getStoreInformation() { + return getInformationUrl(); + } + @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof PluginModel)) return false; PluginModel that = (PluginModel) o;