Skip to content

Commit 2c32616

Browse files
authored
Merge pull request #779 from scottsut/master
feat: 1.0.0-beta.1 release
2 parents 5cc8134 + a84e726 commit 2c32616

File tree

577 files changed

+16531
-11003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

577 files changed

+16531
-11003
lines changed

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>datart-parent</artifactId>
77
<groupId>datart</groupId>
8-
<version>1.0.0-beta.0</version>
8+
<version>1.0.0-beta.1</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

core/src/main/java/datart/core/base/consts/Const.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
package datart.core.base.consts;
2020

2121

22+
import java.util.regex.Pattern;
23+
2224
public class Const {
2325

2426
public static final byte VIZ_PUBLISH = 2;
@@ -32,7 +34,6 @@ public class Const {
3234
/**
3335
* 正则表达式
3436
*/
35-
3637
public static final String REG_EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
3738

3839
public static final String REG_USER_PASSWORD = ".{6,20}";
@@ -46,12 +47,15 @@ public class Const {
4647
//默认的变量引用符号
4748
public static final String DEFAULT_VARIABLE_QUOTE = "$";
4849
//变量匹配符
49-
public static final String VARIABLE_EXP = "\\$\\w+\\$";
50+
public static final Pattern VARIABLE_PATTERN = Pattern.compile("\\$\\S+\\$");
51+
//变量正则模板
52+
public static final String VARIABLE_PATTERN_TEMPLATE = "\\$%s\\$";
53+
5054
/**
5155
* 权限变量
5256
*/
53-
//管理员权限,拥有所有数据的权限
54-
public static final String ALL_PERMISSION = "@ALL_PERMISSION@";
57+
// //管理员权限,拥有所有数据的权限
58+
// public static final String ALL_PERMISSION = "@ALL_PERMISSION@";
5559

5660
/**
5761
* Token Key
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Datart
3+
* <p>
4+
* Copyright 2021
5+
* <p>
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
* <p>
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
* <p>
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package datart.core.base.consts;
19+
20+
public enum PlatformSettings {
21+
22+
// download record limit
23+
DOWNLOAD_RECORD_LIMIT
24+
25+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Datart
3+
* <p>
4+
* Copyright 2021
5+
* <p>
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
* <p>
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
* <p>
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package datart.core.base.exception;
20+
21+
import lombok.Data;
22+
import lombok.EqualsAndHashCode;
23+
24+
@EqualsAndHashCode(callSuper = true)
25+
@Data
26+
public class SqlParseError extends BaseException {
27+
28+
public SqlParseError(Throwable e) {
29+
super(e);
30+
}
31+
32+
private String sql;
33+
34+
private String dbType;
35+
36+
public String toString() {
37+
return "SQL:" + sql + " \r\n" +
38+
"DB: " + dbType + " \r\n" +
39+
"EXCEPTION:" + getMessage();
40+
}
41+
42+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package datart.core.base.processor;
2+
3+
public interface ExtendProcessor {
4+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package datart.core.base.processor;
2+
3+
import lombok.Builder;
4+
import lombok.Data;
5+
6+
@Builder
7+
@Data
8+
public class ProcessorResponse {
9+
10+
private boolean success;
11+
private int errCode;
12+
private String message;
13+
14+
public static ProcessorResponse success() {
15+
return ProcessorResponse.builder()
16+
.success(true)
17+
.build();
18+
}
19+
20+
public static ProcessorResponse failure(int errCode,String message) {
21+
return ProcessorResponse.builder()
22+
.success(false)
23+
.errCode(errCode)
24+
.message(message)
25+
.build();
26+
}
27+
}

core/src/main/java/datart/core/common/CSVParse.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@ public List<List<Object>> parse() throws IOException {
7070
} else {
7171
types = inferDataType(records.get(1));
7272
}
73-
return records.parallelStream().map(this::extractValues)
73+
List<List<Object>> values = records.parallelStream().map(this::extractValues)
7474
.collect(Collectors.toList());
75+
// remove utf-8-with-bom char
76+
String start = values.get(0).get(0).toString();
77+
if (start.charAt(0) == '\uFEFF') {
78+
values.get(0).set(0, start.substring(1));
79+
}
80+
return values;
7581
}
7682

7783
private ValueType[] inferDataType(CSVRecord record) {
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Datart
3+
* <p>
4+
* Copyright 2021
5+
* <p>
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
* <p>
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
* <p>
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package datart.core.common;
20+
21+
import java.util.Map;
22+
import java.util.concurrent.ConcurrentHashMap;
23+
24+
public class RequestContext {
25+
26+
private static final InheritableThreadLocal<Map<String, Exception>> exceptions = new InheritableThreadLocal<>();
27+
28+
public static void putWarning(String name, Exception exception) {
29+
Map<String, Exception> exceptionMap = exceptions.get();
30+
if (exceptionMap == null) {
31+
exceptionMap = new ConcurrentHashMap<>();
32+
exceptions.set(exceptionMap);
33+
}
34+
exceptionMap.put(name, exception);
35+
}
36+
37+
public static Map<String, Exception> getWarnings() {
38+
return exceptions.get();
39+
}
40+
41+
public static void clean() {
42+
exceptions.remove();
43+
}
44+
45+
}

core/src/main/java/datart/core/data/provider/Column.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ public class Column implements Serializable {
2929
private String name;
3030

3131
private ValueType type;
32-
32+
3333
private String fmt;
3434

35+
private String pkDatabase;
36+
37+
private String pkTable;
38+
39+
private String pkColumn;
40+
3541
public Column(String name, ValueType type) {
3642
this.name = name;
3743
this.type = type;

core/src/main/java/datart/core/data/provider/ScriptVariable.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public class ScriptVariable extends TypedValue {
4141

4242
private boolean expression;
4343

44+
// Permission variable valid flag, which is false when executed by the organization owner
45+
private boolean disabled;
46+
4447
@Override
4548
public String toString() {
4649
if (values == null) {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package datart.core.data.provider.processor;
2+
3+
import datart.core.base.processor.ExtendProcessor;
4+
import datart.core.base.processor.ProcessorResponse;
5+
import datart.core.data.provider.DataProviderSource;
6+
import datart.core.data.provider.Dataframe;
7+
import datart.core.data.provider.ExecuteParam;
8+
import datart.core.data.provider.QueryScript;
9+
10+
public interface DataProviderPostProcessor extends ExtendProcessor {
11+
ProcessorResponse postRun(Dataframe frame, DataProviderSource config, QueryScript script, ExecuteParam executeParam);
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package datart.core.data.provider.processor;
2+
3+
import datart.core.base.processor.ExtendProcessor;
4+
import datart.core.base.processor.ProcessorResponse;
5+
import datart.core.data.provider.DataProviderSource;
6+
import datart.core.data.provider.ExecuteParam;
7+
import datart.core.data.provider.QueryScript;
8+
9+
public interface DataProviderPreProcessor extends ExtendProcessor {
10+
ProcessorResponse preRun(DataProviderSource config, QueryScript script, ExecuteParam executeParam);
11+
}

core/src/main/java/datart/core/entity/Schedule.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package datart.core.entity;
22

3+
import java.util.Date;
34
import lombok.Data;
45
import lombok.EqualsAndHashCode;
56

6-
import java.util.Date;
7-
87
@Data
98
@EqualsAndHashCode(callSuper = true)
109
public class Schedule extends BaseEntity {

core/src/main/java/datart/core/mappers/ext/OrgSettingsMapperExt.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ public interface OrgSettingsMapperExt extends OrgSettingsMapper {
1616
})
1717
List<OrgSettings> selectByOrg(String orgId);
1818

19+
@Select({
20+
"SELECT * FROM org_settings t WHERE t.org_id = #{orgId} and `type`=#{type}"
21+
})
22+
OrgSettings selectByOrgAndType(String orgId, String type);
23+
1924
}

data-providers/file-data-provider/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>datart-parent</artifactId>
77
<groupId>datart</groupId>
8-
<version>1.0.0-beta.0</version>
8+
<version>1.0.0-beta.1</version>
99
<relativePath>../../pom.xml</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>

data-providers/http-data-provider/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>datart-parent</artifactId>
77
<groupId>datart</groupId>
8-
<version>1.0.0-beta.0</version>
8+
<version>1.0.0-beta.1</version>
99
<relativePath>../../pom.xml</relativePath>
1010
</parent>
1111

data-providers/jdbc-data-provider/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>datart-parent</artifactId>
77
<groupId>datart</groupId>
8-
<version>1.0.0-beta.0</version>
8+
<version>1.0.0-beta.1</version>
99
<relativePath>../../pom.xml</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>

data-providers/jdbc-data-provider/src/main/java/datart/data/provider/JdbcDataProvider.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public class JdbcDataProvider extends DataProvider {
4949

5050
public static final String DRIVER_CLASS = "driverClass";
5151

52+
public static final String ENABLE_SPECIAL_SQL = "enableSpecialSQL";
53+
5254
private static final String I18N_PREFIX = "config.template.jdbc.";
5355

5456
/**
@@ -113,6 +115,13 @@ private JdbcProperties conv2JdbcProperties(DataProviderSource config) {
113115
jdbcProperties.setDriverClass(StringUtils.isBlank(driverClass) ?
114116
ProviderFactory.getJdbcDriverInfo(jdbcProperties.getDbType()).getDriverClass() :
115117
driverClass);
118+
119+
Object enableSpecialSQL = config.getProperties().get(ENABLE_SPECIAL_SQL);
120+
121+
if (enableSpecialSQL != null && "true".equals(enableSpecialSQL.toString())) {
122+
jdbcProperties.setEnableSpecialSql(true);
123+
}
124+
116125
Object properties = config.getProperties().get("properties");
117126
if (properties != null) {
118127
if (properties instanceof Map) {

data-providers/jdbc-data-provider/src/main/java/datart/data/provider/jdbc/DataSourceFactoryDruidImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private Properties configDataSource(JdbcProperties properties) {
5757
}
5858
pro.setProperty(DruidDataSourceFactory.PROP_MAXWAIT, JdbcDataProvider.DEFAULT_MAX_WAIT.toString());
5959

60-
pro.setProperty("druid.mysql.usePingMethod", "false");
60+
System.setProperty("druid.mysql.usePingMethod", "false");
6161

6262
// url properties
6363
// pro.setProperty(DruidDataSourceFactory.PROP_CONNECTIONPROPERTIES, "useUnicode=true;characterEncoding=utf8;characterSetResults=utf8");

0 commit comments

Comments
 (0)