Skip to content
Merged
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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</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.45</version>
<version>3.4.46</version>
</parent>
<artifactId>springboot-starter</artifactId>

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

import com.codingapi.springboot.framework.script.gateway.GroovyMetadataReloadGateway;
import com.codingapi.springboot.framework.script.meta.GroovyMetadata;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

public class GroovyMetadataReloadGatewayContext {

private final List<GroovyMetadataReloadGateway> gateways;

@Getter
private final static GroovyMetadataReloadGatewayContext instance = new GroovyMetadataReloadGatewayContext();

private GroovyMetadataReloadGatewayContext(){
this.gateways = new ArrayList<>();
}

public void addGateway(GroovyMetadataReloadGateway gateway){
this.gateways.add(gateway);
}

public void reload(GroovyMetadata metadata){
for (GroovyMetadataReloadGateway gateway:gateways){
gateway.reload(metadata);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.codingapi.springboot.framework.script.gateway;

import com.codingapi.springboot.framework.script.meta.GroovyMetadata;

/**
* 脚本元数据刷新加载对象
*/
public interface GroovyMetadataReloadGateway {

void reload(GroovyMetadata metadata);

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public GroovyMetadata() {
this.binds = new ArrayList<>();
}

/**
* 通过class构建 脚本类型数据
* @param clazz class类型
*/
public void buildType(Class<?> clazz) {
String dataType = clazz.getSimpleName();
GroovyType groovyType = this.types.get(dataType);
Expand All @@ -56,20 +60,42 @@ public void buildType(Class<?> clazz) {
if(scriptType!=null) {
groovyType.setDescription(scriptType.description());
}
this.types.put(dataType, groovyType);
this.put(dataType, groovyType);
}
}

/**
* 增加请求参数数据对象
* @param request 请求参数
*/
public void addRequest(GroovyField request) {
this.requests.add(request);
}

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


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


/**
* 增加绑定数据对象
* @param bind 绑定数据
*/
public void addBind(GroovyField bind) {
this.binds.add(bind);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.codingapi.springboot.framework.script.request;

import com.codingapi.springboot.framework.script.GroovyMetadataReloadGatewayContext;
import com.codingapi.springboot.framework.script.meta.GroovyMetadata;
import com.codingapi.springboot.framework.script.service.GroovyMetadataParserService;
import lombok.Getter;
Expand Down Expand Up @@ -84,16 +85,22 @@ public Object[] getParams() {
return objects.toArray();
}

/**
* 重新设置脚本元数据信息
* @param metadata 脚本元数据信息
*/
public void resetMetadata(GroovyMetadata metadata) {
this.metadata = metadata;
GroovyMetadataReloadGatewayContext.getInstance().reload(this.metadata);
}

/**
* 构建元数据信息
* 构建脚本元数据信息
*/
public void buildMetadata() {
GroovyMetadataParserService groovyMetaDataParserService = new GroovyMetadataParserService(this);
this.metadata = groovyMetaDataParserService.parser();
GroovyMetadataReloadGatewayContext.getInstance().reload(this.metadata);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,34 @@ private void loadMethods() {
groovyFunction.setDescription(scriptFunction.description());
}

Parameter[] methodParameters = method.getParameters();
Map<String, Parameter> parameterMap = new HashMap<>();
for (Parameter parameter : methodParameters) {
parameterMap.put(parameter.getName(), parameter);
}

ScriptField[] parameters = scriptFunction.parameters();
Map<String, ScriptField> parameterMap = new HashMap<>();
if (parameters != null) {
for (ScriptField parameter : parameters) {
Parameter methodParameter = parameterMap.get(parameter.name());
if (methodParameter != null) {
Class<?> clazz = methodParameter.getType();
this.metadata.buildType(clazz);

GroovyField groovyParameter = new GroovyField();
groovyParameter.setDataType(clazz.getSimpleName());
groovyParameter.setName(methodParameter.getName());

if (StringUtils.hasText(parameter.name())) {
groovyParameter.setName(parameter.name());
}
if (StringUtils.hasText(parameter.description())) {
groovyParameter.setDescription(parameter.description());
}

groovyFunction.addParameter(groovyParameter);
for (ScriptField scriptField : parameters) {
parameterMap.put(scriptField.name(), scriptField);
}
}

Parameter[] methodParameters = method.getParameters();
for (Parameter methodParameter : methodParameters) {
Class<?> clazz = methodParameter.getType();
this.metadata.buildType(clazz);

GroovyField groovyParameter = new GroovyField();
groovyParameter.setDataType(clazz.getSimpleName());
groovyParameter.setName(methodParameter.getName());

ScriptField scriptParameter = parameterMap.get(methodParameter.getName());
if (scriptParameter != null) {
if (StringUtils.hasText(scriptParameter.name())) {
groovyParameter.setName(scriptParameter.name());
}
if (StringUtils.hasText(scriptParameter.description())) {
groovyParameter.setDescription(scriptParameter.description());
}
}

groovyFunction.addParameter(groovyParameter);
}

Class<?> returnType = method.getReturnType();
Expand Down