public class

OfflineTable

extends Object
java.lang.Object
   ↳ com.kinvey.android.offline.OfflineTable<T extends com.google.api.client.json.GenericJson>

Class Overview

This class manages the necessary tables for offline to function associated with one specific AsyncAppData collection.

Schema-less entities are stored in an `offline_MyCollection` table, which has two columns-- one for the _id of the entity and one for the json representation of the entity. `queue_MyCollection` maintains an ordered list of queued requests, so that they be retrieved and executed when a connection is restored. The queue associates an HTTP Verb with an _id of the entity to perform it on. Another table is used to support queries, mapping the query string to a list of returned _ids.

Summary

Constants
String COLUMN_ACTION
String COLUMN_DELETED
String COLUMN_ID
String COLUMN_JSON
String COLUMN_QUERY_STRING
String COLUMN_RESULT
String COLUMN_UNIQUE_KEY
String COLUMN_USER
String PREFIX_OFFLINE
String PREFIX_QUERY
String PREFIX_QUEUE
String PREFIX_RESULTS
String UNIQUE_INDEX_IDS
String UNIQUE_INDEX_QUEUE
Fields
public String QUERY_NAME
public String QUEUE_NAME
public String RESULTS_NAME
public String TABLE_NAME
Public Constructors
OfflineTable(String collection)
Public Methods
KinveyDeleteResponse delete(OfflineHelper helper, AbstractClient client, String id)
Flag an entity for deletion
void enqueueRequest(OfflineHelper helper, String verb, String id)
enqueue a request for later execution
T getEntity(OfflineHelper helper, AbstractClient client, String id, Class<T> responseClass)
Retrive an entity from this offline table
List<OfflineResponseInfo> getHistoricalRequests(OfflineHelper helper)
This method is deprecated. removed, as table would grow infinitely
T[] getQuery(OfflineHelper helper, AbstractClient client, String q, Class clazz)
Retrieve the results of a query from this offline table
T insertEntity(OfflineHelper helper, AbstractClient client, GenericJson offlineEntity)
Insert an entity into this offline table
void onCreate(SQLiteDatabase database)
void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion)
OfflineRequestInfo popSingleQueue(OfflineHelper helper)
Pop a queued request and remove it from the queue
static void runCommand(SQLiteDatabase database, String command)
Run a SQLLite command against a database
void storeCompletedRequestInfo(OfflineHelper helper, String collectionName, boolean success, OfflineRequestInfo info, String returnValue)
This method is deprecated. removed, as trable would grow infinitely
void storeQueryResults(OfflineHelper helper, String queryString, List<String> resultIds)
Store the results of a query
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String COLUMN_ACTION

Constant Value: "_action"

public static final String COLUMN_DELETED

Constant Value: "_deleted"

public static final String COLUMN_ID

Constant Value: "_id"

public static final String COLUMN_JSON

Constant Value: "_json"

public static final String COLUMN_QUERY_STRING

Constant Value: "_queryString"

public static final String COLUMN_RESULT

Constant Value: "_result"

public static final String COLUMN_UNIQUE_KEY

Constant Value: "_key"

public static final String COLUMN_USER

Constant Value: "_user"

public static final String PREFIX_OFFLINE

Constant Value: "offline_"

public static final String PREFIX_QUERY

Constant Value: "query_"

public static final String PREFIX_QUEUE

Constant Value: "queue_"

public static final String PREFIX_RESULTS

Constant Value: "results_"

public static final String UNIQUE_INDEX_IDS

Constant Value: "SOME_INDEX"

public static final String UNIQUE_INDEX_QUEUE

Constant Value: "ANOTHER_INDEX"

Fields

public String QUERY_NAME

public String QUEUE_NAME

public String RESULTS_NAME

public String TABLE_NAME

Public Constructors

public OfflineTable (String collection)

Public Methods

public KinveyDeleteResponse delete (OfflineHelper helper, AbstractClient client, String id)

Flag an entity for deletion

public void enqueueRequest (OfflineHelper helper, String verb, String id)

enqueue a request for later execution

public T getEntity (OfflineHelper helper, AbstractClient client, String id, Class<T> responseClass)

Retrive an entity from this offline table

public List<OfflineResponseInfo> getHistoricalRequests (OfflineHelper helper)

This method is deprecated.
removed, as table would grow infinitely

return a list of all historical offline requests@return

public T[] getQuery (OfflineHelper helper, AbstractClient client, String q, Class clazz)

Retrieve the results of a query from this offline table

public T insertEntity (OfflineHelper helper, AbstractClient client, GenericJson offlineEntity)

Insert an entity into this offline table

public void onCreate (SQLiteDatabase database)

public void onUpgrade (SQLiteDatabase database, int oldVersion, int newVersion)

public OfflineRequestInfo popSingleQueue (OfflineHelper helper)

Pop a queued request and remove it from the queue

public static void runCommand (SQLiteDatabase database, String command)

Run a SQLLite command against a database

public void storeCompletedRequestInfo (OfflineHelper helper, String collectionName, boolean success, OfflineRequestInfo info, String returnValue)

This method is deprecated.
removed, as trable would grow infinitely

store the results of a request executed in the background

public void storeQueryResults (OfflineHelper helper, String queryString, List<String> resultIds)

Store the results of a query