(開始日と終了日の範囲に基づいて)Lotus Notes Dominoサーバーからカレンダーエントリを照会するJavaコードがあります。以下は、コードの簡略版です。日付ロケールに依存しないロータスドミノのカレンダーエントリの照会
日付をローカルクライアントと同じ形式にするDominoサーバーに照会すると、すべて正常です。サーバーとクライアントの両方がm/d/y形式を使用します。ただし、サーバーとクライアントが異なる形式(たとえば、米国の書式m/d/yのサーバーとドイツ語の書式d/m/yのクライアント)を使用している場合、間違った数のLotus Notesエントリが見つかります。
これは、getLocalTime()を使用して日付をローカル文字列に変換し、@TextToTime()を使用して日付範囲を作成するためです。
サーバーで使用している日付形式を確認する方法はありますか? 日付から文字列への変換を完全に回避する方法はありますか?私は、2つのLotus DateTimeオブジェクトを渡し、サーバーが必要に応じてデコードするようにします。
import lotus.domino.*;
Session session = NotesFactory.createSession((String)null, (String)null, password);
Database db = session.getDatabase(dominoServer, mailfile, false);
// Get our start and end query dates in Lotus Notes format. We will query
// using the localized format for the dates.
lotus.domino.DateTime minStartDateLN = session.createDateTime(minStartDate);
lotus.domino.DateTime maxEndDateLN = session.createDateTime(maxEndDate);
// Query Lotus Notes to get calendar entries in our date range.
// Here is an overview of this SELECT:
// @IsAvailable(CalendarDateTime) is true if the LN document is a calendar entry
// @Explode splits a string based on the delimiters ",; "
// The operator *= is a permuted equal operator. It compares all entries on
// the left side to all entries on the right side. If there is at least one
// match, then true is returned. Explode is used because the CalendarDateTime
// field can have many dates separated by ";" (e.g. for recurring meetings).
String calendarQuery = "SELECT (@IsAvailable(CalendarDateTime) & (@Explode(CalendarDateTime) *= @Explode(@TextToTime(\""
+ minStartDateLN.getLocalTime()
+ "-" + maxEndDateLN.getLocalTime() + "\"))))";
DocumentCollection queryResults = db.search(calendarQuery);
私はそれを試みました。私が1つの日付だけを照会していたら、それはうまくいっていました。残念ながら、@日付形式を使用して日付範囲を指定する方法(開始から終了まで)を決めることはできません。 FYI:私は今、機能するソリューションを掲載しました。 –