寺田さん、私の方でも調べてみました。
おっしゃるように、繰り返しカレンダーのハンドリングが1つの原因でうまくいっていないようです。
カレンダーの並べ変えのロジックをWhenオブジェクトを参照して行っていますが、繰り返しカレンダーは、Whenオブジェクトを持っていないので、正常に動作しないことになります。
getFirstEntryメソッドを以下のように修正してみました。
修正方法として、並べ替えはCalendarQueryクラスへのパラメータとして実装しました。また、最大取得エントリー数の設定も必要で、いままでは20個程度しか取得できていませんでした。
ご確認いただけますでしょうか。
public BaseDoc getFirstEntry(String syncStartDate) {<br/>
<br/>
Settings mySets = Factory.getSettings();<br/>
URL entryUrl;<br/>
workEntry = null;<br/>
try {<br/>
entryUrl = new URL("http://www.google.com/calendar/feeds/" + mySets.getGoogleAccountName() + "/private/full/");
CalendarService cs = Factory.getCalendarService();<br/>
<br/>
// Set query parameters to specify <br/>
// Date from which GooCalSync start synchronize calendar entries.<br/>
// Calendar entry order to be sorted starttime and ascending.<br/>
// maximun number of entries received. 65535 is set so that all entries could be retrieved actually.<br/>
// recurrence calendar entry retrieved as single entry with recurrence information.<br/>
CalendarQuery myQuery = new CalendarQuery(entryUrl); <br/>
myQuery.setMinimumStartTime(DateTime.parseDateTime(syncStartDate)); <br/>
myQuery.setStringCustomParameter("orderby", "starttime");<br/>
myQuery.setStringCustomParameter("sortorder", "ascending");<br/>
myQuery.setMaxResults(65535);<br/>
myQuery.setStringCustomParameter("singleevents", "false");<br/>
<br/>
CalendarEventFeed workFeed = (CalendarEventFeed) cs.query(myQuery, CalendarEventFeed.class);<br/>
counter = 0;<br/>
<br/>
if (workFeed == null) {<br/>
return null;<br/>
} else {<br/>
workFeedList = workFeed.getEntries();<br/>
if (workFeedList.size() > counter) {<br/>
<br/>
// Commented by M.Ohkawa.<br/>
// This sort logic could not handle recurrence entries.<br/>
// Sorting should be treated by Google API.<br/>
//Collections.sort(workFeedList,new CalendarComparator());<br/>
<br/>
workEntry = workFeedList.get(counter);<br/>
counter++;<br/>
return convEntry(workEntry); <br/>
} else {<br/>
return null;<br/>
}<br/>
}<br/>
} catch (ResourceNotFoundException e) {<br/>
return null;<br/>
} catch (MalformedURLException e) {<br/>
e.printStackTrace();<br/>
System.exit(-1);<br/>
} catch (IOException e) {<br/>
e.printStackTrace();<br/>
System.exit(-1);<br/>
} catch (ServiceException e) {<br/>
e.printStackTrace();<br/>
System.exit(-1);<br/>
}<br/>
return null;<br/>
}