Skip to content

Commit 0bc15ea

Browse files
authored
Rename "processor" to "handler" (#137)
* Rename "processor" to "handler" (because "row handler" is an existing term that indicates handling local database rows in provider source code) * Update some comments
1 parent 5fc6688 commit 0bc15ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+273
-273
lines changed

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventProcessor.kt renamed to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/AndroidEventHandler.kt

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ import android.content.Entity
1010
import android.provider.CalendarContract.Events
1111
import android.provider.CalendarContract.ExtendedProperties
1212
import at.bitfire.synctools.icalendar.AssociatedEvents
13-
import at.bitfire.synctools.mapping.calendar.processor.AccessLevelProcessor
14-
import at.bitfire.synctools.mapping.calendar.processor.AndroidEventFieldProcessor
15-
import at.bitfire.synctools.mapping.calendar.processor.AttendeesProcessor
16-
import at.bitfire.synctools.mapping.calendar.processor.AvailabilityProcessor
17-
import at.bitfire.synctools.mapping.calendar.processor.CategoriesProcessor
18-
import at.bitfire.synctools.mapping.calendar.processor.ColorProcessor
19-
import at.bitfire.synctools.mapping.calendar.processor.DescriptionProcessor
20-
import at.bitfire.synctools.mapping.calendar.processor.DurationProcessor
21-
import at.bitfire.synctools.mapping.calendar.processor.EndTimeProcessor
22-
import at.bitfire.synctools.mapping.calendar.processor.LocationProcessor
23-
import at.bitfire.synctools.mapping.calendar.processor.OrganizerProcessor
24-
import at.bitfire.synctools.mapping.calendar.processor.OriginalInstanceTimeProcessor
25-
import at.bitfire.synctools.mapping.calendar.processor.RecurrenceFieldsProcessor
26-
import at.bitfire.synctools.mapping.calendar.processor.RemindersProcessor
27-
import at.bitfire.synctools.mapping.calendar.processor.SequenceProcessor
28-
import at.bitfire.synctools.mapping.calendar.processor.StartTimeProcessor
29-
import at.bitfire.synctools.mapping.calendar.processor.StatusProcessor
30-
import at.bitfire.synctools.mapping.calendar.processor.TitleProcessor
31-
import at.bitfire.synctools.mapping.calendar.processor.UidProcessor
32-
import at.bitfire.synctools.mapping.calendar.processor.UnknownPropertiesProcessor
33-
import at.bitfire.synctools.mapping.calendar.processor.UrlProcessor
13+
import at.bitfire.synctools.mapping.calendar.handler.AccessLevelHandler
14+
import at.bitfire.synctools.mapping.calendar.handler.AndroidEventFieldHandler
15+
import at.bitfire.synctools.mapping.calendar.handler.AttendeesHandler
16+
import at.bitfire.synctools.mapping.calendar.handler.AvailabilityHandler
17+
import at.bitfire.synctools.mapping.calendar.handler.CategoriesHandler
18+
import at.bitfire.synctools.mapping.calendar.handler.ColorHandler
19+
import at.bitfire.synctools.mapping.calendar.handler.DescriptionHandler
20+
import at.bitfire.synctools.mapping.calendar.handler.DurationHandler
21+
import at.bitfire.synctools.mapping.calendar.handler.EndTimeHandler
22+
import at.bitfire.synctools.mapping.calendar.handler.LocationHandler
23+
import at.bitfire.synctools.mapping.calendar.handler.OrganizerHandler
24+
import at.bitfire.synctools.mapping.calendar.handler.OriginalInstanceTimeHandler
25+
import at.bitfire.synctools.mapping.calendar.handler.RecurrenceFieldsHandler
26+
import at.bitfire.synctools.mapping.calendar.handler.RemindersHandler
27+
import at.bitfire.synctools.mapping.calendar.handler.SequenceHandler
28+
import at.bitfire.synctools.mapping.calendar.handler.StartTimeHandler
29+
import at.bitfire.synctools.mapping.calendar.handler.StatusHandler
30+
import at.bitfire.synctools.mapping.calendar.handler.TitleHandler
31+
import at.bitfire.synctools.mapping.calendar.handler.UidHandler
32+
import at.bitfire.synctools.mapping.calendar.handler.UnknownPropertiesHandler
33+
import at.bitfire.synctools.mapping.calendar.handler.UrlHandler
3434
import at.bitfire.synctools.storage.calendar.EventAndExceptions
3535
import at.bitfire.synctools.storage.calendar.EventsContract
3636
import net.fortuna.ical4j.model.DateList
@@ -51,38 +51,38 @@ import java.util.UUID
5151
* @param accountName account name (used to generate reminder email address)
5252
* @param prodIdGenerator generates the `PRODID` to use
5353
*/
54-
class AndroidEventProcessor(
54+
class AndroidEventHandler(
5555
accountName: String,
5656
private val prodIdGenerator: ProdIdGenerator
5757
) {
5858

5959
private val tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry()
6060

61-
private val fieldProcessors: Array<AndroidEventFieldProcessor> = arrayOf(
61+
private val fieldHandlers: Array<AndroidEventFieldHandler> = arrayOf(
6262
// event row fields
63-
UidProcessor(),
64-
OriginalInstanceTimeProcessor(tzRegistry),
65-
TitleProcessor(),
66-
LocationProcessor(),
67-
StartTimeProcessor(tzRegistry),
68-
EndTimeProcessor(tzRegistry),
69-
DurationProcessor(tzRegistry),
70-
RecurrenceFieldsProcessor(tzRegistry),
71-
DescriptionProcessor(),
72-
ColorProcessor(),
73-
AccessLevelProcessor(),
74-
AvailabilityProcessor(),
75-
StatusProcessor(),
63+
UidHandler(),
64+
OriginalInstanceTimeHandler(tzRegistry),
65+
TitleHandler(),
66+
LocationHandler(),
67+
StartTimeHandler(tzRegistry),
68+
EndTimeHandler(tzRegistry),
69+
DurationHandler(tzRegistry),
70+
RecurrenceFieldsHandler(tzRegistry),
71+
DescriptionHandler(),
72+
ColorHandler(),
73+
AccessLevelHandler(),
74+
AvailabilityHandler(),
75+
StatusHandler(),
7676
// scheduling
77-
SequenceProcessor(),
78-
OrganizerProcessor(),
79-
AttendeesProcessor(),
77+
SequenceHandler(),
78+
OrganizerHandler(),
79+
AttendeesHandler(),
8080
// extended properties
81-
CategoriesProcessor(),
82-
UnknownPropertiesProcessor(),
83-
UrlProcessor(),
81+
CategoriesHandler(),
82+
UnknownPropertiesHandler(),
83+
UrlHandler(),
8484
// sub-components
85-
RemindersProcessor(accountName)
85+
RemindersHandler(accountName)
8686
)
8787

8888

@@ -102,7 +102,7 @@ class AndroidEventProcessor(
102102
/**
103103
* Maps an Android event with its exceptions to VEVENTs.
104104
*
105-
* VEVENTs must have a valid `UID`, so this method (or better to say, the [UidProcessor] that it calls)
105+
* VEVENTs must have a valid `UID`, so this method (or better to say, the [UidHandler] that it calls)
106106
* generates an UID, if necessary. If an `UID` was generated, it is noted in the result.
107107
*/
108108
fun mapToVEvents(eventAndExceptions: EventAndExceptions): MappingResult {
@@ -190,8 +190,8 @@ class AndroidEventProcessor(
190190
// initialization adds DTSTAMP
191191
val vEvent = VEvent(/* initialise = */ true)
192192

193-
for (processor in fieldProcessors)
194-
processor.process(from = entity, main = main, to = vEvent)
193+
for (handler in fieldHandlers)
194+
handler.process(from = entity, main = main, to = vEvent)
195195
return vEvent
196196
}
197197

@@ -220,7 +220,7 @@ class AndroidEventProcessor(
220220
it.values.getAsString(ExtendedProperties.NAME) == EventsContract.EXTNAME_GOOGLE_CALENDAR_UID
221221
}?.values?.getAsString(ExtendedProperties.VALUE)
222222
if (googleCalendarUid != null) {
223-
// copy to UID_2445 so that it will be processed by UidProcessor and return
223+
// copy to UID_2445 so that it will be processed by UidHandler and return
224224
mainValues.put(Events.UID_2445, googleCalendarUid)
225225
return googleCalendarUid
226226
}

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/builder/EndTimeBuilder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class EndTimeBuilder: AndroidEntityBuilder {
9393
* - DTEND is DATE, DTSTART is DATE-TIME → DTEND is amended to DATE-TIME with time and timezone from DTSTART
9494
* - DTEND is DATE-TIME, DTSTART is DATE → DTEND is reduced to its date component
9595
*
96-
* @see at.bitfire.synctools.mapping.calendar.processor.RecurrenceFieldsProcessor.alignUntil
96+
* @see at.bitfire.synctools.mapping.calendar.handler.RecurrenceFieldsHandler.alignUntil
9797
*/
9898
@VisibleForTesting
9999
internal fun alignWithDtStart(dtEnd: DtEnd, dtStart: DtStart): DtEnd {

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AccessLevelProcessor.kt renamed to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AccessLevelHandler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.synctools.mapping.calendar.processor
7+
package at.bitfire.synctools.mapping.calendar.handler
88

99
import android.content.Entity
1010
import android.provider.CalendarContract.Events
@@ -14,7 +14,7 @@ import net.fortuna.ical4j.model.component.VEvent
1414
import net.fortuna.ical4j.model.property.Clazz
1515
import org.json.JSONException
1616

17-
class AccessLevelProcessor: AndroidEventFieldProcessor {
17+
class AccessLevelHandler: AndroidEventFieldHandler {
1818

1919
override fun process(from: Entity, main: Entity, to: VEvent) {
2020
val values = from.entityValues

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidEventFieldProcessor.kt renamed to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidEventFieldHandler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.synctools.mapping.calendar.processor
7+
package at.bitfire.synctools.mapping.calendar.handler
88

99
import android.content.Entity
1010
import at.bitfire.synctools.exception.InvalidLocalResourceException
1111
import net.fortuna.ical4j.model.component.VEvent
1212

13-
interface AndroidEventFieldProcessor {
13+
interface AndroidEventFieldHandler {
1414

1515
/**
1616
* Takes specific data from an event (= event row plus data rows, taken from the content provider)

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AndroidTimeField.kt renamed to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AndroidTimeField.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.synctools.mapping.calendar.processor
7+
package at.bitfire.synctools.mapping.calendar.handler
88

99
import at.bitfire.synctools.util.AndroidTimeUtils
1010
import net.fortuna.ical4j.model.Date

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AttendeesProcessor.kt renamed to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AttendeesHandler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.synctools.mapping.calendar.processor
7+
package at.bitfire.synctools.mapping.calendar.handler
88

99
import android.content.ContentValues
1010
import android.content.Entity
@@ -21,7 +21,7 @@ import java.net.URISyntaxException
2121
import java.util.logging.Level
2222
import java.util.logging.Logger
2323

24-
class AttendeesProcessor: AndroidEventFieldProcessor {
24+
class AttendeesHandler: AndroidEventFieldHandler {
2525

2626
private val logger
2727
get() = Logger.getLogger(javaClass.name)

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/AvailabilityProcessor.kt renamed to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/AvailabilityHandler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.synctools.mapping.calendar.processor
7+
package at.bitfire.synctools.mapping.calendar.handler
88

99
import android.content.Entity
1010
import android.provider.CalendarContract.Events
1111
import net.fortuna.ical4j.model.component.VEvent
1212
import net.fortuna.ical4j.model.property.Transp
1313

14-
class AvailabilityProcessor: AndroidEventFieldProcessor {
14+
class AvailabilityHandler: AndroidEventFieldHandler {
1515

1616
override fun process(from: Entity, main: Entity, to: VEvent) {
1717
val transp: Transp = when (from.entityValues.getAsInteger(Events.AVAILABILITY)) {

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/CategoriesProcessor.kt renamed to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/CategoriesHandler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.synctools.mapping.calendar.processor
7+
package at.bitfire.synctools.mapping.calendar.handler
88

99
import android.content.Entity
1010
import android.provider.CalendarContract.ExtendedProperties
@@ -13,7 +13,7 @@ import net.fortuna.ical4j.model.TextList
1313
import net.fortuna.ical4j.model.component.VEvent
1414
import net.fortuna.ical4j.model.property.Categories
1515

16-
class CategoriesProcessor: AndroidEventFieldProcessor {
16+
class CategoriesHandler: AndroidEventFieldHandler {
1717

1818
override fun process(from: Entity, main: Entity, to: VEvent) {
1919
val extended = from.subValues.filter { it.uri == ExtendedProperties.CONTENT_URI }.map { it.values }

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/ColorProcessor.kt renamed to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/ColorHandler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.synctools.mapping.calendar.processor
7+
package at.bitfire.synctools.mapping.calendar.handler
88

99
import android.content.Entity
1010
import android.provider.CalendarContract.Events
@@ -13,7 +13,7 @@ import net.fortuna.ical4j.model.component.VEvent
1313
import net.fortuna.ical4j.model.property.Color
1414
import java.util.logging.Logger
1515

16-
class ColorProcessor: AndroidEventFieldProcessor {
16+
class ColorHandler: AndroidEventFieldHandler {
1717

1818
private val logger
1919
get() = Logger.getLogger(javaClass.name)

lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/processor/DescriptionProcessor.kt renamed to lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler/DescriptionHandler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
package at.bitfire.synctools.mapping.calendar.processor
7+
package at.bitfire.synctools.mapping.calendar.handler
88

99
import android.content.Entity
1010
import android.provider.CalendarContract.Events
1111
import at.bitfire.vcard4android.Utils.trimToNull
1212
import net.fortuna.ical4j.model.component.VEvent
1313
import net.fortuna.ical4j.model.property.Description
1414

15-
class DescriptionProcessor: AndroidEventFieldProcessor {
15+
class DescriptionHandler: AndroidEventFieldHandler {
1616

1717
override fun process(from: Entity, main: Entity, to: VEvent) {
1818
val description = from.entityValues.getAsString(Events.DESCRIPTION).trimToNull()

0 commit comments

Comments
 (0)