Skip to content

Commit d726d13

Browse files
authored
Merge branch 'devel' into dbeaver/pro#6327/refactor-sql-editor-vqb
2 parents c8ef08b + e6e92f0 commit d726d13

File tree

31 files changed

+264
-144
lines changed

31 files changed

+264
-144
lines changed

server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle.properties

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,10 @@ meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.deploymentType.n
1010
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbUrl.name=Security manager database URL
1111
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbDriverName.name=Security manager database driver name
1212
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbProductName.name=Security manager database product name
13-
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbProductVersion.name=Security manager database product version
13+
meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbProductVersion.name=Security manager database product version
14+
15+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.readOnly.name = Read-only connection
16+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = Auto-commit
17+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Keep-alive interval (seconds)
18+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultSchema.name = Default schema
19+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultCatalog.name = Default catalog
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Garder actif (en secondes)
2+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.description = Pas de déconnexion automatique
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.readOnly.name = Только для чтения
2+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = Авто-коммит
3+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Интервал Keep-alive (в секундах)
4+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultSchema.name = Схема по умолчанию
5+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultCatalog.name = Каталог по умолчанию
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.readOnly.name = Kết nối chỉ đọc
2+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = Tự động commit
3+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Giữ kết nối (tính bằng giây)
4+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.description = Không tự động ngắt kết nối
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = 自动提交
2+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = 保持连接 (秒)
3+
meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.description = 无自动断开连接

