




下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、下面的代碼實(shí)現(xiàn)了數(shù)據(jù)導(dǎo)出,并實(shí)現(xiàn)了數(shù)據(jù)導(dǎo)入到其他系統(tǒng)中.,包括附件的處理.public void run(String servername, String username, String password,String dbname, String viewname) try / 取得配置文件取得臨時(shí)中專的文件目錄.提交的數(shù)據(jù)到服務(wù)的名稱 ,端口ResourceBundle localizationResources = ResourceBundle.getBundle("ip");/ 臨時(shí)目錄String temppath = localizationResource
2、s.getString("temppath");/ 端口String port = localizationResources.getString("port");/ 應(yīng)用名稱String webapp = localizationResources.getString("webapp");/ 文檔數(shù)量int rundocnum = 0;/ 附件的文件數(shù)量int = 0;/ 應(yīng)用的域名String dominoHost = servername;/ "dev1"/ 數(shù)據(jù)操作的sessionSession sessi
3、on;/ 通過 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)
4、 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
5、" + 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
6、 = " + p);/ 開始執(zhí)行的時(shí)間long a = System.currentTimeMillis();System.out.print("開始計(jì)時(shí) ");/* Vector vss= (Vector)db.getViews(); List vs=new ArrayList();* for(int i=0;i<vss.size();i+) /* vs.add(View)vss.get(i).getName() ; System.out.println(View)* vss.get(i).getName(); * * vss.clear(); Syste
7、m.out.print("getViews"+db.getViews().size();* for(int i=0;i<2;i+)* System.out.print("用時(shí):"+(System.currentTimeMillis()-a); View v =* (View) db.getView(vs.get(i).toString().trim();*/View v = (View) db.getView(viewname);/ 直接使用某個(gè)視圖/ 當(dāng)前視圖的文檔數(shù)量int count = v.getAllEntries().getCount(
8、);System.out.println("視圖名稱:" + v.getName();System.out.print("別名:" + v.getAliases();ViewNavigator nav = v.createViewNav();ViewEntry entry = nav.getFirstDocument();/* 對(duì)視圖包括的文檔的循環(huán)查詢并處理*/for (int j = 0; j < count; j+) rundocnum+;String title = ""String user = ""
9、;String body = ""String key = ""List = new ArrayList();System.out.print(j + 1) + ".");System.out.println("標(biāo)題"+ entry.getDocument().getItemValueString("title");title = entry.getDocument().getItemValueString("title");String oldname = entry.ge
10、tDocument().getAuthors().toString().trim();String newname = oldname.substring(oldname.indexOf("cn=") + 5,oldname.indexOf("/OU");user = erInfoUtil.findUIDbyName(entry.getDocument().getAuthors().toString().trim();System.out.println("作者:" + user);body = entry.getDocument()
11、.getItemValueString("body");System.out.println("正文:" + body);Enumeration items = entry.getDocument().getItems().elements();/ 刪除上一個(gè)文檔附件文件在本地的副本if (!entry.getDocument().getItems().isEmpty() = new );if (f1.isDirectory() for (int m = 0; m < f1.listFiles().length; m+) System.out.pr
12、int("刪除文件"+ f1.listFiles()m.getAbsoluteFile().getPath();f1.listFiles()m.getAbsoluteFile().delete();/ 對(duì)當(dāng)前文檔的附件生成副本并上傳到服務(wù)器while (items.hasMoreElements() Item item = (Item) items.nextElement();if (item.getType() != Item.ATTACHMENT) else ;System.out.println("附件:"+ entry.getDocument()
13、.getAttachment(item.getValueString().getName();EmbeddedObject EObjAttachment = entry.getDocument().getAttachment(item.getValueString();InputStream is = EObjAttachment.getInputStream();long = is.available();if ( > 0) byte buf = new byte(int) ;is.read(buf);File f = new + "/"+ EObjAttachme
14、nt.getSource(); fos = new (f);fos.write(buf);fos.flush();fos.close();System.out.print("創(chuàng)建文件" + f.getAbsolutePath();(f);/ 提交數(shù)據(jù)到數(shù)據(jù)庫/ 調(diào)用增加數(shù)據(jù)到數(shù)據(jù)庫的方法1 返回一個(gè)keykey = "0"/ 此處增加數(shù)據(jù)到數(shù)據(jù)庫/ 調(diào)用http post 的方式提交數(shù)據(jù)if () > 0) InetAddress addr = InetAddress.getLocalHost();String sAddr = addr.toStr
15、ing(); / localhost/String sIP = sAddr.substring(sAddr.indexOf('/') + 1);if (!webapp.equals("") webapp = webapp + "/"PostMethod = new PostMethod("http:/" + sIP+ ":" + port + webapp + "servlet/upload?key="+ key);System.out.println(&quo
16、t;http:/" + sIP + ":" + port+ webapp + "servlet/upload?key=" + key);try Part parts = new Part();for (int i = 0; i < (); i+) partsi = new ("hello" + i, new File(i).toString();.setRequestEntity(new MultipartRequestEntity(parts, ();HttpClient client = new HttpClient();client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);int status = client.executeMethod(); catch (Exception e) e.printStackTrace();/ 提交完成/ 每當(dāng)處理完當(dāng)前文檔,必須把指針指向下一個(gè)文檔地址entry = nav.getNextDocument();
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 安全員崗位知識(shí)培訓(xùn)課件
- 取水論證報(bào)告范文
- 求職機(jī)構(gòu)報(bào)告范文
- 情緒調(diào)控研究報(bào)告范文
- 浙江國(guó)企招聘2024金華蘭溪市興瀾旅游開發(fā)有限公司招聘4人筆試參考題庫附帶答案詳解
- 鉗工理論知識(shí)培訓(xùn)課件
- 二零二五年度辦公室租賃及智能安防系統(tǒng)合同
- 二零二五年度贈(zèng)與子女房產(chǎn)及裝修設(shè)計(jì)一體化協(xié)議
- 二零二五年度幼兒托管與環(huán)保教育服務(wù)協(xié)議
- 二零二五年度紋身藝術(shù)市場(chǎng)分析與營(yíng)銷協(xié)議
- 2025年湖南司法警官職業(yè)學(xué)院?jiǎn)握新殬I(yè)技能測(cè)試題庫審定版
- 2025年湖南科技職業(yè)學(xué)院?jiǎn)握新殬I(yè)技能測(cè)試題庫匯編
- 《火力發(fā)電廠水處理技術(shù)概述》課件
- 春節(jié)后復(fù)工安全培訓(xùn)課件
- 全國(guó)電子工業(yè)版初中信息技術(shù)第二冊(cè)第2單元2.1活動(dòng)3《使用云盤備份數(shù)據(jù)》教學(xué)設(shè)計(jì)
- 2025海南三亞政府雇員人才儲(chǔ)備庫招聘300人易考易錯(cuò)模擬試題(共500題)試卷后附參考答案
- 招標(biāo)代理服務(wù)投標(biāo)方案(技術(shù)標(biāo))
- 財(cái)務(wù)人員防騙技巧培訓(xùn)課件
- 交替?zhèn)髯g課件外研社王丹
- 人教版(2024)八年級(jí)下冊(cè)物理第九章《壓強(qiáng)》第4節(jié) 跨學(xué)科實(shí)踐:制作簡(jiǎn)易活塞式抽水機(jī) 教案
- 《餐飲業(yè)概述》課件 - 探索美食與服務(wù)之道
評(píng)論
0/150
提交評(píng)論