2017-02-28 42 views
0

我在Lotus Domino日曆(版本8.5.1)中預定了「全天」,計劃從2017年2月23日到03/01/2017年。我使用NCSO.jar,我試圖讓從Lotus Domino這一任命以這種方式:Lotus Domino日曆(版本8.5.1)中的「全天」返回預約

lotus.domino.Session s = null; 
s = DominoSessionInfo.sessionInfo.getSession(); 
lotus.domino.Database maildb = getMailDb(sessionInfo); 
lotus.domino.DateRange dr = s.createDateRange(startDate, endDate); 
lotus.domino.View calview = maildb.getView("($Calendar)"); 
lotus.domino.ViewEntryCollection docColl = calview.getAllEntriesByKey(dr); 

public static lotus.domino.Database getMailDb(DominoSessionInfo sessionInfo) throws NotesException, NamingException{ 

lotus.domino.Session s = DominoSessionInfo.sessionInfo.getSession(); 
log.info("Open DB on: " + s.getServerName() + " with mail server *" + 
     sessionInfo.getProfileInfo().getMailServer() + "* and mail file *" + 
     sessionInfo.getProfileInfo().getMailFile()); 
    lotus.domino.Database maildb = s.getDatabase(sessionInfo.getProfileInfo().getMailServer(), 
     sessionInfo.getProfileInfo().getMailFile()); 
if (! maildb.isOpen()){ 
    maildb.open(); 
} 
return maildb; 
} 

當dr.getText():2017年2月27日12:00: 00:00 CET - 03/06/2017 12:00:00 AM CET(即開始日期:2017/02/27 12:00:00 CET和結束日期:03/06/2017 12:00:00 AM CET)此代碼如果在dr.getText():02/20/2017 12:00:00 AM CET - 02/27/2017 12:00:00 AM CET(即startDate:02/20/2017 12: 00:00 AM CET and endDate:02/27/2017 12:00:00 AM CET)此代碼返回此約會。

當startDate和endDate的值分別爲02/27/2017 12:00:00 AM CET和03/06/2017 12:00:00時,如何修改代碼以返回此預約AM CET?

在此先感謝。

圖片:Appointment Lotus Notes screenshoot

+0

您是否查看了約會文檔中CalendarDateTime項目中的值,並檢查了時間組件是什麼? –

+0

Hi Richard,約會中的CalendarDateTime項目的值如下; doc.getItemValue(「CalendarDateTime」):[02/23/2017 12:00:00 AM CET] – Edoardo

+0

CalendarDateTime中只有一個值?從2/23到3/1沒有每天都有列表嗎? –

回答

0

最後我能解決這個問題!取而代之的是代碼:

lotus.domino.DateRange dr = s.createDateRange(startDate, endDate); 
lotus.domino.View calview = maildb.getView("($Calendar)"); 
lotus.domino.ViewEntryCollection docColl = calview.getAllEntriesByKey(dr); 

我用這個:

String strDateFormat; 
// Get the date separator used on the Domino server, e.g./or - 
String dateSep = s.getInternational().getDateSep(); 
// Determine if the server date format is DMY, YMD, or MDY 
if (s.getInternational().isDateDMY()) { 
    strDateFormat = "dd" + dateSep + "MM" + dateSep + "yyyy";     
} 
else if (s.getInternational().isDateYMD()) { 
    strDateFormat = "yyyy" + dateSep + "MM" + dateSep + "dd"; 
} 
else { 
    strDateFormat = "MM" + dateSep + "dd" + dateSep + "yyyy"; 
} 
DateFormat dateFormat = new SimpleDateFormat(strDateFormat); 

String calendarQuery = "SELECT (@IsAvailable(CalendarDateTime) & @IsAvailable(EndDateTime) & (@Explode(CalendarDateTime) *<= @Explode(@TextToTime(\"" + dateFormat.format(endDate) + "\"))) (@Explode(EndDateTime) *>= @Explode(@TextToTime(\"" + dateFormat.format(startDate) + "\"))))"; 

lotus.domino.DocumentCollection queryResults = maildb.search(calendarQuery); 

這樣做我能任用返回「全天」(計劃從2017年2月23日到03/01/2017)的任何時間間隔至少包含一天預約計劃。