public class

AppData

extends Object
java.lang.Object
   ↳ com.kinvey.java.AppData<T>
Known Direct Subclasses

Class Overview

Class for managing appData access to the Kinvey backend.

Summary

Nested Classes
class AppData.Aggregate Generic Aggregate class, constructs the HTTP request object for Aggregate requests. 
class AppData.Delete Generic Delete class. 
class AppData.Get Generic Get class. 
class AppData.GetEntity Generic Get class. 
class AppData.Save Generic Save class. 
Constants
String GEOLOC_FIELD_NAME static final String representing universal "_geoloc" value, used for geoqueries
String ID_FIELD_NAME static final String representing universal "_id" value, used to uniquely identify entites
Public Methods
Aggregate aggregate(ArrayList<String> fields, AggregateEntity.AggregateType type, String aggregateField, Query query)
public helper method to create AggregateEntity and return an intialize Aggregate Request Object@return
Aggregate averageBlocking(ArrayList<String> fields, String averageField, Query query)
Retrieve a group by AVERAGE on a collection or filtered collection@return
AppDataOperation.BlockingDeleteBuilder blockingDeleteBuilder()
Create and return a new synchronous App Data Request Builder associated with *this* instance of AppData.
AppDataOperation.BlockingGetBuilder blockingGetBuilder()
Create and return a new synchronous App Data Request Builder associated with *this* instance of AppData.
AppDataOperation.BlockingSaveBuilder blockingSaveBuilder()
Create and return a new synchronous App Data Request Builder associated with *this* instance of AppData.
void clearCustomRequestProperties()
Aggregate countBlocking(ArrayList<String> fields, Query query)
Retrieve a group by COUNT on a collection or filtered collection
Delete deleteBlocking(Query query)
Delete an entity from a collection by Query.
Delete deleteBlocking(String entityID)
Delete an entity from a collection by ID.
Get getBlocking(Query query)
Method to get a query of entities.
Get getBlocking()
Method to get all entities in a collection.
Get getBlocking(Query query, String[] resolves)
Convenience wrapper method to execute a query and resolve KinveyReferences in the entities
Get getBlocking(String[] ids)
Method to get a query of entities.
Get getBlocking(String queryString)
Method to resolve a raw query string
Get getBlocking(Query query, String[] resolves, int resolve_depth, boolean retain)
Method to execute a query and resolve KinveyReferences in the entities
String getCollectionName()
Gets the current collectionName
Class<T> getCurrentClass()
Gets current class that this AppData instance references.
GetEntity getEntityBlocking(String entityID)
Method to get an entity or entities.
GetEntity getEntityBlocking(String entityID, String[] resolves, int resolve_depth, boolean retain)
Method to get an entity or entities.
GetEntity getEntityBlocking(String id, String[] resolves)
Convenience wrapper method to get an entity and resolve KinveyReferences
boolean isOnline()
Aggregate maxBlocking(ArrayList<String> fields, String maxField, Query query)
Retrieve a group by MAX on a collection or filtered collection@return
Aggregate minBlocking(ArrayList<String> fields, String minField, Query query)
Retrieve a group by MIN on a collection or filtered collection@return
Query query()
Creates a new instance of Query
Save saveBlocking(T entity)
Save (create or update) an entity to a collection.
void setCache(Cache cache, CachePolicy policy)
Define a cache as well as the policy to use when interacting with the cache
void setClientAppVersion(String appVersion)
void setClientAppVersion(int major, int minor, int patch)
void setCollectionName(String collectionName)
Sets the collectionName
void setCustomRequestProperties(GenericJson customheaders)
void setCustomRequestProperty(String key, Object value)
void setOffline(OfflinePolicy policy, OfflineStore store)
Define the policy for Offline sync to use when performing operations in the background
Aggregate sumBlocking(ArrayList<String> fields, String sumField, Query query)
Retrieve a group by SUM on a collection or filtered collection@return
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String GEOLOC_FIELD_NAME

static final String representing universal "_geoloc" value, used for geoqueries

Constant Value: "_geoloc"

public static final String ID_FIELD_NAME

static final String representing universal "_id" value, used to uniquely identify entites

Constant Value: "_id"

Public Methods

public Aggregate aggregate (ArrayList<String> fields, AggregateEntity.AggregateType type, String aggregateField, Query query)

public helper method to create AggregateEntity and return an intialize Aggregate Request Object@return

Parameters
fields fields to group by
type Type of aggregation
aggregateField Field to aggregate on
query optional query to filter by (null for all records in a collection)
Throws
IOException

public Aggregate averageBlocking (ArrayList<String> fields, String averageField, Query query)

Retrieve a group by AVERAGE on a collection or filtered collection@return

Parameters
fields fields to group by
averageField field to average
query optional query to filter by (null for all records in a collection)
Throws
IOException

public AppDataOperation.BlockingDeleteBuilder blockingDeleteBuilder ()

Create and return a new synchronous App Data Request Builder associated with *this* instance of AppData.

Returns
  • a new request builder for a blocking DELETE operation

public AppDataOperation.BlockingGetBuilder blockingGetBuilder ()

