SyncTarget

abstract class SyncTarget @JvmOverloads constructor(idFieldName: String? = null, modificationDateFieldName: String? = null)

Abstract super class for SyncUpTarget and SyncDownTarget

Targets handle interactions with local store and with remote server.

Default targets use SmartStore for local store and local*_ fields to flag dirty (i.e. locally created/updated/deleted) records. Custom targets can use a different local store and/or different fields to flag dirty records.

Default targets use SObject Rest API to read/write records to the server. Custom targets can use different end points to read/write records to the server.

Inheritors

Constructors

Link copied to clipboard
constructor(target: JSONObject?)
constructor(idFieldName: String? = null, modificationDateFieldName: String? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun addSyncId(record: JSONObject, syncId: Long)
Link copied to clipboard
open fun asJSON(): JSONObject
Link copied to clipboard
fun cleanAndSaveInLocalStore(syncManager: SyncManager, soupName: String, record: JSONObject)

Save cleaned record in local store

Link copied to clipboard
fun cleanAndSaveInSmartStore(smartStore: SmartStore, soupName: String, record: JSONObject, idFieldName: String?, handleTx: Boolean)
Link copied to clipboard
fun cleanRecord(record: JSONObject)
Link copied to clipboard
fun deleteFromLocalStore(syncManager: SyncManager, soupName: String, record: JSONObject)

Delete record from local store

Link copied to clipboard
fun getDirtyRecordIds(syncManager: SyncManager, soupName: String, idField: String): SortedSet<String>

Return ids of "dirty" records (records locally created/upated or deleted)

Link copied to clipboard
fun getFromLocalStore(syncManager: SyncManager, soupName: String, storeId: String): JSONObject

Get record from local store by storeId

fun getFromLocalStore(syncManager: SyncManager, soupName: String, storeIds: List<String>): List<JSONObject>

Get records from local store by storeId

Link copied to clipboard
fun isDirty(record: JSONObject): Boolean

Given a record, return true if it was locally created/updated or deleted

Link copied to clipboard

Given a record, return true if it was locally created

Link copied to clipboard

Given a record, return true if it was locally deleted

Link copied to clipboard

Given a record, return true if it was locally updated

Link copied to clipboard
open fun saveRecordsToLocalStore(syncManager: SyncManager, soupName: String, records: JSONArray, syncId: Long)

Save records to local store