Skip to content
Merged

Dev #200

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/example-app/example-app-cmd-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/example-app-cmd-meta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/example-app-query/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/example-domain-leave/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-domain</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/example-domain-user/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-domain</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion example/example-interface/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
</parent>

<artifactId>example-interface</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion example/example-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-example</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.47</version>
<version>3.4.49</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</parent>

<artifactId>springboot-example</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>

<name>springboot-example</name>
<description>springboot-example project for Spring Boot</description>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>

<url>https://github.com/codingapi/springboot-framewrok</url>
<name>springboot-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-data-authorization/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
</parent>

<name>springboot-starter-data-authorization</name>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-data-fast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.47</version>
<version>3.4.49</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.47</version>
<version>3.4.49</version>
</parent>

<name>springboot-starter-flow</name>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.47</version>
<version>3.4.49</version>
</parent>

<artifactId>springboot-starter-security</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.4.47</version>
<version>3.4.49</version>
</parent>
<artifactId>springboot-starter</artifactId>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public class GroovyMetadata {
*/
private final List<GroovyField> binds;

/**
* 程序主函数名称
*/
@Setter
private String mainMethod;

/**
* 返回类型
*/
Expand All @@ -38,6 +44,12 @@ public class GroovyMetadata {
*/
private final Map<String, GroovyType> types;

/**
* 脚本说明
*/
@Setter
private String description;


public GroovyMetadata() {
this.types = new HashMap<>();
Expand All @@ -47,6 +59,7 @@ public GroovyMetadata() {

/**
* 通过class构建 脚本类型数据
*
* @param clazz class类型
*/
public void buildType(Class<?> clazz) {
Expand All @@ -57,7 +70,7 @@ public void buildType(Class<?> clazz) {
groovyType = groovyTypeParser.parser();
groovyType.setDataType(dataType);
ScriptType scriptType = clazz.getAnnotation(ScriptType.class);
if(scriptType!=null) {
if (scriptType != null) {
groovyType.setDescription(scriptType.description());
}
this.put(dataType, groovyType);
Expand All @@ -66,6 +79,7 @@ public void buildType(Class<?> clazz) {

/**
* 增加请求参数数据对象
*
* @param request 请求参数
*/
public void addRequest(GroovyField request) {
Expand All @@ -74,26 +88,29 @@ public void addRequest(GroovyField request) {

/**
* 更新流程类型数据
* @param dataType 数据类型
*
* @param dataType 数据类型
* @param groovyType 脚本类型
*/
public void put(String dataType,GroovyType groovyType){
public void put(String dataType, GroovyType groovyType) {
this.types.put(dataType, groovyType);
}


/**
* 获取流程类型数据
*
* @param dataType 数据类型
* @return 脚本类型
*/
public GroovyType getType(String dataType){
public GroovyType getType(String dataType) {
return this.types.get(dataType);
}


/**
* 增加绑定数据对象
*
* @param bind 绑定数据
*/
public void addBind(GroovyField bind) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public class GroovyRunningScript<T> {
*/
private final String script;

/**
* 脚本说明
*/
private final String description;

/**
* 返回数据类型
*/
Expand All @@ -47,37 +52,46 @@ public class GroovyRunningScript<T> {
private GroovyMetadata metadata;


public GroovyRunningScript(String method, String script, Class<T> returnType, List<GroovyBindObject> binds, List<GroovyBindObject> requests) {
public GroovyRunningScript(String method, String script, String description, Class<T> returnType, List<GroovyBindObject> binds, List<GroovyBindObject> requests) {
this.method = method;
this.script = script;
this.description = description;
this.returnType = returnType;
this.requests = requests;
this.binds = binds;
}

public GroovyRunningScript(String method, String script, Class<T> returnType, GroovyBindObjectBuilder bindBuilder, GroovyBindObjectBuilder requestBuilder) {
this(method, script, returnType, bindBuilder != null ? bindBuilder.build() : null, requestBuilder != null ? requestBuilder.build() : null);
public GroovyRunningScript(String method, String script, String description, Class<T> returnType, GroovyBindObjectBuilder bindBuilder, GroovyBindObjectBuilder requestBuilder) {
this(method, script, description, returnType, bindBuilder != null ? bindBuilder.build() : null, requestBuilder != null ? requestBuilder.build() : null);
}


public GroovyRunningScript(String method, String script, Class<T> returnType, GroovyBindObjectBuilder requestBuilder) {
this(method, script, returnType, null, requestBuilder);
public GroovyRunningScript(String method, String script, String description, Class<T> returnType, GroovyBindObjectBuilder requestBuilder) {
this(method, script, description, returnType, null, requestBuilder);
}

public GroovyRunningScript(String script, Class<T> returnType, GroovyBindObjectBuilder bindBuilder, GroovyBindObjectBuilder requestBuilder) {
this("run", script, returnType, bindBuilder, requestBuilder);
public GroovyRunningScript(String script, Class<T> returnType, GroovyBindObjectBuilder bindBuilder, GroovyBindObjectBuilder requestBuilder) {
this("run", script, null, returnType, bindBuilder, requestBuilder);
}

public GroovyRunningScript(String script, Class<T> returnType, GroovyBindObjectBuilder requestBuilder) {
public GroovyRunningScript(String script, String description, Class<T> returnType, GroovyBindObjectBuilder bindBuilder, GroovyBindObjectBuilder requestBuilder) {
this("run", script, description, returnType, bindBuilder, requestBuilder);
}

public GroovyRunningScript(String script,String description, Class<T> returnType, GroovyBindObjectBuilder requestBuilder) {
this("run", script, returnType, null, requestBuilder);
}

public GroovyRunningScript(String script,Class<T> returnType, GroovyBindObjectBuilder requestBuilder) {
this("run", script,null, returnType, null, requestBuilder);
}

/**
* 获取参数
*/
public Object[] getParams() {
List<Object> objects = new ArrayList<>();
if(this.requests!=null) {
if (this.requests != null) {
for (GroovyBindObject bindObject : this.requests) {
objects.add(bindObject.getObject());
}
Expand All @@ -87,6 +101,7 @@ public Object[] getParams() {

/**
* 重新设置脚本元数据信息
*
* @param metadata 脚本元数据信息
*/
public void resetMetadata(GroovyMetadata metadata) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class GroovyMetadataParserService {
public GroovyMetadataParserService(GroovyRunningScript<?> script) {
this.script = script;
this.groovyMetadata = new GroovyMetadata();
this.groovyMetadata.setMainMethod(script.getMethod());
this.groovyMetadata.setDescription(script.getDescription());
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.codingapi.springboot.framework.script;

import com.alibaba.fastjson.JSON;
import com.codingapi.springboot.framework.script.meta.GroovyMetadata;
import com.codingapi.springboot.framework.script.request.GroovyBindObjectBuilder;
import com.codingapi.springboot.framework.script.request.GroovyRunningScript;
import com.codingapi.springboot.framework.script.request.MyScriptRequest;
Expand Down