Create and return a new synchronous App Data Request Builder associated with *this* instance of AppData.

Returns
  • a new request builder for a blocking GET operation

public AppDataOperation.BlockingSaveBuilder blockingSaveBuilder ()

Create and return a new synchronous App Data Request Builder associated with *this* instance of AppData.

Returns
  • a new request builder for a blocking SAVE (put or post) operation

public void clearCustomRequestProperties ()

public Aggregate countBlocking (ArrayList<String> fields, Query query)

Retrieve a group by COUNT on a collection or filtered collection

Parameters
fields fields to group by
query optional query to filter by (null for all records in a collection)
Returns
  • Aggregate object
Throws
IOException

public Delete deleteBlocking (Query query)

Delete an entity from a collection by Query.

Parameters
query query for entities to delete
Returns
  • Delete object
Throws
IOException

public Delete deleteBlocking (String entityID)

Delete an entity from a collection by ID.

Parameters
entityID entityID to delete
Returns
  • Delete object
Throws
IOException

public Get getBlocking (Query query)

Method to get a query of entities. Pass an empty query to return all entities in a collection.

Parameters
query Query to get
Returns
  • Get object
Throws
IOException

public Get getBlocking ()

Method to get all entities in a collection.

Returns
  • Get Object
Throws
IOException

public Get getBlocking (Query query, String[] resolves)

Convenience wrapper method to execute a query and resolve KinveyReferences in the entities

Parameters
query - Query to get
resolves list of KinveyReference fields to resolve
Returns
  • Get Request object ready for execution
Throws
IOException

public Get getBlocking (String[] ids)

Method to get a query of entities. Pass an array of entity _ids to return the entites.

Parameters
ids array of _ids to query for
Returns
  • Get object
Throws
IOException

public Get getBlocking (String queryString)

Method to resolve a raw query string

Returns
  • Get object
Throws
IOException

public Get getBlocking (Query query, String[] resolves, int resolve_depth, boolean retain)

Method to execute a query and resolve KinveyReferences in the entities

Parameters
query Query to get
resolves list of KinveyReference fields to resolve
resolve_depth the depth of KinveyReferences fields to resolve
retain should resolved KinveyReferences be retained
Returns
  • Get object
Throws
IOException

public String getCollectionName ()

Gets the current collectionName

Returns
  • Name of appData collection

public Class<T> getCurrentClass ()

Gets current class that this AppData instance references.

Returns
  • Current appData class for marshalling data

public GetEntity getEntityBlocking (String entityID)

Method to get an entity or entities. Pass null to entityID to return all entities in a collection.

Parameters
entityID entityID to get
Returns
  • Get object
Throws
IOException

public GetEntity getEntityBlocking (String entityID, String[] resolves, int resolve_depth, boolean retain)

Method to get an entity or entities. Pass null to entityID to return all entities in a collection.

Parameters
entityID entityID to get
resolves list of KinveyReference fields to resolve
resolve_depth the depth of KinveyReferences fields to resolve
retain should resolved KinveyReferences be retained
Returns
  • Get object
Throws
IOException

public GetEntity getEntityBlocking (String id, String[] resolves)

Convenience wrapper method to get an entity and resolve KinveyReferences

Parameters
id the id of the entity to query for
resolves list of KinveyReference fields to resolve
Returns
  • Get Request object ready for execution
Throws
IOException

public boolean isOnline ()

public Aggregate maxBlocking (ArrayList<String> fields, String maxField, Query query)

Retrieve a group by MAX on a collection or filtered collection@return

Parameters
fields fields to group by
maxField field to obtain max value from
query optional query to filter by (null for all records in a collection)
Throws
IOException

public Aggregate minBlocking (ArrayList<String> fields, String minField, Query query)

Retrieve a group by MIN on a collection or filtered collection@return

Parameters
fields fields to group by
minField field to obtain MIN value from
query optional query to filter by (null for all records in a collection)
Throws
IOException

public Query query ()

Creates a new instance of Query

Returns
  • New instance of Query object.

public Save saveBlocking (T entity)

Save (create or update) an entity to a collection.

Parameters
entity Entity to Save
Returns
  • Save object
Throws
IOException

public void setCache (Cache cache, CachePolicy policy)

Define a cache as well as the policy to use when interacting with the cache

Parameters
cache an implementation of the Cache interface, the cache itself
policy the policy defining behavior of the cache.

public void setClientAppVersion (String appVersion)

public void setClientAppVersion (int major, int minor, int patch)

public void setCollectionName (String collectionName)

Sets the collectionName

Parameters
collectionName Name of the appData collection.

public void setCustomRequestProperties (GenericJson customheaders)

public void setCustomRequestProperty (String key, Object value)

public void setOffline (OfflinePolicy policy, OfflineStore store)

Define the policy for Offline sync to use when performing operations in the background

Parameters
policy the policy defining behavior of offline sync

public Aggregate sumBlocking (ArrayList<String> fields, String sumField, Query query)

Retrieve a group by SUM on a collection or filtered collection@return

Parameters
fields fields to group by
sumField field to sum
query optional query to filter by (null for all records in a collection)
Throws
IOException