全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
下面的代码实现了数据导出,并实现了数据导入到其他系统中.,包括附件的处理.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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年武威市农村信用社联合社秋季校园招聘笔试备考题库(浓缩500题)及答案详解(各地真题)
- 2025年广东省江门市辅警考试真题及答案
- 本溪市农村信用社联合社秋季校园招聘笔试备考题库(浓缩500题)附答案详解(模拟题)
- 2026年莆田市农村信用社联合社秋季校园招聘笔试备考题库(浓缩500题)含答案详解(轻巧夺冠)
- 贵港市农村信用社联合社秋季校园招聘笔试备考题库(浓缩500题)及答案详解(名校卷)
- 2025年高校探访职业试题及答案
- 2025年高校辅导员招聘面试题集及参考答案
- 2026年邯郸市农村信用社联合社秋季校园招聘笔试备考题库(浓缩500题)有答案详解
- 衡阳市农村信用社联合社秋季校园招聘笔试备考题库(浓缩500题)含答案详解(综合卷)
- 2025年云南省特种作人员取证培训以及特种设备作业人员取证培训考试氟化工艺作业复习题库及答案
- 2024年执法资格考试题库(附答案)
- 2024年深圳市龙华建设发展集团有限公司招聘笔试冲刺题(带答案解析)
- 药师竞聘正高述职报告
- 公务员心理健康与调适讲座
- 昇兴(安徽)包装有限公司年产 18 亿只铝制两片罐项目环境影响评价报告书
- 企业电气安全事故案例分析
- 2023学年完整公开课版液压方枕器
- 2023年度环保管家服务招标文件
- 固定式人字抱杆整立施工作业指导书
- 犬胃切开术的课件资料
- 天津某钢厂高速线材主轧线设备安装方案年产万吨
评论
0/150
提交评论