A Sample Code Stub Written in Java Agent To Transfer Attachment To Blob

xiaoxiao2021-03-06  118

import lotus.domino *;. import java.util.Vector; import java.util.Enumeration; public class JavaAgent extends AgentBase {public void NotesMain () {try {Session session = getSession (); AgentContext agentContext = session.getAgentContext () ; DBHandler lobs = new DBHandler (); // Instantiate root frameDateTime date = session.createDateTime ( "11/11/01"); DocumentCollection dc = agentContext.unprocessedSearch ( "AttachedFile = 1", date, 0); if (dc .Getcount ()! = 0) {INTEGER INTOBJ = New Integer (0); Document Doc = DC.GetFirstDocument (); if (Doc! = null) {Lobs.dbConnection (); if (lobs.m_connection! = null) {while (doc = null!) {Item it = doc.getFirstItem ( "UNID"); RichTextItem rtitem = (RichTextItem) doc.getFirstItem ( "attachfile"); Vector v = rtitem.getEmbeddedObjects (); Enumeration e = v. elements (); while (e.hasMoreElements ()) {EmbeddedObject eo = (EmbeddedObject) e.nextElement (); lobs.insertBLOB (it.getValueString (), eo);} doc.replaceItemValue ( "AttachedFile", intObj); Doc.save (true); doc = dc.getnextdocument (doc);} // End WH ILE (Doc! = null) Lobs.closeSession ();} // end if (lobs.m_connection! = null)} // end if (doc! = null)} log.close ();} catch (Exception E) {E.PrintStackTrace ();}}}

转载请注明原文地址:https://www.9cbs.com/read-100437.html

New Post(0)