From 635e03f693adc5933f3cafd925083c63ef7a5fca Mon Sep 17 00:00:00 2001 From: Palin Date: Sat, 7 Sep 2019 13:25:39 +0800 Subject: [PATCH 1/6] =?UTF-8?q?finkit=E5=88=9D=E6=AC=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/design/ui/container/ReportletPane.java | 4 ++++ .../com/fanruan/api/err/ValidationException.java | 4 ++++ .../java/com/fanruan/api/function/FunctionKit.java | 6 ++++++ src/main/java/com/fanruan/api/net/NetworkKit.java | 6 ++++++ .../java/com/fanruan/api/newer/NodeVisitor.java | 4 ++++ .../com/fanruan/api/newer/RHFunctionProcessor.java | 4 ++++ .../fanruan/api/newer/TemplateSessionIDInfo.java | 4 ++++ src/main/java/com/fanruan/api/util/RenderKit.java | 13 +++++++++++++ 8 files changed, 45 insertions(+) create mode 100644 src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java create mode 100644 src/main/java/com/fanruan/api/err/ValidationException.java create mode 100644 src/main/java/com/fanruan/api/newer/NodeVisitor.java create mode 100644 src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java create mode 100644 src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java diff --git a/src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java b/src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java new file mode 100644 index 0000000..4337dcd --- /dev/null +++ b/src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java @@ -0,0 +1,4 @@ +package com.fanruan.api.design.ui.container; + +public class ReportletPane extends com.fr.design.gui.itree.filetree.ReportletPane { +} diff --git a/src/main/java/com/fanruan/api/err/ValidationException.java b/src/main/java/com/fanruan/api/err/ValidationException.java new file mode 100644 index 0000000..1d8fcad --- /dev/null +++ b/src/main/java/com/fanruan/api/err/ValidationException.java @@ -0,0 +1,4 @@ +package com.fanruan.api.err; + +public abstract class ValidationException extends com.fr.design.Exception.ValidationException { +} diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index 68eaa19..adb5419 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -7,6 +7,7 @@ import com.fr.file.FunctionManager; import com.fr.file.FunctionManagerProvider; import com.fr.script.Calculator; import com.fr.stable.StringUtils; +import com.fr.stable.fun.FunctionHelper; import com.fr.stable.script.FunctionDef; import java.util.ArrayList; @@ -84,4 +85,9 @@ public class FunctionKit { public static com.fr.file.FunctionManager getInstance() { return com.fr.file.FunctionManager.getInstance(); } + + public static int generateFunctionID(String var0) { + return FunctionHelper.generateFunctionID(var0); + } + } \ No newline at end of file diff --git a/src/main/java/com/fanruan/api/net/NetworkKit.java b/src/main/java/com/fanruan/api/net/NetworkKit.java index d534934..ebc52ef 100644 --- a/src/main/java/com/fanruan/api/net/NetworkKit.java +++ b/src/main/java/com/fanruan/api/net/NetworkKit.java @@ -1,5 +1,6 @@ package com.fanruan.api.net; +import com.fr.base.ServerConfig; import com.fr.data.NetworkHelper; import org.jetbrains.annotations.Nullable; @@ -117,4 +118,9 @@ public class NetworkKit { public static @Nullable String getHTTPRequestParameter(HttpServletRequest req, String... paraNames) { return NetworkHelper.getHTTPRequestParameter(req, paraNames); } + + + public static String createServletURL(HttpServletRequest req) { + return NetworkHelper.createServletURL(req, ServerConfig.getInstance().getServletName()); + } } diff --git a/src/main/java/com/fanruan/api/newer/NodeVisitor.java b/src/main/java/com/fanruan/api/newer/NodeVisitor.java new file mode 100644 index 0000000..3abc52c --- /dev/null +++ b/src/main/java/com/fanruan/api/newer/NodeVisitor.java @@ -0,0 +1,4 @@ +package com.fanruan.api.newer; + +public abstract class NodeVisitor extends com.fr.stable.core.NodeVisitor { +} diff --git a/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java b/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java new file mode 100644 index 0000000..374e5cf --- /dev/null +++ b/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java @@ -0,0 +1,4 @@ +package com.fanruan.api.newer; + +public abstract class RHFunctionProcessor extends com.fr.plugin.form.widget.monitor.RHFunctionProcessor { +} diff --git a/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java b/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java new file mode 100644 index 0000000..160fdcd --- /dev/null +++ b/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java @@ -0,0 +1,4 @@ +package com.fanruan.api.newer; + +public abstract class TemplateSessionIDInfo extends com.fr.web.core.TemplateSessionIDInfo { +} diff --git a/src/main/java/com/fanruan/api/util/RenderKit.java b/src/main/java/com/fanruan/api/util/RenderKit.java index 3858679..cf5311c 100644 --- a/src/main/java/com/fanruan/api/util/RenderKit.java +++ b/src/main/java/com/fanruan/api/util/RenderKit.java @@ -1,6 +1,7 @@ package com.fanruan.api.util; import com.fr.base.TemplateUtils; +import com.fr.script.Calculator; import java.util.Map; @@ -19,4 +20,16 @@ public class RenderKit { public static String renderParameter4Tpl(String text, Map map) throws Exception { return TemplateUtils.renderParameter4Tpl(text, map); } + + /** + * 根据参数, 来计算文档字符串 + * @param var0 待渲染的文本模板 + * @param var1 参数集合 + * @return 返回渲染后的文本 + * @throws Exception 渲染过程中出现错误则抛出此异常 + */ + public static String render(String var0, Calculator var1) throws Exception { + return TemplateUtils.render(var0, var1); + } + } From 161206536e8d6dc02a56fd664f8d79254c339b60 Mon Sep 17 00:00:00 2001 From: Palin Date: Mon, 9 Sep 2019 23:40:26 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=8C=89=E8=A6=81=E6=B1=82=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/{ui/container => work}/ReportletPane.java | 2 +- .../java/com/fanruan/api/err/ValidationException.java | 5 ++++- .../java/com/fanruan/api/function/FunctionKit.java | 9 +++++++-- src/main/java/com/fanruan/api/newer/NodeVisitor.java | 4 ---- .../com/fanruan/api/newer/RHFunctionProcessor.java | 4 ---- .../com/fanruan/api/newer/TemplateSessionIDInfo.java | 4 ---- .../com/fanruan/api/report/TemplateSessionIDInfo.java | 9 +++++++++ .../com/fanruan/api/report/analy/data/NodeVisitor.java | 4 ++++ src/main/java/com/fanruan/api/util/RenderKit.java | 8 ++++---- src/test/java/com/fanruan/api/util/RenderKitTest.java | 10 +++++++++- 10 files changed, 38 insertions(+), 21 deletions(-) rename src/main/java/com/fanruan/api/design/{ui/container => work}/ReportletPane.java (66%) delete mode 100644 src/main/java/com/fanruan/api/newer/NodeVisitor.java delete mode 100644 src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java delete mode 100644 src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java create mode 100644 src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java create mode 100644 src/main/java/com/fanruan/api/report/analy/data/NodeVisitor.java diff --git a/src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java b/src/main/java/com/fanruan/api/design/work/ReportletPane.java similarity index 66% rename from src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java rename to src/main/java/com/fanruan/api/design/work/ReportletPane.java index 4337dcd..4671429 100644 --- a/src/main/java/com/fanruan/api/design/ui/container/ReportletPane.java +++ b/src/main/java/com/fanruan/api/design/work/ReportletPane.java @@ -1,4 +1,4 @@ -package com.fanruan.api.design.ui.container; +package com.fanruan.api.design.work; public class ReportletPane extends com.fr.design.gui.itree.filetree.ReportletPane { } diff --git a/src/main/java/com/fanruan/api/err/ValidationException.java b/src/main/java/com/fanruan/api/err/ValidationException.java index 1d8fcad..7da52c4 100644 --- a/src/main/java/com/fanruan/api/err/ValidationException.java +++ b/src/main/java/com/fanruan/api/err/ValidationException.java @@ -1,4 +1,7 @@ package com.fanruan.api.err; -public abstract class ValidationException extends com.fr.design.Exception.ValidationException { +/** + * 验证异常 + */ +public class ValidationException extends com.fr.design.Exception.ValidationException { } diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index adb5419..3aa6971 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -78,6 +78,7 @@ public class FunctionKit { return new NameAndDescription[0]; } + /** * 得到函数管理器实例 * @return 函数管理器 @@ -86,8 +87,12 @@ public class FunctionKit { return com.fr.file.FunctionManager.getInstance(); } - public static int generateFunctionID(String var0) { - return FunctionHelper.generateFunctionID(var0); + /** + * 得到函数标识 + * @return 函数标识 + */ + public static int generateFunctionID(String string) { + return FunctionHelper.generateFunctionID(string); } } \ No newline at end of file diff --git a/src/main/java/com/fanruan/api/newer/NodeVisitor.java b/src/main/java/com/fanruan/api/newer/NodeVisitor.java deleted file mode 100644 index 3abc52c..0000000 --- a/src/main/java/com/fanruan/api/newer/NodeVisitor.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.newer; - -public abstract class NodeVisitor extends com.fr.stable.core.NodeVisitor { -} diff --git a/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java b/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java deleted file mode 100644 index 374e5cf..0000000 --- a/src/main/java/com/fanruan/api/newer/RHFunctionProcessor.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.newer; - -public abstract class RHFunctionProcessor extends com.fr.plugin.form.widget.monitor.RHFunctionProcessor { -} diff --git a/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java b/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java deleted file mode 100644 index 160fdcd..0000000 --- a/src/main/java/com/fanruan/api/newer/TemplateSessionIDInfo.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fanruan.api.newer; - -public abstract class TemplateSessionIDInfo extends com.fr.web.core.TemplateSessionIDInfo { -} diff --git a/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java b/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java new file mode 100644 index 0000000..0a8e8cd --- /dev/null +++ b/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java @@ -0,0 +1,9 @@ +package com.fanruan.api.report; + +/** + * @author Palin + * @version 10.0 + * Created by Palin on 2019/9/9 0009 + */ +public abstract class TemplateSessionIDInfo extends com.fr.web.core.TemplateSessionIDInfo{ +} diff --git a/src/main/java/com/fanruan/api/report/analy/data/NodeVisitor.java b/src/main/java/com/fanruan/api/report/analy/data/NodeVisitor.java new file mode 100644 index 0000000..4029665 --- /dev/null +++ b/src/main/java/com/fanruan/api/report/analy/data/NodeVisitor.java @@ -0,0 +1,4 @@ +package com.fanruan.api.report.analy.data; + +public abstract class NodeVisitor extends com.fr.stable.core.NodeVisitor { +} diff --git a/src/main/java/com/fanruan/api/util/RenderKit.java b/src/main/java/com/fanruan/api/util/RenderKit.java index cf5311c..653aab7 100644 --- a/src/main/java/com/fanruan/api/util/RenderKit.java +++ b/src/main/java/com/fanruan/api/util/RenderKit.java @@ -23,13 +23,13 @@ public class RenderKit { /** * 根据参数, 来计算文档字符串 - * @param var0 待渲染的文本模板 - * @param var1 参数集合 + * @param string 待渲染的文本模板 + * @param calculator 参数集合 * @return 返回渲染后的文本 * @throws Exception 渲染过程中出现错误则抛出此异常 */ - public static String render(String var0, Calculator var1) throws Exception { - return TemplateUtils.render(var0, var1); + public static String render(String string, Calculator calculator) throws Exception { + return TemplateUtils.render(string, calculator); } } diff --git a/src/test/java/com/fanruan/api/util/RenderKitTest.java b/src/test/java/com/fanruan/api/util/RenderKitTest.java index 4c53c41..78b498b 100644 --- a/src/test/java/com/fanruan/api/util/RenderKitTest.java +++ b/src/test/java/com/fanruan/api/util/RenderKitTest.java @@ -25,4 +25,12 @@ public class RenderKitTest extends Prepare { String text = "${name} is ${age} years old, he earned ${salary} dollars per month."; Assert.assertEquals("Alex is 20 years old, he earned 100 dollars per month.", RenderKit.renderParameter4Tpl(text, map)); } -} \ No newline at end of file + + @Test + public void render() throws Exception{ + String string = new String("a"); + Calculator calculator = new Calculator("b"); + Assert.assertEquals("a", RenderKit.render(string)); + Assert.assertEquals("b", RenderKit.render(calculator)); + } +} From 6d87a273a4c12a14cbbaa3e87d356418ee80ce6d Mon Sep 17 00:00:00 2001 From: Palin Date: Tue, 10 Sep 2019 14:10:27 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/api/function/FunctionKit.java | 9 --------- src/main/java/com/fanruan/api/util/RenderKit.java | 10 ++++++---- .../java/com/fanruan/api/util/RenderKitTest.java | 13 ++++++------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index 3aa6971..f9fccef 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -7,7 +7,6 @@ import com.fr.file.FunctionManager; import com.fr.file.FunctionManagerProvider; import com.fr.script.Calculator; import com.fr.stable.StringUtils; -import com.fr.stable.fun.FunctionHelper; import com.fr.stable.script.FunctionDef; import java.util.ArrayList; @@ -87,12 +86,4 @@ public class FunctionKit { return com.fr.file.FunctionManager.getInstance(); } - /** - * 得到函数标识 - * @return 函数标识 - */ - public static int generateFunctionID(String string) { - return FunctionHelper.generateFunctionID(string); - } - } \ No newline at end of file diff --git a/src/main/java/com/fanruan/api/util/RenderKit.java b/src/main/java/com/fanruan/api/util/RenderKit.java index 653aab7..bd5d003 100644 --- a/src/main/java/com/fanruan/api/util/RenderKit.java +++ b/src/main/java/com/fanruan/api/util/RenderKit.java @@ -2,7 +2,9 @@ package com.fanruan.api.util; import com.fr.base.TemplateUtils; import com.fr.script.Calculator; +import com.fr.stable.script.CalculatorProvider; +import java.util.Collections; import java.util.Map; /** @@ -23,13 +25,13 @@ public class RenderKit { /** * 根据参数, 来计算文档字符串 - * @param string 待渲染的文本模板 - * @param calculator 参数集合 + * @param s 待渲染的文本模板 + * @param c 参数集合 * @return 返回渲染后的文本 * @throws Exception 渲染过程中出现错误则抛出此异常 */ - public static String render(String string, Calculator calculator) throws Exception { - return TemplateUtils.render(string, calculator); + public static String render(String s, Calculator c) throws Exception { + return TemplateUtils.render(s, c); } } diff --git a/src/test/java/com/fanruan/api/util/RenderKitTest.java b/src/test/java/com/fanruan/api/util/RenderKitTest.java index 78b498b..6946f6a 100644 --- a/src/test/java/com/fanruan/api/util/RenderKitTest.java +++ b/src/test/java/com/fanruan/api/util/RenderKitTest.java @@ -1,13 +1,12 @@ package com.fanruan.api.util; import com.fanruan.api.Prepare; +import com.fr.script.Calculator; import org.junit.Assert; import org.junit.Test; - import java.util.HashMap; import java.util.Map; -import static org.junit.Assert.*; /** * @author richie @@ -28,9 +27,9 @@ public class RenderKitTest extends Prepare { @Test public void render() throws Exception{ - String string = new String("a"); - Calculator calculator = new Calculator("b"); - Assert.assertEquals("a", RenderKit.render(string)); - Assert.assertEquals("b", RenderKit.render(calculator)); - } + Calculator c = Calculator.createCalculator(); + String s = "abc${p1}xyz${p2}"; + Assert.assertEquals("abc1xyz2", RenderKit.render(s,c)); +} + } From 6cb16987e524cb05388d46b72f4de29c42efffe2 Mon Sep 17 00:00:00 2001 From: Palin Date: Wed, 11 Sep 2019 13:46:10 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/function/FunctionKit.java | 1 - src/test/java/com/fanruan/api/util/RenderKitTest.java | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index f9fccef..227cb25 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -77,7 +77,6 @@ public class FunctionKit { return new NameAndDescription[0]; } - /** * 得到函数管理器实例 * @return 函数管理器 diff --git a/src/test/java/com/fanruan/api/util/RenderKitTest.java b/src/test/java/com/fanruan/api/util/RenderKitTest.java index 6946f6a..a705166 100644 --- a/src/test/java/com/fanruan/api/util/RenderKitTest.java +++ b/src/test/java/com/fanruan/api/util/RenderKitTest.java @@ -28,8 +28,11 @@ public class RenderKitTest extends Prepare { @Test public void render() throws Exception{ Calculator c = Calculator.createCalculator(); - String s = "abc${p1}xyz${p2}"; - Assert.assertEquals("abc1xyz2", RenderKit.render(s,c)); -} + Map map = new HashMap<>(); + map.put("p1",1); + map.put("p2",2); + String s = "abc${p1}xyz${p2}"; + Assert.assertEquals("abcxyz", RenderKit.render(s,c)); + } } From b70cb2aa5336a84eb6289ab15fdf35ceef5ae707 Mon Sep 17 00:00:00 2001 From: Palin Date: Wed, 11 Sep 2019 14:48:47 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/function/FunctionKit.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index 227cb25..7c5d03e 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -7,6 +7,7 @@ import com.fr.file.FunctionManager; import com.fr.file.FunctionManagerProvider; import com.fr.script.Calculator; import com.fr.stable.StringUtils; +import com.fr.stable.fun.FunctionHelper; import com.fr.stable.script.FunctionDef; import java.util.ArrayList; @@ -85,4 +86,12 @@ public class FunctionKit { return com.fr.file.FunctionManager.getInstance(); } + /** + * 根据插件ID生成整数类型的标识符 + * @param stringID + * @return + */ + public static int generateFunctionID(String stringID) { + return FunctionHelper.generateFunctionID(stringID); + } } \ No newline at end of file From 4e4a3250a5a3e90a89f0b1860346028e60fd98d2 Mon Sep 17 00:00:00 2001 From: Palin Date: Thu, 12 Sep 2019 09:11:39 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0jar=E9=87=8D=E8=BD=BD?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/report/TemplateSessionIDInfo.java | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java diff --git a/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java b/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java deleted file mode 100644 index 0a8e8cd..0000000 --- a/src/main/java/com/fanruan/api/report/TemplateSessionIDInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fanruan.api.report; - -/** - * @author Palin - * @version 10.0 - * Created by Palin on 2019/9/9 0009 - */ -public abstract class TemplateSessionIDInfo extends com.fr.web.core.TemplateSessionIDInfo{ -}