Browse Source

REPORT-75140 抽象出一个多结果数据集

feature/x
rinoux 2 years ago
parent
commit
c807066d48
  1. 3
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  2. 31
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  3. 3
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  4. 8
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataSourceOP.java
  5. 3
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  6. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  7. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java
  8. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

3
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -4,7 +4,6 @@ import com.fr.base.BaseUtils;
import com.fr.base.TableData;
import com.fr.data.MultiResultTableData;
import com.fr.data.TableDataSource;
import com.fr.data.api.StoreProcedureAssist;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.TableDataCreatorProducer;
@ -184,7 +183,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
private boolean isIncludeUnderline(String name) {
return ComparatorUtils.equals(name.indexOf(StoreProcedureAssist.GROUP_MARKER), -1) ? false : true;
return ComparatorUtils.equals(name.indexOf(MultiResultTableData.GROUP_MARKER), -1) ? false : true;
}
public abstract void addDataPane(final AbstractTableDataPane<?> uPanel, String paneName);

31
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -9,8 +9,10 @@ import com.fr.data.TableDataSourceTailor;
import com.fr.data.core.DataCoreXmlUtils;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.NameDataModel;
import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.impl.storeproc.StoreProcedureConstants;
import com.fr.data.impl.storeproc.StoreProcedureHelper;
import com.fr.data.operator.DataOperator;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.datapane.preview.PreviewTablePane;
@ -322,9 +324,8 @@ public abstract class DesignTableDataManager {
public static java.util.Map<String, TableDataWrapper> getAllDataSetIncludingProcedure(java.util.Map<String, TableDataWrapper> resMap) {
java.util.LinkedHashMap<String, TableDataWrapper> dsMap = new java.util.LinkedHashMap<String, TableDataWrapper>();
Iterator<Entry<String, TableDataWrapper>> entryIt = resMap.entrySet().iterator();
while (entryIt.hasNext()) {
String key = entryIt.next().getKey();
for (Entry<String, TableDataWrapper> entry : resMap.entrySet()) {
String key = entry.getKey();
TableDataWrapper tableDataWrapper = resMap.get(key);
if (tableDataWrapper.getTableData() instanceof MultiResultTableData) {
MultiResultTableData<?> tableData = (MultiResultTableData<?>) tableDataWrapper.getTableData();
@ -333,9 +334,10 @@ public abstract class DesignTableDataManager {
TableDataWrapper tdw = new MultiResultTableDataNameWrapper(name + "_Table", tableData);
boolean hasSchemaOrResult = false;
// 存储过程的特殊处理,还有其它名称
if (tableData instanceof StoreProcedure) {
StoreProcedure storeProcedure = (StoreProcedure) tableData;
StoreProcedureParameter[] parameters = StoreProcedure.getSortPara(storeProcedure.getParameters());
StoreProcedureParameter[] parameters = StoreProcedureHelper.getSortPara(storeProcedure.getParameters());
for (StoreProcedureParameter parameter : parameters) {
if (parameter.getSchema() != StoreProcedureConstants.IN) {
@ -345,20 +347,21 @@ public abstract class DesignTableDataManager {
hasSchemaOrResult = true;
}
}
} else {
for (NameDataModel nameDataModel : tableData.getDataModelList()) {
String dmName = name + "_" + nameDataModel.getName();
dsMap.put(nameDataModel.getName(), new MultiResultTableDataWrapper(tableData, name, dmName, false));
} /*else {
// TODO getDataModelList是空的
for (String n : tableData.getResultNames()) {
String dmName = name + "_" + n;
dsMap.put(n, new MultiResultTableDataWrapper(tableData, name, dmName, false));
}
}
}*/
if (!resultNames.isEmpty()) {
hasSchemaOrResult = true;
for (int i = 0; i < resultNames.size(); i++) {
String parameterName = name + "_" + resultNames.get(i);
TableDataWrapper newTwd = new MultiResultTableDataWrapper(tableData, name, parameterName, false);
dsMap.put(parameterName, newTwd);
for (String resultName : resultNames) {
String dmName = name + "_" + resultName;
TableDataWrapper newTwd = new MultiResultTableDataWrapper(tableData, name, dmName, false);
dsMap.put(dmName, newTwd);
}
}
@ -622,7 +625,7 @@ public abstract class DesignTableDataManager {
// 把storeProcedure写成xml文件到out
DataCoreXmlUtils.writeXMLStoreProcedure(writer, storeProcedure, null);
if (storeProcedure.getDataModelSize() > 0 && !storeProcedure.isFirstExpand()) {
return storeProcedure.creatLazyDataModel();
return storeProcedure.getDataModelList().toArray(new ProcedureDataModel[0]);
}
ParameterProvider[] inParameters = DataOperator.getInstance().getStoreProcedureParameters(storeProcedure);

3
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -5,7 +5,6 @@ import com.fr.base.TableDataBean;
import com.fr.config.RemoteConfigEvent;
import com.fr.data.MultiResultTableData;
import com.fr.data.TableDataSource;
import com.fr.data.api.StoreProcedureAssist;
import com.fr.design.data.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.FineJOptionPane;
@ -137,7 +136,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
}
private boolean isIncludeUnderline(String name) {
return name.contains(StoreProcedureAssist.GROUP_MARKER);
return name.contains(MultiResultTableData.GROUP_MARKER);
}
/**

8
designer-base/src/main/java/com/fr/design/data/datapane/TableDataSourceOP.java

@ -4,9 +4,9 @@ import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData;
import com.fr.data.MultiResultTableData;
import com.fr.data.TableDataSource;
import com.fr.data.impl.NameDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.impl.storeproc.StoreProcedureConstants;
import com.fr.data.impl.storeproc.StoreProcedureHelper;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.wrapper.MultiResultTableDataNameWrapper;
@ -203,7 +203,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
if (tableData instanceof StoreProcedure) {
StoreProcedure storeProcedure = (StoreProcedure) tableData;
StoreProcedureParameter[] parameters = StoreProcedure.getSortPara(storeProcedure.getParameters());
StoreProcedureParameter[] parameters = StoreProcedureHelper.getSortPara(storeProcedure.getParameters());
for (StoreProcedureParameter parameter : parameters) {
if (parameter.getSchema() != StoreProcedureConstants.IN) {
if (!nodeName.contains(parameter.getName())) {
@ -217,7 +217,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
}
}
}
} else {
} /*else {
if (tableData.getDataModelList().size() > 1) {
for (NameDataModel nameDataModel : tableData.getDataModelList()) {
if (!nodeName.contains(nameDataModel.getName())) {
@ -231,7 +231,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
}
}
}
}
}*/
if (!resultNames.isEmpty()) {

3
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -3,7 +3,6 @@ package com.fr.design.data.datapane;
import com.fr.base.TableData;
import com.fr.data.MultiResultTableData;
import com.fr.data.TableDataSource;
import com.fr.data.api.StoreProcedureAssist;
import com.fr.data.impl.DBTableData;
import com.fr.data.impl.TableDataSourceDependent;
import com.fr.design.DesignModelAdapter;
@ -522,7 +521,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
private boolean isIncludeUnderline(String name) {
return !ComparatorUtils.equals(name.indexOf(StoreProcedureAssist.GROUP_MARKER), -1);
return !ComparatorUtils.equals(name.indexOf(MultiResultTableData.GROUP_MARKER), -1);
}
@Override

6
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -289,16 +289,16 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
@Override
protected Void doInBackground() throws Exception {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
sp.setCalculating(true);
// sp.setCalculating(true);
ProcedureDataModel[] dataModels = (ProcedureDataModel[]) DesignTableDataManager.createLazyDataModel(sp, false);
sp.refreshDataModelListAndResultNames(dataModels);
//sp.refreshDataModelListAndResultNames(dataModels);
return null;
}
@Override
public void done() {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
sp.setCalculating(false);
// sp.setCalculating(false);
doAfterProcudureDone();
fireDSChanged();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());

2
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java

@ -71,7 +71,7 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper {
public MultiResultTableDataWrapper(Component component, MultiResultTableData<?> tableData, String tableDataName, String dsName, boolean needLoad) {
this.dsName = dsName;
this.tableData = tableData;
this.tableData.setCalculating(false);
/*this.tableData.setCalculating(false);*/
this.tableDataName = tableDataName;
if (component == null) {
component = new JFrame();

2
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

@ -76,7 +76,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
public StoreProcedureDataWrapper(Component component, StoreProcedure storeProcedure, String storeprocedureName, String dsName, boolean needLoad) {
this.dsName = dsName;
this.storeProcedure = storeProcedure;
this.storeProcedure.setCalculating(false);
/*this.storeProcedure.setCalculating(false);*/
this.storeprocedureName = storeprocedureName;
if (component == null) {
component = new JFrame();

Loading…
Cancel
Save