Browse Source

REPORT-114392 FR-FBP版本本地设计适配 适配数据中心

fbp-1.0
Destiny.Lin 4 months ago
parent
commit
679617e66f
  1. 19
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  2. 13
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  3. 26
      designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java
  4. 3
      designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java

19
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -1,7 +1,8 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.decision.webservice.bean.dataset.ServerDataSetBean;
import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.DataSetProcessorFactory;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -22,6 +23,7 @@ import com.fr.esd.event.DsNameTarget;
import com.fr.esd.event.StrategyEventsNotifier; import com.fr.esd.event.StrategyEventsNotifier;
import com.fr.report.LockItem; import com.fr.report.LockItem;
import com.fr.security.encryption.transmission.TransmissionEncryptionManager;
import com.fr.workspace.server.entity.tabledata.TableDataBean; import com.fr.workspace.server.entity.tabledata.TableDataBean;
import com.fr.workspace.server.repository.tabledata.TableDataRepository; import com.fr.workspace.server.repository.tabledata.TableDataRepository;
@ -29,6 +31,7 @@ import javax.swing.KeyStroke;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -77,11 +80,19 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
} }
// 锁定成功,执行后续操作 // 锁定成功,执行后续操作
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final TableDataBean[] beans = TableDataRepository.getInstance().getAllTableData(); final List<ServerDataSetBean> beans = TableDataRepository.getInstance().getAllTableData();
final Map<String, TableData> tableDataMap = new HashMap<>(); final Map<String, TableData> tableDataMap = new HashMap<>();
for (TableDataBean bean : beans) { try {
tableDataMap.put(bean.getName() , bean.getTableData()); TransmissionEncryptionManager.setTransEncryptionLevel(1);
for (ServerDataSetBean bean : beans) {
tableDataMap.put(bean.getDatasetName() , DataSetProcessorFactory.getTableDataSet(bean.getDatasetType(), bean.getDatasetData()));
}
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
} }
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() {
public void complete() { public void complete() {
populate(tableDataMap); populate(tableDataMap);

13
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -13,6 +13,7 @@ import com.fr.design.gui.ibutton.UILockButton;
import com.fr.report.LockItem; import com.fr.report.LockItem;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository;
@ -80,8 +81,6 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
* 刷新ComboBox.items * 刷新ComboBox.items
*/ */
protected Iterator<String> items() { protected Iterator<String> items() {
Iterator<String> nameIt = ConnectionRepository.getInstance().getConnNames().iterator();
Collection<String> noAuthConnections = RemoteAuthorityRepository.getInstance().getNoAuthConnections(); Collection<String> noAuthConnections = RemoteAuthorityRepository.getInstance().getNoAuthConnections();
nameList = new ArrayList<>(); nameList = new ArrayList<>();
@ -89,16 +88,14 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
if (noAuthConnections == null) { if (noAuthConnections == null) {
return nameList.iterator(); return nameList.iterator();
} }
while (nameIt.hasNext()) { List<ConnectionBean> beans = ConnectionRepository.getInstance().getAll();
String conName = nameIt.next(); for (ConnectionBean bean : beans) {
String conName = bean.getName();
if (noAuthConnections.contains(conName)) { if (noAuthConnections.contains(conName)) {
continue; continue;
} }
Connection connection = ConnectionRepository.getInstance().getByName(conName).getConnection(); filterConnection(bean.getConnection(), conName, nameList);
// nameList依赖items方法初始化,父类ItemEditableComboBoxPanel里异步执行item方法
filterConnection(connection, conName, nameList);
} }
return nameList.iterator(); return nameList.iterator();
} }

26
designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java

@ -24,16 +24,22 @@ public class LocalConnectionSource extends BaseConnectionSource {
try { try {
// 暂时这么处理,后续最好拉到外层包装一下 // 暂时这么处理,后续最好拉到外层包装一下
TransmissionEncryptionManager.setTransEncryptionLevel(1); TransmissionEncryptionManager.setTransEncryptionLevel(1);
dataOperator.testConnectionWithException(ConnectionProcessorFactory.createConnection(database)); ConnectionProcessorFactory.testConnectionWithSchemaReturn(database);
} finally { } finally {
TransmissionEncryptionManager.removeTransEncryptionLevel(); TransmissionEncryptionManager.removeTransEncryptionLevel();
} }
} }
@Override @Override
public void add(ConnectionInfoBean bean) throws Exception { public void add(ConnectionInfoBean bean) throws Exception {
Connection connection = ConnectionProcessorFactory.createConnection(bean); try {
validate(bean.getConnectionName(), connection); TransmissionEncryptionManager.setTransEncryptionLevel(1);
ConnectionProcessorFactory.addConnection(bean); Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.addConnection(bean);
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
} }
@Override @Override
@ -43,9 +49,15 @@ public class LocalConnectionSource extends BaseConnectionSource {
@Override @Override
public void update(ConnectionInfoBean bean) throws Exception { public void update(ConnectionInfoBean bean) throws Exception {
Connection connection = ConnectionProcessorFactory.createConnection(bean); try {
validate(bean.getConnectionName(), connection); TransmissionEncryptionManager.setTransEncryptionLevel(1);
ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean); Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean);
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
} }
@Override @Override

3
designer-base/src/main/java/com/fr/design/mainframe/share/ComponentShareUtil.java

@ -11,6 +11,7 @@ import com.fr.design.DesignerCloudURLManager;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark; import com.fr.general.locale.LocaleMark;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.widget.ShareRepository;
/** /**
* Created by kerry on 2021/10/27 * Created by kerry on 2021/10/27
@ -45,7 +46,7 @@ public class ComponentShareUtil {
*/ */
public static boolean hasTouched() { public static boolean hasTouched() {
String sharePath = ComponentPath.SHARE_PATH.path(); String sharePath = ComponentPath.SHARE_PATH.path();
String[] components = WorkContext.getWorkResource().list(sharePath, new ReuFilter()); String[] components = ShareRepository.getInstance().getComponents(sharePath);
return components != null && components.length > 6; return components != null && components.length > 6;
} }

Loading…
Cancel
Save