Skip to content

Read/write events as EventAndExceptions data object#45

Merged
rfc2822 merged 18 commits intomainfrom
associated-entities
Aug 6, 2025
Merged

Read/write events as EventAndExceptions data object#45
rfc2822 merged 18 commits intomainfrom
associated-entities

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Jul 22, 2025

To be merged for bitfireAT/davx5-ose#1605 / DAVx5 4.5.4


  • Introduced EventAndExceptions data object for local storage that contains a main event and optional exceptions for it (not to be confused with an Entity that comprises a main event row and its data rows, or with AssociatedEvents that is in iCalendar level, not on local storage level)
  • LegacyAndroidEventBuilder which generated a BatchOperation (operation) rewritten to LegacyAndroidEventBuilder2 that generates a EventAndExceptions object (data object, doesn't contain operations and thus can be tested much easier)
    • test was adapted to new API structure, but the assertions themselves were not changed
  • AndroidEvent removed
  • AndroidRecurringCalendar provides CRUD for EventAndExceptions

The big goal is that

  • every CalDAV calendar storage object (represented as AssociatedEvents) can be mapped to exactly one data object (EventAndExceptions) and vice versa,
  • this mapping is done completely separated from storage,
  • the mapped object can be read/written on storage level.

@rfc2822 rfc2822 self-assigned this Jul 22, 2025
@rfc2822 rfc2822 added the refactoring Quality improvement of existing functions label Jul 22, 2025
@rfc2822 rfc2822 requested a review from Copilot July 24, 2025 10:36

This comment was marked as outdated.

…tAndExceptions.kt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rfc2822
Copy link
Member Author

rfc2822 commented Jul 24, 2025

Basically ready, but I will have another look when DAVx5 4.5.3 is released

@rfc2822 rfc2822 force-pushed the associated-entities branch from 1d7f950 to ad80101 Compare July 24, 2025 15:44
@rfc2822 rfc2822 requested a review from Copilot August 4, 2025 07:46

This comment was marked as outdated.

@rfc2822 rfc2822 requested a review from Copilot August 5, 2025 11:55

This comment was marked as outdated.

@rfc2822 rfc2822 force-pushed the associated-entities branch from d4ea1ca to daf8e93 Compare August 5, 2025 12:00
@rfc2822 rfc2822 requested a review from Copilot August 5, 2025 12:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the Android calendar event handling system by introducing the EventAndExceptions data object pattern. The goal is to cleanly separate data mapping from storage operations and ensure one-to-one mapping between CalDAV storage objects and local data objects.

Key changes:

  • Introduced EventAndExceptions data object for local storage containing main events and exceptions
  • Created LegacyAndroidEventBuilder2 to generate data objects instead of batch operations
  • Added AndroidRecurringCalendar for CRUD operations on events with exceptions
  • Removed deprecated AndroidEvent class

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
EventAndExceptions.kt New data class representing main event and its exceptions
AndroidRecurringCalendar.kt New class handling CRUD operations for events with exceptions
LegacyAndroidEventBuilder2.kt Refactored builder to generate data objects instead of batch operations
AndroidCalendar.kt Enhanced with batch operation support and entity-based methods
Test files Updated tests to work with new data object pattern
Comments suppressed due to low confidence (1)

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/LegacyAndroidEventBuilder2.kt:63

  • [nitpick] The class name 'LegacyAndroidEventBuilder2' suggests this is a temporary naming scheme. Consider using a more descriptive name like 'AndroidEventDataBuilder' or 'EventAndExceptionsBuilder' to better reflect its purpose.
class LegacyAndroidEventBuilder2(

@rfc2822 rfc2822 force-pushed the associated-entities branch from daf8e93 to 03f333a Compare August 5, 2025 12:05
@rfc2822 rfc2822 marked this pull request as ready for review August 5, 2025 12:06
@rfc2822 rfc2822 marked this pull request as draft August 5, 2025 12:17
…tent provider access in LegacyAndroidEventProcessor anymore)
@rfc2822 rfc2822 marked this pull request as ready for review August 5, 2025 15:08
@rfc2822
Copy link
Member Author

rfc2822 commented Aug 5, 2025

I understand that this is hard to review … but maybe you see something that looks really strange to you @sunkup

@rfc2822 rfc2822 requested a review from sunkup August 5, 2025 15:27
Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes well, we talked about it twice already and the structural changes are really nice improvement. I don't see any major issues in the code, but there are two small things that I don't understand entirely and would love to hear some clarification on.

@rfc2822 rfc2822 merged commit 5455760 into main Aug 6, 2025
6 checks passed
@rfc2822 rfc2822 deleted the associated-entities branch August 6, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Quality improvement of existing functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants