Browse Source

Pull request #5367: REPORT-57209 共享数据集显示配置兼容

Merge in DESIGN/design from ~RINOUX/design:release/11.0 to release/11.0

* commit '2562ca8a15efe3f77b77784c75df8d373deb29f4':
  REPORT-57209 共享数据集显示配置兼容
persist/11.0
rinoux 3 years ago
parent
commit
d749e1e2c1
  1. 21
      designer-base/src/main/java/com/fr/design/data/StrategyConfigAttrUtils.java
  2. 16
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  3. 29
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

21
designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java → designer-base/src/main/java/com/fr/design/data/StrategyConfigAttrUtils.java

@ -26,7 +26,7 @@ import java.util.Set;
* @version 10.0 * @version 10.0
* Created by rinoux on 2020/10/28 * Created by rinoux on 2020/10/28
*/ */
public class DesignerStrategyConfigUtils { public class StrategyConfigAttrUtils {
/** /**
* 获取当前编辑模版的数据集缓存配置属性 * 获取当前编辑模版的数据集缓存配置属性
@ -56,25 +56,6 @@ public class DesignerStrategyConfigUtils {
} }
/**
* 当前编辑的模版是否被批量开启
*
* @return
*/
public static boolean isEditingTemplateRecommended() {
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate != null) {
FILE file = jTemplate.getEditingFILE();
if (file != null) {
String path = file.getPath();
return StrategyConfigService.isTemplateEnabled(path);
}
}
return false;
}
/** /**
* 获取模版数据集配置 * 获取模版数据集配置
* *

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

@ -11,7 +11,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.BasicTableDataUtils; import com.fr.design.data.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.DesignerStrategyConfigUtils; import com.fr.design.data.StrategyConfigAttrUtils;
import com.fr.design.data.tabledata.StoreProcedureWorkerListener; import com.fr.design.data.tabledata.StoreProcedureWorkerListener;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane; import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane;
@ -291,10 +291,10 @@ public class TableDataTreePane extends BasicTableDataTreePane {
editingConfig.setDsName(tdName); editingConfig.setDsName(tdName);
if (!ComparatorUtils.equals(oldName, tdName)) { if (!ComparatorUtils.equals(oldName, tdName)) {
//重命名 //重命名
DesignerStrategyConfigUtils.removeStrategyConfig(oldName); StrategyConfigAttrUtils.removeStrategyConfig(oldName);
} }
DesignerStrategyConfigUtils.addStrategyConfig(editingConfig); StrategyConfigAttrUtils.addStrategyConfig(editingConfig);
} }
((DBTableData) td).setDsName(tdName); ((DBTableData) td).setDsName(tdName);
} }
@ -588,7 +588,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
if (wrapper.getTableData() instanceof DBTableData) { if (wrapper.getTableData() instanceof DBTableData) {
DBTableData td = (DBTableData) wrapper.getTableData(); DBTableData td = (DBTableData) wrapper.getTableData();
StrategyConfig config = DesignerStrategyConfigUtils.getStrategyConfig(wrapper.getTableDataName()); StrategyConfig config = StrategyConfigAttrUtils.getStrategyConfig(wrapper.getTableDataName());
if (config == null) { if (config == null) {
result.put(td, td.isShare() ? ESDStatus.SINGLE_ON : ESDStatus.SINGLE_OFF); result.put(td, td.isShare() ? ESDStatus.SINGLE_ON : ESDStatus.SINGLE_OFF);
} else { } else {
@ -632,14 +632,14 @@ public class TableDataTreePane extends BasicTableDataTreePane {
StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName); StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName);
strategyConfig.setEnable(true); strategyConfig.setEnable(true);
strategyConfig.setUseGlobal(false); strategyConfig.setUseGlobal(false);
DesignerStrategyConfigUtils.addStrategyConfig(strategyConfig); StrategyConfigAttrUtils.addStrategyConfig(strategyConfig);
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
} }
} }
} }
private @NotNull StrategyConfig getOrCreateStrategyConfig(String dsName) { private @NotNull StrategyConfig getOrCreateStrategyConfig(String dsName) {
StrategyConfig config = DesignerStrategyConfigUtils.getStrategyConfig(dsName); StrategyConfig config = StrategyConfigAttrUtils.getStrategyConfig(dsName);
if (config == null) { if (config == null) {
config = StrategyConfigHelper.createStrategyConfig(true); config = StrategyConfigHelper.createStrategyConfig(true);
@ -680,7 +680,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName); StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName);
strategyConfig.setEnable(false); strategyConfig.setEnable(false);
strategyConfig.setUseGlobal(false); strategyConfig.setUseGlobal(false);
DesignerStrategyConfigUtils.addStrategyConfig(strategyConfig); StrategyConfigAttrUtils.addStrategyConfig(strategyConfig);
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
} }
} }
@ -814,7 +814,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
checkButtonEnabled(); checkButtonEnabled();
//删掉缓存配置 //删掉缓存配置
DesignerStrategyConfigUtils.removeStrategyConfig(selectedNO.getName()); StrategyConfigAttrUtils.removeStrategyConfig(selectedNO.getName());
// 如果一个模版是平台开启,这个数据集的配置不会存xml,预览模版时直接从全局配置copy,这样 // 如果一个模版是平台开启,这个数据集的配置不会存xml,预览模版时直接从全局配置copy,这样
// 导致删除的时候StrategyConfigsAttrSavedHook没有通过前后配置比较感知数据集被删除,因此不会发出事件让其失效 // 导致删除的时候StrategyConfigsAttrSavedHook没有通过前后配置比较感知数据集被删除,因此不会发出事件让其失效

29
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -12,7 +12,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignerStrategyConfigUtils; import com.fr.design.data.StrategyConfigAttrUtils;
import com.fr.design.data.datapane.ESDStrategyConfigPane; import com.fr.design.data.datapane.ESDStrategyConfigPane;
import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane; import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.PreviewTablePane;
@ -106,7 +106,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
//配置 //配置
private StrategyConfig strategyConfig; private StrategyConfig strategyConfig;
private StrategyConfigHandler configHandler; private StrategyConfigHandler<DBTableData> configHandler;
public DBTableDataPane() { public DBTableDataPane() {
@ -353,7 +353,8 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
//判断是不是模版数据集 //判断是不是模版数据集
switch (this.dbTableData.getScope()) { switch (this.dbTableData.getScope()) {
case TEMPLATE: case TEMPLATE:
setEsdEnableStatus(DesignerStrategyConfigUtils.isEditingTemplateRecommended(), false); String tplPath = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath();
setEsdEnableStatus(StrategyConfigService.isTemplateEnabled(tplPath), false);
break; break;
case SERVER: case SERVER:
//不会走到这里 //不会走到这里
@ -706,21 +707,31 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
String dsName = getTableData().getDsName(); String dsName = getTableData().getDsName();
//这里为了之前兼容插件创建的配置,缓存配置不在DBTableData,而是从模版attr读取 //这里为了之前兼容插件创建的配置,缓存配置不在DBTableData,而是从模版attr读取
strategyConfig = DesignerStrategyConfigUtils.getStrategyConfig(dsName); strategyConfig = StrategyConfigAttrUtils.getStrategyConfig(dsName);
if (strategyConfig == null || strategyConfig.isUseGlobal()) {
//模版里面没有配置,检查模版是否被开启 if (useGlobal(getTableData(), strategyConfig, tplPath)) {
boolean tplEnabled = StrategyConfigService.isTemplateEnabled(tplPath);
if (tplEnabled) {
//使用全局配置 //使用全局配置
strategyConfig = StrategyConfigHelper.createStrategyConfig(true); strategyConfig = StrategyConfigHelper.createStrategyConfig(true);
} } else if (getTableData().isShare()) {
//使用共享数据集兼容配置
strategyConfig = StrategyConfigHelper.createStrategyConfig(true, false, true);
} }
} }
return strategyConfig; return strategyConfig;
} }
private boolean useGlobal(DBTableData dbTableData, StrategyConfig strategyConfig, String tplPath) {
//非共享且配置为空或者指定使用全局配置时,检查是否全局开启
if (!dbTableData.isShare() && (strategyConfig == null || strategyConfig.isUseGlobal())) {
//模版里面没有配置,检查模版是否被开启
return StrategyConfigService.isTemplateEnabled(tplPath);
}
return false;
}
@Override @Override
public void save(DBTableData saved, StrategyConfig config) { public void save(DBTableData saved, StrategyConfig config) {

Loading…
Cancel
Save