session = NotesFactory.createSessionWithIOR(ior,username,password);
logger.info("连接邮件服务器成功" );
//得到数据库
database = session.getDatabase(session.getServerName(), mailFile, false);
Document doc = database.createDocument();
View vw = null;
View vw1 = database.getView("Incidents\\All");
if(null == vw1){
logger.info("没有符合条件的视图");
return null;
}
int aa = vw1.FTSearch("测试邮件");
vw1.getAllDocumentsByKey("");
Document doc1 = vw1.getFirstDocument();
int begin = 0;
while(doc1!=null){
Vector columnNames = vw1.getColumns();
if(begin==0){
System.out.println("columnNames -- "+columnNames+" -- end");
}
//------------------------------------------------------------------------------
Vector srVector = doc1.getColumnValues();
//详细列
Vector itemVector = doc1.getItems();
String subject = (String)doc1.getItemValue("Subject_NAV").get(0);
String content = (String)doc1.getItemValue("Findings_NAV").get(0);
String author = (String)doc1.getItemValue("Author_NAV").get(0);
String recipients = (String)doc1.getItemValue("Recipients").get(0);
DateTime created = (DateTime)doc1.getItemValue("Created_NAV").get(0);
System.out.println("发送人="+author+" 标题="+subject+" 内容="+content+" 接收人="+recipients+" 生成日期="+created);
System.out.println("============="+itemVector);
System.out.println("begin -- "+srVector+" -- end");
//------------------------------------------------------------------------------
begin++;
doc1 = www.hnnedu.com vw1.getNextDocument(doc1);
}
str = "success";
} catch (Exception ex) {
if(ex instanceof lotus.domino.NotesException){
logger.info("通过CORBA访问数据库发生错误,错误代码为"+((lotus.domino.NotesException)ex).id);
}
logger.info("连接邮件服务器失败");
str = "fail";
ex.printStackTrace();
}finally{
if(database!=null){
try {
database.recycle();
} catch (NotesException e) {
e.printStackTrace();
}
}
if(session!=null){
try {
session.recycle();
} catch (NotesException e) {
e.printStackTrace();
}
}
}