Browse Source

REPORT-5856 插件管理插件新分类

master
XiaXiang 7 years ago
parent
commit
8056cf9d09
  1. 14
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  2. 75
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  3. 15
      designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

14
designer_base/src/com/fr/design/extra/PluginOperateUtils.java

@ -122,7 +122,7 @@ public class PluginOperateUtils {
return resultArray.toString();
}
public static void dealParams(StringBuilder url, String category, String seller, String fee) {
public static void dealParams(StringBuilder url, String category, String seller, String fee, String scope) {
if (StringUtils.isNotBlank(category)) {
url.append("cid=").append(category.split("-")[1]);
} else {
@ -152,6 +152,18 @@ public class PluginOperateUtils {
url.append("&fee=").append(StringUtils.EMPTY);
}
}
if (StringUtils.isNotBlank(scope)) {
switch (scope.split("-")[1]) {
case "universal":
url.append("&scope=").append(1);
break;
case "program":
url.append("&scope=").append(2);
break;
default:
url.append("&scope=").append(StringUtils.EMPTY);
}
}
}
public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) {

75
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -54,6 +54,7 @@ public class PluginWebBridge {
private static final String THREAD_NAME_TEMPLATE = "pluginbridge-thread-%s";
private static final String ACTION = "action";
private static final String KEYWORD = "keyword";
private static final String PLUGIN_INFO = "pluginInfo";
private static final int COREPOOLSIZE = 3;
private static final int MAXPOOLSIZE = 5;
@ -72,20 +73,7 @@ public class PluginWebBridge {
new LinkedBlockingQueue<Runnable>(COREPOOLSIZE),
new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build());
/**
* 动作枚举
*/
public enum ACTIONS {
SEARCH("search");
private String context;
ACTIONS(String context) {
this.context = context;
}
public String getContext() {
return context;
}
private PluginWebBridge() {
}
public static PluginWebBridge getHelper() {
@ -106,9 +94,6 @@ public class PluginWebBridge {
return helper;
}
private PluginWebBridge() {
}
/**
* 获取打开动作配置
*
@ -155,12 +140,26 @@ public class PluginWebBridge {
*
* @param keyword 关键词
*/
public void openWithSearch(String keyword) {
HashMap<String, Object> map = new HashMap<String, Object>(2);
map.put(KEYWORD, keyword);
setRunConfig(ACTIONS.SEARCH, map);
}
/**
* 根据插件信息跳转到应用中心
*
* @param keyword
* @param pluginInfo
*/
public void showResultInStore(String keyword, String pluginInfo) {
HashMap<String, Object> map = new HashMap<>();
map.put(KEYWORD, keyword);
map.put(PLUGIN_INFO, pluginInfo);
setRunConfig(ACTIONS.SHOW_RESULT, map);
}
public void setEngine(WebEngine webEngine) {
this.webEngine = webEngine;
}
@ -182,7 +181,6 @@ public class PluginWebBridge {
PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback);
}
/**
* 从磁盘上选择插件安装包进行安装
*
@ -204,7 +202,6 @@ public class PluginWebBridge {
PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback);
}
/**
* 从插件服务器上更新选中的插件
*
@ -342,17 +339,31 @@ public class PluginWebBridge {
* @param callback 回调函数
*/
public void getPluginFromStore(String category, String seller, String fee, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(category, seller, fee));
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(category, seller, fee, ""));
threadPoolExecutor.submit(task);
}
/**
* 根据条件获取在线插件
*
* @param info 插件信息
* @param callback 回调函数
*/
public void getPluginFromStoreNew(String info, final JSObject callback) {
try {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info)));
threadPoolExecutor.submit(task);
} catch (JSONException e) {
FRLogger.getLogger().error(e.getMessage());
}
}
public void getPluginPrefix(final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginPrefixExecutor());
threadPoolExecutor.submit(task);
}
/**
* 在线获取插件分类
*
@ -487,9 +498,6 @@ public class PluginWebBridge {
}
}
/*-------------------------------登录部分的处理----------------------------------*/
/**
* 注册页面
*/
@ -501,6 +509,9 @@ public class PluginWebBridge {
}
}
/*-------------------------------登录部分的处理----------------------------------*/
/**
* 忘记密码
*/
@ -577,4 +588,20 @@ public class PluginWebBridge {
return true;
}
/**
* 动作枚举
*/
public enum ACTIONS {
SEARCH("search"), SHOW_RESULT("showResult");
private String context;
ACTIONS(String context) {
this.context = context;
}
public String getContext() {
return context;
}
}
}

15
designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -20,11 +20,20 @@ public class GetPluginFromStoreExecutor implements Executor {
private String category;
private String seller;
private String fee;
private String scope;
public GetPluginFromStoreExecutor(String category, String seller, String fee) {
public GetPluginFromStoreExecutor(JSONObject info) {
this.category = info.optString("category");
this.fee = info.optString("fee");
this.seller = info.optString("seller");
this.scope = info.optString("scope");
}
public GetPluginFromStoreExecutor(String category, String seller, String fee, String scope) {
this.category = category;
this.seller = seller;
this.fee = fee;
this.scope = scope;
}
@Override
@ -44,7 +53,7 @@ public class GetPluginFromStoreExecutor implements Executor {
@Override
public void run(Process<String> process) {
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?";
boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee);
boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope);
if (getRecommend) {
result = PluginOperateUtils.getRecommendPlugins();
return;
@ -53,7 +62,7 @@ public class GetPluginFromStoreExecutor implements Executor {
if (StringUtils.isNotBlank(plistUrl)) {
StringBuilder url = new StringBuilder();
url.append(plistUrl);
PluginOperateUtils.dealParams(url, category, seller, fee);
PluginOperateUtils.dealParams(url, category, seller, fee, scope);
try {
HttpClient httpClient = new HttpClient(url.toString());
httpClient.asGet();

Loading…
Cancel
Save