1
0
mirror of https://github.com/etesync/android synced 2024-11-15 20:38:58 +00:00

Use EntityEvent to populate entities from local DB

This commit is contained in:
Ricki Hirner 2015-05-03 18:32:56 +02:00
parent 365e04154b
commit f19d528739
2 changed files with 186 additions and 208 deletions

View File

@ -191,7 +191,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
try { try {
@Cleanup EntityIterator iter = ContactsContract.RawContacts.newEntityIterator(providerClient.query( @Cleanup EntityIterator iter = ContactsContract.RawContacts.newEntityIterator(providerClient.query(
ContactsContract.RawContactsEntity.CONTENT_URI, syncAdapterURI(ContactsContract.RawContactsEntity.CONTENT_URI),
null, RawContacts._ID + "=" + c.getLocalID(), null, RawContacts._ID + "=" + c.getLocalID(),
null, null)); null, null));
@ -252,8 +252,6 @@ public class LocalAddressBook extends LocalCollection<Contact> {
break; break;
} }
} }
Log.i(TAG, "Populated contact: " + c);
} else } else
throw new RecordNotFoundException(); throw new RecordNotFoundException();
} catch(RemoteException ex) { } catch(RemoteException ex) {
@ -341,7 +339,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
break; break;
case Phone.TYPE_CUSTOM: case Phone.TYPE_CUSTOM:
String customType = row.getAsString(Phone.LABEL); String customType = row.getAsString(Phone.LABEL);
if (!StringUtils.isEmpty(customType)) if (StringUtils.isNotEmpty(customType))
number.addType(TelephoneType.get(labelToXName(customType))); number.addType(TelephoneType.get(labelToXName(customType)));
} }
if (row.getAsBoolean(Phone.IS_PRIMARY)) if (row.getAsBoolean(Phone.IS_PRIMARY))
@ -363,7 +361,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
break; break;
case Email.TYPE_CUSTOM: case Email.TYPE_CUSTOM:
String customType = row.getAsString(Email.LABEL); String customType = row.getAsString(Email.LABEL);
if (!StringUtils.isEmpty(customType)) if (StringUtils.isNotEmpty(customType))
email.addType(EmailType.get(labelToXName(customType))); email.addType(EmailType.get(labelToXName(customType)));
} }
if (row.getAsBoolean(Email.IS_PRIMARY)) if (row.getAsBoolean(Email.IS_PRIMARY))
@ -393,18 +391,18 @@ public class LocalAddressBook extends LocalCollection<Contact> {
title = row.getAsString(Organization.TITLE), title = row.getAsString(Organization.TITLE),
role = row.getAsString(Organization.JOB_DESCRIPTION); role = row.getAsString(Organization.JOB_DESCRIPTION);
if (!StringUtils.isEmpty(company) || !StringUtils.isEmpty(department)) { if (StringUtils.isNotEmpty(company) || StringUtils.isNotEmpty(department)) {
ezvcard.property.Organization org = new ezvcard.property.Organization(); ezvcard.property.Organization org = new ezvcard.property.Organization();
if (!StringUtils.isEmpty(company)) if (StringUtils.isNotEmpty(company))
org.addValue(company); org.addValue(company);
if (!StringUtils.isEmpty(department)) if (StringUtils.isNotEmpty(department))
org.addValue(department); org.addValue(department);
c.setOrganization(org); c.setOrganization(org);
} }
if (!StringUtils.isEmpty(title)) if (StringUtils.isNotEmpty(title))
c.setJobTitle(title); c.setJobTitle(title);
if (!StringUtils.isEmpty(role)) if (StringUtils.isNotEmpty(role))
c.setJobDescription(role); c.setJobDescription(role);
} }
@ -454,7 +452,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
break; break;
case Im.TYPE_CUSTOM: case Im.TYPE_CUSTOM:
String customType = row.getAsString(Im.LABEL); String customType = row.getAsString(Im.LABEL);
if (!StringUtils.isEmpty(customType)) if (StringUtils.isNotEmpty(customType))
impp.addType(ImppType.get(labelToXName(customType))); impp.addType(ImppType.get(labelToXName(customType)));
} }
@ -483,7 +481,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
break; break;
case StructuredPostal.TYPE_CUSTOM: case StructuredPostal.TYPE_CUSTOM:
String customType = row.getAsString(StructuredPostal.LABEL); String customType = row.getAsString(StructuredPostal.LABEL);
if (!StringUtils.isEmpty(customType)) if (StringUtils.isNotEmpty(customType))
address.addType(AddressType.get(labelToXName(customType))); address.addType(AddressType.get(labelToXName(customType)));
break; break;
} }
@ -626,7 +624,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
types.add(RelatedType.SPOUSE); types.add(RelatedType.SPOUSE);
case Relation.TYPE_CUSTOM: case Relation.TYPE_CUSTOM:
String customType = row.getAsString(Relation.LABEL); String customType = row.getAsString(Relation.LABEL);
if (!StringUtils.isEmpty(customType)) if (StringUtils.isNotEmpty(customType))
types.add(RelatedType.get(customType)); types.add(RelatedType.get(customType));
} }
} }
@ -643,7 +641,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
break; break;
case SipAddress.TYPE_CUSTOM: case SipAddress.TYPE_CUSTOM:
String customType = row.getAsString(SipAddress.LABEL); String customType = row.getAsString(SipAddress.LABEL);
if (!StringUtils.isEmpty(customType)) if (StringUtils.isNotEmpty(customType))
impp.addType(ImppType.get(labelToXName(customType))); impp.addType(ImppType.get(labelToXName(customType)));
} }
c.getImpps().add(impp); c.getImpps().add(impp);

