JAVA/CORBA クラス


例:getNextEntity メソッド
次のエージェントは、最初に breadth を検索して、マルチパートエンティティの最後の分岐の最後にある子をすべて取得します。

import lotus.domino.*;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

// (Your code goes here)
// Do not convert MIME to rich text
session.setConvertMIME(false);
DocumentCollection dc = agentContext.getUnprocessedDocuments();
Document doc = dc.getFirstDocument();
while (doc != null) {
MIMEEntity mime = doc.getMIMEEntity();
if (mime != null) {
// Drill down to last child at bottom of first branch
MIMEEntity child = mime.getNextEntity(MIMEEntity.SEARCH_BREADTH);
while (child != null) {
mime = child;
child = mime.getNextEntity(MIMEEntity.SEARCH_BREADTH);
}
Stream stream = session.createStream();
String pathname = "c:\\lotus\\notes\\data\\temp.txt";
if (stream.open(pathname, "us-ascii")) {
// Get content of all children at bottom level
// of first branch in reverse order
while (mime != null) {
mime.getContentAsText(stream, false);
mime = mime.getPrevSibling();
}
}
stream.close();
else System.out.println
("Can't open c:\\lotus\\notes\\data\\temp.txt");
}
else
{
System.out.println
("Not MIME - " + doc.getItemValueString("Subject"));
}
doc = dc.getNextDocument(doc);
}
// Restore conversion
session.setConvertMIME(true);

} catch(Exception e) {
e.printStackTrace();
}
}
}

関連項目