michael@0: /** michael@0: * Copyright (c) 2012-2013, Gerald Garcia, Timo Berger michael@0: * michael@0: * This file is part of Andoid Caldav Sync Adapter Free. michael@0: * michael@0: * Andoid Caldav Sync Adapter Free is free software: you can redistribute michael@0: * it and/or modify it under the terms of the GNU General Public License michael@0: * as published by the Free Software Foundation, either version 3 of the michael@0: * License, or at your option any later version. michael@0: * michael@0: * Andoid Caldav Sync Adapter Free is distributed in the hope that michael@0: * it will be useful, but WITHOUT ANY WARRANTY; without even the implied michael@0: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the michael@0: * GNU General Public License for more details. michael@0: * michael@0: * You should have received a copy of the GNU General Public License michael@0: * along with Andoid Caldav Sync Adapter Free. michael@0: * If not, see . michael@0: * michael@0: */ michael@0: michael@0: package org.gege.caldavsyncadapter.android.entities; michael@0: michael@0: import java.net.URISyntaxException; michael@0: import java.text.ParseException; michael@0: import net.fortuna.ical4j.model.Calendar; michael@0: import net.fortuna.ical4j.model.Component; michael@0: import net.fortuna.ical4j.model.ComponentList; michael@0: import net.fortuna.ical4j.model.Date; michael@0: import net.fortuna.ical4j.model.DateTime; michael@0: import net.fortuna.ical4j.model.Dur; michael@0: import net.fortuna.ical4j.model.ParameterList; michael@0: import net.fortuna.ical4j.model.Property; michael@0: import net.fortuna.ical4j.model.PropertyList; michael@0: import net.fortuna.ical4j.model.TimeZone; michael@0: import net.fortuna.ical4j.model.TimeZoneRegistry; michael@0: import net.fortuna.ical4j.model.TimeZoneRegistryFactory; michael@0: import net.fortuna.ical4j.model.component.VAlarm; michael@0: import net.fortuna.ical4j.model.component.VEvent; michael@0: import net.fortuna.ical4j.model.parameter.Cn; michael@0: import net.fortuna.ical4j.model.parameter.PartStat; michael@0: import net.fortuna.ical4j.model.parameter.Role; michael@0: import net.fortuna.ical4j.model.parameter.Rsvp; michael@0: import net.fortuna.ical4j.model.parameter.Value; michael@0: import net.fortuna.ical4j.model.property.Action; michael@0: import net.fortuna.ical4j.model.property.Attendee; michael@0: import net.fortuna.ical4j.model.property.CalScale; michael@0: import net.fortuna.ical4j.model.property.Clazz; michael@0: import net.fortuna.ical4j.model.property.Description; michael@0: import net.fortuna.ical4j.model.property.DtEnd; michael@0: import net.fortuna.ical4j.model.property.DtStart; michael@0: import net.fortuna.ical4j.model.property.Duration; michael@0: import net.fortuna.ical4j.model.property.ExDate; michael@0: import net.fortuna.ical4j.model.property.ExRule; michael@0: import net.fortuna.ical4j.model.property.Location; michael@0: import net.fortuna.ical4j.model.property.Organizer; michael@0: import net.fortuna.ical4j.model.property.ProdId; michael@0: import net.fortuna.ical4j.model.property.RDate; michael@0: import net.fortuna.ical4j.model.property.RRule; michael@0: import net.fortuna.ical4j.model.property.Status; michael@0: import net.fortuna.ical4j.model.property.Summary; michael@0: import net.fortuna.ical4j.model.property.Trigger; michael@0: import net.fortuna.ical4j.model.property.Uid; michael@0: import net.fortuna.ical4j.model.property.Version; michael@0: //import android.accounts.Account; michael@0: //import android.content.ContentProviderClient; michael@0: //import android.content.ContentValues; michael@0: //import android.content.SyncStats; michael@0: import android.database.Cursor; michael@0: import android.net.Uri; michael@0: //import android.os.RemoteException; michael@0: import android.provider.CalendarContract.Attendees; michael@0: //import android.provider.CalendarContract.Calendars; michael@0: import android.provider.CalendarContract.Events; michael@0: import android.provider.CalendarContract.Reminders; michael@0: michael@0: //import org.gege.caldavsyncadapter.Event; michael@0: //import org.gege.caldavsyncadapter.caldav.CaldavFacade; michael@0: import org.gege.caldavsyncadapter.caldav.entities.CalendarEvent; michael@0: //import org.gege.caldavsyncadapter.caldav.entities.DavCalendar; michael@0: //import org.gege.caldavsyncadapter.syncadapter.SyncAdapter; michael@0: michael@0: public class AndroidEvent extends org.gege.caldavsyncadapter.Event { michael@0: michael@0: private Uri muri; michael@0: michael@0: private Uri mAndroidCalendarUri; michael@0: michael@0: /** michael@0: * the list of attendees michael@0: */ michael@0: private PropertyList mAttendees = new PropertyList(); michael@0: michael@0: /** michael@0: * the list of reminders michael@0: */ michael@0: private ComponentList mReminders = new ComponentList(); michael@0: michael@0: private Calendar mCalendar = null; michael@0: michael@0: /* private Account mAccount = null; michael@0: private ContentProviderClient mProvider = null;*/ michael@0: michael@0: //public AndroidEvent(Account account, ContentProviderClient provider, Uri uri, Uri calendarUri) { michael@0: public AndroidEvent(Uri uri, Uri calendarUri) { michael@0: super(); michael@0: this.setUri(uri); michael@0: /* this.mAccount = account; michael@0: this.mProvider = provider;*/ michael@0: //this.setCounterpartUri(calendarUri); michael@0: mAndroidCalendarUri = calendarUri; michael@0: } michael@0: michael@0: public Calendar getIcsEvent() { michael@0: return mCalendar; michael@0: } michael@0: michael@0: public String getETag() { michael@0: String Result = ""; michael@0: if (this.ContentValues.containsKey(ETAG)) michael@0: Result = this.ContentValues.getAsString(ETAG); michael@0: return Result; michael@0: } michael@0: michael@0: public void setETag(String eTag) { michael@0: this.ContentValues.put(ETAG, eTag); michael@0: } michael@0: michael@0: public Uri getUri() { michael@0: return muri; michael@0: } michael@0: michael@0: public void setUri(Uri uri) { michael@0: this.muri = uri; michael@0: } michael@0: michael@0: public Uri getAndroidCalendarUri() { michael@0: return mAndroidCalendarUri; michael@0: } michael@0: michael@0: @Override michael@0: public String toString() { michael@0: return this.getUri().toString(); michael@0: } michael@0: michael@0: /** michael@0: * reads an android event from a given cursor into {@link AndroidEvent#ContentValues} michael@0: * @param cur the cursor with the event michael@0: * @return success of this funtion michael@0: * @see AndroidEvent#ContentValues michael@0: */ michael@0: public boolean readContentValues(Cursor cur) { michael@0: this.setETag(cur.getString(cur.getColumnIndex(ETAG))); michael@0: michael@0: this.ContentValues.put(Events.EVENT_TIMEZONE, cur.getString(cur.getColumnIndex(Events.EVENT_TIMEZONE))); michael@0: this.ContentValues.put(Events.EVENT_END_TIMEZONE, cur.getString(cur.getColumnIndex(Events.EVENT_END_TIMEZONE))); michael@0: this.ContentValues.put(Events.DTSTART, cur.getLong(cur.getColumnIndex(Events.DTSTART))); michael@0: this.ContentValues.put(Events.DTEND, cur.getLong(cur.getColumnIndex(Events.DTEND))); michael@0: this.ContentValues.put(Events.ALL_DAY, cur.getLong(cur.getColumnIndex(Events.ALL_DAY))); michael@0: this.ContentValues.put(Events.TITLE, cur.getString(cur.getColumnIndex(Events.TITLE))); michael@0: this.ContentValues.put(Events.CALENDAR_ID, cur.getString(cur.getColumnIndex(Events.CALENDAR_ID))); michael@0: this.ContentValues.put(Events._SYNC_ID, cur.getString(cur.getColumnIndex(Events._SYNC_ID))); michael@0: //this.ContentValues.put(Events.SYNC_DATA1, cur.getString(cur.getColumnIndex(Events.SYNC_DATA1))); //not needed here, eTag has already been read michael@0: this.ContentValues.put(Events.DESCRIPTION, cur.getString(cur.getColumnIndex(Events.DESCRIPTION))); michael@0: this.ContentValues.put(Events.EVENT_LOCATION, cur.getString(cur.getColumnIndex(Events.EVENT_LOCATION))); michael@0: this.ContentValues.put(Events.ACCESS_LEVEL, cur.getInt(cur.getColumnIndex(Events.ACCESS_LEVEL))); michael@0: michael@0: this.ContentValues.put(Events.STATUS, cur.getInt(cur.getColumnIndex(Events.STATUS))); michael@0: michael@0: this.ContentValues.put(Events.LAST_DATE, cur.getInt(cur.getColumnIndex(Events.LAST_DATE))); michael@0: this.ContentValues.put(Events.DURATION, cur.getString(cur.getColumnIndex(Events.DURATION))); michael@0: michael@0: this.ContentValues.put(Events.RDATE, cur.getString(cur.getColumnIndex(Events.RDATE))); michael@0: this.ContentValues.put(Events.RRULE, cur.getString(cur.getColumnIndex(Events.RRULE))); michael@0: this.ContentValues.put(Events.EXRULE, cur.getString(cur.getColumnIndex(Events.EXRULE))); michael@0: this.ContentValues.put(Events.EXDATE, cur.getString(cur.getColumnIndex(Events.EXDATE))); michael@0: this.ContentValues.put(Events.DIRTY, cur.getInt(cur.getColumnIndex(Events.DIRTY))); michael@0: this.ContentValues.put(UID, cur.getString(cur.getColumnIndex(UID))); michael@0: this.ContentValues.put(RAWDATA, cur.getString(cur.getColumnIndex(RAWDATA))); michael@0: michael@0: return true; michael@0: } michael@0: michael@0: /** michael@0: * reads the attendees from a given cursor michael@0: * @param cur the cursor with the attendees michael@0: * @return success of this function michael@0: * @see AndroidEvent#mAttendees michael@0: */ michael@0: public boolean readAttendees(Cursor cur) { michael@0: Attendee attendee = null; michael@0: Organizer organizer = null; michael@0: ParameterList paraList = null; michael@0: michael@0: String Name = ""; michael@0: Cn cn = null; michael@0: michael@0: String Email = ""; michael@0: michael@0: int Relationship = 0; michael@0: michael@0: michael@0: int Status = 0; michael@0: PartStat partstat = null; michael@0: michael@0: int Type = 0; michael@0: Role role = null; michael@0: michael@0: try { michael@0: while (cur.moveToNext()) { michael@0: Name = cur.getString(cur.getColumnIndex(Attendees.ATTENDEE_NAME)); michael@0: Email = cur.getString(cur.getColumnIndex(Attendees.ATTENDEE_EMAIL)); michael@0: Relationship = cur.getInt(cur.getColumnIndex(Attendees.ATTENDEE_RELATIONSHIP)); michael@0: Type = cur.getInt(cur.getColumnIndex(Attendees.ATTENDEE_TYPE)); michael@0: Status = cur.getInt(cur.getColumnIndex(Attendees.ATTENDEE_STATUS)); michael@0: michael@0: if (Relationship == Attendees.RELATIONSHIP_ORGANIZER) { michael@0: organizer = new Organizer(); michael@0: organizer.setValue("mailto:" + Email); michael@0: paraList = organizer.getParameters(); michael@0: mAttendees.add(organizer); michael@0: } else { michael@0: attendee = new Attendee(); michael@0: attendee.setValue("mailto:" + Email); michael@0: paraList = attendee.getParameters(); michael@0: mAttendees.add(attendee); michael@0: } michael@0: michael@0: Rsvp rsvp = new Rsvp(true); michael@0: paraList.add(rsvp); michael@0: michael@0: cn = new Cn(Name); michael@0: paraList.add(cn); michael@0: michael@0: if (Status == Attendees.ATTENDEE_STATUS_INVITED) michael@0: partstat = new PartStat(PartStat.NEEDS_ACTION.getValue()); michael@0: else if (Status == Attendees.ATTENDEE_STATUS_ACCEPTED) michael@0: partstat = new PartStat(PartStat.ACCEPTED.getValue()); michael@0: else if (Status == Attendees.ATTENDEE_STATUS_DECLINED) michael@0: partstat = new PartStat(PartStat.DECLINED.getValue()); michael@0: else if (Status == Attendees.ATTENDEE_STATUS_NONE) michael@0: partstat = new PartStat(PartStat.COMPLETED.getValue()); michael@0: else if (Status == Attendees.ATTENDEE_STATUS_TENTATIVE) michael@0: partstat = new PartStat(PartStat.TENTATIVE.getValue()); michael@0: else michael@0: partstat = new PartStat(PartStat.NEEDS_ACTION.getValue()); michael@0: paraList.add(partstat); michael@0: michael@0: if (Type == Attendees.TYPE_OPTIONAL) michael@0: role = new Role(Role.OPT_PARTICIPANT.getValue()); michael@0: else if (Type == Attendees.TYPE_NONE) michael@0: role = new Role(Role.NON_PARTICIPANT.getValue()); //regular participants in android are non required? michael@0: else if (Type == Attendees.TYPE_REQUIRED) michael@0: role = new Role(Role.REQ_PARTICIPANT.getValue()); michael@0: else michael@0: role = new Role(Role.NON_PARTICIPANT.getValue()); michael@0: paraList.add(role); michael@0: } michael@0: michael@0: } catch (URISyntaxException e) { michael@0: e.printStackTrace(); michael@0: } michael@0: return true; michael@0: } michael@0: michael@0: /** michael@0: * reads the reminders from a given cursor michael@0: * @param cur the cursor with the reminders michael@0: * @return success of this function michael@0: */ michael@0: public boolean readReminder(Cursor cur) { michael@0: int Method; michael@0: int Minutes; michael@0: VAlarm reminder; michael@0: while (cur.moveToNext()) { michael@0: reminder = new VAlarm(); michael@0: Method = cur.getInt(cur.getColumnIndex(Reminders.METHOD)); michael@0: Minutes = cur.getInt(cur.getColumnIndex(Reminders.MINUTES)) * -1; michael@0: michael@0: michael@0: Dur dur = new Dur(0, 0, Minutes, 0); michael@0: Trigger tri = new Trigger(dur); michael@0: Value val = new Value(Duration.DURATION); michael@0: tri.getParameters().add(val); michael@0: reminder.getProperties().add(tri); michael@0: michael@0: Description desc = new Description(); michael@0: desc.setValue("caldavsyncadapter standard description"); michael@0: reminder.getProperties().add(desc); michael@0: michael@0: michael@0: if (Method == Reminders.METHOD_EMAIL) michael@0: reminder.getProperties().add(Action.EMAIL); michael@0: else michael@0: reminder.getProperties().add(Action.DISPLAY); michael@0: michael@0: this.mReminders.add(reminder); michael@0: } michael@0: return true; michael@0: } michael@0: michael@0: /** michael@0: * generates a new ics-file. michael@0: * uses {@link AndroidEvent#ContentValues} as source. michael@0: * this should only be used when a new event has been generated within android. michael@0: * @param strUid the UID for this event. example: UID:e6be67c6-eff0-44f8-a1a0-6c2cb1029944-caldavsyncadapter michael@0: * @return success of the function michael@0: * @see CalendarEvent#fetchBody() michael@0: */ michael@0: public boolean createIcs(String strUid) { michael@0: boolean Result = false; michael@0: TimeZone timezone = null; michael@0: TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); michael@0: //TODO: do not simply create the ics-file new. take into account the RAWDATA if available michael@0: /* michael@0: * dtstart=1365598800000 michael@0: * dtend=1365602400000 michael@0: * eventTimezone=Europe/Berlin michael@0: * eventEndTimezone=null michael@0: * duration=null michael@0: * allDay=0 michael@0: * rrule=null michael@0: * rdate=null michael@0: * exrule=null michael@0: * exdate=null michael@0: * title=Einurlner Termin michael@0: * description=null michael@0: * eventLocation=null michael@0: * accessLevel=0 michael@0: * eventStatus=0 michael@0: * michael@0: * calendar_id=4 michael@0: * lastDate=-197200128 michael@0: * sync_data1=null michael@0: * _sync_id=null michael@0: * dirty=1 michael@0: */ michael@0: michael@0: try { michael@0: mCalendar = new Calendar(); michael@0: PropertyList propCalendar = mCalendar.getProperties(); michael@0: propCalendar.add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN")); michael@0: propCalendar.add(Version.VERSION_2_0); michael@0: propCalendar.add(CalScale.GREGORIAN); michael@0: michael@0: VEvent event = new VEvent(); michael@0: mCalendar.getComponents().add(event); michael@0: PropertyList propEvent = event.getProperties(); michael@0: michael@0: // DTSTAMP -> is created by new VEvent() automatical michael@0: //na michael@0: michael@0: // CREATED michael@0: //na michael@0: michael@0: // LAST-MODIFIED michael@0: //na michael@0: michael@0: // SEQUENCE michael@0: //na michael@0: michael@0: // DTSTART michael@0: long lngStart = this.ContentValues.getAsLong(Events.DTSTART); michael@0: String strTZStart = this.ContentValues.getAsString(Events.EVENT_TIMEZONE); michael@0: boolean allDay = this.ContentValues.getAsBoolean(Events.ALL_DAY); michael@0: if (lngStart > 0) { michael@0: DtStart dtStart = new DtStart(); michael@0: if (allDay) { michael@0: Date dateStart = new Date(); michael@0: dateStart.setTime(lngStart); michael@0: dtStart.setDate(dateStart); michael@0: } else { michael@0: DateTime datetimeStart = new DateTime(); michael@0: datetimeStart.setTime(lngStart); michael@0: dtStart.setDate(datetimeStart); michael@0: michael@0: timezone = registry.getTimeZone(strTZStart); michael@0: dtStart.setTimeZone(timezone); michael@0: michael@0: // no timezone information for allDay events michael@0: mCalendar.getComponents().add(timezone.getVTimeZone()); michael@0: } michael@0: propEvent.add(dtStart); michael@0: } michael@0: michael@0: // DTEND michael@0: long lngEnd = this.ContentValues.getAsLong(Events.DTEND); michael@0: String strTZEnd = this.ContentValues.getAsString(Events.EVENT_END_TIMEZONE); michael@0: if (strTZEnd == null) michael@0: strTZEnd = strTZStart; michael@0: if (lngEnd > 0) { michael@0: DtEnd dtEnd = new DtEnd(); michael@0: if (allDay) { michael@0: Date dateEnd = new Date(); michael@0: dateEnd.setTime(lngEnd); michael@0: dtEnd.setDate(dateEnd); michael@0: } else { michael@0: DateTime datetimeEnd = new DateTime(); michael@0: datetimeEnd.setTime(lngEnd); michael@0: dtEnd.setDate(datetimeEnd); michael@0: if (strTZEnd != null) michael@0: timezone = registry.getTimeZone(strTZEnd); michael@0: dtEnd.setTimeZone(timezone); michael@0: } michael@0: propEvent.add(dtEnd); michael@0: } michael@0: michael@0: // DURATION michael@0: if (this.ContentValues.containsKey(Events.DURATION)) { michael@0: String strDuration = this.ContentValues.getAsString(Events.DURATION); michael@0: if (strDuration != null) { michael@0: Duration duration = new Duration(); michael@0: duration.setValue(strDuration); michael@0: michael@0: propEvent.add(duration); michael@0: } michael@0: } michael@0: michael@0: //RRULE michael@0: if (this.ContentValues.containsKey(Events.RRULE)) { michael@0: String strRrule = this.ContentValues.getAsString(Events.RRULE); michael@0: if (strRrule != null) { michael@0: if (!strRrule.equals("")) { michael@0: RRule rrule = new RRule(); michael@0: rrule.setValue(strRrule); michael@0: propEvent.add(rrule); michael@0: } michael@0: } michael@0: } michael@0: michael@0: //RDATE michael@0: if (this.ContentValues.containsKey(Events.RDATE)) { michael@0: String strRdate = this.ContentValues.getAsString(Events.RDATE); michael@0: if (strRdate != null) { michael@0: if (!strRdate.equals("")) { michael@0: RDate rdate = new RDate(); michael@0: rdate.setValue(strRdate); michael@0: propEvent.add(rdate); michael@0: } michael@0: } michael@0: } michael@0: michael@0: //EXRULE michael@0: if (this.ContentValues.containsKey(Events.EXRULE)) { michael@0: String strExrule = this.ContentValues.getAsString(Events.EXRULE); michael@0: if (strExrule != null) { michael@0: if (!strExrule.equals("")) { michael@0: ExRule exrule = new ExRule(); michael@0: exrule.setValue(strExrule); michael@0: propEvent.add(exrule); michael@0: } michael@0: } michael@0: } michael@0: michael@0: //EXDATE michael@0: if (this.ContentValues.containsKey(Events.EXDATE)) { michael@0: String strExdate = this.ContentValues.getAsString(Events.EXDATE); michael@0: if (strExdate != null) { michael@0: if (!strExdate.equals("")) { michael@0: ExDate exdate = new ExDate(); michael@0: exdate.setValue(strExdate); michael@0: propEvent.add(exdate); michael@0: } michael@0: } michael@0: } michael@0: michael@0: //SUMMARY michael@0: if (this.ContentValues.containsKey(Events.TITLE)) { michael@0: String strTitle = this.ContentValues.getAsString(Events.TITLE); michael@0: if (strTitle != null) { michael@0: Summary summary = new Summary(strTitle); michael@0: propEvent.add(summary); michael@0: } michael@0: } michael@0: michael@0: //DESCIPTION michael@0: if (this.ContentValues.containsKey(Events.DESCRIPTION)) { michael@0: String strDescription = this.ContentValues.getAsString(Events.DESCRIPTION); michael@0: if (strDescription != null) { michael@0: if (!strDescription.equals("")) { michael@0: Description description = new Description(strDescription); michael@0: propEvent.add(description); michael@0: } michael@0: } michael@0: } michael@0: michael@0: //LOCATION michael@0: if (this.ContentValues.containsKey(Events.EVENT_LOCATION)) { michael@0: String strLocation = this.ContentValues.getAsString(Events.EVENT_LOCATION); michael@0: if (strLocation != null) { michael@0: if (!strLocation.equals("")) { michael@0: Location location = new Location(strLocation); michael@0: propEvent.add(location); michael@0: } michael@0: } michael@0: } michael@0: michael@0: //CLASS / ACCESS_LEVEL michael@0: if (this.ContentValues.containsKey(Events.ACCESS_LEVEL)) { michael@0: int accessLevel = this.ContentValues.getAsInteger(Events.ACCESS_LEVEL); michael@0: Clazz clazz = new Clazz(); michael@0: if (accessLevel == Events.ACCESS_PUBLIC) michael@0: clazz.setValue(Clazz.PUBLIC.getValue()); michael@0: else if (accessLevel == Events.ACCESS_PRIVATE) michael@0: clazz.setValue(Clazz.PRIVATE.getValue()); michael@0: else if (accessLevel == Events.ACCESS_CONFIDENTIAL) michael@0: clazz.setValue(Clazz.CONFIDENTIAL.getValue()); michael@0: else michael@0: clazz.setValue(Clazz.PUBLIC.getValue()); michael@0: michael@0: propEvent.add(clazz); michael@0: } michael@0: michael@0: //STATUS michael@0: if (this.ContentValues.containsKey(Events.STATUS)) { michael@0: int intStatus = this.ContentValues.getAsInteger(Events.STATUS); michael@0: if (intStatus > -1) { michael@0: Status status = new Status(); michael@0: if (intStatus == Events.STATUS_CANCELED) michael@0: status.setValue(Status.VEVENT_CANCELLED.getValue()); michael@0: else if (intStatus == Events.STATUS_CONFIRMED) michael@0: status.setValue(Status.VEVENT_CONFIRMED.getValue()); michael@0: else if (intStatus == Events.STATUS_TENTATIVE) michael@0: status.setValue(Status.VEVENT_TENTATIVE.getValue()); michael@0: michael@0: propEvent.add(status); michael@0: } michael@0: } michael@0: michael@0: //UID michael@0: Uid uid = new Uid(strUid); michael@0: propEvent.add(uid); michael@0: michael@0: // Attendees michael@0: if (mAttendees.size() > 0) { michael@0: for (Object objProp: mAttendees) { michael@0: Property prop = (Property) objProp; michael@0: propEvent.add(prop); michael@0: } michael@0: } michael@0: michael@0: // Reminders michael@0: if (mReminders.size() > 0) { michael@0: for (Object objComp: mReminders) { michael@0: Component com = (Component) objComp; michael@0: event.getAlarms().add(com); michael@0: } michael@0: } michael@0: michael@0: } catch (ParseException e) { michael@0: e.printStackTrace(); michael@0: } michael@0: michael@0: return Result; michael@0: } michael@0: michael@0: /** michael@0: * marks the android event as already handled michael@0: * @return michael@0: * @see AndroidEvent#cInternalTag michael@0: * @see SyncAdapter#synchroniseEvents(CaldavFacade, Account, ContentProviderClient, Uri, DavCalendar, SyncStats) michael@0: * @throws RemoteException michael@0: */ michael@0: /* public boolean tagAndroidEvent() throws RemoteException { michael@0: michael@0: ContentValues values = new ContentValues(); michael@0: values.put(Event.INTERNALTAG, 1); michael@0: michael@0: int RowCount = this.mProvider.update(asSyncAdapter(this.getUri(), this.mAccount.name, this.mAccount.type), values, null, null); michael@0: //Log.e(TAG,"Rows updated: " + RowCount.toString()); michael@0: michael@0: return (RowCount == 1); michael@0: }*/ michael@0: michael@0: /* private static Uri asSyncAdapter(Uri uri, String account, String accountType) { michael@0: return uri.buildUpon() michael@0: .appendQueryParameter(android.provider.CalendarContract.CALLER_IS_SYNCADAPTER,"true") michael@0: .appendQueryParameter(Calendars.ACCOUNT_NAME, account) michael@0: .appendQueryParameter(Calendars.ACCOUNT_TYPE, accountType).build(); michael@0: }*/ michael@0: } michael@0: