さいすけがExtensionPropertyをどう扱うかをテストしてみました。
以下の手順でテストしました。
Step1. GooCalSyncでGoogle上にカレンダー作成して、ExtensionPropertyをセット。
Step2. さいすけで同期を実行し、iPhone上にカレンダーをもってくる。
Step3. さいすけ上でカレンダーのタイトルを変更し、Googleとの同期を実行。
Step4. GooCalSyncで、ExtentionPropertyで検索。
結果、セットしたExtensionPropertyは削除され、Step4では検索結果がゼロでした。
ExtensionPropertyは、Step3で消されています。さすがに、iCal UIDは変更されていません。
Google上で変更する分には、ExtensionPropertyは消されていませんでした。
やっぱり、ExtensionPropertyは採用できませんね。
そうすると、GooCalSyncのNotesDB上でiCal UIDとNotes UNIDの対応表を持つ案しかないですね。
■Step1でのコード
import com.google.gdata.client.;
import com.google.gdata.client.calendar.;
import com.google.gdata.data.;
import com.google.gdata.data.acl.;
import com.google.gdata.data.calendar.;
import com.google.gdata.data.extensions.;
import com.google.gdata.util.*;
import java.net.URL;
public class addcalext {
/**<br/>
* @param args<br/>
*/<br/>
public static void main(String[] args) {<br/>
try {<br/>
<br/>
CalendarService myService = new CalendarService("OpenNTF-GooCalSyncTest-0.1");<br/>
myService.setUserCredentials("GooCalSync@gmail.com", "lotus123");<br/>
URL postUrl = new URL("http://www.google.com/calendar/feeds/GooCalSync@gmail.com/private/full");
EventEntry myEntry = new EventEntry();<br/>
myEntry.setTitle(new PlainTextConstruct("ExtentionPropertyのテスト"));<br/>
myEntry.setContent(new PlainTextConstruct("GooCalSyncで作成"));<br/>
com.google.gdata.data.DateTime startTime = com.google.gdata.data.DateTime.parseDateTime("2009-04-25T15:00:00-08:00");<br/>
com.google.gdata.data.DateTime endTime = com.google.gdata.data.DateTime.parseDateTime("2009-04-25T17:00:00-08:00");<br/>
<br/>
When eventTimes = new When();<br/>
eventTimes.setStartTime(startTime);<br/>
eventTimes.setEndTime(endTime);<br/>
myEntry.addTime(eventTimes);<br/>
<br/>
// Send the request and receive the response:<br/>
System.out.println("Posting calendar data....");<br/>
EventEntry insertedEntry = myService.insert(postUrl, myEntry);<br/>
<br/>
//Extendedプロパティの追加<br/>
ExtendedProperty property = new ExtendedProperty();<br/>
property.setName("X-GooCalSync-LotusNotesUNID");<br/>
property.setValue("1111222233334444AAAABBBBCCCCDDDD");<br/>
insertedEntry.addExtension(property);<br/>
insertedEntry.update();<br/>
<br/>
System.out.println("Finished!");<br/>
} catch (ServiceException se) {<br/>
System.out.println("ServiceException is caught by Google Data API ");<br/>
se.printStackTrace();<br/>
} catch(Exception e) {<br/>
e.printStackTrace();<br/>
}<br/>
}<br/>
}
■Step4でのコード
import com.google.gdata.client.;
import com.google.gdata.client.calendar.;
import com.google.gdata.data.;
import com.google.gdata.data.acl.;
import com.google.gdata.data.calendar.;
import com.google.gdata.data.extensions.;
import com.google.gdata.util.*;
import java.net.URL;
import java.net.URL;
public class searchcalext {
public static void main(String[] args) {<br/>
<br/>
try {<br/>
<br/>
CalendarService myService = new CalendarService("OpenNTF-GooCalSyncTest-0.1");<br/>
myService.setUserCredentials("GooCalSync@gmail.com", "lotus123"); <br/>
<br/>
URL entryUrl = new URL("http://www.google.com/calendar/feeds/GooCalSync@gmail.com/private/full");
CalendarQuery cquery = new CalendarQuery(entryUrl);<br/>
cquery.setExtendedPropertyQuery(CalendarQuery.ExtendedPropertyMatch.arrayFromExtendedPropertyQueryString("[X-GooCalSync-LotusNotesUNID:1111222233334444AAAABBBBCCCCDDDD]"));<br/>
CalendarEventFeed resultFeed = myService.query(cquery, CalendarEventFeed.class);<br/>
System.out.println("Extensionエントリ数:" + resultFeed.getEntries().size());<br/>
for (int i = 0; i < resultFeed.getEntries().size(); i++) {<br/>
CalendarEventEntry entry = resultFeed.getEntries().get(i);<br/>
System.out.println(entry.getTitle().getPlainText());<br/>
} <br/>
<br/>
System.out.println("Finished!");<br/>
} catch (ServiceException se) {<br/>
System.out.println("ServiceException is caught by Google Data API ");<br/>
se.printStackTrace();<br/>
} catch(Exception e) {<br/>
e.printStackTrace();<br/>
}<br/>
<br/>
}<br/>
}