Dbeaver/pro#2523 annotations (#2447)

* dbeaver/pro#2523 Model annotations

* dbeaver/pro#2523 Model annotations
This commit is contained in:
Serge Rider
2024-03-05 18:27:47 +01:00
committed by GitHub
parent ab01bc5384
commit 6d4bb860ae
11 changed files with 49 additions and 31 deletions
@@ -51,6 +51,7 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
this.dataSourceFilter = filter;
}
@NotNull
@Override
public DBPProject getProject() {
return dataSourceRegistry.getProject();
@@ -58,7 +59,7 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
@Nullable
@Override
public DBPDataSourceContainer getDataSource(String id) {
public DBPDataSourceContainer getDataSource(@NotNull String id) {
DBPDataSourceContainer dataSource = dataSourceRegistry.getDataSource(id);
if (dataSource == null || dataSourceFilter != null && !dataSourceFilter.filter(dataSource)) {
return null;
@@ -68,7 +69,7 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
@Nullable
@Override
public DBPDataSourceContainer getDataSource(DBPDataSource dataSource) {
public DBPDataSourceContainer getDataSource(@NotNull DBPDataSource dataSource) {
if (dataSourceFilter != null && !dataSourceFilter.filter(dataSource.getContainer())) {
return null;
}
@@ -107,13 +108,13 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
@NotNull
@Override
public DBPDataSourceContainer createDataSource(DBPDriver driver, DBPConnectionConfiguration connConfig) {
public DBPDataSourceContainer createDataSource(@NotNull DBPDriver driver, @NotNull DBPConnectionConfiguration connConfig) {
return dataSourceRegistry.createDataSource(driver, connConfig);
}
@NotNull
@Override
public DBPDataSourceContainer createDataSource(DBPDataSourceContainer source) {
public DBPDataSourceContainer createDataSource(@NotNull DBPDataSourceContainer source) {
return dataSourceRegistry.createDataSource(source);
}
@@ -164,18 +165,20 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
return dataSourceRegistry.getRootFolders();
}
@Nullable
@Override
public DBPDataSourceFolder getFolder(String path) {
public DBPDataSourceFolder getFolder(@NotNull String path) {
return dataSourceRegistry.getFolder(path);
}
@NotNull
@Override
public DBPDataSourceFolder addFolder(DBPDataSourceFolder parent, String name) {
public DBPDataSourceFolder addFolder(@Nullable DBPDataSourceFolder parent, @NotNull String name) {
return dataSourceRegistry.addFolder(parent, name);
}
@Override
public void removeFolder(DBPDataSourceFolder folder, boolean dropContents) {
public void removeFolder(@NotNull DBPDataSourceFolder folder, boolean dropContents) {
dataSourceRegistry.removeFolder(folder, dropContents);
}
@@ -197,18 +200,18 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
}
@Override
public void updateSavedFilter(DBSObjectFilter filter) {
public void updateSavedFilter(@NotNull DBSObjectFilter filter) {
dataSourceRegistry.updateSavedFilter(filter);
}
@Override
public void removeSavedFilter(String filterName) {
public void removeSavedFilter(@NotNull String filterName) {
dataSourceRegistry.removeSavedFilter(filterName);
}
@Nullable
@Override
public DBWNetworkProfile getNetworkProfile(String source, String name) {
public DBWNetworkProfile getNetworkProfile(@Nullable String source, @NotNull String name) {
return dataSourceRegistry.getNetworkProfile(source, name);
}
@@ -219,18 +222,18 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
}
@Override
public void updateNetworkProfile(DBWNetworkProfile profile) {
public void updateNetworkProfile(@NotNull DBWNetworkProfile profile) {
dataSourceRegistry.updateNetworkProfile(profile);
}
@Override
public void removeNetworkProfile(DBWNetworkProfile profile) {
public void removeNetworkProfile(@NotNull DBWNetworkProfile profile) {
dataSourceRegistry.removeNetworkProfile(profile);
}
@Nullable
@Override
public DBAAuthProfile getAuthProfile(String id) {
public DBAAuthProfile getAuthProfile(@NotNull String id) {
return dataSourceRegistry.getAuthProfile(id);
}
@@ -247,12 +250,12 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
}
@Override
public void updateAuthProfile(DBAAuthProfile profile) {
public void updateAuthProfile(@NotNull DBAAuthProfile profile) {
dataSourceRegistry.updateAuthProfile(profile);
}
@Override
public void removeAuthProfile(DBAAuthProfile profile) {
public void removeAuthProfile(@NotNull DBAAuthProfile profile) {
dataSourceRegistry.removeAuthProfile(profile);
}
@@ -271,6 +274,7 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
dataSourceRegistry.refreshConfig(dataSourceIds);
}
@Nullable
@Override
public Throwable getLastError() {
return dataSourceRegistry.getLastError();
@@ -287,7 +291,7 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
}
@Override
public void notifyDataSourceListeners(DBPEvent event) {
public void notifyDataSourceListeners(@NotNull DBPEvent event) {
dataSourceRegistry.notifyDataSourceListeners(event);
}
@@ -307,6 +311,7 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
dataSourceRegistry.setAuthCredentialsProvider(authCredentialsProvider);
}
@NotNull
@Override
public Set<DBPDataSourceFolder> getTemporaryFolders() {
return dataSourceRegistry.getTemporaryFolders();
@@ -17,6 +17,7 @@
package io.cloudbeaver;
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.app.DBPDataSourceRegistry;
@@ -40,6 +41,7 @@ public abstract class WebProjectImpl extends BaseWebProjectImpl {
super(workspace, resourceController, sessionContext, project, dataSourceFilter);
}
@Nullable
@Override
public Object getProjectProperty(String propName) {
try {
@@ -51,7 +53,7 @@ public abstract class WebProjectImpl extends BaseWebProjectImpl {
}
@Override
public void setProjectProperty(String propName, Object propValue) {
public void setProjectProperty(@NotNull String propName, @Nullable Object propValue) {
try {
getResourceController().setProjectProperty(getId(), propName, propValue);
} catch (DBException e) {
@@ -19,6 +19,7 @@ package io.cloudbeaver.model.session;
import io.cloudbeaver.model.WebServerMessage;
import io.cloudbeaver.model.app.WebAuthApplication;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.auth.SMSessionPrincipal;
@@ -43,6 +44,7 @@ public class WebHeadlessSession extends BaseWebSession {
}
@Nullable
@Override
public SMSessionPrincipal getSessionPrincipal() {
return null;
@@ -140,6 +140,7 @@ public class WebSession extends BaseWebSession
refreshSessionAuth();
}
@Nullable
@Override
public SMSessionPrincipal getSessionPrincipal() {
synchronized (authTokens) {
@@ -85,11 +85,13 @@ public class WebSessionWorkspace implements DBPWorkspace {
return accessibleProjects;
}
@Nullable
@Override
public DBPProject getActiveProject() {
return activeProject;
}
@Nullable
@Override
public WebProjectImpl getProject(@NotNull String projectName) {
for (WebProjectImpl project : accessibleProjects) {
@@ -148,12 +150,12 @@ public class WebSessionWorkspace implements DBPWorkspace {
}
@Override
public boolean hasRealmPermission(String permission) {
public boolean hasRealmPermission(@NotNull String permission) {
return false;
}
@Override
public boolean supportsRealmFeature(String feature) {
public boolean supportsRealmFeature(@NotNull String feature) {
return false;
}
@@ -223,7 +223,7 @@ public class CBPlatform extends BasePlatformImpl {
}
@NotNull
public Path getTempFolder(DBRProgressMonitor monitor, String name) {
public Path getTempFolder(@NotNull DBRProgressMonitor monitor, @NotNull String name) {
if (tempFolder == null) {
// Make temp folder
monitor.subTask("Create temp folder");
@@ -41,7 +41,7 @@ public class WebSQLCellValueReceiver implements DBDDataReceiver {
}
@Override
public void fetchStart(DBCSession session, DBCResultSet resultSet, long offset, long maxRows) throws DBCException {
public void fetchStart(@NotNull DBCSession session, @NotNull DBCResultSet resultSet, long offset, long maxRows) throws DBCException {
DBCResultSetMetaData meta = resultSet.getMeta();
List<DBCAttributeMetaData> attributes = meta.getAttributes();
DBCAttributeMetaData attrMeta = attributes.get(rowIndex);
@@ -49,7 +49,7 @@ public class WebSQLCellValueReceiver implements DBDDataReceiver {
}
@Override
public void fetchRow(DBCSession session, DBCResultSet resultSet) throws DBCException {
public void fetchRow(@NotNull DBCSession session, @NotNull DBCResultSet resultSet) throws DBCException {
value = binding.getValueHandler().fetchValueObject(
resultSet.getSession(),
resultSet,
@@ -58,7 +58,7 @@ public class WebSQLCellValueReceiver implements DBDDataReceiver {
}
@Override
public void fetchEnd(DBCSession session, DBCResultSet resultSet) throws DBCException {
public void fetchEnd(@NotNull DBCSession session, @NotNull DBCResultSet resultSet) throws DBCException {
}
@@ -1019,12 +1019,12 @@ public class WebSQLProcessor implements WebSessionProvider {
}
@Override
public void fetchStart(DBCSession session, DBCResultSet resultSet, long offset, long maxRows) {
public void fetchStart(@NotNull DBCSession session, @NotNull DBCResultSet resultSet, long offset, long maxRows) {
}
@Override
public void fetchRow(DBCSession session, DBCResultSet resultSet)
public void fetchRow(@NotNull DBCSession session, @NotNull DBCResultSet resultSet)
throws DBCException {
DBDAttributeBinding[] resultsAttributes = results.getAttributes();
@@ -1060,7 +1060,7 @@ public class WebSQLProcessor implements WebSessionProvider {
}
@Override
public void fetchEnd(DBCSession session, DBCResultSet resultSet) {
public void fetchEnd(@NotNull DBCSession session, @NotNull DBCResultSet resultSet) {
}
@@ -18,6 +18,7 @@ package io.cloudbeaver.service.sql;
import io.cloudbeaver.model.session.WebSession;
import io.cloudbeaver.server.CBApplication;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPDataKind;
@@ -32,7 +33,10 @@ import org.jkiss.dbeaver.model.struct.DBSEntity;
import org.jkiss.utils.CommonUtils;
import java.lang.reflect.Method;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
class WebSQLQueryDataReceiver implements DBDDataReceiver {
@@ -59,7 +63,7 @@ class WebSQLQueryDataReceiver implements DBDDataReceiver {
}
@Override
public void fetchStart(DBCSession session, DBCResultSet dbResult, long offset, long maxRows) throws DBCException {
public void fetchStart(@NotNull DBCSession session, @NotNull DBCResultSet dbResult, long offset, long maxRows) throws DBCException {
DBCResultSetMetaData meta = dbResult.getMeta();
List<DBCAttributeMetaData> attributes = meta.getAttributes();
bindings = new DBDAttributeBindingMeta[attributes.size()];
@@ -70,7 +74,7 @@ class WebSQLQueryDataReceiver implements DBDDataReceiver {
}
@Override
public void fetchRow(DBCSession session, DBCResultSet resultSet) throws DBCException {
public void fetchRow(@NotNull DBCSession session, @NotNull DBCResultSet resultSet) throws DBCException {
Map<String, Object> metaDataMap = null;
Object[] row = new Object[bindings.length];
@@ -111,7 +115,7 @@ class WebSQLQueryDataReceiver implements DBDDataReceiver {
}
@Override
public void fetchEnd(DBCSession session, DBCResultSet resultSet) throws DBCException {
public void fetchEnd(@NotNull DBCSession session, @NotNull DBCResultSet resultSet) throws DBCException {
WebSession webSession = contextInfo.getProcessor().getWebSession();
DBSEntity entity = dataContainer instanceof DBSEntity ? (DBSEntity) dataContainer : null;
@@ -223,7 +223,7 @@ public class WebServiceDataTransfer implements DBWServiceDataTransfer {
StreamTransferConsumer consumer = new StreamTransferConsumer() {
@Override
public void fetchRow(DBCSession session, DBCResultSet resultSet) throws DBCException {
public void fetchRow(@NotNull DBCSession session, @NotNull DBCResultSet resultSet) throws DBCException {
super.fetchRow(session, resultSet);
if (fileSizeLimit != null && getBytesWritten() > fileSizeLimit.longValue()) {
throw new DBQuotaException(
@@ -17,6 +17,7 @@
package io.cloudbeaver.auth.provider.local;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.auth.SMAuthSpace;
import org.jkiss.dbeaver.model.auth.SMSession;
import org.jkiss.dbeaver.model.auth.SMSessionContext;
@@ -54,6 +55,7 @@ public class LocalAuthSession implements SMSession {
return webSession.getSessionContext();
}
@Nullable
@Override
public SMSessionPrincipal getSessionPrincipal() {
return webSession.getSessionPrincipal();