Browse Source

Merge pull request #1283 in BA/design from ~NEIL/design:release/9.0 to release/9.0

* commit '56ac47162525077be9ac552151875ed74674c0f6':
  无JIRA任务, 修复冲突.
master
superman 7 years ago
parent
commit
fb6b2915dd
  1. 55
      designer_base/src/com/fr/design/data/DesignTableDataManager.java
  2. 90
      designer_base/src/com/fr/env/RemoteEnv.java

55
designer_base/src/com/fr/design/data/DesignTableDataManager.java

@ -6,19 +6,24 @@ import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.core.DataCoreXmlUtils;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.impl.storeproc.StoreProcedureConstants; import com.fr.data.impl.storeproc.StoreProcedureConstants;
import com.fr.design.data.tabledata.wrapper.*;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.data.tabledata.wrapper.ServerTableDataWrapper;
import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper;
import com.fr.design.data.tabledata.wrapper.StoreProcedureNameWrapper;
import com.fr.design.data.tabledata.wrapper.TableDataFactory;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.parameter.ParameterInputPane; import com.fr.design.parameter.ParameterInputPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -34,8 +39,16 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.text.Collator; import java.text.Collator;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
/** /**
* 设计器管理操作数据集的类: * 设计器管理操作数据集的类:
@ -351,7 +364,20 @@ public abstract class DesignTableDataManager {
* @throws Exception 异常 * @throws Exception 异常
*/ */
public static EmbeddedTableData previewTableDataNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { public static EmbeddedTableData previewTableDataNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception {
return previewTableData(tabledata, rowCount, true, needLoadingBar); return previewTableData(null, tabledata, rowCount, true, needLoadingBar);
}
/**
* 预览需要参数的数据集
*
* @param tabledata 数据集
* @param rowCount 需要预览的行数
* @param needLoadingBar 是否需要加载进度条
* @return 数据集
* @throws Exception 异常
*/
public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception {
return previewTableData(tableDataSource, tabledata, rowCount, true, needLoadingBar);
} }
/** /**
@ -364,7 +390,20 @@ public abstract class DesignTableDataManager {
* @throws Exception 异常 * @throws Exception 异常
*/ */
public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception {
return previewTableData(tabledata, rowCount, false, needLoadingBar); return previewTableData(null, tabledata, rowCount, false, needLoadingBar);
}
/**
* 预览不需要参数的数据集
*
* @param tabledata 数据集
* @param rowCount 需要预览的行数
* @param needLoadingBar 是否需要加载进度条
* @return 数据集
* @throws Exception 异常
*/
public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception {
return previewTableData(tableDataSource, tabledata, rowCount, false, needLoadingBar);
} }
/** /**
@ -376,7 +415,7 @@ public abstract class DesignTableDataManager {
* 而获取数据集的字段名字时则没必要 * 而获取数据集的字段名字时则没必要
* @return * @return
*/ */
private static EmbeddedTableData previewTableData(TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception { private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception {
final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar(); final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar();
Env currentEnv = FRContext.getCurrentEnv(); Env currentEnv = FRContext.getCurrentEnv();
ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata); ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata);
@ -406,7 +445,7 @@ public abstract class DesignTableDataManager {
parameter.setValue(parameterMap.get(parameter.getName())); parameter.setValue(parameterMap.get(parameter.getName()));
} }
} }
return currentEnv.previewTableData(tabledata, parameterMap, rowCount); return currentEnv.previewTableData(tableDataSource, tabledata, parameterMap, rowCount);
} catch (TableDataException e) { } catch (TableDataException e) {
throw new TableDataException(e.getMessage(), e); throw new TableDataException(e.getMessage(), e);
} finally { } finally {

90
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -1,7 +1,16 @@
package com.fr.env; package com.fr.env;
import com.fr.base.*; import com.fr.base.AbstractEnv;
import com.fr.base.EnvException;
import com.fr.base.FRContext;
import com.fr.base.FRCoreContext;
import com.fr.base.ModifiedTable;
import com.fr.base.Parameter;
import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData;
import com.fr.base.Utils;
import com.fr.base.remote.RemoteDeziConstants; import com.fr.base.remote.RemoteDeziConstants;
import com.fr.data.TableDataSource;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
@ -21,13 +30,25 @@ import com.fr.file.CacheManager;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.*; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.LogRecordTime;
import com.fr.general.VT4FR;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.share.ShareConstants; import com.fr.share.ShareConstants;
import com.fr.stable.*; import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.JavaCompileInfo;
import com.fr.stable.LicUtils;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.SvgProvider;
import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.file.XMLFileManagerProvider;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
@ -35,18 +56,40 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.web.ResourceConstants; import com.fr.web.ResourceConstants;
import javax.swing.*; import javax.swing.JOptionPane;
import javax.xml.transform.*; import javax.swing.UIManager;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import java.awt.*; import java.awt.Component;
import java.io.*; import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.NoRouteToHostException; import java.net.NoRouteToHostException;
import java.net.Socket; import java.net.Socket;
import java.util.*; import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -112,6 +155,15 @@ public class RemoteEnv extends AbstractEnv {
return password; return password;
} }
// 修复密码中包含特殊字符,无法登录的问题
private String getEncodedPassword() {
try {
return URLEncoder.encode(password, "UTF-8");
} catch (UnsupportedEncodingException e) {
return password;
}
}
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
clearUserID(); clearUserID();
@ -333,7 +385,7 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design"); para.put("op", "fr_remote_design");
para.put("cmd", "test_server_connection"); para.put("cmd", "test_server_connection");
para.put("user", user); para.put("user", user);
para.put("password", password); para.put("password", getEncodedPassword());
if (path.startsWith("https") && (!DesignerEnvManager.getEnvManager().isHttps())) { if (path.startsWith("https") && (!DesignerEnvManager.getEnvManager().isHttps())) {
return false; return false;
@ -454,7 +506,7 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design"); para.put("op", "fr_remote_design");
para.put("cmd", "r_sign_in"); para.put("cmd", "r_sign_in");
para.put("user", user); para.put("user", user);
para.put("password", password); para.put("password", getEncodedPassword());
simulaRPC(para, true); simulaRPC(para, true);
@ -1202,6 +1254,11 @@ public class RemoteEnv extends AbstractEnv {
return DavXMLUtils.readXMLParameters(input); return DavXMLUtils.readXMLParameters(input);
} }
@Override
public EmbeddedTableData previewTableData(Object tableData, Map parameterMap, int rowCount) throws Exception {
return previewTableData(null, tableData, parameterMap, rowCount);
}
/** /**
* 根据指定的参数生成一个实际可预览的数据集 * 根据指定的参数生成一个实际可预览的数据集
* *
@ -1211,7 +1268,7 @@ public class RemoteEnv extends AbstractEnv {
* @return 实际的二维数据集 * @return 实际的二维数据集
* @throws Exception 如果生成数据失败则抛出此异常 * @throws Exception 如果生成数据失败则抛出此异常
*/ */
public EmbeddedTableData previewTableData(Object tableData, java.util.Map parameterMap, int rowCount) throws Exception { public EmbeddedTableData previewTableData(TableDataSource dataSource, Object tableData, java.util.Map parameterMap, int rowCount) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
// 把tableData写成xml文件到out // 把tableData写成xml文件到out
@ -1250,6 +1307,11 @@ public class RemoteEnv extends AbstractEnv {
return previewTableData(tableData, parameterMap, -1); 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是无法得到的 * nameValuePairs,这个参数要接着this.path,拼成一个URL,否则服务器端req.getParameter是无法得到的
* *
@ -1934,7 +1996,7 @@ public class RemoteEnv extends AbstractEnv {
para.put("op", "fr_remote_design"); para.put("op", "fr_remote_design");
para.put("cmd", "design_get_designer_version"); para.put("cmd", "design_get_designer_version");
para.put("user", user); para.put("user", user);
para.put("password", password); para.put("password", getEncodedPassword());
HttpClient client = createHttpMethod(para, true); HttpClient client = createHttpMethod(para, true);
try { try {
@ -2156,6 +2218,10 @@ public class RemoteEnv extends AbstractEnv {
} }
} }
public void doWhenServerShutDown() {
}
@Override @Override
public boolean isLocalEnv() { public boolean isLocalEnv() {

Loading…
Cancel
Save