diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/TableDataBeanHelper.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/TableDataBeanHelper.java index ad3f9ad14e..a5309a8ce0 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/TableDataBeanHelper.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/TableDataBeanHelper.java @@ -16,8 +16,10 @@ import com.fr.decision.webservice.bean.dataset.ParameterExternal; import com.fr.decision.webservice.bean.dataset.SQLDataSetBean; import com.fr.decision.webservice.bean.dataset.ServerDataSetBean; import com.fr.decision.webservice.bean.dataset.StoreProcedureBean; +import com.fr.decision.webservice.bean.dataset.StrategyConfigBean; import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.SQLDataSetProcessor; import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.StoreProcedureProcessor; +import com.fr.esd.core.strategy.config.StrategyConfig; import com.fr.general.GeneralUtils; import com.fr.general.sql.SqlUtils; import com.fr.json.JSONObject; @@ -29,6 +31,7 @@ import com.fr.stable.StringUtils; import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.tabledata.DataEncryptionHelper; import com.fr.workspace.server.repository.tabledata.TableDataRepository; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -163,6 +166,22 @@ public class TableDataBeanHelper { parameterBeans.add(new ParameterBean(parameter.getValue().getClass().getSimpleName(), parameter.getName(), GeneralUtils.objectToString(parameter.getValue()))); } bean.setParameters(parameterBeans); + StrategyConfig config = dataSet.getStrategyConfig(); + if (config != null) { + StrategyConfigBean strategyConfigBean = new StrategyConfigBean(); + strategyConfigBean.setUseGlobal(config.isUseGlobal()); + strategyConfigBean.setShouldMonitor(config.shouldMonitor()); + strategyConfigBean.setShouldEvolve(config.shouldEvolve()); + strategyConfigBean.setScheduleBySchema(config.isScheduleBySchema()); + strategyConfigBean.setTimeToLive(config.getTimeToLive()); + strategyConfigBean.setTimeToIdle(config.getTimeToIdle()); + strategyConfigBean.setUpdateInterval(config.getUpdateInterval()); + strategyConfigBean.setTerminalTime(config.getTerminalTime()); + strategyConfigBean.setUpdateSchema(config.getUpdateSchema()); + strategyConfigBean.setActiveInitiation(config.isActiveInitiation()); + strategyConfigBean.setShare(config.enabled()); + bean.setStrategyConfig(strategyConfigBean); + } return JSONObject.mapFrom(bean); } @@ -190,6 +209,27 @@ public class TableDataBeanHelper { tableData.setShare(oldDataSet.isShare()); tableData.setDataQueryProcessor(oldDataSet.getDataQueryProcessor()); } + StrategyConfig config = getStrategyConfig(bean.getStrategyConfig()); + tableData.setStrategyConfig(config); return tableData; } + + private static StrategyConfig getStrategyConfig(StrategyConfigBean bean) { + if (bean == null) { + return new StrategyConfig(); + } + StrategyConfig config = new StrategyConfig(); + config.setEnable(bean.isShare()); + config.setUseGlobal(bean.isUseGlobal()); + config.setShouldMonitor(bean.isShouldMonitor()); + config.setShouldEvolve(bean.isShouldEvolve()); + config.setScheduleBySchema(bean.isScheduleBySchema()); + config.setTimeToLive(bean.getTimeToLive()); + config.setTimeToIdle(bean.getTimeToIdle()); + config.setUpdateInterval(bean.getUpdateInterval()); + config.setTerminalTime(bean.getTerminalTime()); + config.setUpdateSchema(bean.getUpdateSchema()); + config.setActiveInitiation(bean.isActiveInitiation()); + return config; + } }