commit
7e35439cc3
@ -10,8 +10,9 @@ import org.spiderflow.core.context.SpiderContext;
|
||||
import org.spiderflow.core.model.SpiderNode;
|
||||
import org.spiderflow.core.utils.DataSourceUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 数据源执行器
|
||||
* 定义数据源执行器
|
||||
* @author jmxd
|
||||
*
|
||||
*/
|
||||
|
@ -12,6 +12,11 @@ import org.spiderflow.core.model.SpiderNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 函数执行器
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class FunctionExecutor implements Executor{
|
||||
|
||||
|
@ -13,6 +13,11 @@ import org.spiderflow.core.model.SpiderOutput;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 输出执行器
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class OutputExecutor implements Executor{
|
||||
|
||||
|
@ -15,6 +15,11 @@ import org.spiderflow.web.service.SpiderFlowService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 子流程执行器
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class ProcessExecutor implements Executor{
|
||||
|
||||
|
@ -17,6 +17,11 @@ import org.spiderflow.core.model.SpiderNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 请求执行器
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class RequestExecutor implements Executor{
|
||||
|
||||
|
@ -6,6 +6,11 @@ import org.spiderflow.core.context.SpiderContext;
|
||||
import org.spiderflow.core.model.SpiderNode;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 开始执行器
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class StartExecutor implements Executor{
|
||||
|
||||
|
@ -12,6 +12,11 @@ import org.spiderflow.core.model.SpiderNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 定义变量执行器
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class VariableExecutor implements Executor{
|
||||
|
||||
|
@ -7,6 +7,11 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import freemarker.template.TemplateModelException;
|
||||
|
||||
/**
|
||||
* 封装正则表达式的选择器方法类
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class RegxFunction extends FreemarkerTemplateMethodModel{
|
||||
|
||||
|
@ -7,6 +7,11 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import freemarker.template.TemplateModelException;
|
||||
|
||||
/**
|
||||
* 封装多个正则表达式的选择器方法类
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class RegxsFunction extends FreemarkerTemplateMethodModel{
|
||||
|
||||
|
@ -9,6 +9,11 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import freemarker.template.TemplateModelException;
|
||||
|
||||
/**
|
||||
* 封装选择器(Selector)的选择器(Freemarker)方法类
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class SelectorFunction extends FreemarkerTemplateMethodModel{
|
||||
|
||||
|
@ -9,6 +9,11 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import freemarker.template.TemplateModelException;
|
||||
|
||||
/**
|
||||
* 封装多个选择器(Selector)的选择器(Freemarker)方法类
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class SelectorsFunction extends FreemarkerTemplateMethodModel{
|
||||
|
||||
|
@ -9,6 +9,11 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import freemarker.template.TemplateModelException;
|
||||
|
||||
/**
|
||||
* 封装路径表达式(XML路径语言)的选择器方法类
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class XPathFunction extends FreemarkerTemplateMethodModel{
|
||||
|
||||
|
@ -9,6 +9,11 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import freemarker.template.TemplateModelException;
|
||||
|
||||
/**
|
||||
* 封装多个路径表达式(XML路径语言)的选择器方法类
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class XPathsFunction extends FreemarkerTemplateMethodModel{
|
||||
|
||||
|
@ -2,6 +2,11 @@ package org.spiderflow.core.freemarker.functions.utils;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
/**
|
||||
* 字符串内容和Base64互相转换 工具类 防止NPE
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class Base64FunctionUtils {
|
||||
|
||||
public static String encode(byte[] bytes){
|
||||
|
@ -6,6 +6,11 @@ import java.util.Date;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
/**
|
||||
* 时间获取/格式化 工具类 防止NPE 默认格式(yyyy-MM-dd HH:mm:ss)
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class DateFunctionUtils {
|
||||
|
||||
private static final String DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
||||
|
@ -8,8 +8,19 @@ import java.nio.charset.Charset;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
/**
|
||||
* 文件读写 工具类 防止NPE
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class FileFunctionUtils {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param path 文件路径/名
|
||||
* @param createDirectory 是否需要创建
|
||||
* @return File 文件
|
||||
*/
|
||||
private static File getFile(String path,boolean createDirectory){
|
||||
File f = new File(path);
|
||||
if(createDirectory&&!f.getParentFile().exists()){
|
||||
|
@ -2,6 +2,11 @@ package org.spiderflow.core.freemarker.functions.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
/**
|
||||
* Json和String互相转换 工具类 防止NPE
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class JsonFunctionUtils {
|
||||
|
||||
public static Object parse(String jsonString){
|
||||
|
@ -1,14 +1,25 @@
|
||||
package org.spiderflow.core.freemarker.functions.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* List 工具类 防止NPE 添加了类似python的split()方法
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class ListFunctionUtils {
|
||||
|
||||
public static int length(List<?> list){
|
||||
return list != null ? list.size() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param list 原List
|
||||
* @param len 按多长进行分割
|
||||
* @return List<List<?>> 分割后的数组
|
||||
*/
|
||||
public static List<List<?>> split(List<?> list,int len){
|
||||
List<List<?>> result = new ArrayList<>();
|
||||
if (list == null || list.size() == 0 || len < 1) {
|
||||
|
@ -2,6 +2,11 @@ package org.spiderflow.core.freemarker.functions.utils;
|
||||
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
|
||||
/**
|
||||
* 随机数/字符串 生成方法
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class RandomFunctionUtils {
|
||||
|
||||
public static int randomInt(int min,int max){
|
||||
@ -16,6 +21,12 @@ public class RandomFunctionUtils {
|
||||
return RandomUtils.nextLong(min, max);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param chars 字符个数
|
||||
* @param length 字符范围
|
||||
* @return String 随机字符串
|
||||
*/
|
||||
public static String string(String chars,int length){
|
||||
if (chars != null) {
|
||||
char[] newChars = new char[length];
|
||||
|
@ -6,6 +6,11 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* String 工具类 防止NPE
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class StringFunctionUtils {
|
||||
|
||||
public static String substring(String content, int beginIndex) {
|
||||
@ -80,6 +85,10 @@ public class StringFunctionUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成UUID
|
||||
* @return String UUID
|
||||
*/
|
||||
public static String uuid() {
|
||||
return UUID.randomUUID().toString().replace("-", "");
|
||||
}
|
||||
|
@ -5,6 +5,11 @@ import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* url 按指定字符集进行编码/解码 默认字符集(UTF-8) 工具类 防止NPE
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class UrlFunctionUtils {
|
||||
|
||||
public static String encode(String url){
|
||||
|
@ -11,6 +11,11 @@ import org.jsoup.Connection.Method;
|
||||
import org.jsoup.Connection.Response;
|
||||
import org.jsoup.Jsoup;
|
||||
|
||||
/**
|
||||
* 请求对象包装类
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class HttpRequest {
|
||||
|
||||
private String url;
|
||||
|
@ -6,6 +6,11 @@ import org.jsoup.Connection.Response;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
/**
|
||||
* 响应对象包装类
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class HttpResponse {
|
||||
|
||||
private Response response;
|
||||
|
Loading…
Reference in New Issue
Block a user