server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebConnectionConfig.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public class WebConnectionConfig {
5656
private boolean saveCredentials;
5757
private boolean sharedCredentials;
5858
private Map<String, Object> mainPropertyValues;
59+
private Map<String, Object> expertSettingsValues;
5960
private Map<String, Object> providerProperties;
6061
private Map<String, Object> externalParameters;
6162
private List<WebNetworkHandlerConfigInput> networkHandlersConfig;
@@ -72,17 +73,13 @@ public WebConnectionConfig(Map<String, Object> params) {
7273
if (!CommonUtils.isEmpty(params)) {
7374
connectionId = JSONUtils.getString(params, "connectionId");
7475
driverId = JSONUtils.getString(params, "driverId");
75-
readOnly = JSONUtils.getBoolean(params, "readOnly");
7676

7777
host = JSONUtils.getString(params, "host");
7878
port = JSONUtils.getString(params, "port");
7979
serverName = JSONUtils.getString(params, "serverName");
8080
databaseName = JSONUtils.getString(params, "databaseName");
8181
url = JSONUtils.getString(params, "url");
8282

83-
keepAliveInterval = JSONUtils.getInteger(params, "keepAliveInterval", -1);
84-
defaultAutoCommit = JSONUtils.getBoolean(params, "autocommit", true);
85-
8683
name = JSONUtils.getString(params, "name");
8784
description = JSONUtils.getString(params, "description");
8885
folder = JSONUtils.getString(params, "folder");
@@ -99,8 +96,18 @@ public WebConnectionConfig(Map<String, Object> params) {
9996

10097
mainPropertyValues = JSONUtils.getObjectOrNull(params, "mainPropertyValues");
10198
providerProperties = JSONUtils.getObjectOrNull(params, "providerProperties");
102-
defaultCatalogName = JSONUtils.getString(params, "defaultCatalogName");
103-
defaultSchemaName = JSONUtils.getString(params, "defaultSchemaName");
99+
100+
expertSettingsValues = JSONUtils.getObjectOrNull(params, "expertSettingsValues");
101+
keepAliveInterval = JSONUtils.getInteger(
102+
expertSettingsValues != null ? expertSettingsValues : params, WebExpertSettingsProperties.PROP_KEEP_ALIVE_INTERVAL, -1);
103+
readOnly = JSONUtils.getBoolean(
104+
expertSettingsValues != null ? expertSettingsValues : params, WebExpertSettingsProperties.PROP_READ_ONLY);
105+
defaultAutoCommit = JSONUtils.getBoolean(
106+
expertSettingsValues != null ? expertSettingsValues : params, WebExpertSettingsProperties.PROP_AUTO_COMMIT, true);
107+
defaultCatalogName = JSONUtils.getString(
108+
expertSettingsValues != null ? expertSettingsValues : params, WebExpertSettingsProperties.PROP_DEFAULT_CATALOG);
109+
defaultSchemaName = JSONUtils.getString(
110+
expertSettingsValues != null ? expertSettingsValues : params, WebExpertSettingsProperties.PROP_DEFAULT_SCHEMA);
104111

105112
String configType = JSONUtils.getString(params, "configurationType");
106113
configurationType = configType == null ? null : DBPDriverConfigurationType.valueOf(configType);
@@ -221,6 +228,11 @@ public Map<String, Object> getMainPropertyValues() {
221228
return mainPropertyValues;
222229
}
223230

231+
@Property
232+
public Map<String, Object> getExpertSettingsValues() {
233+
return expertSettingsValues;
234+
}
235+
224236
@Property
225237
public Map<String, Object> getProviderProperties() {
226238
return providerProperties;

server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebConnectionInfo.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,17 @@ public Map<String, String> getMainPropertyValues() {
417417
return mainProperties;
418418
}
419419

420+
@Property
421+
public Map<String, Object> getExpertSettingsValues() {
422+
Map<String, Object> expertSettings = new LinkedHashMap<>();
423+
expertSettings.put(WebExpertSettingsProperties.PROP_AUTO_COMMIT, isAutocommit());
424+
expertSettings.put(WebExpertSettingsProperties.PROP_KEEP_ALIVE_INTERVAL, getKeepAliveInterval());
425+
expertSettings.put(WebExpertSettingsProperties.PROP_READ_ONLY, isReadOnly());
426+
expertSettings.put(WebExpertSettingsProperties.PROP_DEFAULT_CATALOG, getDefaultCatalogName());
427+
expertSettings.put(WebExpertSettingsProperties.PROP_DEFAULT_SCHEMA, getDefaultSchemaName());
428+
return expertSettings;
429+
}
430+
420431
@Property
421432
public Map<String, String> getProviderProperties() {
422433
return dataSourceContainer.getConnectionConfiguration().getProviderProperties();
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package io.cloudbeaver.model;
2+
3+
import org.jkiss.code.NotNull;
4+
import org.jkiss.dbeaver.model.DBPObject;
5+
import org.jkiss.dbeaver.model.connection.DBPDriver;
6+
import org.jkiss.dbeaver.model.connection.DBPDriverConstants;
7+
import org.jkiss.dbeaver.model.meta.IPropertyValueValidator;
8+
import org.jkiss.dbeaver.model.meta.Property;
9+
import org.jkiss.utils.CommonUtils;
10+
11+
/**
12+
* Web expert settings properties. Class for returning filtered expert settings properties in web interface.
13+
*/
14+
public class WebExpertSettingsProperties implements DBPObject {
15+
public static final String PROP_READ_ONLY = "readOnly";
16+
public static final String PROP_AUTO_COMMIT = "autocommit";
17+
public static final String PROP_KEEP_ALIVE_INTERVAL = "keepAliveInterval";
18+
public static final String PROP_DEFAULT_CATALOG = "defaultCatalogName";
19+
public static final String PROP_DEFAULT_SCHEMA = "defaultSchemaName";
20+
21+
private final DBPDriver driver;
22+
23+
public WebExpertSettingsProperties(@NotNull DBPDriver driver) {
24+
this.driver = driver;
25+
}
26+
27+
@Property(order = 1, id = PROP_KEEP_ALIVE_INTERVAL, visibleIf = KeepAliveIntervalFieldValidator.class)
28+
public int getKeepAliveInterval() {
29+
return 0;
30+
}
31+
32+
@Property(order = 2, id = PROP_AUTO_COMMIT, visibleIf = AutoCommitFieldValidator.class)
33+
public boolean isAutoCommit() {
34+
return true;
35+
}
36+
37+
@Property(order = 3, id = PROP_READ_ONLY, visibleIf = ReadOnlyFieldValidator.class)
38+
public boolean isReadOnly() {
39+
return false;
40+
}
41+
42+
@Property(order = 4, id = PROP_DEFAULT_CATALOG, visibleIf = DefaultCatalogFieldVisibleValidator.class)
43+
public String getDefaultCatalog() {
44+
return null;
45+
}
46+
47+
@Property(order = 5, id = PROP_DEFAULT_SCHEMA, visibleIf = DefaultSchemaFieldVisibleValidator.class)
48+
public String getDefaultSchema() {
49+
return null;
50+
}
51+
52+
53+
public static class KeepAliveIntervalFieldValidator implements IPropertyValueValidator<WebExpertSettingsProperties, Object> {
54+
@Override
55+
public boolean isValidValue(WebExpertSettingsProperties object, Object value) throws IllegalArgumentException {
56+
return CommonUtils.toBoolean(!object.driver.isEmbedded(), true);
57+
}
58+
}
59+
60+
public static class AutoCommitFieldValidator implements IPropertyValueValidator<WebExpertSettingsProperties, Object> {
61+
@Override
62+
public boolean isValidValue(WebExpertSettingsProperties object, Object value) throws IllegalArgumentException {
63+
return CommonUtils.toBoolean(object.driver.getDriverParameter(DBPDriverConstants.PARAM_SUPPORTS_TRANSACTIONS), true);
64+
}
65+
}
66+
67+
public static class ReadOnlyFieldValidator implements IPropertyValueValidator<WebExpertSettingsProperties, Object> {
68+
@Override
69+
public boolean isValidValue(WebExpertSettingsProperties object, Object value) throws IllegalArgumentException {
70+
return CommonUtils.toBoolean(object.driver.getDriverParameter(DBPDriverConstants.PARAM_SUPPORTS_READ_ONLY_MODE), true);
71+
}
72+
}
73+
74+
public static class DefaultCatalogFieldVisibleValidator implements IPropertyValueValidator<WebExpertSettingsProperties, Object> {
75+
@Override
76+
public boolean isValidValue(WebExpertSettingsProperties object, Object value) throws IllegalArgumentException {
77+
return CommonUtils.toBoolean(object.driver.getDriverParameter(DBPDriverConstants.PARAM_SUPPORTS_CATALOG_SELECTION), true);
78+
}
79+
}
80+
81+
public static class DefaultSchemaFieldVisibleValidator implements IPropertyValueValidator<WebExpertSettingsProperties, Object> {
82+
@Override
83+
public boolean isValidValue(WebExpertSettingsProperties object, Object value) throws IllegalArgumentException {
84+
return CommonUtils.toBoolean(object.driver.getDriverParameter(DBPDriverConstants.PARAM_SUPPORTS_SCHEMA_SELECTION), true);
85+
}
86+
}
87+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
log.api.graphql.debug = Log GraphQL requests to console
2-
log.api.graphql.debug.description = Enable detailed logging of GraphQL queries in the server log, including all provided variables
2+
log.api.graphql.debug.description = Enable detailed logging of GraphQL queries in the server log, including all provided variables
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
log.api.graphql.debug =Логировать GraphQL-запросы в консоль
2-
log.api.graphql.debug.description = Включите подробное логирование запросов GraphQL в журнале сервера, включая все предоставленные переменные
2+
log.api.graphql.debug.description = Включите подробное логирование запросов GraphQL в журнале сервера, включая все предоставленные переменные

0 commit comments

Comments
 (0)