Since DtEnd and Duration are both related to the end date, we could group these two into one sealed interface.
Since we also want to support have fallbacks for some fields if one field value is missing (this can be only applicable at the same type of event), and we also want to support #9 . Hence, the new modelling would be following:
make ToBeMappedYouTrackIssueInfo a normal data class, and it contains a list of instances of DateTimeFieldInfo. (solve #9)
The DateTimeFieldInfo would also be a normal data class with the following fields:
An enum field determining is the event is date or datetime type:
An start datetime field
A list of instances of a sealed interface called maybe EndDateTimeFieldInfo. (see explanation below)
A list of AlarmSetting. (see #8)
The first two fields identify the DateTimeFieldInfo instance.
EndDateTimeFieldInfo simply have 3 subclasses of
uses a dedicated end datetime field from YouTrack issue
uses a dedicated duration field from YouTrack issue, with asking to be negative or positive
uses a fixed duration
EndDateTimeFieldInfo is used for representing a multi-day event and datetime event. If the list is empty, it means no end datetime = a whole day event. The order of the list representing the attempt to create end date time or duration.
e.g. The ToBeMappedYouTrackIssueInfo can contain all 3 types of EndDateTimeFieldInfo in the list. And the 3rd option "uses a fixed duration" can be the backout option if both the end datetime field and duration field is unavailable in a YouTrack issue
However, if all attempts from the list is failed (e.g. a non-empty list without the "uses a fixed duration" EndDateTimeFieldInfo and all fields in that list failed to get value), then this should be traded as hard mapping failure (same level failure as missing start date), because mapping it to a whole day event may cause confusion. (or maybe we can make it a configurable setting)
Currently we are using our own model but it is actually quite annoying and hard to model it.
Why not just use whatever RFC5545's VEvent defined. In summary, a VEvent can have:
Then, the 5 types can also to mapped to 3 differentEventType
:1. one day event2. multi-day event3. datetime eventSo this lead to 3 settable fields: DtStart, DtEnd, and Duration.
Since DtEnd and Duration are both related to the end date, we could group these two into one sealed interface.
Since we also want to support have fallbacks for some fields if one field value is missing (this can be only applicable at the same type of event), and we also want to support #9 . Hence, the new modelling would be following:
ToBeMappedYouTrackIssueInfo
a normal data class, and it contains a list of instances ofDateTimeFieldInfo
. (solve #9)DateTimeFieldInfo
would also be a normal data class with the following fields:EndDateTimeFieldInfo
. (see explanation below)AlarmSetting
. (see #8) The first two fields identify theDateTimeFieldInfo
instance.EndDateTimeFieldInfo
simply have 3 subclasses ofEndDateTimeFieldInfo
is used for representing a multi-day event and datetime event. If the list is empty, it means no end datetime = a whole day event. The order of the list representing the attempt to create end date time or duration.ToBeMappedYouTrackIssueInfo
can contain all 3 types ofEndDateTimeFieldInfo
in the list. And the 3rd option "uses a fixed duration" can be the backout option if both the end datetime field and duration field is unavailable in a YouTrack issueEndDateTimeFieldInfo
and all fields in that list failed to get value), then this should be traded as hard mapping failure (same level failure as missing start date), because mapping it to a whole day event may cause confusion. (or maybe we can make it a configurable setting)