




全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
下面的代码实现了数据导出,并实现了数据导入到其他系统中.,包括附件的处理.public void run(String servername, String username, String password,String dbname, String viewname) try / 取得配置文件取得临时中专的文件目录.提交的数据到服务的名称 ,端口ResourceBundle localizationResources = ResourceBundle.getBundle(ip);/ 临时目录String temppath = localizationResources.getString(temppath);/ 端口String port = localizationResources.getString(port);/ 应用名称String webapp = localizationResources.getString(webapp);/ 文档数量int rundocnum = 0;/ 附件的文件数量int filenum = 0;/ 应用的域名String dominoHost = servername;/ dev1;/ 数据操作的sessionSession session;/ 通过 http 获取 IORString strIOR = null;URL url = new URL(http:/ + dominoHost + /diiop_ior.txt);InputStream in = url.openStream();BufferedReader br = new BufferedReader(new InputStreamReader(in);for (boolean bExit = false; !bExit;) String line = br.readLine();if (line = null) bExit = true; else if (strIOR = null)strIOR = line;elsestrIOR = strIOR + line;if (strIOR.startsWith(IOR:)bExit = true;br.close();/ System.out.println(strIOR - + strIOR);session = NotesFactory.createSessionWithIOR(strIOR, username,password);/ System.out.println(session + session); / 如果这一行打印出来了,表示连接成功/ Database db = session.getDatabase(null, zboa/gkxx.nsf);/ Database db = session.getDatabase(null, zboa/scjyxx.nsf);Database db = session.getDatabase(null, dbname);/ String p = session.getPlatform();/ System.out.println(run Platform = + p);/ 开始执行的时间long a = System.currentTimeMillis();System.out.print(开始计时 );/* Vector vss= (Vector)db.getViews(); List vs=new ArrayList();* for(int i=0;ivss.size();i+) /* vs.add(View)vss.get(i).getName() ; System.out.println(View)* vss.get(i).getName(); * * vss.clear(); System.out.print(getViews+db.getViews().size();* for(int i=0;i2;i+)* System.out.print(用时:+(System.currentTimeMillis()-a); View v =* (View) db.getView(vs.get(i).toString().trim();*/View v = (View) db.getView(viewname);/ 直接使用某个视图/ 当前视图的文档数量int count = v.getAllEntries().getCount();System.out.println(视图名称: + v.getName();System.out.print(别名: + v.getAliases();ViewNavigator nav = v.createViewNav();ViewEntry entry = nav.getFirstDocument();/* 对视图包括的文档的循环查询并处理*/for (int j = 0; j count; j+) rundocnum+;String title = ;String user = ;String body = ;String key = ;List filelist = new ArrayList();System.out.print(j + 1) + .);System.out.println(标题+ entry.getDocument().getItemValueString(title);title = entry.getDocument().getItemValueString(title);String oldname = entry.getDocument().getAuthors().toString().trim();String newname = oldname.substring(oldname.indexOf(cn=) + 5,oldname.indexOf(/OU);user = rmation.util.UserInfoUtil.findUIDbyName(entry.getDocument().getAuthors().toString().trim();System.out.println(作者: + user);body = entry.getDocument().getItemValueString(body);System.out.println(正文: + body);Enumeration items = entry.getDocument().getItems().elements();/ 删除上一个文档附件文件在本地的副本if (!entry.getDocument().getItems().isEmpty() File f1 = new File(temppath);if (f1.isDirectory() for (int m = 0; m 0) byte buf = new byte(int) fileSize;is.read(buf);File f = new File(temppath + /+ EObjAttachment.getSource();FileOutputStream fos = new FileOutputStream(f);fos.write(buf);fos.flush();fos.close();System.out.print(创建文件 + f.getAbsolutePath();filelist.add(f);/ 提交数据到数据库/ 调用增加数据到数据库的方法1 返回一个keykey = 0;/ 此处增加数据到数据库/ 调用http post 的方式提交数据if (filelist.size() 0) InetAddress addr = InetAddress.getLocalHost();String sAddr = addr.toString(); / localhost/String sIP = sAddr.substring(sAddr.indexOf(/) + 1);if (!webapp.equals() webapp = webapp + /;PostMethod filePost = new PostMethod(http:/ + sIP+ : + port + webapp + servlet/upload?key=+ key);System.out.println(http:/ + sIP + : + port+ webapp + servlet/upload?key= + key);try Part parts = new Partfilelist.size();for (int i = 0; i filelist.size(); i+) partsi = new FilePart(hello + i, new File(filelist.get(i).toString();filePost.setRequestEntity(new MultipartRequestEntity(parts, filePost.getParams();HttpClient client = new HttpClient();client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);int status = client.executeMethod(filePost); catch (Exception e) e.printStackTrace();/ 提交完成/ 每当处理完当前文档,必须把指针指向下一个文档地址entry = nav.getNextDocument();System.ou
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年科四考试试题题库及答案
- 慢性粒细胞白血病课件
- 心理演讲素材考试题及答案
- 钦州历史中考试卷及答案
- 管理运营岗位考试题及答案
- 情感障碍护理课件
- 中专外科护理考试题及答案
- 恐龙的时间课件
- 考幼师证考试试题及答案
- 治疗师操作考试题及答案
- 2025年秋季学期安全主题班会教育记录
- 火电厂安全员课件
- 2025年银行内部审计部门财务审计员竞聘考试指南
- 2025至2030中国PCIE行业项目调研及市场前景预测评估报告
- 2025广东深圳市光明区统计局招聘(选聘)专干4人笔试参考题库附答案解析
- Unit 1 A new start Starting out 课件(内嵌音视频)高一英语外研版必修第一册
- 2025年人防工程试题及答案
- 安全烹饪知识培训内容课件
- 2025-2026学年道德与法治八年级上册教学计划
- 中小学校长在2025秋季开学第一次全体教师大会上讲话:人心决定温度人格决定高度人品决定厚度
- 技改管理制度
评论
0/150
提交评论