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) {

0 commit comments

Comments
 (0)