mirror of
https://github.com/etesync/android
synced 2024-11-15 20:38:58 +00:00
Remove unnecessary getters/setters
* remove getters/setters for protected fields when they're only accessed from package scope * version bump to 0.8.3
This commit is contained in:
parent
be80b6fde8
commit
fc1874af85
@ -45,7 +45,7 @@ public class ContactTest extends InstrumentationTestCase {
|
|||||||
assertTrue(new String(c.toEntity().toByteArray()).contains("VERSION:3.0"));
|
assertTrue(new String(c.toEntity().toByteArray()).contains("VERSION:3.0"));
|
||||||
|
|
||||||
// now let's generate VCard 4.0
|
// now let's generate VCard 4.0
|
||||||
c.setVCardVersion(VCardVersion.V4_0);
|
c.vCardVersion = VCardVersion.V4_0;
|
||||||
assertEquals("text/vcard; version=4.0", c.getContentType().toString());
|
assertEquals("text/vcard; version=4.0", c.getContentType().toString());
|
||||||
assertTrue(new String(c.toEntity().toByteArray()).contains("VERSION:4.0"));
|
assertTrue(new String(c.toEntity().toByteArray()).contains("VERSION:4.0"));
|
||||||
}
|
}
|
||||||
@ -53,11 +53,11 @@ public class ContactTest extends InstrumentationTestCase {
|
|||||||
public void testReferenceVCard3() throws IOException, InvalidResourceException {
|
public void testReferenceVCard3() throws IOException, InvalidResourceException {
|
||||||
Contact c = parseVCF("reference-vcard3.vcf", Charset.forName(CharEncoding.UTF_8));
|
Contact c = parseVCF("reference-vcard3.vcf", Charset.forName(CharEncoding.UTF_8));
|
||||||
|
|
||||||
assertEquals("Gümp", c.getFamilyName());
|
assertEquals("Gümp", c.familyName);
|
||||||
assertEquals("Förrest", c.getGivenName());
|
assertEquals("Förrest", c.givenName);
|
||||||
assertEquals("Förrest Gümp", c.getDisplayName());
|
assertEquals("Förrest Gümp", c.displayName);
|
||||||
assertEquals("Bubba Gump Shrimpß Co.", c.getOrganization().getValues().get(0));
|
assertEquals("Bubba Gump Shrimpß Co.", c.organization.getValues().get(0));
|
||||||
assertEquals("Shrimp Man", c.getJobTitle());
|
assertEquals("Shrimp Man", c.jobTitle);
|
||||||
|
|
||||||
Telephone phone1 = c.getPhoneNumbers().get(0);
|
Telephone phone1 = c.getPhoneNumbers().get(0);
|
||||||
assertEquals("(111) 555-1212", phone1.getText());
|
assertEquals("(111) 555-1212", phone1.getText());
|
||||||
@ -76,21 +76,21 @@ public class ContactTest extends InstrumentationTestCase {
|
|||||||
|
|
||||||
@Cleanup InputStream photoStream = assetMgr.open("davdroid-logo-192.png", AssetManager.ACCESS_STREAMING);
|
@Cleanup InputStream photoStream = assetMgr.open("davdroid-logo-192.png", AssetManager.ACCESS_STREAMING);
|
||||||
byte[] expectedPhoto = IOUtils.toByteArray(photoStream);
|
byte[] expectedPhoto = IOUtils.toByteArray(photoStream);
|
||||||
assertTrue(Arrays.equals(c.getPhoto(), expectedPhoto));
|
assertTrue(Arrays.equals(c.photo, expectedPhoto));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testParseInvalidUnknownProperties() throws IOException {
|
public void testParseInvalidUnknownProperties() throws IOException {
|
||||||
Contact c = parseVCF("invalid-unknown-properties.vcf");
|
Contact c = parseVCF("invalid-unknown-properties.vcf");
|
||||||
assertEquals("VCard with invalid unknown properties", c.getDisplayName());
|
assertEquals("VCard with invalid unknown properties", c.displayName);
|
||||||
assertNull(c.getUnknownProperties());
|
assertNull(c.unknownProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testParseLatin1() throws IOException {
|
public void testParseLatin1() throws IOException {
|
||||||
Contact c = parseVCF("latin1.vcf", Charset.forName(CharEncoding.ISO_8859_1));
|
Contact c = parseVCF("latin1.vcf", Charset.forName(CharEncoding.ISO_8859_1));
|
||||||
assertEquals("Özkan Äuçek", c.getDisplayName());
|
assertEquals("Özkan Äuçek", c.displayName);
|
||||||
assertEquals("Özkan", c.getGivenName());
|
assertEquals("Özkan", c.givenName);
|
||||||
assertEquals("Äuçek", c.getFamilyName());
|
assertEquals("Äuçek", c.familyName);
|
||||||
assertNull(c.getUnknownProperties());
|
assertNull(c.unknownProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ public class EventTest extends InstrumentationTestCase {
|
|||||||
|
|
||||||
assertEquals(1, event.getExceptions().size());
|
assertEquals(1, event.getExceptions().size());
|
||||||
Event exception = event.getExceptions().get(0);
|
Event exception = event.getExceptions().get(0);
|
||||||
assertEquals("20150503", exception.getRecurrenceId().getValue());
|
assertEquals("20150503", exception.recurrenceId.getValue());
|
||||||
assertEquals("Another summary for the third day", exception.getSummary());
|
assertEquals("Another summary for the third day", exception.summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStartEndTimes() throws IOException, ParserException, InvalidResourceException {
|
public void testStartEndTimes() throws IOException, ParserException, InvalidResourceException {
|
||||||
@ -104,7 +104,7 @@ public class EventTest extends InstrumentationTestCase {
|
|||||||
|
|
||||||
public void testUnfolding() throws IOException, InvalidResourceException {
|
public void testUnfolding() throws IOException, InvalidResourceException {
|
||||||
Event e = parseCalendar("two-line-description-without-crlf.ics");
|
Event e = parseCalendar("two-line-description-without-crlf.ics");
|
||||||
assertEquals("http://www.tgbornheim.de/index.php?sessionid=&page=&id=&sportcentergroup=&day=6", e.getDescription());
|
assertEquals("http://www.tgbornheim.de/index.php?sessionid=&page=&id=&sportcentergroup=&day=6", e.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,15 +150,15 @@ public class LocalCalendarTest extends InstrumentationTestCase {
|
|||||||
assertNotNull("Couldn't build and insert event", event);
|
assertNotNull("Couldn't build and insert event", event);
|
||||||
// compare with original event
|
// compare with original event
|
||||||
try {
|
try {
|
||||||
assertEquals(event.getSummary(), event2.getSummary());
|
assertEquals(event.summary, event2.summary);
|
||||||
assertEquals(event.getDescription(), event2.getDescription());
|
assertEquals(event.description, event2.description);
|
||||||
assertEquals(event.getLocation(), event2.getLocation());
|
assertEquals(event.location, event2.location);
|
||||||
assertEquals(event.getDtStart(), event2.getDtStart());
|
assertEquals(event.dtStart, event2.dtStart);
|
||||||
assertFalse(event2.isAllDay());
|
assertFalse(event2.isAllDay());
|
||||||
|
|
||||||
assertEquals(1, event2.getAlarms().size());
|
assertEquals(1, event2.getAlarms().size());
|
||||||
VAlarm alarm = event2.getAlarms().get(0);
|
VAlarm alarm = event2.getAlarms().get(0);
|
||||||
assertEquals(event.getSummary(), alarm.getDescription().getValue()); // should be built from event name
|
assertEquals(event.summary, alarm.getDescription().getValue()); // should be built from event name
|
||||||
assertEquals(new Dur(0, 0, -(24*60 + 60*2 + 3), 0), alarm.getTrigger().getDuration()); // calendar provider stores trigger in minutes
|
assertEquals(new Dur(0, 0, -(24*60 + 60*2 + 3), 0), alarm.getTrigger().getDuration()); // calendar provider stores trigger in minutes
|
||||||
} finally {
|
} finally {
|
||||||
testCalendar.delete(event);
|
testCalendar.delete(event);
|
||||||
@ -184,10 +184,10 @@ public class LocalCalendarTest extends InstrumentationTestCase {
|
|||||||
assertNotNull("Couldn't build and insert event", event);
|
assertNotNull("Couldn't build and insert event", event);
|
||||||
// compare with original event
|
// compare with original event
|
||||||
try {
|
try {
|
||||||
assertEquals(event.getSummary(), event2.getSummary());
|
assertEquals(event.summary, event2.summary);
|
||||||
assertEquals(event.getDescription(), event2.getDescription());
|
assertEquals(event.description, event2.description);
|
||||||
assertEquals(event.getLocation(), event2.getLocation());
|
assertEquals(event.location, event2.location);
|
||||||
assertEquals(event.getDtStart(), event2.getDtStart());
|
assertEquals(event.dtStart, event2.dtStart);
|
||||||
assertTrue(event2.isAllDay());
|
assertTrue(event2.isAllDay());
|
||||||
} finally {
|
} finally {
|
||||||
testCalendar.delete(event);
|
testCalendar.delete(event);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="at.bitfire.davdroid"
|
package="at.bitfire.davdroid"
|
||||||
android:versionCode="69" android:versionName="0.8.2"
|
android:versionCode="70" android:versionName="0.8.3"
|
||||||
android:installLocation="internalOnly">
|
android:installLocation="internalOnly">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
|
@ -11,7 +11,7 @@ import net.fortuna.ical4j.model.property.ProdId;
|
|||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
public static final String
|
public static final String
|
||||||
APP_VERSION = "0.8.2",
|
APP_VERSION = "0.8.3",
|
||||||
ACCOUNT_TYPE = "bitfire.at.davdroid",
|
ACCOUNT_TYPE = "bitfire.at.davdroid",
|
||||||
WEB_URL_HELP = "https://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app",
|
WEB_URL_HELP = "https://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app",
|
||||||
WEB_URL_VIEW_LOGS = "https://github.com/bitfireAT/davdroid/wiki/How-to-view-the-logs";
|
WEB_URL_VIEW_LOGS = "https://github.com/bitfireAT/davdroid/wiki/How-to-view-the-logs";
|
||||||
|
@ -70,28 +70,28 @@ import lombok.ToString;
|
|||||||
public class Contact extends Resource {
|
public class Contact extends Resource {
|
||||||
private final static String TAG = "davdroid.Contact";
|
private final static String TAG = "davdroid.Contact";
|
||||||
|
|
||||||
@Getter @Setter protected VCardVersion vCardVersion = VCardVersion.V3_0;
|
protected VCardVersion vCardVersion = VCardVersion.V3_0;
|
||||||
|
|
||||||
public static final ContentType
|
public static final ContentType
|
||||||
MIME_VCARD3 = ContentType.create("text/vcard", CharEncoding.UTF_8),
|
MIME_VCARD3 = ContentType.create("text/vcard", CharEncoding.UTF_8),
|
||||||
MIME_VCARD4 = ContentType.parse("text/vcard; version=4.0");
|
MIME_VCARD4 = ContentType.parse("text/vcard; version=4.0");
|
||||||
|
|
||||||
public final static String
|
public static final String
|
||||||
PROPERTY_STARRED = "X-DAVDROID-STARRED",
|
PROPERTY_STARRED = "X-DAVDROID-STARRED",
|
||||||
PROPERTY_PHONETIC_FIRST_NAME = "X-PHONETIC-FIRST-NAME",
|
PROPERTY_PHONETIC_FIRST_NAME = "X-PHONETIC-FIRST-NAME",
|
||||||
PROPERTY_PHONETIC_MIDDLE_NAME = "X-PHONETIC-MIDDLE-NAME",
|
PROPERTY_PHONETIC_MIDDLE_NAME = "X-PHONETIC-MIDDLE-NAME",
|
||||||
PROPERTY_PHONETIC_LAST_NAME = "X-PHONETIC-LAST-NAME",
|
PROPERTY_PHONETIC_LAST_NAME = "X-PHONETIC-LAST-NAME",
|
||||||
PROPERTY_SIP = "X-SIP";
|
PROPERTY_SIP = "X-SIP";
|
||||||
|
|
||||||
public final static EmailType EMAIL_TYPE_MOBILE = EmailType.get("x-mobile");
|
public static final EmailType EMAIL_TYPE_MOBILE = EmailType.get("x-mobile");
|
||||||
|
|
||||||
public final static TelephoneType
|
public static final TelephoneType
|
||||||
PHONE_TYPE_CALLBACK = TelephoneType.get("x-callback"),
|
PHONE_TYPE_CALLBACK = TelephoneType.get("x-callback"),
|
||||||
PHONE_TYPE_COMPANY_MAIN = TelephoneType.get("x-company_main"),
|
PHONE_TYPE_COMPANY_MAIN = TelephoneType.get("x-company_main"),
|
||||||
PHONE_TYPE_RADIO = TelephoneType.get("x-radio"),
|
PHONE_TYPE_RADIO = TelephoneType.get("x-radio"),
|
||||||
PHONE_TYPE_ASSISTANT = TelephoneType.get("X-assistant"),
|
PHONE_TYPE_ASSISTANT = TelephoneType.get("X-assistant"),
|
||||||
PHONE_TYPE_MMS = TelephoneType.get("x-mms");
|
PHONE_TYPE_MMS = TelephoneType.get("x-mms");
|
||||||
public final static RelatedType
|
public static final RelatedType
|
||||||
RELATED_TYPE_BROTHER = RelatedType.get("brother"),
|
RELATED_TYPE_BROTHER = RelatedType.get("brother"),
|
||||||
RELATED_TYPE_FATHER = RelatedType.get("father"),
|
RELATED_TYPE_FATHER = RelatedType.get("father"),
|
||||||
RELATED_TYPE_MANAGER = RelatedType.get("manager"),
|
RELATED_TYPE_MANAGER = RelatedType.get("manager"),
|
||||||
@ -99,22 +99,22 @@ public class Contact extends Resource {
|
|||||||
RELATED_TYPE_REFERRED_BY = RelatedType.get("referred-by"),
|
RELATED_TYPE_REFERRED_BY = RelatedType.get("referred-by"),
|
||||||
RELATED_TYPE_SISTER = RelatedType.get("sister");
|
RELATED_TYPE_SISTER = RelatedType.get("sister");
|
||||||
|
|
||||||
@Getter @Setter private String unknownProperties;
|
protected String unknownProperties;
|
||||||
|
protected boolean starred;
|
||||||
|
|
||||||
@Getter @Setter private boolean starred;
|
protected String displayName, nickName;
|
||||||
|
protected String prefix, givenName, middleName, familyName, suffix;
|
||||||
|
protected String phoneticGivenName, phoneticMiddleName, phoneticFamilyName;
|
||||||
|
protected String note;
|
||||||
|
protected Organization organization;
|
||||||
|
protected String jobTitle, jobDescription;
|
||||||
|
|
||||||
@Getter @Setter private String displayName, nickName;
|
protected byte[] photo;
|
||||||
@Getter @Setter private String prefix, givenName, middleName, familyName, suffix;
|
|
||||||
@Getter @Setter private String phoneticGivenName, phoneticMiddleName, phoneticFamilyName;
|
|
||||||
@Getter @Setter private String note;
|
|
||||||
@Getter @Setter private Organization organization;
|
|
||||||
@Getter @Setter private String jobTitle, jobDescription;
|
|
||||||
|
|
||||||
@Getter @Setter private byte[] photo;
|
protected Anniversary anniversary;
|
||||||
|
protected Birthday birthDay;
|
||||||
@Getter @Setter private Anniversary anniversary;
|
|
||||||
@Getter @Setter private Birthday birthDay;
|
|
||||||
|
|
||||||
|
// lists must not be set to null (because they're iterated using "for"), so only getters are exposed
|
||||||
@Getter private List<Telephone> phoneNumbers = new LinkedList<>();
|
@Getter private List<Telephone> phoneNumbers = new LinkedList<>();
|
||||||
@Getter private List<Email> emails = new LinkedList<>();
|
@Getter private List<Email> emails = new LinkedList<>();
|
||||||
@Getter private List<Impp> impps = new LinkedList<>();
|
@Getter private List<Impp> impps = new LinkedList<>();
|
||||||
|
@ -66,28 +66,30 @@ import lombok.Setter;
|
|||||||
public class Event extends iCalendar {
|
public class Event extends iCalendar {
|
||||||
private final static String TAG = "davdroid.Event";
|
private final static String TAG = "davdroid.Event";
|
||||||
|
|
||||||
@Getter @Setter protected RecurrenceId recurrenceId;
|
protected RecurrenceId recurrenceId;
|
||||||
|
|
||||||
@Getter @Setter protected String summary, location, description;
|
protected String summary, location, description;
|
||||||
|
|
||||||
@Getter protected DtStart dtStart;
|
protected DtStart dtStart;
|
||||||
@Getter protected DtEnd dtEnd;
|
protected DtEnd dtEnd;
|
||||||
@Getter @Setter protected Duration duration;
|
|
||||||
@Getter protected List<RDate> rdates = new LinkedList<>();
|
|
||||||
@Getter @Setter protected RRule rrule;
|
|
||||||
@Getter protected List<ExDate> exdates = new LinkedList<>();
|
|
||||||
@Getter @Setter protected ExRule exrule;
|
|
||||||
@Getter protected List<Event> exceptions = new LinkedList<>();
|
|
||||||
|
|
||||||
@Getter @Setter protected Boolean forPublic;
|
// lists must not be set to null (because they're iterated using "for"), so only getters are exposed
|
||||||
@Getter @Setter protected Status status;
|
protected Duration duration;
|
||||||
|
@Getter private List<RDate> rdates = new LinkedList<>();
|
||||||
|
protected RRule rrule;
|
||||||
|
@Getter private List<ExDate> exdates = new LinkedList<>();
|
||||||
|
protected ExRule exrule;
|
||||||
|
@Getter private List<Event> exceptions = new LinkedList<>();
|
||||||
|
|
||||||
@Getter @Setter protected boolean opaque;
|
protected Boolean forPublic;
|
||||||
|
protected Status status;
|
||||||
|
|
||||||
@Getter @Setter protected Organizer organizer;
|
protected boolean opaque;
|
||||||
@Getter protected List<Attendee> attendees = new LinkedList<>();
|
|
||||||
|
|
||||||
@Getter protected List<VAlarm> alarms = new LinkedList<>();
|
protected Organizer organizer;
|
||||||
|
@Getter private List<Attendee> attendees = new LinkedList<>();
|
||||||
|
|
||||||
|
@Getter private List<VAlarm> alarms = new LinkedList<>();
|
||||||
|
|
||||||
|
|
||||||
public Event(String name, String ETag) {
|
public Event(String name, String ETag) {
|
||||||
|
@ -136,7 +136,7 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
|
|
||||||
public Contact newResource(long localID, String resourceName, String eTag) {
|
public Contact newResource(long localID, String resourceName, String eTag) {
|
||||||
Contact c = new Contact(localID, resourceName, eTag);
|
Contact c = new Contact(localID, resourceName, eTag);
|
||||||
c.setVCardVersion(accountSettings.getAddressBookVCardVersion());
|
c.vCardVersion = accountSettings.getAddressBookVCardVersion();
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,8 +187,8 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
|
|
||||||
ContentValues values = e.getEntityValues();
|
ContentValues values = e.getEntityValues();
|
||||||
c.setUid(values.getAsString(entryColumnUID()));
|
c.setUid(values.getAsString(entryColumnUID()));
|
||||||
c.setUnknownProperties(values.getAsString(COLUMN_UNKNOWN_PROPERTIES));
|
c.unknownProperties = values.getAsString(COLUMN_UNKNOWN_PROPERTIES);
|
||||||
c.setStarred(values.getAsInteger(RawContacts.STARRED) != 0);
|
c.starred = values.getAsInteger(RawContacts.STARRED) != 0;
|
||||||
|
|
||||||
List<Entity.NamedContentValues> subValues = e.getSubValues();
|
List<Entity.NamedContentValues> subValues = e.getSubValues();
|
||||||
for (Entity.NamedContentValues subValue : subValues) {
|
for (Entity.NamedContentValues subValue : subValues) {
|
||||||
@ -247,17 +247,17 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void populateStructuredName(Contact c, ContentValues row) {
|
private void populateStructuredName(Contact c, ContentValues row) {
|
||||||
c.setDisplayName(row.getAsString(StructuredName.DISPLAY_NAME));
|
c.displayName = row.getAsString(StructuredName.DISPLAY_NAME);
|
||||||
|
|
||||||
c.setPrefix(row.getAsString(StructuredName.PREFIX));
|
c.prefix = row.getAsString(StructuredName.PREFIX);
|
||||||
c.setGivenName(row.getAsString(StructuredName.GIVEN_NAME));
|
c.givenName = row.getAsString(StructuredName.GIVEN_NAME);
|
||||||
c.setMiddleName(row.getAsString(StructuredName.MIDDLE_NAME));
|
c.middleName = row.getAsString(StructuredName.MIDDLE_NAME);
|
||||||
c.setFamilyName(row.getAsString(StructuredName.FAMILY_NAME));
|
c.familyName = row.getAsString(StructuredName.FAMILY_NAME);
|
||||||
c.setSuffix(row.getAsString(StructuredName.SUFFIX));
|
c.suffix = row.getAsString(StructuredName.SUFFIX);
|
||||||
|
|
||||||
c.setPhoneticGivenName(row.getAsString(StructuredName.PHONETIC_GIVEN_NAME));
|
c.phoneticGivenName = row.getAsString(StructuredName.PHONETIC_GIVEN_NAME);
|
||||||
c.setPhoneticMiddleName(row.getAsString(StructuredName.PHONETIC_MIDDLE_NAME));
|
c.phoneticMiddleName = row.getAsString(StructuredName.PHONETIC_MIDDLE_NAME);
|
||||||
c.setPhoneticFamilyName(row.getAsString(StructuredName.PHONETIC_FAMILY_NAME));
|
c.phoneticFamilyName = row.getAsString(StructuredName.PHONETIC_FAMILY_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void populatePhoneNumber(Contact c, ContentValues row) {
|
protected void populatePhoneNumber(Contact c, ContentValues row) {
|
||||||
@ -364,12 +364,12 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
try {
|
try {
|
||||||
@Cleanup AssetFileDescriptor fd = providerClient.openAssetFile(photoUri, "r");
|
@Cleanup AssetFileDescriptor fd = providerClient.openAssetFile(photoUri, "r");
|
||||||
@Cleanup InputStream is = fd.createInputStream();
|
@Cleanup InputStream is = fd.createInputStream();
|
||||||
c.setPhoto(IOUtils.toByteArray(is));
|
c.photo = IOUtils.toByteArray(is);
|
||||||
} catch(IOException ex) {
|
} catch(IOException ex) {
|
||||||
Log.w(TAG, "Couldn't read high-res contact photo", ex);
|
Log.w(TAG, "Couldn't read high-res contact photo", ex);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
c.setPhoto(row.getAsByteArray(Photo.PHOTO));
|
c.photo = row.getAsByteArray(Photo.PHOTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void populateOrganization(Contact c, ContentValues row) {
|
protected void populateOrganization(Contact c, ContentValues row) {
|
||||||
@ -384,13 +384,13 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
org.addValue(company);
|
org.addValue(company);
|
||||||
if (StringUtils.isNotEmpty(department))
|
if (StringUtils.isNotEmpty(department))
|
||||||
org.addValue(department);
|
org.addValue(department);
|
||||||
c.setOrganization(org);
|
c.organization = org;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(title))
|
if (StringUtils.isNotEmpty(title))
|
||||||
c.setJobTitle(title);
|
c.jobTitle = title;
|
||||||
if (StringUtils.isNotEmpty(role))
|
if (StringUtils.isNotEmpty(role))
|
||||||
c.setJobDescription(role);
|
c.jobDescription = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void populateIMPP(Contact c, ContentValues row) {
|
protected void populateIMPP(Contact c, ContentValues row) {
|
||||||
@ -449,11 +449,11 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
|
|
||||||
protected void populateNickname(Contact c, ContentValues row) {
|
protected void populateNickname(Contact c, ContentValues row) {
|
||||||
// TYPE (maiden name, short name, …) and LABEL are not processed here because Contacts app doesn't support it
|
// TYPE (maiden name, short name, …) and LABEL are not processed here because Contacts app doesn't support it
|
||||||
c.setNickName(row.getAsString(Nickname.NAME));
|
c.nickName = row.getAsString(Nickname.NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void populateNote(Contact c, ContentValues row) {
|
protected void populateNote(Contact c, ContentValues row) {
|
||||||
c.setNote(row.getAsString(Note.NOTE));
|
c.note = row.getAsString(Note.NOTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void populatePostalAddress(Contact c, ContentValues row) {
|
protected void populatePostalAddress(Contact c, ContentValues row) {
|
||||||
@ -539,10 +539,10 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
Date date = formatter.parse(row.getAsString(CommonDataKinds.Event.START_DATE));
|
Date date = formatter.parse(row.getAsString(CommonDataKinds.Event.START_DATE));
|
||||||
switch (row.getAsInteger(CommonDataKinds.Event.TYPE)) {
|
switch (row.getAsInteger(CommonDataKinds.Event.TYPE)) {
|
||||||
case CommonDataKinds.Event.TYPE_ANNIVERSARY:
|
case CommonDataKinds.Event.TYPE_ANNIVERSARY:
|
||||||
c.setAnniversary(new Anniversary(date));
|
c.anniversary = new Anniversary(date);
|
||||||
break;
|
break;
|
||||||
case CommonDataKinds.Event.TYPE_BIRTHDAY:
|
case CommonDataKinds.Event.TYPE_BIRTHDAY:
|
||||||
c.setBirthDay(new Birthday(date));
|
c.birthDay = new Birthday(date);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
@ -658,8 +658,8 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
.withValue(entryColumnRemoteName(), contact.getName())
|
.withValue(entryColumnRemoteName(), contact.getName())
|
||||||
.withValue(entryColumnUID(), contact.getUid())
|
.withValue(entryColumnUID(), contact.getUid())
|
||||||
.withValue(entryColumnETag(), contact.getETag())
|
.withValue(entryColumnETag(), contact.getETag())
|
||||||
.withValue(COLUMN_UNKNOWN_PROPERTIES, contact.getUnknownProperties())
|
.withValue(COLUMN_UNKNOWN_PROPERTIES, contact.unknownProperties)
|
||||||
.withValue(RawContacts.STARRED, contact.isStarred() ? 1 : 0);
|
.withValue(RawContacts.STARRED, contact.starred ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -675,19 +675,19 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
for (ezvcard.property.Email email : contact.getEmails())
|
for (ezvcard.property.Email email : contact.getEmails())
|
||||||
queueOperation(buildEmail(newDataInsertBuilder(localID, backrefIdx), email));
|
queueOperation(buildEmail(newDataInsertBuilder(localID, backrefIdx), email));
|
||||||
|
|
||||||
if (contact.getPhoto() != null)
|
if (contact.photo != null)
|
||||||
queueOperation(buildPhoto(newDataInsertBuilder(localID, backrefIdx), contact.getPhoto()));
|
queueOperation(buildPhoto(newDataInsertBuilder(localID, backrefIdx), contact.photo));
|
||||||
|
|
||||||
queueOperation(buildOrganization(newDataInsertBuilder(localID, backrefIdx), contact));
|
queueOperation(buildOrganization(newDataInsertBuilder(localID, backrefIdx), contact));
|
||||||
|
|
||||||
for (Impp impp : contact.getImpps())
|
for (Impp impp : contact.getImpps())
|
||||||
queueOperation(buildIMPP(newDataInsertBuilder(localID, backrefIdx), impp));
|
queueOperation(buildIMPP(newDataInsertBuilder(localID, backrefIdx), impp));
|
||||||
|
|
||||||
if (contact.getNickName() != null)
|
if (contact.nickName != null)
|
||||||
queueOperation(buildNickName(newDataInsertBuilder(localID, backrefIdx), contact.getNickName()));
|
queueOperation(buildNickName(newDataInsertBuilder(localID, backrefIdx), contact.nickName));
|
||||||
|
|
||||||
if (contact.getNote() != null)
|
if (contact.note != null)
|
||||||
queueOperation(buildNote(newDataInsertBuilder(localID, backrefIdx), contact.getNote()));
|
queueOperation(buildNote(newDataInsertBuilder(localID, backrefIdx), contact.note));
|
||||||
|
|
||||||
for (Address address : contact.getAddresses())
|
for (Address address : contact.getAddresses())
|
||||||
queueOperation(buildAddress(newDataInsertBuilder(localID, backrefIdx), address));
|
queueOperation(buildAddress(newDataInsertBuilder(localID, backrefIdx), address));
|
||||||
@ -698,10 +698,10 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
for (String url : contact.getURLs())
|
for (String url : contact.getURLs())
|
||||||
queueOperation(buildURL(newDataInsertBuilder(localID, backrefIdx), url));
|
queueOperation(buildURL(newDataInsertBuilder(localID, backrefIdx), url));
|
||||||
|
|
||||||
if (contact.getAnniversary() != null)
|
if (contact.anniversary != null)
|
||||||
queueOperation(buildEvent(newDataInsertBuilder(localID, backrefIdx), contact.getAnniversary(), CommonDataKinds.Event.TYPE_ANNIVERSARY));
|
queueOperation(buildEvent(newDataInsertBuilder(localID, backrefIdx), contact.anniversary, CommonDataKinds.Event.TYPE_ANNIVERSARY));
|
||||||
if (contact.getBirthDay() != null)
|
if (contact.birthDay != null)
|
||||||
queueOperation(buildEvent(newDataInsertBuilder(localID, backrefIdx), contact.getBirthDay(), CommonDataKinds.Event.TYPE_BIRTHDAY));
|
queueOperation(buildEvent(newDataInsertBuilder(localID, backrefIdx), contact.birthDay, CommonDataKinds.Event.TYPE_BIRTHDAY));
|
||||||
|
|
||||||
for (Related related : contact.getRelations())
|
for (Related related : contact.getRelations())
|
||||||
for (RelatedType type : related.getTypes())
|
for (RelatedType type : related.getTypes())
|
||||||
@ -721,15 +721,15 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
protected Builder buildStructuredName(Builder builder, Contact contact) {
|
protected Builder buildStructuredName(Builder builder, Contact contact) {
|
||||||
return builder
|
return builder
|
||||||
.withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)
|
.withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)
|
||||||
.withValue(StructuredName.PREFIX, contact.getPrefix())
|
.withValue(StructuredName.PREFIX, contact.prefix)
|
||||||
.withValue(StructuredName.DISPLAY_NAME, contact.getDisplayName())
|
.withValue(StructuredName.DISPLAY_NAME, contact.displayName)
|
||||||
.withValue(StructuredName.GIVEN_NAME, contact.getGivenName())
|
.withValue(StructuredName.GIVEN_NAME, contact.givenName)
|
||||||
.withValue(StructuredName.MIDDLE_NAME, contact.getMiddleName())
|
.withValue(StructuredName.MIDDLE_NAME, contact.middleName)
|
||||||
.withValue(StructuredName.FAMILY_NAME, contact.getFamilyName())
|
.withValue(StructuredName.FAMILY_NAME, contact.familyName)
|
||||||
.withValue(StructuredName.SUFFIX, contact.getSuffix())
|
.withValue(StructuredName.SUFFIX, contact.suffix)
|
||||||
.withValue(StructuredName.PHONETIC_GIVEN_NAME, contact.getPhoneticGivenName())
|
.withValue(StructuredName.PHONETIC_GIVEN_NAME, contact.phoneticGivenName)
|
||||||
.withValue(StructuredName.PHONETIC_MIDDLE_NAME, contact.getPhoneticMiddleName())
|
.withValue(StructuredName.PHONETIC_MIDDLE_NAME, contact.phoneticMiddleName)
|
||||||
.withValue(StructuredName.PHONETIC_FAMILY_NAME, contact.getPhoneticFamilyName());
|
.withValue(StructuredName.PHONETIC_FAMILY_NAME, contact.phoneticFamilyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Builder buildPhoneNumber(Builder builder, Telephone number) {
|
protected Builder buildPhoneNumber(Builder builder, Telephone number) {
|
||||||
@ -842,10 +842,10 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Builder buildOrganization(Builder builder, Contact contact) {
|
protected Builder buildOrganization(Builder builder, Contact contact) {
|
||||||
if (contact.getOrganization() == null && contact.getJobTitle() == null && contact.getJobDescription() == null)
|
if (contact.organization == null && contact.jobTitle == null && contact.jobDescription == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ezvcard.property.Organization organization = contact.getOrganization();
|
ezvcard.property.Organization organization = contact.organization;
|
||||||
String company = null, department = null;
|
String company = null, department = null;
|
||||||
if (organization != null) {
|
if (organization != null) {
|
||||||
Iterator<String> org = organization.getValues().iterator();
|
Iterator<String> org = organization.getValues().iterator();
|
||||||
@ -859,8 +859,8 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
|||||||
.withValue(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE)
|
.withValue(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE)
|
||||||
.withValue(Organization.COMPANY, company)
|
.withValue(Organization.COMPANY, company)
|
||||||
.withValue(Organization.DEPARTMENT, department)
|
.withValue(Organization.DEPARTMENT, department)
|
||||||
.withValue(Organization.TITLE, contact.getJobTitle())
|
.withValue(Organization.TITLE, contact.jobTitle)
|
||||||
.withValue(Organization.JOB_DESCRIPTION, contact.getJobDescription());
|
.withValue(Organization.JOB_DESCRIPTION, contact.jobDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Builder buildIMPP(Builder builder, Impp impp) {
|
protected Builder buildIMPP(Builder builder, Impp impp) {
|
||||||
|
@ -78,8 +78,8 @@ import lombok.Getter;
|
|||||||
public class LocalCalendar extends LocalCollection<Event> {
|
public class LocalCalendar extends LocalCollection<Event> {
|
||||||
private static final String TAG = "davdroid.LocalCalendar";
|
private static final String TAG = "davdroid.LocalCalendar";
|
||||||
|
|
||||||
@Getter private String url;
|
@Getter protected String url;
|
||||||
@Getter private long id;
|
@Getter protected long id;
|
||||||
|
|
||||||
protected static final String COLLECTION_COLUMN_CTAG = Calendars.CAL_SYNC1;
|
protected static final String COLLECTION_COLUMN_CTAG = Calendars.CAL_SYNC1;
|
||||||
|
|
||||||
@ -333,9 +333,9 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
protected void populateEvent(Event e, ContentValues values) {
|
protected void populateEvent(Event e, ContentValues values) {
|
||||||
e.setUid(values.getAsString(entryColumnUID()));
|
e.setUid(values.getAsString(entryColumnUID()));
|
||||||
|
|
||||||
e.setSummary(values.getAsString(Events.TITLE));
|
e.summary = values.getAsString(Events.TITLE);
|
||||||
e.setLocation(values.getAsString(Events.EVENT_LOCATION));
|
e.location = values.getAsString(Events.EVENT_LOCATION);
|
||||||
e.setDescription(values.getAsString(Events.DESCRIPTION));
|
e.description = values.getAsString(Events.DESCRIPTION);
|
||||||
|
|
||||||
final boolean allDay = values.getAsInteger(Events.ALL_DAY) != 0;
|
final boolean allDay = values.getAsInteger(Events.ALL_DAY) != 0;
|
||||||
final long tsStart = values.getAsLong(Events.DTSTART);
|
final long tsStart = values.getAsLong(Events.DTSTART);
|
||||||
@ -360,14 +360,14 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
if (tsEnd != null)
|
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.duration = new Duration(new Dur(duration));
|
||||||
}
|
}
|
||||||
|
|
||||||
// recurrence
|
// recurrence
|
||||||
try {
|
try {
|
||||||
String strRRule = values.getAsString(Events.RRULE);
|
String strRRule = values.getAsString(Events.RRULE);
|
||||||
if (!StringUtils.isEmpty(strRRule))
|
if (!StringUtils.isEmpty(strRRule))
|
||||||
e.setRrule(new RRule(strRRule));
|
e.rrule = new RRule(strRRule);
|
||||||
|
|
||||||
String strRDate = values.getAsString(Events.RDATE);
|
String strRDate = values.getAsString(Events.RDATE);
|
||||||
if (!StringUtils.isEmpty(strRDate)) {
|
if (!StringUtils.isEmpty(strRDate)) {
|
||||||
@ -379,7 +379,7 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
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.exrule = exRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
String strExDate = values.getAsString(Events.EXDATE);
|
String strExDate = values.getAsString(Events.EXDATE);
|
||||||
@ -406,28 +406,28 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
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.recurrenceId = new RecurrenceId(originalDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// status
|
// status
|
||||||
if (values.containsKey(Events.STATUS))
|
if (values.containsKey(Events.STATUS))
|
||||||
switch (values.getAsInteger(Events.STATUS)) {
|
switch (values.getAsInteger(Events.STATUS)) {
|
||||||
case Events.STATUS_CONFIRMED:
|
case Events.STATUS_CONFIRMED:
|
||||||
e.setStatus(Status.VEVENT_CONFIRMED);
|
e.status = Status.VEVENT_CONFIRMED;
|
||||||
break;
|
break;
|
||||||
case Events.STATUS_TENTATIVE:
|
case Events.STATUS_TENTATIVE:
|
||||||
e.setStatus(Status.VEVENT_TENTATIVE);
|
e.status = Status.VEVENT_TENTATIVE;
|
||||||
break;
|
break;
|
||||||
case Events.STATUS_CANCELED:
|
case Events.STATUS_CANCELED:
|
||||||
e.setStatus(Status.VEVENT_CANCELLED);
|
e.status = Status.VEVENT_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// availability
|
// availability
|
||||||
e.setOpaque(values.getAsInteger(Events.AVAILABILITY) != Events.AVAILABILITY_FREE);
|
e.opaque = values.getAsInteger(Events.AVAILABILITY) != Events.AVAILABILITY_FREE;
|
||||||
|
|
||||||
// set ORGANIZER
|
// set ORGANIZER
|
||||||
try {
|
try {
|
||||||
e.setOrganizer(new Organizer(new URI("mailto", values.getAsString(Events.ORGANIZER), null)));
|
e.organizer = new Organizer(new URI("mailto", values.getAsString(Events.ORGANIZER), null));
|
||||||
} catch (URISyntaxException ex) {
|
} catch (URISyntaxException ex) {
|
||||||
Log.e(TAG, "Error when creating ORGANIZER mailto URI, ignoring", ex);
|
Log.e(TAG, "Error when creating ORGANIZER mailto URI, ignoring", ex);
|
||||||
}
|
}
|
||||||
@ -436,10 +436,10 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
switch (values.getAsInteger(Events.ACCESS_LEVEL)) {
|
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.forPublic = false;
|
||||||
break;
|
break;
|
||||||
case Events.ACCESS_PUBLIC:
|
case Events.ACCESS_PUBLIC:
|
||||||
e.setForPublic(true);
|
e.forPublic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,7 +526,7 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
|
|
||||||
PropertyList props = alarm.getProperties();
|
PropertyList props = alarm.getProperties();
|
||||||
props.add(Action.DISPLAY);
|
props.add(Action.DISPLAY);
|
||||||
props.add(new Description(event.getSummary()));
|
props.add(new Description(event.summary));
|
||||||
event.getAlarms().add(alarm);
|
event.getAlarms().add(alarm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,8 +547,7 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
.withValue(Events.GUESTS_CAN_MODIFY, 1)
|
.withValue(Events.GUESTS_CAN_MODIFY, 1)
|
||||||
.withValue(Events.GUESTS_CAN_SEE_GUESTS, 1);
|
.withValue(Events.GUESTS_CAN_SEE_GUESTS, 1);
|
||||||
|
|
||||||
final RecurrenceId recurrenceId = event.getRecurrenceId();
|
if (event.recurrenceId == null) {
|
||||||
if (recurrenceId == null) {
|
|
||||||
// this event is a "master event" (not an exception)
|
// this event is a "master event" (not an exception)
|
||||||
builder .withValue(entryColumnRemoteName(), event.getName())
|
builder .withValue(entryColumnRemoteName(), event.getName())
|
||||||
.withValue(entryColumnETag(), event.getETag())
|
.withValue(entryColumnETag(), event.getETag())
|
||||||
@ -563,9 +562,9 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean recurring = false;
|
boolean recurring = false;
|
||||||
if (event.getRrule() != null) {
|
if (event.rrule != null) {
|
||||||
recurring = true;
|
recurring = true;
|
||||||
builder.withValue(Events.RRULE, event.getRrule().getValue());
|
builder.withValue(Events.RRULE, event.rrule.getValue());
|
||||||
}
|
}
|
||||||
if (!event.getRdates().isEmpty()) {
|
if (!event.getRdates().isEmpty()) {
|
||||||
recurring = true;
|
recurring = true;
|
||||||
@ -575,9 +574,9 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
Log.e(TAG, "Couldn't parse RDate(s)", e);
|
Log.e(TAG, "Couldn't parse RDate(s)", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.getExrule() != null)
|
if (event.exrule != null)
|
||||||
builder.withValue(Events.EXRULE, event.getExrule().getValue());
|
builder.withValue(Events.EXRULE, event.exrule.getValue());
|
||||||
if (!event.getExdates().isEmpty())
|
if (!event.getExceptions().isEmpty())
|
||||||
try {
|
try {
|
||||||
builder.withValue(Events.EXDATE, DateUtils.recurrenceSetsToAndroidString(event.getExdates(), event.isAllDay()));
|
builder.withValue(Events.EXDATE, DateUtils.recurrenceSetsToAndroidString(event.getExdates(), event.isAllDay()));
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
@ -588,28 +587,27 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
// because that's the way Android likes it (see docs)
|
// because that's the way Android likes it (see docs)
|
||||||
if (recurring) {
|
if (recurring) {
|
||||||
// calculate DURATION from start and end date
|
// calculate DURATION from start and end date
|
||||||
Duration duration = new Duration(event.getDtStart().getDate(), event.getDtEnd().getDate());
|
Duration duration = new Duration(event.dtStart.getDate(), event.dtEnd.getDate());
|
||||||
builder.withValue(Events.DURATION, duration.getValue());
|
builder.withValue(Events.DURATION, duration.getValue());
|
||||||
} else
|
} else
|
||||||
builder .withValue(Events.DTEND, event.getDtEndInMillis())
|
builder .withValue(Events.DTEND, event.getDtEndInMillis())
|
||||||
.withValue(Events.EVENT_END_TIMEZONE, event.getDtEndTzID());
|
.withValue(Events.EVENT_END_TIMEZONE, event.getDtEndTzID());
|
||||||
|
|
||||||
if (event.getSummary() != null)
|
if (event.summary != null)
|
||||||
builder.withValue(Events.TITLE, event.getSummary());
|
builder.withValue(Events.TITLE, event.summary);
|
||||||
if (event.getLocation() != null)
|
if (event.location != null)
|
||||||
builder.withValue(Events.EVENT_LOCATION, event.getLocation());
|
builder.withValue(Events.EVENT_LOCATION, event.location);
|
||||||
if (event.getDescription() != null)
|
if (event.description != null)
|
||||||
builder.withValue(Events.DESCRIPTION, event.getDescription());
|
builder.withValue(Events.DESCRIPTION, event.description);
|
||||||
|
|
||||||
Organizer organizer = event.getOrganizer();
|
if (event.organizer != null) {
|
||||||
if (organizer != null) {
|
final URI uri = event.organizer.getCalAddress();
|
||||||
final URI uri = organizer.getCalAddress();
|
|
||||||
|
|
||||||
String email = null;
|
String email = null;
|
||||||
if (uri != null && "mailto".equalsIgnoreCase(uri.getScheme()))
|
if (uri != null && "mailto".equalsIgnoreCase(uri.getScheme()))
|
||||||
email = uri.getSchemeSpecificPart();
|
email = uri.getSchemeSpecificPart();
|
||||||
else {
|
else {
|
||||||
iCalendar.Email emailParam = (iCalendar.Email)organizer.getParameter(iCalendar.Email.PARAMETER_NAME);
|
iCalendar.Email emailParam = (iCalendar.Email)event.organizer.getParameter(iCalendar.Email.PARAMETER_NAME);
|
||||||
if (emailParam != null)
|
if (emailParam != null)
|
||||||
email = emailParam.getValue();
|
email = emailParam.getValue();
|
||||||
else
|
else
|
||||||
@ -618,20 +616,20 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
builder.withValue(Events.ORGANIZER, email != null ? email : uri.toString());
|
builder.withValue(Events.ORGANIZER, email != null ? email : uri.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Status status = event.getStatus();
|
//Status status = event.getStatus();
|
||||||
if (status != null) {
|
if (event.status!= null) {
|
||||||
int statusCode = Events.STATUS_TENTATIVE;
|
int statusCode = Events.STATUS_TENTATIVE;
|
||||||
if (status == Status.VEVENT_CONFIRMED)
|
if (event.status == Status.VEVENT_CONFIRMED)
|
||||||
statusCode = Events.STATUS_CONFIRMED;
|
statusCode = Events.STATUS_CONFIRMED;
|
||||||
else if (status == Status.VEVENT_CANCELLED)
|
else if (event.status == Status.VEVENT_CANCELLED)
|
||||||
statusCode = Events.STATUS_CANCELED;
|
statusCode = Events.STATUS_CANCELED;
|
||||||
builder.withValue(Events.STATUS, statusCode);
|
builder.withValue(Events.STATUS, statusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.withValue(Events.AVAILABILITY, event.isOpaque() ? Events.AVAILABILITY_BUSY : Events.AVAILABILITY_FREE);
|
builder.withValue(Events.AVAILABILITY, event.opaque ? Events.AVAILABILITY_BUSY : Events.AVAILABILITY_FREE);
|
||||||
|
|
||||||
if (event.getForPublic() != null)
|
if (event.forPublic != null)
|
||||||
builder.withValue(Events.ACCESS_LEVEL, event.getForPublic() ? Events.ACCESS_PUBLIC : Events.ACCESS_PRIVATE);
|
builder.withValue(Events.ACCESS_LEVEL, event.forPublic ? Events.ACCESS_PUBLIC : Events.ACCESS_PRIVATE);
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
@ -672,13 +670,12 @@ public class LocalCalendar extends LocalCollection<Event> {
|
|||||||
buildEntry(builder, exception, false);
|
buildEntry(builder, exception, false);
|
||||||
builder.withValue(Events.ORIGINAL_SYNC_ID, exception.getName());
|
builder.withValue(Events.ORIGINAL_SYNC_ID, exception.getName());
|
||||||
|
|
||||||
final RecurrenceId recurrenceId = exception.getRecurrenceId();
|
|
||||||
final boolean originalAllDay = master.isAllDay();
|
final boolean originalAllDay = master.isAllDay();
|
||||||
|
|
||||||
Date date = recurrenceId.getDate();
|
Date date = exception.recurrenceId.getDate();
|
||||||
if (originalAllDay && date instanceof DateTime) { // correct VALUE=DATE-TIME RECURRENCE-IDs to VALUE=DATE
|
if (originalAllDay && date instanceof DateTime) { // correct VALUE=DATE-TIME RECURRENCE-IDs to VALUE=DATE
|
||||||
final DateFormat dateFormatDate = new SimpleDateFormat("yyyyMMdd");
|
final DateFormat dateFormatDate = new SimpleDateFormat("yyyyMMdd");
|
||||||
final String dateString = dateFormatDate.format(recurrenceId.getDate());
|
final String dateString = dateFormatDate.format(exception.recurrenceId.getDate());
|
||||||
try {
|
try {
|
||||||
date = new Date(dateString);
|
date = new Date(dateString);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user