View File

@ -16,6 +16,8 @@ import android.content.ContentProviderOperation.Builder;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.ContentUris; import android.content.ContentUris;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Entity;
import android.content.EntityIterator;
import android.database.Cursor; import android.database.Cursor;
import android.database.DatabaseUtils; import android.database.DatabaseUtils;
import android.net.Uri; import android.net.Uri;
@ -260,7 +262,7 @@ public class LocalCalendar extends LocalCollection<Event> {
" AND " + Events.ORIGINAL_SYNC_ID + " NOT IN (" + StringUtils.join(sqlFileNames, ",") + ")"; // retain by remote file name " AND " + Events.ORIGINAL_SYNC_ID + " NOT IN (" + StringUtils.join(sqlFileNames, ",") + ")"; // retain by remote file name
pendingOperations.add(ContentProviderOperation pendingOperations.add(ContentProviderOperation
.newDelete(entriesURI()) .newDelete(entriesURI())
.withSelection(where, new String[] { String.valueOf(id) }) .withSelection(where, new String[]{String.valueOf(id)})
.withYieldAllowed(true) .withYieldAllowed(true)
.build() .build()
); );
@ -273,7 +275,7 @@ public class LocalCalendar extends LocalCollection<Event> {
// delete all exceptions of this event, too // delete all exceptions of this event, too
pendingOperations.add(ContentProviderOperation pendingOperations.add(ContentProviderOperation
.newDelete(entriesURI()) .newDelete(entriesURI())
.withSelection(Events.ORIGINAL_ID+"=?", new String[] { Long.toString(resource.getLocalID()) }) .withSelection(Events.ORIGINAL_ID + "=?", new String[] { Long.toString(resource.getLocalID()) })
.build() .build()
); );
} }
@ -286,7 +288,7 @@ public class LocalCalendar extends LocalCollection<Event> {
pendingOperations.add(ContentProviderOperation pendingOperations.add(ContentProviderOperation
.newUpdate(entriesURI()) .newUpdate(entriesURI())
.withValue(Events.DIRTY, 0) .withValue(Events.DIRTY, 0)
.withSelection(Events.ORIGINAL_ID+"=?", new String[] { Long.toString(resource.getLocalID()) }) .withSelection(Events.ORIGINAL_ID + "=?", new String[] { Long.toString(resource.getLocalID()) })
.build() .build()
); );
} }
@ -296,36 +298,54 @@ public class LocalCalendar extends LocalCollection<Event> {
@Override @Override
public void populate(Resource resource) throws LocalStorageException { public void populate(Resource resource) throws LocalStorageException {
Event e = (Event)resource; Event event = (Event)resource;
try { try {
@Cleanup Cursor cursor = providerClient.query(ContentUris.withAppendedId(entriesURI(), e.getLocalID()), @Cleanup EntityIterator iterEvents = CalendarContract.EventsEntity.newEntityIterator(
new String[] { providerClient.query(
/* 0 */ Events.TITLE, Events.EVENT_LOCATION, Events.DESCRIPTION, syncAdapterURI(CalendarContract.EventsEntity.CONTENT_URI),
/* 3 */ Events.DTSTART, Events.DTEND, Events.EVENT_TIMEZONE, Events.EVENT_END_TIMEZONE, Events.ALL_DAY, null, Events._ID + "=" + event.getLocalID(),
/* 8 */ Events.STATUS, Events.ACCESS_LEVEL, null, null),
/* 10 */ Events.RRULE, Events.RDATE, Events.EXRULE, Events.EXDATE, providerClient
/* 14 */ Events.HAS_ATTENDEE_DATA, Events.ORGANIZER, Events.SELF_ATTENDEE_STATUS, );
/* 17 */ entryColumnUID(), Events.DURATION, Events.AVAILABILITY, while (iterEvents.hasNext()) {
/* 20 */ Events.ORIGINAL_ALL_DAY, Events.ORIGINAL_INSTANCE_TIME Entity e = iterEvents.next();
}, null, null, null);
if (cursor != null && cursor.moveToNext()) {
e.setUid(cursor.getString(17));
e.setSummary(cursor.getString(0)); ContentValues values = e.getEntityValues();
e.setLocation(cursor.getString(1)); populateEvent(event, values);
e.setDescription(cursor.getString(2));
boolean allDay = cursor.getInt(7) != 0; List<Entity.NamedContentValues> subValues = e.getSubValues();
long tsStart = cursor.getLong(3), for (Entity.NamedContentValues subValue : subValues) {
tsEnd = cursor.getLong(4); values = subValue.values;
String duration = cursor.getString(18); if (Attendees.CONTENT_URI.equals(subValue.uri))
populateAttendee(event, values);
if (Reminders.CONTENT_URI.equals(subValue.uri))
populateReminder(event, values);
}
populateExceptions(event);
}
} catch (RemoteException ex) {
throw new LocalStorageException("Couldn't process locally stored event", ex);
}
}
protected void populateEvent(Event e, ContentValues values) {
e.setUid(values.getAsString(entryColumnUID()));
e.setSummary(values.getAsString(Events.TITLE));
e.setLocation(values.getAsString(Events.EVENT_LOCATION));
e.setDescription(values.getAsString(Events.DESCRIPTION));
boolean allDay = values.getAsBoolean(Events.ALL_DAY);
long tsStart = values.getAsLong(Events.DTSTART);
Long tsEnd = values.getAsLong(Events.DTEND);
String duration = values.getAsString(Events.DURATION);
String tzId = null; String tzId = null;
if (allDay) { if (allDay) {
e.setDtStart(tsStart, null); e.setDtStart(tsStart, null);
// provide only DTEND and not DURATION for all-day events if (tsEnd == null) {
if (tsEnd == 0) {
Dur dur = new Dur(duration); Dur dur = new Dur(duration);
java.util.Date dEnd = dur.getTime(new java.util.Date(tsStart)); java.util.Date dEnd = dur.getTime(new java.util.Date(tsStart));
tsEnd = dEnd.getTime(); tsEnd = dEnd.getTime();
@ -335,9 +355,9 @@ public class LocalCalendar extends LocalCollection<Event> {
} else { } else {
// use the start time zone for the end time, too // use the start time zone for the end time, too
// because apps like Samsung Planner allow the user to change "the" time zone but change the start time zone only // because apps like Samsung Planner allow the user to change "the" time zone but change the start time zone only
tzId = cursor.getString(5); tzId = values.getAsString(Events.EVENT_TIMEZONE);
e.setDtStart(tsStart, tzId); e.setDtStart(tsStart, tzId);
if (tsEnd != 0) if (tsEnd != null)
e.setDtEnd(tsEnd, tzId); e.setDtEnd(tsEnd, tzId);
else if (!StringUtils.isEmpty(duration)) else if (!StringUtils.isEmpty(duration))
e.setDuration(new Duration(new Dur(duration))); e.setDuration(new Duration(new Dur(duration)));
@ -345,25 +365,25 @@ public class LocalCalendar extends LocalCollection<Event> {
// recurrence // recurrence
try { try {
String strRRule = cursor.getString(10); String strRRule = values.getAsString(Events.RRULE);
if (!StringUtils.isEmpty(strRRule)) if (!StringUtils.isEmpty(strRRule))
e.setRrule(new RRule(strRRule)); e.setRrule(new RRule(strRRule));
String strRDate = cursor.getString(11); String strRDate = values.getAsString(Events.RDATE);
if (!StringUtils.isEmpty(strRDate)) { if (!StringUtils.isEmpty(strRDate)) {
RDate rDate = new RDate(); RDate rDate = new RDate();
rDate.setValue(strRDate); rDate.setValue(strRDate);
e.setRdate(rDate); e.setRdate(rDate);
} }
String strExRule = cursor.getString(12); String strExRule = values.getAsString(Events.EXRULE);
if (!StringUtils.isEmpty(strExRule)) { if (!StringUtils.isEmpty(strExRule)) {
ExRule exRule = new ExRule(); ExRule exRule = new ExRule();
exRule.setValue(strExRule); exRule.setValue(strExRule);
e.setExrule(exRule); e.setExrule(exRule);
} }
String strExDate = cursor.getString(13); String strExDate = values.getAsString(Events.EXDATE);
if (!StringUtils.isEmpty(strExDate)) { if (!StringUtils.isEmpty(strExDate)) {
// ignored, see https://code.google.com/p/android/issues/detail?id=21426 // ignored, see https://code.google.com/p/android/issues/detail?id=21426
ExDate exDate = new ExDate(); ExDate exDate = new ExDate();
@ -376,22 +396,21 @@ public class LocalCalendar extends LocalCollection<Event> {
Log.w(TAG, "Invalid recurrence rules, ignoring", ex); Log.w(TAG, "Invalid recurrence rules, ignoring", ex);
} }
// recurrence exceptions if (values.containsKey(Events.ORIGINAL_INSTANCE_TIME)) {
if (!cursor.isNull(21)) { // this event is an exception of a recurring event
long originalInstanceTime = cursor.getLong(21); long originalInstanceTime = values.getAsLong(Events.ORIGINAL_INSTANCE_TIME);
boolean originalAllDay = cursor.getInt(20) != 0; boolean originalAllDay = values.getAsBoolean(Events.ORIGINAL_ALL_DAY);
Date originalDate = originalAllDay ? Date originalDate = originalAllDay ?
new Date(originalInstanceTime) : new Date(originalInstanceTime) :
new DateTime(originalInstanceTime); new DateTime(originalInstanceTime);
if (originalDate instanceof DateTime) if (originalDate instanceof DateTime)
((DateTime)originalDate).setUtc(true); ((DateTime)originalDate).setUtc(true);
e.setRecurrenceId(new RecurrenceId(originalDate)); e.setRecurrenceId(new RecurrenceId(originalDate));
} else }
// this event may have exceptions
populateExceptions(e);
// status // status
switch (cursor.getInt(8)) { if (values.containsKey(Events.STATUS))
switch (values.getAsInteger(Events.STATUS)) {
case Events.STATUS_CONFIRMED: case Events.STATUS_CONFIRMED:
e.setStatus(Status.VEVENT_CONFIRMED); e.setStatus(Status.VEVENT_CONFIRMED);
break; break;
@ -403,20 +422,18 @@ public class LocalCalendar extends LocalCollection<Event> {
} }
// availability // availability
e.setOpaque(cursor.getInt(19) != Events.AVAILABILITY_FREE); e.setOpaque(values.getAsInteger(Events.AVAILABILITY) != Events.AVAILABILITY_FREE);
// attendees // set ORGANIZER only when there are attendees
if (cursor.getInt(14) != 0) { // has attendees if (values.getAsBoolean(Events.HAS_ATTENDEE_DATA) && values.containsKey(Events.ORGANIZER))
try { try {
e.setOrganizer(new Organizer(new URI("mailto", cursor.getString(15), null))); e.setOrganizer(new Organizer(new URI("mailto", values.getAsString(Events.ORGANIZER), null)));
} catch (URISyntaxException ex) { } catch (URISyntaxException ex) {
Log.e(TAG, "Error when creating ORGANIZER URI, ignoring", ex); Log.e(TAG, "Error when creating ORGANIZER URI, ignoring", ex);
} }
populateAttendees(e);
}
// classification // classification
switch (cursor.getInt(9)) { switch (values.getAsInteger(Events.ACCESS_LEVEL)) {
case Events.ACCESS_CONFIDENTIAL: case Events.ACCESS_CONFIDENTIAL:
case Events.ACCESS_PRIVATE: case Events.ACCESS_PRIVATE:
e.setForPublic(false); e.setForPublic(false);
@ -424,26 +441,15 @@ public class LocalCalendar extends LocalCollection<Event> {
case Events.ACCESS_PUBLIC: case Events.ACCESS_PUBLIC:
e.setForPublic(true); e.setForPublic(true);
} }
populateReminders(e);
} else
throw new RecordNotFoundException();
} catch(RemoteException ex) {
throw new LocalStorageException(ex);
}
} }
void populateExceptions(Event e) throws RemoteException { void populateExceptions(Event e) throws RemoteException {
Uri exceptionsUri = Events.CONTENT_URI.buildUpon() @Cleanup Cursor c = providerClient.query(syncAdapterURI(Events.CONTENT_URI),
.appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true") new String[]{Events._ID, entryColumnRemoteName()},
.build(); Events.ORIGINAL_ID + "=?", new String[]{ String.valueOf(e.getLocalID()) }, null);
@Cleanup Cursor c = providerClient.query(exceptionsUri, new String[] {
/* 0 */ Events._ID, entryColumnRemoteName()
}, Events.ORIGINAL_ID + "=?", new String[] { String.valueOf(e.getLocalID()) }, null);
while (c != null && c.moveToNext()) { while (c != null && c.moveToNext()) {
long exceptionId = c.getLong(0); long exceptionId = c.getLong(0);
String exceptionRemoteName = c.getString(1); String exceptionRemoteName = c.getString(1);
Log.i(TAG, "Found exception ID " + exceptionId + " of original ID " + e.getLocalID());
try { try {
Event exception = new Event(exceptionId, exceptionRemoteName, null); Event exception = new Event(exceptionId, exceptionRemoteName, null);
populate(exception); populate(exception);
@ -454,29 +460,21 @@ public class LocalCalendar extends LocalCollection<Event> {
} }
} }
void populateAttendees(Event e) throws RemoteException { void populateAttendee(Event event, ContentValues values) throws RemoteException {
Uri attendeesUri = Attendees.CONTENT_URI.buildUpon()
.appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
.build();
@Cleanup Cursor c = providerClient.query(attendeesUri, new String[]{
/* 0 */ Attendees.ATTENDEE_EMAIL, Attendees.ATTENDEE_NAME, Attendees.ATTENDEE_TYPE,
/* 3 */ Attendees.ATTENDEE_RELATIONSHIP, Attendees.STATUS
}, Attendees.EVENT_ID + "=?", new String[]{String.valueOf(e.getLocalID())}, null);
while (c != null && c.moveToNext()) {
try { try {
Attendee attendee = new Attendee(new URI("mailto", c.getString(0), null)); Attendee attendee = new Attendee(new URI("mailto", values.getAsString(Attendees.ATTENDEE_EMAIL), null));
ParameterList params = attendee.getParameters(); ParameterList params = attendee.getParameters();
String cn = c.getString(1); String cn = values.getAsString(Attendees.ATTENDEE_NAME);
if (cn != null) if (cn != null)
params.add(new Cn(cn)); params.add(new Cn(cn));
// type // type
int type = c.getInt(2); int type = values.getAsInteger(Attendees.ATTENDEE_TYPE);
params.add((type == Attendees.TYPE_RESOURCE) ? CuType.RESOURCE : CuType.INDIVIDUAL); params.add((type == Attendees.TYPE_RESOURCE) ? CuType.RESOURCE : CuType.INDIVIDUAL);
// role // role
int relationship = c.getInt(3); int relationship = values.getAsInteger(Attendees.ATTENDEE_RELATIONSHIP);
switch (relationship) { switch (relationship) {
case Attendees.RELATIONSHIP_ORGANIZER: case Attendees.RELATIONSHIP_ORGANIZER:
params.add(Role.CHAIR); params.add(Role.CHAIR);
@ -491,7 +489,7 @@ public class LocalCalendar extends LocalCollection<Event> {
} }
// status // status
switch (c.getInt(4)) { switch (values.getAsInteger(Attendees.ATTENDEE_STATUS)) {
case Attendees.ATTENDEE_STATUS_INVITED: case Attendees.ATTENDEE_STATUS_INVITED:
params.add(PartStat.NEEDS_ACTION); params.add(PartStat.NEEDS_ACTION);
break; break;
@ -506,35 +504,19 @@ public class LocalCalendar extends LocalCollection<Event> {
break; break;
} }
e.getAttendees().add(attendee); event.getAttendees().add(attendee);
} catch (URISyntaxException ex) { } catch (URISyntaxException ex) {
Log.e(TAG, "Couldn't parse attendee information, ignoring", ex); Log.e(TAG, "Couldn't parse attendee information, ignoring", ex);
} }
} }
}
void populateReminders(Event e) throws RemoteException { void populateReminder(Event event, ContentValues row) throws RemoteException {
// reminders VAlarm alarm = new VAlarm(new Dur(0, 0, row.getAsInteger(Reminders.MINUTES), 0));
Uri remindersUri = Reminders.CONTENT_URI.buildUpon()
.appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
.build();
@Cleanup Cursor c = providerClient.query(remindersUri, new String[] {
/* 0 */ Reminders.MINUTES, Reminders.METHOD
}, Reminders.EVENT_ID + "=?", new String[] { String.valueOf(e.getLocalID()) }, null);
while (c != null && c.moveToNext()) {
VAlarm alarm = new VAlarm(new Dur(0, 0, -c.getInt(0), 0));
PropertyList props = alarm.getProperties(); PropertyList props = alarm.getProperties();
switch (c.getInt(1)) {
/*case Reminders.METHOD_EMAIL:
props.add(Action.EMAIL);
break;*/
default:
props.add(Action.DISPLAY); props.add(Action.DISPLAY);
props.add(new Description(e.getSummary())); props.add(new Description(event.getSummary()));
} event.getAlarms().add(alarm);
e.getAlarms().add(alarm);
}
} }
@ -549,6 +531,7 @@ public class LocalCalendar extends LocalCollection<Event> {
.withValue(Events.ALL_DAY, event.isAllDay() ? 1 : 0) .withValue(Events.ALL_DAY, event.isAllDay() ? 1 : 0)
.withValue(Events.DTSTART, event.getDtStartInMillis()) .withValue(Events.DTSTART, event.getDtStartInMillis())
.withValue(Events.EVENT_TIMEZONE, event.getDtStartTzID()) .withValue(Events.EVENT_TIMEZONE, event.getDtStartTzID())
.withValue(Events.HAS_ALARM, event.getAlarms().isEmpty() ? 0 : 1)
.withValue(Events.HAS_ATTENDEE_DATA, event.getAttendees().isEmpty() ? 0 : 1) .withValue(Events.HAS_ATTENDEE_DATA, event.getAttendees().isEmpty() ? 0 : 1)
.withValue(Events.GUESTS_CAN_INVITE_OTHERS, 1) .withValue(Events.GUESTS_CAN_INVITE_OTHERS, 1)
.withValue(Events.GUESTS_CAN_MODIFY, 1) .withValue(Events.GUESTS_CAN_MODIFY, 1)
@ -650,17 +633,14 @@ public class LocalCalendar extends LocalCollection<Event> {
protected void removeDataRows(Resource resource) { protected void removeDataRows(Resource resource) {
Event event = (Event)resource; Event event = (Event)resource;
// delete exceptions // delete exceptions
pendingOperations.add(ContentProviderOperation.newDelete(entriesURI()) pendingOperations.add(ContentProviderOperation.newDelete(syncAdapterURI(Events.CONTENT_URI))
.withSelection(Events.ORIGINAL_ID + "=?", .withSelection(Events.ORIGINAL_ID + "=?", new String[] { String.valueOf(event.getLocalID())}).build());
new String[] { String.valueOf(event.getLocalID()) }).build());
// delete attendees // delete attendees
pendingOperations.add(ContentProviderOperation.newDelete(syncAdapterURI(Attendees.CONTENT_URI)) pendingOperations.add(ContentProviderOperation.newDelete(syncAdapterURI(Attendees.CONTENT_URI))
.withSelection(Attendees.EVENT_ID + "=?", .withSelection(Attendees.EVENT_ID + "=?", new String[] { String.valueOf(event.getLocalID()) }).build());
new String[] { String.valueOf(event.getLocalID()) }).build());
// delete reminders // delete reminders
pendingOperations.add(ContentProviderOperation.newDelete(syncAdapterURI(Reminders.CONTENT_URI)) pendingOperations.add(ContentProviderOperation.newDelete(syncAdapterURI(Reminders.CONTENT_URI))
.withSelection(Reminders.EVENT_ID + "=?", .withSelection(Reminders.EVENT_ID + "=?", new String[] { String.valueOf(event.getLocalID()) }).build());
new String[] { String.valueOf(event.getLocalID()) }).build());
} }