Browse Source

Merge branch 'feature/10.0' of http://cloud.finedevelop.com:2015/scm/~kerry/design_10.0 into feature/10.0

master
kerry 6 years ago
parent
commit
dca9833874
  1. 2
      designer-base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  2. 16
      designer-base/src/com/fr/design/data/DesignTableDataManager.java
  3. 7
      designer-base/src/com/fr/design/data/datapane/ChoosePane.java
  4. 4
      designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  5. 3
      designer-base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java
  6. 38
      designer-base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  7. 18
      designer-base/src/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  8. 2
      designer-base/src/com/fr/design/file/TemplateTreePane.java
  9. 15
      designer-base/src/com/fr/design/gui/ilist/TableViewList.java
  10. 100
      designer-base/src/com/fr/env/RemoteEnv.java
  11. 2
      designer-chart/src/com/fr/design/chart/ChartTypePane.java
  12. 2
      designer-realize/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

2
designer-base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -75,7 +75,7 @@ public class AlphaFineConfigManager implements XMLable {
public static boolean isALPHALicAvailable() {
return FRContext.getCurrentEnv() != null && VT4FR.AlphaFine.support();
return FRContext.getCurrentEnv() != null && VT4FR.AlphaFine.isSupport();
}
@Override

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

@ -1,6 +1,5 @@
package com.fr.design.data;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData;
@ -10,6 +9,7 @@ import com.fr.data.impl.EmbeddedTableData;
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.operator.DataOperator;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.data.tabledata.wrapper.ServerTableDataWrapper;
@ -417,8 +417,7 @@ public abstract class DesignTableDataManager {
*/
private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception {
final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar();
Env currentEnv = FRContext.getCurrentEnv();
ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata);
ParameterProvider[] parameters = DataOperator.getInstance().getTableDataParameters(tabledata);
if (ArrayUtils.isEmpty(parameters)) {
parameters = tabledata.getParameters(Calculator.createCalculator());
}
@ -440,13 +439,13 @@ public abstract class DesignTableDataManager {
loadingBar.start();
}
try {
for (ParameterProvider parameter : currentEnv.getTableDataParameters(tabledata)) {
for (ParameterProvider parameter : DataOperator.getInstance().getTableDataParameters(tabledata)) {
if (parameterMap.containsKey(parameter.getName())) {
parameter.setValue(parameterMap.get(parameter.getName()));
}
}
return currentEnv.previewTableData(tableDataSource, tabledata, parameterMap, rowCount);
} catch (TableDataException e) {
return DataOperator.getInstance().previewTableData(tableDataSource, tabledata, parameterMap, rowCount);
} catch (Exception e) {
throw new TableDataException(e.getMessage(), e);
} finally {
new Timer().schedule(new TimerTask() {
@ -510,11 +509,10 @@ public abstract class DesignTableDataManager {
XMLPrintWriter writer = XMLPrintWriter.create(out);
// 把storeProcedure写成xml文件到out
DataCoreXmlUtils.writeXMLStoreProcedure(writer, storeProcedure, null);
Env currentEnv = FRContext.getCurrentEnv();
if (storeProcedure.getDataModelSize() > 0 && !storeProcedure.isFirstExpand()) {
return storeProcedure.creatLazyDataModel();
}
ParameterProvider[] inParameters = currentEnv.getStoreProcedureParameters(storeProcedure);
ParameterProvider[] inParameters = DataOperator.getInstance().getStoreProcedureParameters(storeProcedure);
final Map<String, Object> parameterMap = new HashMap<String, Object>();
if (inParameters.length > 0 && !ComparatorUtils.equals(threadLocal.get(), NO_PARAMETER)) {// 检查Parameter.
final ParameterInputPane pPane = new ParameterInputPane(inParameters);
@ -529,7 +527,7 @@ public abstract class DesignTableDataManager {
if (needLoadingBar) {
StoreProcedureDataWrapper.loadingBar.start();
}
return FRContext.getCurrentEnv().previewProcedureDataModel(storeProcedure, parameterMap, 0);
return DataOperator.getInstance().previewProcedureDataModel(storeProcedure, parameterMap, 0);
}
public static void setThreadLocal(String value) {

7
designer-base/src/com/fr/design/data/datapane/ChoosePane.java

@ -9,6 +9,7 @@ import com.fr.data.core.db.TableProcedure;
import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.impl.Connection;
import com.fr.data.impl.DBTableData;
import com.fr.data.operator.DataOperator;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane;
@ -449,7 +450,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
return TableData.EMPTY_TABLEDATA;
}
try {
connect = FRContext.getCurrentEnv().testConnection(database);
connect = DataOperator.getInstance().testConnection(database);
} catch (Exception ignored) {
}
if (!connect) {
@ -468,7 +469,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} else {
try {
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName())));
tableData = FRContext.getCurrentEnv().previewTableData(tableDataLocal, java.util.Collections.EMPTY_MAP,
tableData = DataOperator.getInstance().previewTableData(tableDataLocal, java.util.Collections.EMPTY_MAP,
DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow());
} catch (Exception e) {
failedToFindTable();
@ -524,7 +525,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}
try {
// daniel:增加参数
colNames = FRContext.getCurrentEnv().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject);
colNames = DataOperator.getInstance().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject);
} catch (Exception e2) {
FRContext.getLogger().error(e2.getMessage(), e2);
}

4
designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -3,9 +3,9 @@
*/
package com.fr.design.data.datapane.connect;
import com.fr.base.FRContext;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.data.operator.DataOperator;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
@ -118,7 +118,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
protected Object doInBackground() throws Exception {
try {
com.fr.data.impl.Connection database = DatabaseConnectionPane.this.updateBean();
boolean connect = FRContext.getCurrentEnv().testConnection(database);
boolean connect = DataOperator.getInstance().testConnection(database);
okButton.setEnabled(true);
message.setText(database.connectMessage(connect));
} catch (Exception exp) {

3
designer-base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -10,6 +10,7 @@ import com.fr.data.TableDataSource;
import com.fr.data.impl.DBTableData;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.operator.DataOperator;
import com.fr.design.DesignerEnvManager;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog;
@ -358,7 +359,7 @@ public class PreviewTablePane extends BasicPane {
protected PreviewTableModel doInBackground() throws Exception {
connectionBar.start();
if (tableData instanceof DBTableData) {
boolean status = FRContext.getCurrentEnv().testConnection(((DBTableData) tableData).getDatabase());
boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase());
if (!status) {
connectionBar.close();
throw new Exception(Inter.getLocText("Datasource-Connection_failed"));

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

@ -1,25 +1,12 @@
package com.fr.design.data.tabledata.tabledatapane;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.StoreProcedureParameter;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.operator.DataOperator;
import com.fr.design.actions.UpdateAction;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
@ -46,6 +33,16 @@ import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> implements ResponseDataSourceChange {
private static final String[] DRIVERS = {
"oracle.jdbc.driver.OracleDriver",
@ -194,7 +191,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
try {
storeProcedureContext.setText(StringUtils.EMPTY);
String connectionname = connectionTableProcedurePane.getSelectedDatabaseConnnectonName();
String procedureText = FRContext.getCurrentEnv().getProcedureText(connectionname, storeprocedure.getQuery());
String procedureText = DataOperator.getInstance().getProcedureText(connectionname, storeprocedure.getQuery());
storeProcedureContext.setText(procedureText);
warningLabel.setText(StringUtils.EMPTY);
} catch (Exception ex) {
@ -301,7 +298,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
text = text.trim();
String connectionname = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName();
try {
String procedureText = FRContext.getCurrentEnv().getProcedureText(this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(), text);
String procedureText = DataOperator.getInstance().getProcedureText(this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(), text);
// 获取参数默认值,例如:NAME in varchar2 default 'SCOTT',默认值为SCOTT
String parameterDefaultValue = "";
@ -315,22 +312,17 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
}
StoreProcedureParameter[] newparameters;
newparameters = FRContext.getCurrentEnv().getStoreProcedureDeclarationParameters(connectionname, text, parameterDefaultValue);
newparameters = DataOperator.getInstance().getStoreProcedureDeclarationParameters(connectionname, text, parameterDefaultValue);
editorPane.populate(newparameters);
storeProcedureContext.setText(procedureText);
warningLabel.setText("");
} catch (SQLException sql) {
warningLabel.setText(Inter.getLocText(new String[]{"Database", "Datasource-Connection_failed"}));
storeProcedureContext.setText("");
editorPane.populate(new StoreProcedureParameter[0]);
} catch (Exception e) {
warningLabel.setText(e.getMessage());
warningLabel.setText(Inter.getLocText(new String[]{"Database", "Datasource-Connection_failed"}));
storeProcedureContext.setText("");
editorPane.populate(new StoreProcedureParameter[0]);
}
return;
}
/**

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

@ -1,19 +1,11 @@
package com.fr.design.data.tabledata.wrapper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CancellationException;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.TableData;
import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.operator.DataOperator;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.BasicDialog;
@ -24,6 +16,12 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CancellationException;
/**
* <code>StoreProcedureDataWrappe</code> 存储过程的一个返回数据集,不是它本身<br>
* Oracle数据库肯定有它SQL SERVER就不一定有了,大部分情况下都没有.
@ -191,7 +189,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
worker = new SwingWorker<Void, Void>() {
protected Void doInBackground() throws Exception {
connectionBar.start();
boolean status = FRContext.getCurrentEnv().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection());
boolean status = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection());
if (!status) {
connectionBar.close();
// bug 61345 预览失败时,关闭窗口

2
designer-base/src/com/fr/design/file/TemplateTreePane.java

@ -182,7 +182,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
if (nodeFile.exists()) {
String path = StableUtils.pathJoin(nodeFile.getEnvPath(), nodeFile.getPath());
FileAssistUtils.moveToTrash(path);
FileAssistUtils.moveToTrash(nodeFile.getPath());
deleteHistory(path.replaceAll("/", "\\\\"));
} else {
JOptionPane.showMessageDialog(this, Inter.getLocText("Warning-Template_Do_Not_Exsit"), ProductConstants.PRODUCT_NAME,

15
designer-base/src/com/fr/design/gui/ilist/TableViewList.java

@ -7,6 +7,7 @@ import com.fr.data.core.db.TableProcedure;
import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.core.db.dialect.OracleDialect;
import com.fr.data.impl.Connection;
import com.fr.data.operator.DataOperator;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.dnd.SerializableTransferable;
@ -17,7 +18,11 @@ import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.dnd.*;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceAdapter;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseAdapter;
@ -90,7 +95,7 @@ public class TableViewList extends UIList {
int count = 3;
//总共给3次连接的机会
while (!status && count > 0) {
status = FRContext.getCurrentEnv().testConnection(datasource);
status = DataOperator.getInstance().testConnection(datasource);
count--;
}
if (!status) {
@ -133,9 +138,9 @@ public class TableViewList extends UIList {
String[] schemas = DataCoreUtils.getDatabaseSchema(datasource);
searchFilter = searchFilter.toLowerCase();
boolean isOracle = FRContext.getCurrentEnv().isOracle(datasource);
boolean isOracle = DataOperator.getInstance().isOracle(datasource);
boolean isOracleSystemSpace = DesignerEnvManager.getEnvManager().isOracleSystemSpace();
// oracleb不勾选显示所有表,则只显示用户下的(包括存储过程和table表)
if (isOracle && !isOracleSystemSpace) {

100
designer-base/src/com/fr/env/RemoteEnv.java vendored

@ -1,11 +1,9 @@
package com.fr.env;
import com.fr.base.EnvException;
import com.fr.base.TableData;
import com.fr.base.operator.common.CommonOperator;
import com.fr.base.operator.connect.ConnectOperator;
import com.fr.base.operator.file.FileOperator;
import com.fr.base.operator.file.SimpleFileOperator;
import com.fr.base.operator.org.OrganizationOperator;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.common.rpc.RemoteCallServerConfig;
@ -13,8 +11,6 @@ import com.fr.common.rpc.netty.MessageSendExecutor;
import com.fr.common.rpc.netty.RemoteCallClient;
import com.fr.core.env.EnvConstants;
import com.fr.core.env.EnvContext;
import com.fr.data.TableDataSource;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.dav.AbstractEnv;
import com.fr.dav.DavXMLUtils;
@ -24,6 +20,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.file.CacheManager;
import com.fr.general.CommonIOUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.EnvProxyFactory;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.http.HttpToolbox;
@ -111,9 +108,28 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
MessageSendExecutor.getInstance().stop();
return true;
}
@Override
public EnvProxyFactory getProxyFactory() {
return new EnvProxyFactory() {
@Override
public <T> T get(Class<T> clazz, T obj) {
assert clazz != null;
try {
return MessageSendExecutor.getInstance().execute(clazz);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
}
@Override
public FileOperator getFileOperator() throws Exception {
return MessageSendExecutor.getInstance().execute(FileOperator.class);
}
@ -126,12 +142,7 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
public OrganizationOperator getOrganizationOperator() throws Exception {
return MessageSendExecutor.getInstance().execute(OrganizationOperator.class);
}
@Override
public SimpleFileOperator getSimpleFileOperator() throws Exception {
return MessageSendExecutor.getInstance().execute(SimpleFileOperator.class);
}
@Override
public RemoteEnvConfig getEnvConfig() {
return config;
@ -211,7 +222,7 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
* @param in InputStream输入流
* @return 转换后的字符串
*/
public static String stream2String(InputStream in) {
private static String stream2String(InputStream in) {
if (in == null) {
return null;
}
@ -230,7 +241,7 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
* @return 测试连接成功返回true
* @throws Exception 异常
*/
public boolean testServerConnection() throws Exception {
private boolean testServerConnection() throws Exception {
return testConnection(true, true, DesignerContext.getDesignerFrame());
}
@ -432,67 +443,8 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
return Boolean.valueOf(IOUtils.inputStream2String(input, EncodeConstants.ENCODING_UTF_8));
}
@Override
public EmbeddedTableData previewTableData(Object tableData, Map parameterMap, int rowCount) throws Exception {
return previewTableData(null, tableData, parameterMap, rowCount);
}
/**
* 根据指定的参数生成一个实际可预览的数据集
*
* @param tableData 带参数的数据集
* @param parameterMap 参数键值对
* @param rowCount 需要获取的行数
* @return 实际的二维数据集
* @throws Exception 如果生成数据失败则抛出此异常
*/
@Override
public EmbeddedTableData previewTableData(TableDataSource dataSource, Object tableData, java.util.Map parameterMap, int rowCount) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
// 把tableData写成xml文件到out
DavXMLUtils.writeXMLFileTableDataAndSource((TableData) tableData, out);
// 把parameterMap转成JSON格式的字符串
JSONObject jo = new JSONObject(parameterMap);
String jsonParameter = jo.toString();
HashMap<String, String> para = new HashMap<>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_preview_td");
para.put("pars", jsonParameter);
para.put("rowcount", String.valueOf(rowCount));
InputStream input = postBytes2ServerB(out.toByteArray(), para);
if (input == null) {
return null;
}
return (EmbeddedTableData) DavXMLUtils.readXMLTableData(input);
}
/**
* 根据指定的参数生成一个实际可预览的数据集
*
* @param tableData 带参数的数据集
* @param parameterMap 参数键值对
* @param start 开始
* @param end 结尾
* @param cols 列名
* @param colIdx 列序号
* @return 实际的二位数据条
* @throws Exception 异常
*/
@Override
public Object previewTableData(Object tableData, java.util.Map parameterMap, int start, int end, String[] cols, int[] colIdx) throws Exception {
return previewTableData(tableData, parameterMap, -1);
}
@Override
public Object previewTableData(TableDataSource dataSource, Object tableData, Map parameterMap, int start, int end, String[] cols, int[] colIdx) throws Exception {
return previewTableData(dataSource, tableData, parameterMap, -1);
}
/**
* nameValuePairs,这个参数要接着this.path,拼成一个URL,否则服务器端req.getParameter是无法得到的
*

2
designer-chart/src/com/fr/design/chart/ChartTypePane.java

@ -172,7 +172,7 @@ public class ChartTypePane extends ChartCommonWizardPane {
}
private boolean supportMap() {
return VT4FR.ChartMap.support();
return VT4FR.ChartMap.isSupport();
}
public void update(ChartCollection cc) {

2
designer-realize/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java

@ -69,7 +69,7 @@ public class ErrorInfoUploader {
// 从云中心更新最新的解决方案文件
private void checkUpdateSolution() {
if (!VT4FR.AlphaFine.support()) {
if (!VT4FR.AlphaFine.isSupport()) {
return;
}

Loading…
Cancel
Save