e) {
e.printStackTrace();
}
}
}
LotusScript 第 8--14 行(清单 14 中)与 Java 等价代码之间最大的不同之处是 RichTextItem 类;在 Java 中,需要使用 Document 类的 createRichTextItem 方法来创建富文本字段(请参见清单 16)。
清单 16. 初始化变量并创建报告电子邮件
import lotus.domino. *;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Database nab;
nab = session.getDatabase("Enter_Server_Name_Here","names.nsf");
Database reportDatabase;
Document personDocument;
Document report;
Document tempDocument;
View view;
String temp;
reportDatabase = agentContext.getCurrentDatabase();
report = reportDatabase.createDocument();
report.replaceItemValue("Form" , "Memo");
report.replaceItemValue("Subject" , "Mail Applications Report");
RichTextItem richTextItem;
richTextItem = report.createRichTextItem("Body");
view = nab.getView("People");
personDocument = view.getFirstDocument();
} catch(Exception e) {
e.printStackTrace();
}
}
}
壓IBM Lotus Domino Designer嶄聞喘Java更秀哘喘殻會(13)
扮寂:2011-01-24 IBM Oscar Hernandez
壓賠汽 14 議及 15--27 佩?厘断壓 while 儉桟嶄頼撹阻寄楚垢恬。壓 Java 嶄?厘断聞喘 try/catch 翠序佩危列侃尖?遇音?壓 LotusScript 嶄椎劔聞喘 On Error 囂鞘。咀葎 getDatabase 圭隈辛嬬砺竃呟械?厘断旋喘 catch 翠栖譜崔 temp 忖憲堪延楚?萩歌需賠汽 17?。
壓 Java 嶄勣芝廖議総匯周並頁嶷喘 Domino 延楚扮勣壓儉桟坪聞喘 recycle 圭隈。壓宸倖蒙歩議 while 儉桟嶄?厘断駅倬芝廖壓耽肝仟議験峙岻念指辺 mailDatabase 才 personDocument。
賠汽 17. 辺鹿喨周方象垂佚連
import lotus.domino. *;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Database nab;
nab = session.getDatabase("Enter_Server_Name_Here","names.nsf");
Database reportDatabase;
Document personDocument;
Document report;
Document tempDocument;
View view;
String temp;
reportDatabase = agentContext.getCurrentDatabase();
report = reportDatabase.createDocument();
report.replaceItemValue("Form" , "Memo");
report.replaceItemValue("Subject" , "Mail Applications Report");
RichTextItem richTextItem;
richTextIt
|