Browse Source

代码质量

master
XiaXiang 8 years ago
parent
commit
d674797a8d
  1. 3
      designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java
  2. 3
      designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java
  3. 9
      designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java
  4. 5
      designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java

3
designer/src/com/fr/design/mainframe/alphafine/cell/cellModel/PluginModel.java

@ -28,8 +28,9 @@ public class PluginModel extends AlphaCellModel {
public PluginModel(String name, String content, CellType type) {
super(name, content, type);
}
public PluginModel(String name, String content, String imageUrl, String version, String jartime, CellType type, int price, int pluginId) {
public PluginModel(String name, String content, String imageUrl, String version, String jartime, String link, CellType type, int price, int pluginId) {
super(name, content);
this.link = link;
setType(type);
this.pluginId = pluginId;
if (getType() == CellType.PLUGIN) {

3
designer/src/com/fr/design/mainframe/alphafine/searchManager/DocumentSearchManager.java

@ -39,6 +39,9 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
HttpClient httpClient = new HttpClient(url);
httpClient.setTimeout(5000);
httpClient.asGet();
if (!httpClient.isServerAlive()) {
return lessModelList;
}
result = httpClient.getResponseText();
try {
JSONObject jsonObject = new JSONObject(result);

9
designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java

@ -47,6 +47,9 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
HttpClient httpClient = new HttpClient(url);
httpClient.setTimeout(5000);
httpClient.asGet();
if (!httpClient.isServerAlive()) {
return lessModelList;
}
result = httpClient.getResponseText();
JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.optJSONArray("result");
@ -99,7 +102,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
type = CellType.REUSE;
}
int price = object.optInt("price");
return new PluginModel(name, content, imageUrl, version, jartime, type, price, pluginId);
return new PluginModel(name, content, imageUrl, version, jartime, link, type, price, pluginId);
}
@Override
@ -111,8 +114,10 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
JSONObject jsonObject = object.optJSONObject("result");
if (jsonObject != null) {
return getPluginModel(jsonObject, true);
} else {
return getPluginModel(object, false);
}
return null;
}

5
designer/src/com/fr/design/mainframe/alphafine/searchManager/RecommendSearchManager.java

@ -18,7 +18,7 @@ import com.fr.stable.CodeUtils;
public class RecommendSearchManager implements AlphaFineSearchProcessor {
private static RecommendSearchManager recommendSearchManager = null;
private SearchResult modelList;
private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/recommend?searchddKey=";
private static final String SEARCHAPI = "http://localhost:8080/monitor/alphafine/search/recommend?searchKey=";
public synchronized static RecommendSearchManager getRecommendSearchManager() {
if (recommendSearchManager == null) {
@ -32,6 +32,9 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
this.modelList = new SearchResult();
HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText));
httpClient.asGet();
if (!httpClient.isServerAlive()) {
return modelList;
}
result = httpClient.getResponseText();
try {
JSONObject jsonObject = new JSONObject(result);

Loading…
Cancel
Save