@@ -64,27 +64,27 @@ import java.util.logging.Logger
6464 * The SEQUENCE field is stored in [Tasks.SYNC_VERSION], so don't use [Tasks.SYNC_VERSION]
6565 * for anything else.
6666 */
67- open class DmfsTask (
68- val taskList : DmfsTaskList < * >
67+ class DmfsTask (
68+ val taskList : DmfsTaskList
6969) {
7070
71- protected val logger = Logger .getLogger(javaClass.name)
72- protected val tzRegistry by lazy { TimeZoneRegistryFactory .getInstance().createRegistry() }
71+ private val logger = Logger .getLogger(javaClass.name)
72+ private val tzRegistry by lazy { TimeZoneRegistryFactory .getInstance().createRegistry() }
7373
7474 var id: Long? = null
7575 var syncId: String? = null
7676 var eTag: String? = null
7777 var flags: Int = 0
7878
7979
80- constructor (taskList: DmfsTaskList < * > , values: ContentValues ): this (taskList) {
80+ constructor (taskList: DmfsTaskList , values: ContentValues ): this (taskList) {
8181 id = values.getAsLong(Tasks ._ID )
8282 syncId = values.getAsString(Tasks ._SYNC_ID )
8383 eTag = values.getAsString(COLUMN_ETAG )
8484 flags = values.getAsInteger(COLUMN_FLAGS ) ? : 0
8585 }
8686
87- constructor (taskList: DmfsTaskList < * > , task: Task , syncId: String? , eTag: String? , flags: Int ): this (taskList) {
87+ constructor (taskList: DmfsTaskList , task: Task , syncId: String? , eTag: String? , flags: Int ): this (taskList) {
8888 this .task = task
8989 this .syncId = syncId
9090 this .eTag = eTag
@@ -160,7 +160,7 @@ open class DmfsTask(
160160 throw FileNotFoundException (" Couldn't find task #$id " )
161161 }
162162
163- protected fun populateTask (values : ContentValues ) {
163+ private fun populateTask (values : ContentValues ) {
164164 val task = requireNotNull(task)
165165
166166 task.uid = values.getAsString(Tasks ._UID )
@@ -267,7 +267,7 @@ open class DmfsTask(
267267 values.getAsString(Tasks .RRULE )?.let { task.rRule = RRule (it) }
268268 }
269269
270- protected fun populateProperty (row : ContentValues ) {
270+ private fun populateProperty (row : ContentValues ) {
271271 logger.log(Level .FINER , " Found property" , row)
272272
273273 val task = requireNotNull(task)
@@ -287,7 +287,7 @@ open class DmfsTask(
287287 }
288288 }
289289
290- protected fun populateAlarm (row : ContentValues ) {
290+ private fun populateAlarm (row : ContentValues ) {
291291 val task = requireNotNull(task)
292292 val props = PropertyList <Property >()
293293
@@ -315,7 +315,7 @@ open class DmfsTask(
315315 task.alarms + = VAlarm (props)
316316 }
317317
318- protected fun populateRelatedTo (row : ContentValues ) {
318+ private fun populateRelatedTo (row : ContentValues ) {
319319 val uid = row.getAsString(Relation .RELATED_UID )
320320 if (uid == null ) {
321321 logger.warning(" Task relation doesn't refer to same task list; can't be synchronized" )
@@ -380,15 +380,19 @@ open class DmfsTask(
380380 return ContentUris .withAppendedId(Tasks .getContentUri(taskList.providerName.authority), existingId)
381381 }
382382
383- protected fun insertProperties (batch : TasksBatchOperation , idxTask : Int? ) {
383+ fun update (values : ContentValues ) {
384+ taskList.provider.update(taskSyncURI(), values, null , null )
385+ }
386+
387+ private fun insertProperties (batch : TasksBatchOperation , idxTask : Int? ) {
384388 insertAlarms(batch, idxTask)
385389 insertCategories(batch, idxTask)
386390 insertComment(batch, idxTask)
387391 insertRelatedTo(batch, idxTask)
388392 insertUnknownProperties(batch, idxTask)
389393 }
390394
391- protected fun insertAlarms (batch : TasksBatchOperation , idxTask : Int? ) {
395+ private fun insertAlarms (batch : TasksBatchOperation , idxTask : Int? ) {
392396 val task = requireNotNull(task)
393397 for (alarm in task.alarms) {
394398 val (alarmRef, minutes) = ICalendar .vAlarmToMin(
@@ -430,7 +434,7 @@ open class DmfsTask(
430434 }
431435 }
432436
433- protected fun insertCategories (batch : TasksBatchOperation , idxTask : Int? ) {
437+ private fun insertCategories (batch : TasksBatchOperation , idxTask : Int? ) {
434438 for (category in requireNotNull(task).categories) {
435439 val builder = CpoBuilder .newInsert(taskList.tasksPropertiesSyncUri())
436440 .withTaskId(Category .TASK_ID , idxTask)
@@ -441,7 +445,7 @@ open class DmfsTask(
441445 }
442446 }
443447
444- protected fun insertComment (batch : TasksBatchOperation , idxTask : Int? ) {
448+ private fun insertComment (batch : TasksBatchOperation , idxTask : Int? ) {
445449 val comment = requireNotNull(task).comment ? : return
446450 val builder = CpoBuilder .newInsert(taskList.tasksPropertiesSyncUri())
447451 .withTaskId(Comment .TASK_ID , idxTask)
@@ -451,7 +455,7 @@ open class DmfsTask(
451455 batch + = builder
452456 }
453457
454- protected fun insertRelatedTo (batch : TasksBatchOperation , idxTask : Int? ) {
458+ private fun insertRelatedTo (batch : TasksBatchOperation , idxTask : Int? ) {
455459 for (relatedTo in requireNotNull(task).relatedTo) {
456460 val relType = when ((relatedTo.getParameter(Parameter .RELTYPE ) as RelType ? )) {
457461 RelType .CHILD ->
@@ -471,7 +475,7 @@ open class DmfsTask(
471475 }
472476 }
473477
474- protected fun insertUnknownProperties (batch : TasksBatchOperation , idxTask : Int? ) {
478+ private fun insertUnknownProperties (batch : TasksBatchOperation , idxTask : Int? ) {
475479 for (property in requireNotNull(task).unknownProperties) {
476480 if (property.value.length > UnknownProperty .MAX_UNKNOWN_PROPERTY_SIZE ) {
477481 logger.warning(" Ignoring unknown property with ${property.value.length} octets (too long)" )
@@ -491,7 +495,7 @@ open class DmfsTask(
491495 return taskList.provider.delete(taskSyncURI(), null , null )
492496 }
493497
494- protected fun buildTask (builder : CpoBuilder , update : Boolean ) {
498+ private fun buildTask (builder : CpoBuilder , update : Boolean ) {
495499 if (! update)
496500 builder .withValue(Tasks .LIST_ID , taskList.id)
497501
@@ -602,7 +606,7 @@ open class DmfsTask(
602606 }
603607
604608
605- protected fun CpoBuilder.withTaskId (column : String , idxTask : Int? ): CpoBuilder {
609+ private fun CpoBuilder.withTaskId (column : String , idxTask : Int? ): CpoBuilder {
606610 if (idxTask != null )
607611 withValueBackReference(column, idxTask)
608612 else
@@ -611,7 +615,7 @@ open class DmfsTask(
611615 }
612616
613617
614- protected fun taskSyncURI (loadProperties : Boolean = false): Uri {
618+ private fun taskSyncURI (loadProperties : Boolean = false): Uri {
615619 val id = requireNotNull(id)
616620 return ContentUris .withAppendedId(taskList.tasksSyncUri(loadProperties), id)
617621 }
0 commit comments