From de6dca775bfcd304c17b90ac6588940f4140169c Mon Sep 17 00:00:00 2001 From: fr_shine Date: Wed, 6 Jul 2016 14:26:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/env/RemoteEnv.java | 113 +++++++++++++++++--- 1 file changed, 96 insertions(+), 17 deletions(-) diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 7cff11c37f..6c6be6bcf5 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -816,18 +816,23 @@ public class RemoteEnv implements Env { return sqlTableObjs; } - /** - * 在当前路径下新建文件夹 - * - * @param folderPath 文件名 - * @return 成功创建返回true - * @throws Exception - */ - @Override public boolean createFolder(String folderPath) throws Exception { + return createFolder(folderPath, false); + } + + /** + * 在当前路径下新建文件夹 + * + * @param folderPath 文件名 + * @return 成功创建返回true + * @throws Exception + */ + @Override + public boolean createFolder(String folderPath, boolean isWebReport) throws Exception { HashMap para = new HashMap(); para.put("op", "fr_remote_design"); para.put("cmd", "design_create_folder"); + para.put("isWebReport", isWebReport ? "true" : "false"); para.put("folder_path", folderPath); HttpClient client = createHttpMethod(para); @@ -840,6 +845,11 @@ public class RemoteEnv implements Env { return Boolean.valueOf(IOUtils.inputStream2String(input, EncodeConstants.ENCODING_UTF_8)); } + @Override + public boolean createFile(String filePath) throws Exception { + return createFile(filePath, false); + } + /** * 新建一个文件 * @@ -847,11 +857,11 @@ public class RemoteEnv implements Env { * @return 成功新建返回true * @throws Exception */ - @Override - public boolean createFile(String filePath) throws Exception { + public boolean createFile(String filePath, boolean isWebReport) throws Exception { HashMap para = new HashMap(); para.put("op", "fr_remote_design"); para.put("cmd", "design_create_file"); + para.put("isWebReport", isWebReport ? "true" : "false"); para.put("file_path", filePath); HttpClient client = createHttpMethod(para); @@ -864,6 +874,23 @@ public class RemoteEnv implements Env { return Boolean.valueOf(IOUtils.inputStream2String(input, EncodeConstants.ENCODING_UTF_8)); } + public boolean renameFile(String newPath, String oldPath) throws Exception { + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_rename_file"); + para.put("newPath", newPath); + para.put("oldPath", oldPath); + + HttpClient client = createHttpMethod(para); + InputStream input = execute4InputStream(client); + + if (input == null) { + return false; + } + + return Boolean.valueOf(IOUtils.inputStream2String(input, EncodeConstants.ENCODING_UTF_8)); + } + /** * 判断文件是否存在 * @@ -942,14 +969,18 @@ public class RemoteEnv implements Env { public void stopUserCheckTimer() { } - - /** - * 删除文件 - * - * @param filePath 文件地址 - * @return 删除成功返回true - */ public boolean deleteFile(String filePath) { + return deleteFile(filePath, false); + } + + + /** + * 删除文件 + * + * @param filePath 文件地址 + * @return 删除成功返回true + */ + public boolean deleteFile(String filePath, boolean isWebReport) { if (filePath == null) { return false; } @@ -957,6 +988,7 @@ public class RemoteEnv implements Env { HashMap para = new HashMap(); para.put("op", "fr_remote_design"); para.put("cmd", "delete_file"); + para.put("isWebReport", isWebReport ? "true" : "false"); para.put("file_path", filePath); HttpClient client = createHttpMethod(para); @@ -1582,6 +1614,53 @@ public class RemoteEnv implements Env { return new Bytes2ServerOutputStream(para); } + /** + * 读取文件 + * + * @param path 文件名 从WebReport开始 + * @return 文件输入流 + */ + @Override + public String readWebReportFile(String path) throws Exception { + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_read_file"); + para.put("path", path); + + HttpClient client = createHttpMethod(para); + InputStream input = execute4InputStream(client); + + if (input == null) { + return null; + } + + return stream2String(input); + } + + /** + * 写文件 + * + * @param path 文件名 + * @return 文件输出流 + */ + @Override + public boolean writeWebReportFile(String path, String content) throws Exception { + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_write_file"); + para.put("path", path); + para.put("content", content); + + HttpClient client = createHttpMethod(para); + InputStream input = execute4InputStream(client); + + if (input == null) { + return false; + } + + return Boolean.valueOf(IOUtils.inputStream2String(input, EncodeConstants.ENCODING_UTF_8)); + } + /** * 返回数据库表的列名 *