mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-16 14:50:15 +08:00
Revert "dbeaver/dbeaver-ee#1734 RM resource properties (#985)"
This reverts commit 08b24cace6.
This commit is contained in:
+12
-54
@@ -21,7 +21,6 @@ import io.cloudbeaver.VirtualProjectImpl;
|
||||
import io.cloudbeaver.model.rm.RMUtils;
|
||||
import io.cloudbeaver.service.sql.WebSQLConstants;
|
||||
import io.cloudbeaver.utils.WebAppUtils;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.DBException;
|
||||
@@ -43,10 +42,7 @@ import org.jkiss.utils.CommonUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.*;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
@@ -237,11 +233,11 @@ public class LocalResourceController implements RMController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RMProject getProject(@NotNull String projectId, boolean readResources, boolean readProperties) throws DBException {
|
||||
public RMProject getProject(@NotNull String projectId, boolean readResources) throws DBException {
|
||||
RMProject project = makeProjectFromId(projectId, true);
|
||||
if (readResources) {
|
||||
project.setChildren(
|
||||
listResources(projectId, null, null, readProperties, false, true)
|
||||
listResources(projectId, null, null, true, false, true)
|
||||
);
|
||||
}
|
||||
return project;
|
||||
@@ -316,7 +312,7 @@ public class LocalResourceController implements RMController {
|
||||
if (!folderPath.startsWith(projectPath)) {
|
||||
throw new DBException("Invalid folder path");
|
||||
}
|
||||
return readChildResources(projectId, folderPath, readProperties, readHistory, recursive);
|
||||
return readChildResources(folderPath, readProperties, readHistory, recursive);
|
||||
} catch (NoSuchFileException e) {
|
||||
throw new DBException("Invalid resource folder " + folder);
|
||||
} catch (IOException e) {
|
||||
@@ -325,16 +321,10 @@ public class LocalResourceController implements RMController {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private RMResource[] readChildResources(
|
||||
@NotNull String projectId,
|
||||
@NotNull Path folderPath,
|
||||
boolean readProperties,
|
||||
boolean readHistory,
|
||||
boolean recursive
|
||||
) throws IOException {
|
||||
private RMResource[] readChildResources(Path folderPath, boolean readProperties, boolean readHistory, boolean recursive) throws IOException {
|
||||
try (Stream<Path> files = Files.list(folderPath)) {
|
||||
return files.filter(path -> !path.getFileName().toString().startsWith(".")) // skip hidden files
|
||||
.map((Path path) -> makeResourceFromPath(projectId, path, readProperties, readHistory, recursive))
|
||||
.map((Path path) -> makeResourceFromPath(path, readProperties, readHistory, recursive))
|
||||
.filter(Objects::nonNull)
|
||||
.toArray(RMResource[]::new);
|
||||
}
|
||||
@@ -459,19 +449,6 @@ public class LocalResourceController implements RMController {
|
||||
return DEFAULT_CHANGE_ID;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String setResourceProperty(
|
||||
@NotNull String projectId,
|
||||
@NotNull String resourcePath,
|
||||
@NotNull String propertyName,
|
||||
@Nullable Object propertyValue
|
||||
) throws DBException {
|
||||
validateResourcePath(resourcePath);
|
||||
getProjectMetadata(projectId).setResourceProperty(resourcePath, propertyName, propertyValue);
|
||||
return DEFAULT_CHANGE_ID;
|
||||
}
|
||||
|
||||
private void validateResourcePath(String resourcePath) throws DBException {
|
||||
if (resourcePath.startsWith(".")) {
|
||||
throw new DBException("Resource path '" + resourcePath + "' can't start with dot");
|
||||
@@ -582,20 +559,14 @@ public class LocalResourceController implements RMController {
|
||||
|
||||
for (var resourceName : relativeResourcePath) {
|
||||
resourcePath = resourcePath.resolve(resourceName);
|
||||
result.add(makeResourceFromPath(projectId, resourcePath, false, false, recursive));
|
||||
result.add(makeResourceFromPath(resourcePath, false, false, recursive));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private RMResource makeResourceFromPath(
|
||||
@NotNull String projectId,
|
||||
@NotNull Path path,
|
||||
boolean readProperties,
|
||||
boolean readHistory,
|
||||
boolean recursive
|
||||
) {
|
||||
if (Files.notExists(path)) {
|
||||
private RMResource makeResourceFromPath(Path path, boolean readProperties, boolean readHistory, boolean recursive) {
|
||||
if (path == null || !Files.exists(path)) {
|
||||
return null;
|
||||
}
|
||||
RMResource resource = new RMResource();
|
||||
@@ -623,22 +594,14 @@ public class LocalResourceController implements RMController {
|
||||
))
|
||||
);
|
||||
}
|
||||
if (readProperties) {
|
||||
final BaseProjectImpl project = (BaseProjectImpl) getProjectMetadata(projectId);
|
||||
final String resourcePath = getProjectRelativePath(projectId, path);
|
||||
final Map<String, Object> properties = project.getResourceProperties(resourcePath);
|
||||
|
||||
if (properties != null && !properties.isEmpty()) {
|
||||
resource.setProperties(new LinkedHashMap<>(properties));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
}
|
||||
|
||||
if (recursive && resource.isFolder()) {
|
||||
try {
|
||||
resource.setChildren(readChildResources(projectId, path, readProperties, readHistory, true));
|
||||
resource.setChildren(
|
||||
readChildResources(path, readProperties, readHistory, recursive));
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
}
|
||||
@@ -647,11 +610,6 @@ public class LocalResourceController implements RMController {
|
||||
return resource;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getProjectRelativePath(@NotNull String projectId, @NotNull Path path) throws DBException {
|
||||
return getProjectPath(projectId).toAbsolutePath().relativize(path).toString().replace('\\', IPath.SEPARATOR);
|
||||
}
|
||||
|
||||
public static Builder builder(SMCredentialsProvider credentialsProvider, SMController smController) {
|
||||
return new Builder(credentialsProvider, smController);
|
||||
}
|
||||
|
||||
+2
-2
@@ -528,13 +528,13 @@ public class WebSession extends AbstractSessionPersistent implements SMSession,
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public WebConnectionInfo getWebConnectionInfo(String connectionID) throws DBWebException {
|
||||
public WebConnectionInfo getWebConnectionInfo(@Nullable String projectId, String connectionID) throws DBWebException {
|
||||
WebConnectionInfo connectionInfo;
|
||||
synchronized (connections) {
|
||||
connectionInfo = connections.get(connectionID);
|
||||
}
|
||||
if (connectionInfo == null) {
|
||||
DBPDataSourceContainer dataSource = WebDataSourceUtils.getLocalOrGlobalDataSource(application, this, connectionID);
|
||||
DBPDataSourceContainer dataSource = getProjectById(projectId).getDataSourceRegistry().getDataSource(connectionID);
|
||||
if (dataSource != null) {
|
||||
connectionInfo = new WebConnectionInfo(this, dataSource);
|
||||
synchronized (connections) {
|
||||
|
||||
+5
-6
@@ -16,22 +16,21 @@
|
||||
*/
|
||||
package io.cloudbeaver.utils;
|
||||
|
||||
import io.cloudbeaver.DBWConstants;
|
||||
import io.cloudbeaver.DBWebException;
|
||||
import io.cloudbeaver.model.WebConnectionFolderInfo;
|
||||
import io.cloudbeaver.model.session.WebSession;
|
||||
import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.model.DBPDataSourceFolder;
|
||||
import org.jkiss.utils.CommonUtils;
|
||||
|
||||
public class WebConnectionFolderUtils {
|
||||
|
||||
public static WebConnectionFolderInfo getFolderInfo(WebSession session, String folderPath) throws DBWebException {
|
||||
public static WebConnectionFolderInfo getFolderInfo(
|
||||
WebSession session, @Nullable String projectId, String folderPath
|
||||
) throws DBWebException {
|
||||
DBPDataSourceFolder folder = null;
|
||||
if (!CommonUtils.isEmpty(folderPath)) {
|
||||
folder = session.getSingletonProject().getDataSourceRegistry().getFolder(folderPath);
|
||||
if (folder == null && (session.hasPermission(DBWConstants.PERMISSION_ADMIN) || session.getApplication().isConfigurationMode())) {
|
||||
folder = WebDataSourceUtils.getGlobalDataSourceRegistry().getFolder(folderPath);
|
||||
}
|
||||
folder = session.getProjectById(projectId).getDataSourceRegistry().getFolder(folderPath);
|
||||
}
|
||||
if (folder != null) {
|
||||
return new WebConnectionFolderInfo(session, folder);
|
||||
|
||||
+4
-2
@@ -60,10 +60,12 @@ public class WebDataSourceUtils {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static DBPDataSourceContainer getLocalOrGlobalDataSource(WebApplication application, WebSession webSession, String connectionId) throws DBWebException {
|
||||
public static DBPDataSourceContainer getLocalOrGlobalDataSource(
|
||||
WebApplication application, WebSession webSession, @Nullable String projectId, String connectionId
|
||||
) throws DBWebException {
|
||||
DBPDataSourceContainer dataSource = null;
|
||||
if (!CommonUtils.isEmpty(connectionId)) {
|
||||
dataSource = webSession.getSingletonProject().getDataSourceRegistry().getDataSource(connectionId);
|
||||
dataSource = webSession.getProjectById(projectId).getDataSourceRegistry().getDataSource(connectionId);
|
||||
if (dataSource == null && (webSession.hasPermission(DBWConstants.PERMISSION_ADMIN) || application.isConfigurationMode())) {
|
||||
// If called for new connection in admin mode then this connection may absent in session registry yet
|
||||
dataSource = getGlobalDataSourceRegistry().getDataSource(connectionId);
|
||||
|
||||
@@ -470,21 +470,21 @@ extend type Query {
|
||||
networkHandlers: [NetworkHandlerDescriptor!]!
|
||||
|
||||
# List of user connections.
|
||||
userConnections( id: ID ): [ ConnectionInfo! ]!
|
||||
userConnections( projectId: String, id: ID ): [ ConnectionInfo! ]!
|
||||
# List of template connections.
|
||||
templateConnections: [ ConnectionInfo! ]!
|
||||
|
||||
# List of connection folders
|
||||
connectionFolders( path: ID ): [ ConnectionFolderInfo! ]!
|
||||
connectionFolders( projectId: String, path: ID ): [ ConnectionFolderInfo! ]!
|
||||
|
||||
# Return connection state
|
||||
connectionState( id: ID! ): ConnectionInfo! @deprecated
|
||||
connectionState( projectId: String, id: ID! ): ConnectionInfo! @deprecated
|
||||
|
||||
# Return connection info
|
||||
connectionInfo( id: ID! ): ConnectionInfo!
|
||||
connectionInfo( projectId: String, id: ID! ): ConnectionInfo!
|
||||
|
||||
# Return list of accessible user projects
|
||||
listProjects: [ ProjectInfo ]
|
||||
listProjects: [ ProjectInfo! ]!
|
||||
|
||||
readSessionLog(maxEntries: Int, clearEntries: Boolean): [ LogEntry! ]!
|
||||
}
|
||||
@@ -523,19 +523,19 @@ extend type Mutation {
|
||||
copyConnectionFromNode( nodePath: String!, config: ConnectionConfig, projectId: String ): ConnectionInfo!
|
||||
|
||||
# Test connection configuration. Returns remote server version
|
||||
testConnection( config: ConnectionConfig! ): ConnectionInfo!
|
||||
testConnection( config: ConnectionConfig!, projectId: String ): ConnectionInfo!
|
||||
|
||||
# Test connection configuration. Returns remote server version
|
||||
testNetworkHandler( config: NetworkHandlerConfigInput! ): NetworkEndpointInfo!
|
||||
|
||||
# Initiate existing connection
|
||||
initConnection( id: ID!, credentials: Object, networkCredentials: [NetworkHandlerConfigInput!], saveCredentials: Boolean ): ConnectionInfo!
|
||||
initConnection( id: ID!, projectId: String, credentials: Object, networkCredentials: [NetworkHandlerConfigInput!], saveCredentials: Boolean ): ConnectionInfo!
|
||||
|
||||
# Disconnect from database
|
||||
closeConnection( id: ID! ): ConnectionInfo!
|
||||
closeConnection( id: ID!, projectId: String ): ConnectionInfo!
|
||||
|
||||
# Changes navigator settings for connection
|
||||
setConnectionNavigatorSettings( id: ID!, settings: NavigatorSettingsInput!): ConnectionInfo!
|
||||
setConnectionNavigatorSettings( id: ID!, projectId: String, settings: NavigatorSettingsInput!): ConnectionInfo!
|
||||
|
||||
#### Generic async functions
|
||||
|
||||
|
||||
@@ -107,18 +107,17 @@ extend type Query {
|
||||
|
||||
# Get child nodes
|
||||
navNodeChildren(
|
||||
projectId: ID,
|
||||
parentPath: ID!,
|
||||
offset: Int,
|
||||
limit: Int,
|
||||
onlyFolders: Boolean): [ NavigatorNodeInfo! ]!
|
||||
|
||||
# Get child nodes
|
||||
navNodeParents( projectId: ID, nodePath: ID! ): [ NavigatorNodeInfo! ]!
|
||||
navNodeParents( nodePath: ID! ): [ NavigatorNodeInfo! ]!
|
||||
|
||||
navNodeInfo( projectId: ID, nodePath: ID! ): NavigatorNodeInfo!
|
||||
navNodeInfo( nodePath: ID! ): NavigatorNodeInfo!
|
||||
|
||||
navRefreshNode( projectId: ID, nodePath: ID! ): Boolean
|
||||
navRefreshNode( nodePath: ID! ): Boolean
|
||||
|
||||
# contextId currently not using
|
||||
navGetStructContainers( projectId: ID, connectionId: ID!, contextId: ID, catalog: ID ): DatabaseStructContainers!
|
||||
@@ -128,12 +127,12 @@ extend type Query {
|
||||
extend type Mutation {
|
||||
|
||||
# Rename node and returns new node name
|
||||
navRenameNode( projectId: ID, nodePath: ID!, newName: String! ): String
|
||||
navRenameNode( nodePath: ID!, newName: String! ): String
|
||||
|
||||
# Deletes nodes with specified IDs and returns number of deleted nodes
|
||||
navDeleteNodes( projectId: ID, nodePaths: [ID!]! ): Int
|
||||
navDeleteNodes( nodePaths: [ID!]! ): Int
|
||||
|
||||
# Moves nodes with specified IDs to the connection folder
|
||||
navMoveNodesToFolder(projectId: ID, nodePaths: [ID!]!, folderPath: ID!): Boolean
|
||||
navMoveNodesToFolder( nodePaths: [ID!]!, folderPath: ID!): Boolean
|
||||
|
||||
}
|
||||
@@ -197,12 +197,13 @@ type SQLScriptQuery {
|
||||
|
||||
extend type Query {
|
||||
|
||||
sqlDialectInfo( connectionId: ID! ): SQLDialectInfo
|
||||
sqlDialectInfo( projectId: ID, connectionId: ID! ): SQLDialectInfo
|
||||
|
||||
# Lists SQL contexts for a connection (optional) or returns the particular context info
|
||||
sqlListContexts( connectionId: ID, contextId: ID ): [ SQLContextInfo ]!
|
||||
sqlListContexts( projectId: ID, connectionId: ID, contextId: ID ): [ SQLContextInfo ]!
|
||||
|
||||
sqlCompletionProposals(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
contextId: ID!,
|
||||
query: String!,
|
||||
@@ -212,12 +213,14 @@ extend type Query {
|
||||
): [ SQLCompletionProposal ]
|
||||
|
||||
sqlFormatQuery(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
contextId: ID!,
|
||||
query: String!
|
||||
): String!
|
||||
|
||||
sqlSupportedOperations(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
contextId: ID!,
|
||||
resultsId: ID!,
|
||||
@@ -243,11 +246,13 @@ extend type Query {
|
||||
): String!
|
||||
|
||||
sqlParseScript(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
script: String!
|
||||
): SQLScriptInfo!
|
||||
|
||||
sqlParseQuery(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
script: String!,
|
||||
position: Int!
|
||||
@@ -255,14 +260,15 @@ extend type Query {
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
sqlContextCreate( connectionId: ID!, defaultCatalog: String, defaultSchema: String ): SQLContextInfo!
|
||||
sqlContextCreate( projectId: ID, connectionId: ID!, defaultCatalog: String, defaultSchema: String ): SQLContextInfo!
|
||||
|
||||
sqlContextSetDefaults( connectionId: ID!, contextId: ID!, defaultCatalog: ID, defaultSchema: ID ): Boolean!
|
||||
sqlContextSetDefaults( projectId: ID, connectionId: ID!, contextId: ID!, defaultCatalog: ID, defaultSchema: ID ): Boolean!
|
||||
|
||||
sqlContextDestroy( connectionId: ID!, contextId: ID! ): Boolean!
|
||||
sqlContextDestroy( projectId: ID, connectionId: ID!, contextId: ID! ): Boolean!
|
||||
|
||||
# Execute SQL and return results
|
||||
asyncSqlExecuteQuery(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
contextId: ID!,
|
||||
sql: String!,
|
||||
@@ -273,6 +279,7 @@ extend type Mutation {
|
||||
|
||||
# Read data from table
|
||||
asyncReadDataFromContainer(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
contextId: ID!,
|
||||
containerNodePath: ID!,
|
||||
@@ -282,10 +289,11 @@ extend type Mutation {
|
||||
): AsyncTaskInfo!
|
||||
|
||||
# Close results (free resources)
|
||||
sqlResultClose(connectionId: ID!, contextId: ID!, resultId: ID!): Boolean!
|
||||
sqlResultClose(projectId: ID, connectionId: ID!, contextId: ID!, resultId: ID!): Boolean!
|
||||
|
||||
# Update multiple cell values
|
||||
updateResultsDataBatch(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
contextId: ID!,
|
||||
resultsId: ID!,
|
||||
@@ -297,6 +305,7 @@ extend type Mutation {
|
||||
|
||||
# Return SQL script for cell values update
|
||||
updateResultsDataBatchScript(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
contextId: ID!,
|
||||
resultsId: ID!,
|
||||
@@ -308,6 +317,7 @@ extend type Mutation {
|
||||
|
||||
#Return BLOB name
|
||||
readLobValue(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
contextId: ID!,
|
||||
resultsId: ID!,
|
||||
@@ -320,6 +330,7 @@ extend type Mutation {
|
||||
|
||||
# Read data from table
|
||||
asyncSqlExplainExecutionPlan(
|
||||
projectId: ID,
|
||||
connectionId: ID!,
|
||||
contextId: ID!,
|
||||
query: String!,
|
||||
|
||||
+4
-3
@@ -27,6 +27,7 @@ import io.cloudbeaver.server.CBApplication;
|
||||
import io.cloudbeaver.server.CBPlatform;
|
||||
import io.cloudbeaver.server.graphql.GraphQLEndpoint;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.DBException;
|
||||
import org.jkiss.dbeaver.Log;
|
||||
import org.jkiss.dbeaver.model.rm.RMProject;
|
||||
@@ -117,7 +118,7 @@ public abstract class WebServiceBindingBase<API_TYPE extends DBWService> impleme
|
||||
|
||||
@NotNull
|
||||
protected static WebConnectionInfo getWebConnection(DataFetchingEnvironment env) throws DBWebException {
|
||||
return getWebConnection(getWebSession(env), env.getArgument("connectionId"));
|
||||
return getWebConnection(getWebSession(env), getProjectReference(env), env.getArgument("connectionId"));
|
||||
}
|
||||
|
||||
public static WebSession findWebSession(DataFetchingEnvironment env) {
|
||||
@@ -126,8 +127,8 @@ public abstract class WebServiceBindingBase<API_TYPE extends DBWService> impleme
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static WebConnectionInfo getWebConnection(WebSession session, String connectionId) throws DBWebException {
|
||||
return session.getWebConnectionInfo(connectionId);
|
||||
public static WebConnectionInfo getWebConnection(WebSession session, String projectId, String connectionId) throws DBWebException {
|
||||
return session.getWebConnectionInfo(projectId, connectionId);
|
||||
}
|
||||
|
||||
private class ServiceInvocationHandler implements InvocationHandler {
|
||||
|
||||
+17
-8
@@ -51,10 +51,12 @@ public interface DBWServiceCore extends DBWService {
|
||||
List<WebNetworkHandlerDescriptor> getNetworkHandlers(@NotNull WebSession webSession);
|
||||
|
||||
@WebAction(requirePermissions = {})
|
||||
List<WebConnectionInfo> getUserConnections(@NotNull WebSession webSession, @Nullable String id) throws DBWebException;
|
||||
List<WebConnectionInfo> getUserConnections(
|
||||
@NotNull WebSession webSession, @Nullable String projectId, @Nullable String id) throws DBWebException;
|
||||
|
||||
@WebAction(requirePermissions = {})
|
||||
List<WebConnectionFolderInfo> getConnectionFolders(@NotNull WebSession webSession, @Nullable String id) throws DBWebException;
|
||||
List<WebConnectionFolderInfo> getConnectionFolders(
|
||||
@NotNull WebSession webSession, @Nullable String projectId, @Nullable String id) throws DBWebException;
|
||||
|
||||
@Deprecated
|
||||
@WebAction
|
||||
@@ -98,11 +100,12 @@ public interface DBWServiceCore extends DBWService {
|
||||
// Connections
|
||||
|
||||
@WebAction
|
||||
WebConnectionInfo getConnectionState(WebSession webSession, String connectionId) throws DBWebException;
|
||||
WebConnectionInfo getConnectionState(WebSession webSession, @Nullable String projectId, String connectionId) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
WebConnectionInfo initConnection(
|
||||
@NotNull WebSession webSession,
|
||||
@Nullable String projectId,
|
||||
@NotNull String connectionId,
|
||||
@NotNull Map<String, Object> authProperties,
|
||||
@Nullable List<WebNetworkHandlerConfigInput> networkCredentials,
|
||||
@@ -141,7 +144,8 @@ public interface DBWServiceCore extends DBWService {
|
||||
@NotNull WebConnectionConfig config) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
WebConnectionInfo testConnection(@NotNull WebSession webSession, @NotNull WebConnectionConfig connectionConfig) throws DBWebException;
|
||||
WebConnectionInfo testConnection(
|
||||
@NotNull WebSession webSession, @Nullable String projectId, @NotNull WebConnectionConfig connectionConfig) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
WebNetworkEndpointInfo testNetworkHandler(@NotNull WebSession webSession, @NotNull WebNetworkHandlerConfigInput nhConfig) throws DBWebException;
|
||||
@@ -159,19 +163,24 @@ public interface DBWServiceCore extends DBWService {
|
||||
// Folders
|
||||
|
||||
@WebAction
|
||||
WebConnectionFolderInfo createConnectionFolder(@NotNull WebSession session, @Nullable String folderPath, @NotNull String newName) throws DBWebException;
|
||||
WebConnectionFolderInfo createConnectionFolder(
|
||||
@NotNull WebSession session, @Nullable String projectId, @Nullable String folderPath, @NotNull String newName
|
||||
) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
WebConnectionFolderInfo renameConnectionFolder(@NotNull WebSession session, @NotNull String folderPath, @NotNull String newName) throws DBWebException;
|
||||
WebConnectionFolderInfo renameConnectionFolder(
|
||||
@NotNull WebSession session, @Nullable String projectId, @NotNull String folderPath, @NotNull String newName
|
||||
) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
boolean deleteConnectionFolder(@NotNull WebSession session, @NotNull String nodePath) throws DBWebException;
|
||||
boolean deleteConnectionFolder(@NotNull WebSession session, @Nullable String projectId, @NotNull String nodePath) throws DBWebException;
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Navigator settings
|
||||
|
||||
@WebAction
|
||||
WebConnectionInfo setConnectionNavigatorSettings(WebSession webSession, String id, DBNBrowseSettings settings) throws DBWebException;
|
||||
WebConnectionInfo setConnectionNavigatorSettings(
|
||||
WebSession webSession, @Nullable String projectId, String id, DBNBrowseSettings settings) throws DBWebException;
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Async tasks
|
||||
|
||||
+30
-10
@@ -58,16 +58,20 @@ public class WebServiceBindingCore extends WebServiceBindingBase<DBWServiceCore>
|
||||
.dataFetcher("authModels", env -> getService(env).getAuthModels(getWebSession(env)))
|
||||
.dataFetcher("networkHandlers", env -> getService(env).getNetworkHandlers(getWebSession(env)))
|
||||
.dataFetcher("templateDataSources", env -> getService(env).getTemplateDataSources())
|
||||
.dataFetcher("userConnections", env -> getService(env).getUserConnections(getWebSession(env), env.getArgument("id")))
|
||||
.dataFetcher("userConnections", env -> getService(env).getUserConnections(
|
||||
getWebSession(env), getProjectReference(env), env.getArgument("id")))
|
||||
.dataFetcher("templateConnections", env -> getService(env).getTemplateConnections(getWebSession(env)))
|
||||
|
||||
.dataFetcher("connectionFolders", env -> getService(env).getConnectionFolders(getWebSession(env), env.getArgument("path")))
|
||||
.dataFetcher("connectionFolders", env -> getService(env).getConnectionFolders(
|
||||
getWebSession(env), getProjectReference(env), env.getArgument("path")))
|
||||
|
||||
.dataFetcher("sessionPermissions", env -> getService(env).getSessionPermissions(getWebSession(env)))
|
||||
.dataFetcher("sessionState", env -> getService(env).getSessionState(getWebSession(env)))
|
||||
|
||||
.dataFetcher("connectionState", env -> getService(env).getConnectionState(getWebSession(env), env.getArgument("id")))
|
||||
.dataFetcher("connectionInfo", env -> getService(env).getConnectionState(getWebSession(env), env.getArgument("id")))
|
||||
.dataFetcher("connectionState", env -> getService(env).getConnectionState(
|
||||
getWebSession(env), getProjectReference(env), env.getArgument("id")))
|
||||
.dataFetcher("connectionInfo", env -> getService(env).getConnectionState(
|
||||
getWebSession(env), getProjectReference(env), env.getArgument("id")))
|
||||
|
||||
.dataFetcher("listProjects", env -> getService(env).getProjects(getWebSession(env)))
|
||||
|
||||
@@ -101,9 +105,12 @@ public class WebServiceBindingCore extends WebServiceBindingBase<DBWServiceCore>
|
||||
GraphQLEndpoint.getServletRequest(env), GraphQLEndpoint.getServletResponse(env)))
|
||||
.dataFetcher("changeSessionLanguage", env -> getService(env).changeSessionLanguage(getWebSession(env), env.getArgument("locale")))
|
||||
|
||||
.dataFetcher("createConnection", env -> getService(env).createConnection(getWebSession(env), getProjectReference(env), getConnectionConfig(env)))
|
||||
.dataFetcher("updateConnection", env -> getService(env).updateConnection(getWebSession(env), getProjectReference(env), getConnectionConfig(env)))
|
||||
.dataFetcher("deleteConnection", env -> getService(env).deleteConnection(getWebSession(env), getProjectReference(env), env.getArgument("id")))
|
||||
.dataFetcher("createConnection", env -> getService(env).createConnection(
|
||||
getWebSession(env), getProjectReference(env), getConnectionConfig(env)))
|
||||
.dataFetcher("updateConnection", env -> getService(env).updateConnection(
|
||||
getWebSession(env), getProjectReference(env), getConnectionConfig(env)))
|
||||
.dataFetcher("deleteConnection", env -> getService(env).deleteConnection(
|
||||
getWebSession(env), getProjectReference(env), env.getArgument("id")))
|
||||
.dataFetcher("createConnectionFromTemplate", env -> getService(env).createConnectionFromTemplate(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
@@ -122,17 +129,27 @@ public class WebServiceBindingCore extends WebServiceBindingBase<DBWServiceCore>
|
||||
}
|
||||
return getService(env).initConnection(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("id"),
|
||||
env.getArgument("credentials"),
|
||||
nhc,
|
||||
env.getArgument("saveCredentials"));
|
||||
}
|
||||
)
|
||||
.dataFetcher("testConnection", env -> getService(env).testConnection(getWebSession(env), getConnectionConfig(env)))
|
||||
.dataFetcher("testNetworkHandler", env -> getService(env).testNetworkHandler(getWebSession(env), new WebNetworkHandlerConfigInput(env.getArgument("config"))))
|
||||
.dataFetcher("testConnection", env -> getService(env).testConnection(
|
||||
getWebSession(env), getProjectReference(env), getConnectionConfig(env)
|
||||
))
|
||||
.dataFetcher("testNetworkHandler", env -> getService(env).testNetworkHandler(
|
||||
getWebSession(env), new WebNetworkHandlerConfigInput(env.getArgument("config"))
|
||||
))
|
||||
.dataFetcher("closeConnection", env -> getService(env).closeConnection(getWebSession(env), getProjectReference(env), env.getArgument("id")))
|
||||
|
||||
.dataFetcher("setConnectionNavigatorSettings", env -> getService(env).setConnectionNavigatorSettings(getWebSession(env), env.getArgument("id"), WebServiceUtils.parseNavigatorSettings(env.getArgument("settings"))))
|
||||
.dataFetcher("setConnectionNavigatorSettings", env -> getService(env).setConnectionNavigatorSettings(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("id"),
|
||||
WebServiceUtils.parseNavigatorSettings(env.getArgument("settings"))
|
||||
))
|
||||
|
||||
.dataFetcher("asyncTaskInfo", env -> getService(env).getAsyncTaskInfo(
|
||||
getWebSession(env),
|
||||
@@ -142,16 +159,19 @@ public class WebServiceBindingCore extends WebServiceBindingBase<DBWServiceCore>
|
||||
|
||||
.dataFetcher("createConnectionFolder", env -> getService(env).createConnectionFolder(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("parentFolderPath"),
|
||||
env.getArgument("folderName")
|
||||
))
|
||||
.dataFetcher("renameConnectionFolder", env -> getService(env).renameConnectionFolder(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("folderPath"),
|
||||
env.getArgument("newName")
|
||||
))
|
||||
.dataFetcher("deleteConnectionFolder", env -> getService(env).deleteConnectionFolder(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("folderPath")
|
||||
))
|
||||
;
|
||||
|
||||
+50
-27
@@ -100,9 +100,11 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WebConnectionInfo> getUserConnections(@NotNull WebSession webSession, @Nullable String id) throws DBWebException {
|
||||
public List<WebConnectionInfo> getUserConnections(
|
||||
@NotNull WebSession webSession, @Nullable String projectId, @Nullable String id
|
||||
) throws DBWebException {
|
||||
if (id != null) {
|
||||
WebConnectionInfo connectionInfo = getConnectionState(webSession, id);
|
||||
WebConnectionInfo connectionInfo = getConnectionState(webSession, projectId, id);
|
||||
if (connectionInfo != null) {
|
||||
return Collections.singletonList(connectionInfo);
|
||||
}
|
||||
@@ -149,12 +151,14 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WebConnectionFolderInfo> getConnectionFolders(@NotNull WebSession webSession, @Nullable String id) throws DBWebException {
|
||||
public List<WebConnectionFolderInfo> getConnectionFolders(
|
||||
@NotNull WebSession webSession, @Nullable String projectId, @Nullable String id
|
||||
) throws DBWebException {
|
||||
if (id != null) {
|
||||
WebConnectionFolderInfo folderInfo = WebConnectionFolderUtils.getFolderInfo(webSession, id);
|
||||
WebConnectionFolderInfo folderInfo = WebConnectionFolderUtils.getFolderInfo(webSession, projectId, id);
|
||||
return Collections.singletonList(folderInfo);
|
||||
}
|
||||
return webSession.getSingletonProject().getDataSourceRegistry().getAllFolders().stream()
|
||||
return webSession.getProjectById(projectId).getDataSourceRegistry().getAllFolders().stream()
|
||||
.map(f -> new WebConnectionFolderInfo(webSession, f)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -240,20 +244,23 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebConnectionInfo getConnectionState(WebSession webSession, String connectionId) throws DBWebException {
|
||||
return webSession.getWebConnectionInfo(connectionId);
|
||||
public WebConnectionInfo getConnectionState(
|
||||
WebSession webSession, @Nullable String projectId, String connectionId
|
||||
) throws DBWebException {
|
||||
return webSession.getWebConnectionInfo(projectId, connectionId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WebConnectionInfo initConnection(
|
||||
@NotNull WebSession webSession,
|
||||
@Nullable String projectId,
|
||||
@NotNull String connectionId,
|
||||
@NotNull Map<String, Object> authProperties,
|
||||
@Nullable List<WebNetworkHandlerConfigInput> networkCredentials,
|
||||
@Nullable Boolean saveCredentials) throws DBWebException
|
||||
{
|
||||
WebConnectionInfo connectionInfo = webSession.getWebConnectionInfo(connectionId);
|
||||
WebConnectionInfo connectionInfo = webSession.getWebConnectionInfo(projectId, connectionId);
|
||||
connectionInfo.setSavedCredentials(authProperties, networkCredentials);
|
||||
|
||||
DBPDataSourceContainer dataSourceContainer = connectionInfo.getDataSourceContainer();
|
||||
@@ -342,7 +349,7 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
// }
|
||||
DBPDataSourceRegistry sessionRegistry = webSession.getProjectById(projectId).getDataSourceRegistry();
|
||||
|
||||
WebConnectionInfo connectionInfo = webSession.getWebConnectionInfo(config.getConnectionId());
|
||||
WebConnectionInfo connectionInfo = webSession.getWebConnectionInfo(projectId, config.getConnectionId());
|
||||
DBPDataSourceContainer dataSource = connectionInfo.getDataSourceContainer();
|
||||
webSession.addInfoMessage("Update connection - " + WebServiceUtils.getConnectionContainerInfo(dataSource));
|
||||
|
||||
@@ -371,7 +378,7 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
@Override
|
||||
public boolean deleteConnection(
|
||||
@NotNull WebSession webSession, @Nullable String projectId, @NotNull String connectionId) throws DBWebException {
|
||||
WebConnectionInfo connectionInfo = webSession.getWebConnectionInfo(connectionId);
|
||||
WebConnectionInfo connectionInfo = webSession.getWebConnectionInfo(projectId, connectionId);
|
||||
if (connectionInfo.getDataSourceContainer().getProject() != webSession.getProjectById(projectId)) {
|
||||
throw new DBWebException("Global connection '" + connectionInfo.getName() + "' configuration cannot be deleted");
|
||||
}
|
||||
@@ -397,7 +404,9 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
DBPDataSourceRegistry projectRegistry = webSession.getProjectById(projectId).getDataSourceRegistry();
|
||||
DBPDataSourceContainer newDataSource = projectRegistry.createDataSource(dataSourceTemplate);
|
||||
|
||||
((DataSourceDescriptor) newDataSource).setNavigatorSettings(CBApplication.getInstance().getAppConfiguration().getDefaultNavigatorSettings());
|
||||
((DataSourceDescriptor) newDataSource).setNavigatorSettings(
|
||||
CBApplication.getInstance().getAppConfiguration().getDefaultNavigatorSettings());
|
||||
|
||||
if (!CommonUtils.isEmpty(connectionName)) {
|
||||
newDataSource.setName(connectionName);
|
||||
}
|
||||
@@ -435,7 +444,8 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
|
||||
DBPDataSourceContainer newDataSource = dataSourceRegistry.createDataSource(dataSourceTemplate);
|
||||
|
||||
((DataSourceDescriptor) newDataSource).setNavigatorSettings(CBApplication.getInstance().getAppConfiguration().getDefaultNavigatorSettings());
|
||||
((DataSourceDescriptor) newDataSource).setNavigatorSettings(
|
||||
CBApplication.getInstance().getAppConfiguration().getDefaultNavigatorSettings());
|
||||
|
||||
// Copy props from config
|
||||
if (!CommonUtils.isEmpty(config.getName())) {
|
||||
@@ -457,14 +467,17 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebConnectionInfo testConnection(@NotNull WebSession webSession, @NotNull WebConnectionConfig connectionConfig) throws DBWebException {
|
||||
public WebConnectionInfo testConnection(
|
||||
@NotNull WebSession webSession, @Nullable String projectId, @NotNull WebConnectionConfig connectionConfig
|
||||
) throws DBWebException {
|
||||
String connectionId = connectionConfig.getConnectionId();
|
||||
|
||||
connectionConfig.setSaveCredentials(true); // It is used in createConnectionFromConfig
|
||||
|
||||
DBPDataSourceContainer dataSource = WebDataSourceUtils.getLocalOrGlobalDataSource(CBApplication.getInstance(), webSession, connectionId);
|
||||
DBPDataSourceContainer dataSource = WebDataSourceUtils.getLocalOrGlobalDataSource(
|
||||
CBApplication.getInstance(), webSession, projectId, connectionId);
|
||||
|
||||
DBPDataSourceRegistry sessionRegistry = webSession.getSingletonProject().getDataSourceRegistry();
|
||||
DBPDataSourceRegistry sessionRegistry = webSession.getProjectById(projectId).getDataSourceRegistry();
|
||||
DBPDataSourceContainer testDataSource;
|
||||
if (dataSource != null) {
|
||||
testDataSource = dataSource.createCopy(dataSource.getRegistry());
|
||||
@@ -548,13 +561,17 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebConnectionInfo closeConnection(@NotNull WebSession webSession, @Nullable String projectId, @NotNull String connectionId) throws DBWebException {
|
||||
public WebConnectionInfo closeConnection(
|
||||
@NotNull WebSession webSession, @Nullable String projectId, @NotNull String connectionId
|
||||
) throws DBWebException {
|
||||
return closeAndDeleteConnection(webSession, projectId, connectionId, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private WebConnectionInfo closeAndDeleteConnection(WebSession webSession, String projectId, String connectionId, boolean forceDelete) throws DBWebException {
|
||||
WebConnectionInfo connectionInfo = webSession.getWebConnectionInfo(connectionId);
|
||||
private WebConnectionInfo closeAndDeleteConnection(
|
||||
WebSession webSession, String projectId, String connectionId, boolean forceDelete
|
||||
) throws DBWebException {
|
||||
WebConnectionInfo connectionInfo = webSession.getWebConnectionInfo(projectId, connectionId);
|
||||
|
||||
boolean disconnected = false;
|
||||
DBPDataSourceContainer dataSourceContainer = connectionInfo.getDataSourceContainer();
|
||||
@@ -596,6 +613,7 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
@Override
|
||||
public WebConnectionFolderInfo createConnectionFolder(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@Nullable String parentPath,
|
||||
@NotNull String folderName
|
||||
) throws DBWebException {
|
||||
@@ -605,9 +623,9 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
WebConnectionFolderInfo parentNode = null;
|
||||
try {
|
||||
if (parentPath != null) {
|
||||
parentNode = WebConnectionFolderUtils.getFolderInfo(session, parentPath);
|
||||
parentNode = WebConnectionFolderUtils.getFolderInfo(session, projectId, parentPath);
|
||||
}
|
||||
DBPDataSourceRegistry sessionRegistry = session.getSingletonProject().getDataSourceRegistry();
|
||||
DBPDataSourceRegistry sessionRegistry = session.getProjectById(projectId).getDataSourceRegistry();
|
||||
DBPDataSourceFolder newFolder = WebServiceUtils.createFolder(parentNode, folderName, sessionRegistry);
|
||||
WebConnectionFolderInfo folderInfo = new WebConnectionFolderInfo(session, newFolder);
|
||||
WebServiceUtils.updateConfigAndRefreshDatabases(session);
|
||||
@@ -621,26 +639,29 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
@Override
|
||||
public WebConnectionFolderInfo renameConnectionFolder(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull String folderPath,
|
||||
@NotNull String newName
|
||||
) throws DBWebException {
|
||||
WebConnectionFolderUtils.validateConnectionFolder(newName);
|
||||
WebConnectionFolderInfo folderInfo = WebConnectionFolderUtils.getFolderInfo(session, folderPath);
|
||||
WebConnectionFolderInfo folderInfo = WebConnectionFolderUtils.getFolderInfo(session, projectId, folderPath);
|
||||
folderInfo.getDataSourceFolder().setName(newName);
|
||||
WebServiceUtils.updateConfigAndRefreshDatabases(session);
|
||||
return folderInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteConnectionFolder(@NotNull WebSession session, @NotNull String folderPath) throws DBWebException {
|
||||
public boolean deleteConnectionFolder(
|
||||
@NotNull WebSession session, @Nullable String projectId, @NotNull String folderPath
|
||||
) throws DBWebException {
|
||||
try {
|
||||
WebConnectionFolderInfo folderInfo = WebConnectionFolderUtils.getFolderInfo(session, folderPath);
|
||||
WebConnectionFolderInfo folderInfo = WebConnectionFolderUtils.getFolderInfo(session, projectId, folderPath);
|
||||
DBPDataSourceFolder folder = folderInfo.getDataSourceFolder();
|
||||
if (folder.getDataSourceRegistry().getProject() != session.getSingletonProject()) {
|
||||
if (folder.getDataSourceRegistry().getProject() != session.getProjectById(projectId)) {
|
||||
throw new DBWebException("Global folder '" + folderInfo.getId() + "' cannot be deleted");
|
||||
}
|
||||
session.addInfoMessage("Delete folder");
|
||||
DBPDataSourceRegistry sessionRegistry = session.getSingletonProject().getDataSourceRegistry();
|
||||
DBPDataSourceRegistry sessionRegistry = session.getProjectById(projectId).getDataSourceRegistry();
|
||||
sessionRegistry.removeFolder(folderInfo.getDataSourceFolder(), false);
|
||||
WebServiceUtils.updateConfigAndRefreshDatabases(session);
|
||||
} catch (DBException e) {
|
||||
@@ -650,8 +671,10 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebConnectionInfo setConnectionNavigatorSettings(WebSession webSession, String id, DBNBrowseSettings settings) throws DBWebException {
|
||||
WebConnectionInfo connectionInfo = webSession.getWebConnectionInfo(id);
|
||||
public WebConnectionInfo setConnectionNavigatorSettings(
|
||||
WebSession webSession, @Nullable String projectId, String id, DBNBrowseSettings settings
|
||||
) throws DBWebException {
|
||||
WebConnectionInfo connectionInfo = webSession.getWebConnectionInfo(projectId, id);
|
||||
DataSourceDescriptor dataSourceDescriptor = ((DataSourceDescriptor)connectionInfo.getDataSourceContainer());
|
||||
dataSourceDescriptor.setNavigatorSettings(settings);
|
||||
dataSourceDescriptor.persistConfiguration();
|
||||
|
||||
-7
@@ -34,7 +34,6 @@ public interface DBWServiceNavigator extends DBWService {
|
||||
@WebAction
|
||||
List<WebNavigatorNodeInfo> getNavigatorNodeChildren(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
String parentPath,
|
||||
Integer offset,
|
||||
Integer limit,
|
||||
@@ -43,19 +42,16 @@ public interface DBWServiceNavigator extends DBWService {
|
||||
@WebAction
|
||||
List<WebNavigatorNodeInfo> getNavigatorNodeParents(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
String nodePath) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
WebNavigatorNodeInfo getNavigatorNodeInfo(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull String nodePath) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
boolean refreshNavigatorNode(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull String nodePath) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
@@ -68,20 +64,17 @@ public interface DBWServiceNavigator extends DBWService {
|
||||
@WebAction
|
||||
String renameNode(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull String nodePath,
|
||||
@NotNull String newName) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
int deleteNodes(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull List<String> nodePaths) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
boolean moveNodesToFolder(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull List<String> nodePaths,
|
||||
@NotNull String folderPath) throws DBWebException;
|
||||
}
|
||||
|
||||
-7
@@ -38,7 +38,6 @@ public class WebServiceBindingNavigator extends WebServiceBindingBase<DBWService
|
||||
model.getQueryType()
|
||||
.dataFetcher("navNodeChildren", env -> getService(env).getNavigatorNodeChildren(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("parentPath"),
|
||||
env.getArgument("offset"),
|
||||
env.getArgument("limit"),
|
||||
@@ -46,17 +45,14 @@ public class WebServiceBindingNavigator extends WebServiceBindingBase<DBWService
|
||||
))
|
||||
.dataFetcher("navNodeParents", env -> getService(env).getNavigatorNodeParents(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("nodePath")
|
||||
))
|
||||
.dataFetcher("navNodeInfo", env -> getService(env).getNavigatorNodeInfo(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("nodePath")
|
||||
))
|
||||
.dataFetcher("navRefreshNode", env -> getService(env).refreshNavigatorNode(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("nodePath")
|
||||
))
|
||||
.dataFetcher("navGetStructContainers", env -> getService(env).getStructContainers(
|
||||
@@ -69,18 +65,15 @@ public class WebServiceBindingNavigator extends WebServiceBindingBase<DBWService
|
||||
model.getMutationType()
|
||||
.dataFetcher("navRenameNode", env -> getService(env).renameNode(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("nodePath"),
|
||||
env.getArgument("newName")
|
||||
))
|
||||
.dataFetcher("navDeleteNodes", env -> getService(env).deleteNodes(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("nodePaths")
|
||||
))
|
||||
.dataFetcher("navMoveNodesToFolder", env -> getService(env).moveNodesToFolder(
|
||||
getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("nodePaths"),
|
||||
env.getArgument("folderPath")
|
||||
));
|
||||
|
||||
+5
-16
@@ -68,7 +68,6 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
@Override
|
||||
public List<WebNavigatorNodeInfo> getNavigatorNodeChildren(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull String parentPath,
|
||||
Integer offset,
|
||||
Integer limit,
|
||||
@@ -82,11 +81,11 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
DBNModel navigatorModel = session.getNavigatorModel();
|
||||
List<DBPDriver> applicableDrivers = CBPlatform.getInstance().getApplicableDrivers();
|
||||
if (isRootPath) {
|
||||
DBNProject projectNode = navigatorModel.getRoot().getProjectNode(session.getProjectById(projectId));
|
||||
nodeChildren = DBNUtils.getNodeChildrenFiltered(monitor, projectNode.getDatabases(), true);
|
||||
DBNRoot rootNode = navigatorModel.getRoot();
|
||||
nodeChildren = DBNUtils.getNodeChildrenFiltered(monitor, rootNode, true);
|
||||
if (SHOW_EXTRA_NODES) {
|
||||
// Inject extra nodes. Disabled because we use different root path for extra nodes
|
||||
List<DBNNode> extraNodes = projectNode.getExtraNodes();
|
||||
List<DBNNode> extraNodes = rootNode.getExtraNodes();
|
||||
if (!extraNodes.isEmpty()) {
|
||||
nodeChildren = ArrayUtils.concatArrays(extraNodes.toArray(new DBNNode[0]), nodeChildren);
|
||||
}
|
||||
@@ -147,7 +146,6 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
@Override
|
||||
public List<WebNavigatorNodeInfo> getNavigatorNodeParents(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
String nodePath
|
||||
) throws DBWebException {
|
||||
try {
|
||||
@@ -174,7 +172,6 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
@NotNull
|
||||
public WebNavigatorNodeInfo getNavigatorNodeInfo(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull String nodePath
|
||||
) throws DBWebException {
|
||||
try {
|
||||
@@ -193,7 +190,6 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
@Override
|
||||
public boolean refreshNavigatorNode(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull String nodePath
|
||||
) throws DBWebException {
|
||||
try {
|
||||
@@ -335,7 +331,6 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
@Override
|
||||
public String renameNode(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull String nodePath,
|
||||
@NotNull String newName
|
||||
) throws DBWebException {
|
||||
@@ -376,7 +371,6 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
@Override
|
||||
public int deleteNodes(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull List<String> nodePaths
|
||||
) throws DBWebException {
|
||||
try {
|
||||
@@ -424,9 +418,7 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
sessionRegistry.removeFolder(((DBNLocalFolder) ne.getKey()).getFolder(), false);
|
||||
} else if (ne.getKey() instanceof DBNResourceManagerResource) {
|
||||
DBNResourceManagerResource rmResource = ((DBNResourceManagerResource) ne.getKey());
|
||||
if (projectId == null) {
|
||||
projectId = rmResource.getResourceProject().getId();
|
||||
}
|
||||
String projectId = rmResource.getResourceProject().getId();
|
||||
String resourcePath = rmResource.getResourceFolder();
|
||||
session.getRmController().deleteResource(projectId, resourcePath, true);
|
||||
}
|
||||
@@ -444,7 +436,6 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
@Override
|
||||
public boolean moveNodesToFolder(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@NotNull List<String> nodePaths,
|
||||
@NotNull String folderNodePath
|
||||
) throws DBWebException {
|
||||
@@ -476,9 +467,7 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
throw new DBWebException("Navigator node '" + folderNodePath + "' is not a resource manager node");
|
||||
}
|
||||
// Get project id from node
|
||||
if (projectId == null) {
|
||||
projectId = rmOldNode.getResourceProject().getId();
|
||||
}
|
||||
String projectId = rmOldNode.getResourceProject().getId();
|
||||
// Get paths from nodes
|
||||
String newPath = rmOldNode.getResource().getName();
|
||||
if (folderNode instanceof DBNResourceManagerResource) {
|
||||
|
||||
+5
-1
@@ -37,7 +37,11 @@ import java.util.Map;
|
||||
public interface DBWServiceSQL extends DBWService {
|
||||
|
||||
@WebAction
|
||||
WebSQLContextInfo[] listContexts(@NotNull WebSession session, @Nullable String connectionId, @Nullable String contextId) throws DBWebException;
|
||||
WebSQLContextInfo[] listContexts(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@Nullable String connectionId,
|
||||
@Nullable String contextId) throws DBWebException;
|
||||
|
||||
@WebAction
|
||||
WebSQLDialectInfo getDialectInfo(@NotNull WebConnectionInfo processor) throws DBWebException;
|
||||
|
||||
+1
@@ -53,6 +53,7 @@ public class WebServiceBindingSQL extends WebServiceBindingBase<DBWServiceSQL> i
|
||||
)
|
||||
.dataFetcher("sqlListContexts", env ->
|
||||
getService(env).listContexts(getWebSession(env),
|
||||
getProjectReference(env),
|
||||
env.getArgument("connectionId"),
|
||||
env.getArgument("contextId"))
|
||||
)
|
||||
|
||||
+7
-2
@@ -71,10 +71,15 @@ public class WebServiceSQL implements DBWServiceSQL {
|
||||
private static final Log log = Log.getLog(WebServiceSQL.class);
|
||||
|
||||
@Override
|
||||
public WebSQLContextInfo[] listContexts(@NotNull WebSession session, @Nullable String connectionId, @Nullable String contextId) throws DBWebException {
|
||||
public WebSQLContextInfo[] listContexts(
|
||||
@NotNull WebSession session,
|
||||
@Nullable String projectId,
|
||||
@Nullable String connectionId,
|
||||
@Nullable String contextId
|
||||
) throws DBWebException {
|
||||
List<WebConnectionInfo> conToRead = new ArrayList<>();
|
||||
if (connectionId != null) {
|
||||
WebConnectionInfo webConnection = WebServiceBindingBase.getWebConnection(session, connectionId);
|
||||
WebConnectionInfo webConnection = WebServiceBindingBase.getWebConnection(session, projectId, connectionId);
|
||||
conToRead.add(webConnection);
|
||||
} else {
|
||||
conToRead.addAll(session.getConnections());
|
||||
|
||||
+3
-3
@@ -57,16 +57,16 @@ public class LocalSessionHandler extends AbstractActionSessionHandler {
|
||||
List<WebConnectionInfo> connectionInfoList = webSession.getConnections();
|
||||
WebConnectionInfo connectionInfo = null;
|
||||
if (connectionId != null) {
|
||||
connectionInfo = webSession.getWebConnectionInfo(connectionId);
|
||||
connectionInfo = webSession.getWebConnectionInfo(null, connectionId);
|
||||
} else if (connectionName != null) {
|
||||
List<WebConnectionInfo> filteredConnections = connectionInfoList.stream().filter(t -> t.getName().equals(connectionName)).collect(Collectors.toList());
|
||||
if (filteredConnections.size() == 1) {
|
||||
connectionInfo = webSession.getWebConnectionInfo(filteredConnections.get(0).getId());
|
||||
connectionInfo = webSession.getWebConnectionInfo(null, filteredConnections.get(0).getId());
|
||||
}
|
||||
} else if (connectionURL != null) {
|
||||
List<WebConnectionInfo> filteredConnections = connectionInfoList.stream().filter(t -> t.getUrl().equals(connectionURL)).collect(Collectors.toList());
|
||||
if (filteredConnections.size() == 1) {
|
||||
connectionInfo = webSession.getWebConnectionInfo(filteredConnections.get(0).getId());
|
||||
connectionInfo = webSession.getWebConnectionInfo(null, filteredConnections.get(0).getId());
|
||||
}
|
||||
}
|
||||
if (connectionInfo == null) {
|
||||
|
||||
+1
-1
@@ -922,7 +922,7 @@ public class CBEmbeddedSecurityController implements SMAdminController, SMAuthen
|
||||
.filter((cred) -> {
|
||||
AuthPropertyDescriptor property = credProfile.getCredentialParameter(cred.getKey());
|
||||
|
||||
return property != null && property.getEncryption() != AuthPropertyEncryption.none;
|
||||
return property != null && property.getEncryption() == AuthPropertyEncryption.none;
|
||||
})
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user