|
|
@ -442,64 +442,73 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp |
|
|
|
if (selectedNO != null) { |
|
|
|
if (selectedNO != null) { |
|
|
|
data = selectedNO.getObject(); |
|
|
|
data = selectedNO.getObject(); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
preview((TableDataWrapper) data, BasicTableDataTreePane.this); |
|
|
|
if (((TableDataWrapper) Objects.requireNonNull(data)).getTableData() instanceof MultiResultTableData) { |
|
|
|
} |
|
|
|
((MultiResultTableData<?>) (((TableDataWrapper) data).getTableData())).resetDataModelList(); |
|
|
|
} |
|
|
|
if (data instanceof MultiResultTableDataWrapper) { |
|
|
|
|
|
|
|
MultiResultTableDataWrapper oldSdw = ((MultiResultTableDataWrapper) data); |
|
|
|
|
|
|
|
MultiResultTableDataWrapper newSdw = new MultiResultTableDataWrapper((MultiResultTableData<?>) oldSdw.getTableData(), oldSdw.getMultiResultTableDataName(), oldSdw.getTableDataName()); |
|
|
|
|
|
|
|
newSdw.previewData(MultiResultTableDataWrapper.PREVIEW_ONE); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
MultiResultTableData<?> tableData = (MultiResultTableData<?>) ((TableDataWrapper) data).getTableData(); |
|
|
|
|
|
|
|
MultiResultTableDataWrapper storeProcedureDataWrapper = new MultiResultTableDataWrapper(tableData, StringUtils.EMPTY, StringUtils.EMPTY); |
|
|
|
|
|
|
|
storeProcedureDataWrapper.previewData(MultiResultTableDataWrapper.PREVIEW_ALL); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
TableDataWrapper wrapper = ((TableDataWrapper) data); |
|
|
|
|
|
|
|
if (TableDataAuthHelper.needCheckAuthWhenEdit(wrapper.getTableData())) { |
|
|
|
|
|
|
|
// 先打开一个Loading面板
|
|
|
|
|
|
|
|
TableDataLoadingPane loadingPane = new TableDataLoadingPane(); |
|
|
|
|
|
|
|
BasicDialog loadingDialog = loadingPane.showLargeWindow(SwingUtilities.getWindowAncestor(BasicTableDataTreePane.this), null); |
|
|
|
|
|
|
|
// 查询权限
|
|
|
|
|
|
|
|
new SwingWorker<Boolean, Void>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected Boolean doInBackground() throws Exception { |
|
|
|
|
|
|
|
// 获取无权限连接名称集合
|
|
|
|
|
|
|
|
Collection<String> noAuthConnections = TableDataAuthHelper.getNoAuthConnections(); |
|
|
|
|
|
|
|
// 获取当前数据集对应的数据连接名称
|
|
|
|
|
|
|
|
String connectionName = TableDataAuthHelper.getConnectionNameByDBTableData((DBTableData) wrapper.getTableData()); |
|
|
|
|
|
|
|
return !noAuthConnections.contains(connectionName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
/** |
|
|
|
protected void done() { |
|
|
|
* 预览数据集 |
|
|
|
try { |
|
|
|
* |
|
|
|
Boolean hasAuth = get(); |
|
|
|
* @param data TableDataWrapper |
|
|
|
if (hasAuth) { |
|
|
|
* @param c 底层面板 |
|
|
|
// 有权限时,关闭Loading面板,打开编辑面板
|
|
|
|
*/ |
|
|
|
loadingDialog.setVisible(false); |
|
|
|
public static void preview(TableDataWrapper data, Component c) { |
|
|
|
wrapper.previewData(); |
|
|
|
try { |
|
|
|
} else { |
|
|
|
if (((TableDataWrapper) Objects.requireNonNull(data)).getTableData() instanceof MultiResultTableData) { |
|
|
|
// 无权限时,给出无权限提示
|
|
|
|
((MultiResultTableData<?>) (((TableDataWrapper) data).getTableData())).resetDataModelList(); |
|
|
|
loadingPane.switchTo(TableDataLoadingPane.NO_AUTH_PANE_NAME); |
|
|
|
if (data instanceof MultiResultTableDataWrapper) { |
|
|
|
} |
|
|
|
MultiResultTableDataWrapper oldSdw = ((MultiResultTableDataWrapper) data); |
|
|
|
} catch (Exception e) { |
|
|
|
MultiResultTableDataWrapper newSdw = new MultiResultTableDataWrapper((MultiResultTableData<?>) oldSdw.getTableData(), oldSdw.getMultiResultTableDataName(), oldSdw.getTableDataName()); |
|
|
|
FineLoggerFactory.getLogger().error("loading connection error in remote design", e.getMessage()); |
|
|
|
newSdw.previewData(MultiResultTableDataWrapper.PREVIEW_ONE); |
|
|
|
// 查询权限失败时,给出报错提示
|
|
|
|
} else { |
|
|
|
loadingPane.switchTo(TableDataLoadingPane.ERROR_NAME); |
|
|
|
MultiResultTableData<?> tableData = (MultiResultTableData<?>) ((TableDataWrapper) data).getTableData(); |
|
|
|
|
|
|
|
MultiResultTableDataWrapper storeProcedureDataWrapper = new MultiResultTableDataWrapper(tableData, StringUtils.EMPTY, StringUtils.EMPTY); |
|
|
|
|
|
|
|
storeProcedureDataWrapper.previewData(MultiResultTableDataWrapper.PREVIEW_ALL); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
TableDataWrapper wrapper = ((TableDataWrapper) data); |
|
|
|
|
|
|
|
if (TableDataAuthHelper.needCheckAuthWhenEdit(wrapper.getTableData())) { |
|
|
|
|
|
|
|
// 先打开一个Loading面板
|
|
|
|
|
|
|
|
TableDataLoadingPane loadingPane = new TableDataLoadingPane(); |
|
|
|
|
|
|
|
BasicDialog loadingDialog = loadingPane.showLargeWindow(SwingUtilities.getWindowAncestor(c), null); |
|
|
|
|
|
|
|
// 查询权限
|
|
|
|
|
|
|
|
new SwingWorker<Boolean, Void>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected Boolean doInBackground() throws Exception { |
|
|
|
|
|
|
|
// 获取无权限连接名称集合
|
|
|
|
|
|
|
|
Collection<String> noAuthConnections = TableDataAuthHelper.getNoAuthConnections(); |
|
|
|
|
|
|
|
// 获取当前数据集对应的数据连接名称
|
|
|
|
|
|
|
|
String connectionName = TableDataAuthHelper.getConnectionNameByDBTableData((DBTableData) wrapper.getTableData()); |
|
|
|
|
|
|
|
return !noAuthConnections.contains(connectionName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected void done() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
Boolean hasAuth = get(); |
|
|
|
|
|
|
|
if (hasAuth) { |
|
|
|
|
|
|
|
// 有权限时,关闭Loading面板,打开编辑面板
|
|
|
|
|
|
|
|
loadingDialog.setVisible(false); |
|
|
|
|
|
|
|
wrapper.previewData(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 无权限时,给出无权限提示
|
|
|
|
|
|
|
|
loadingPane.switchTo(TableDataLoadingPane.NO_AUTH_PANE_NAME); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error("loading connection error in remote design", e.getMessage()); |
|
|
|
|
|
|
|
// 查询权限失败时,给出报错提示
|
|
|
|
|
|
|
|
loadingPane.switchTo(TableDataLoadingPane.ERROR_NAME); |
|
|
|
} |
|
|
|
} |
|
|
|
}.execute(); |
|
|
|
} |
|
|
|
loadingDialog.setVisible(true); |
|
|
|
}.execute(); |
|
|
|
} else { |
|
|
|
loadingDialog.setVisible(true); |
|
|
|
wrapper.previewData(); |
|
|
|
} else { |
|
|
|
} |
|
|
|
wrapper.previewData(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|