Browse Source

Pull request #14458: REPORT-114392 FR-FBP版本本地设计适配 适配数据中心

Merge in DESIGN/design from ~DESTINY.LIN/design:fbp-1.0 to fbp-1.0

* commit 'eb3b08280c02e77326de0d5ce6de05c290739eb9':
  REPORT-114392 FR-FBP版本本地设计适配 适配数据中心
fbp-1.0
Destiny.Lin-林锦龙 4 months ago
parent
commit
0ff8f7a980
  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;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
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.actions.UpdateAction;
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.report.LockItem;
import com.fr.security.encryption.transmission.TransmissionEncryptionManager;
import com.fr.workspace.server.entity.tabledata.TableDataBean;
import com.fr.workspace.server.repository.tabledata.TableDataRepository;
@ -29,6 +31,7 @@ import javax.swing.KeyStroke;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -77,11 +80,19 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
}
// 锁定成功,执行后续操作
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<>();
for (TableDataBean bean : beans) {
tableDataMap.put(bean.getName() , bean.getTableData());
try {
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() {
public void complete() {
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.stable.StringUtils;
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.connection.ConnectionRepository;
@ -80,8 +81,6 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
* 刷新ComboBox.items
*/
protected Iterator<String> items() {
Iterator<String> nameIt = ConnectionRepository.getInstance().getConnNames().iterator();
Collection<String> noAuthConnections = RemoteAuthorityRepository.getInstance().getNoAuthConnections();
nameList = new ArrayList<>();
@ -89,16 +88,14 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
if (noAuthConnections == null) {
return nameList.iterator();
}
while (nameIt.hasNext()) {
String conName = nameIt.next();
List<ConnectionBean> beans = ConnectionRepository.getInstance().getAll();
for (ConnectionBean bean : beans) {
String conName = bean.getName();
if (noAuthConnections.contains(conName)) {
continue;
}
Connection connection = ConnectionRepository.getInstance().getByName(conName).getConnection();
// nameList依赖items方法初始化,父类ItemEditableComboBoxPanel里异步执行item方法
filterConnection(connection, conName, nameList);
filterConnection(bean.getConnection(), conName, nameList);
}
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 {
// 暂时这么处理,后续最好拉到外层包装一下
TransmissionEncryptionManager.setTransEncryptionLevel(1);
dataOperator.testConnectionWithException(ConnectionProcessorFactory.createConnection(database));
ConnectionProcessorFactory.testConnectionWithSchemaReturn(database);
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
}
@Override
public void add(ConnectionInfoBean bean) throws Exception {
Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.addConnection(bean);
try {
TransmissionEncryptionManager.setTransEncryptionLevel(1);
Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.addConnection(bean);
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
}
@Override
@ -43,9 +49,15 @@ public class LocalConnectionSource extends BaseConnectionSource {
@Override
public void update(ConnectionInfoBean bean) throws Exception {
Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean);
try {
TransmissionEncryptionManager.setTransEncryptionLevel(1);
Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean);
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
}
@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.LocaleMark;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.widget.ShareRepository;
/**
* Created by kerry on 2021/10/27
@ -45,7 +46,7 @@ public class ComponentShareUtil {
*/
public static boolean hasTouched() {
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;
}

Loading…
Cancel
Save