java.lang.Object | ||
↳ | com.kinvey.java.AppData<T> | |
↳ | com.kinvey.android.AsyncAppData<T> |
Wraps the com.kinvey.java.AppData public methods in asynchronous functionality using native Android AsyncTask.
This functionality can be accessed through the appData(String, Class
convenience method. AppData
gets and saves entities that extend com.google.api.client.json.GenericJson. A class that extends GenericJson
can map class members to KinveyCollection properties using com.google.api.client.util.Key attributes. For example,
the following will map a string "city" to a Kinvey collection attributed named "city":
@Key private String city;
The @Key attribute also can take an optional name, which will map the member to a different attribute name in the Kinvey collection.
@Key("_id") private String customerID;
Methods in this API use either KinveyListCallback
for retrieving entity sets,
KinveyDeleteCallback
for deleting appData, or the general-purpose
KinveyClientCallback
used for retrieving single entites or saving Entities.
Entity Set sample:
AppData<EventEntity> myAppData = kinveyClient.appData("myCollection",EventEntity.class);
myAppData.get(appData().query, new KinveyListCallback<EventEntity> {
public void onFailure(Throwable t) { ...
public void onSuccess(EventEntity[] entities) { ... }
});
}
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
average(ArrayList<String> fields, String averageField, Query query, KinveyClientCallback callback)
Asynchronous request to retrieve a group by AVERAGE on a collection or filtered collection
Generates an asynchronous request to group a collection and provide the average value of records based on a field or groups of fields. | ||||||||||
void |
count(ArrayList<String> fields, Query query, KinveyClientCallback callback)
Asynchronous request to retrieve a group by COUNT on a collection or filtered collection.
| ||||||||||
void |
delete(Query query, KinveyDeleteCallback callback)
Asynchronous request to delete a collection of entites from a collection by Query.
| ||||||||||
void |
delete(String entityID, KinveyDeleteCallback callback)
Asynchronous request to delete an entity to a collection.
| ||||||||||
void |
get(String[] ids, KinveyListCallback<T> callback)
Asynchronous request to fetch an array of Entities using an array of _ids.
| ||||||||||
void |
get(Query query, KinveyListCallback<T> callback)
Asynchronous request to fetch an array of Entities using a Query object.
| ||||||||||
void |
get(KinveyListCallback<T> callback)
Asynchronous request to fetch an array of all Entities in a collection.
| ||||||||||
void |
getEntity(String entityID, KinveyClientCallback<T> callback)
Asynchronous request to fetch a single Entity by ID.
| ||||||||||
void |
max(ArrayList<String> fields, String maxField, Query query, KinveyClientCallback callback)
Asynchronous request to retrieve a group by MAX on a collection or filtered collection
Generates an asynchronous request to group a collection and provide the max value of records based on a field or groups of fields. | ||||||||||
void |
min(ArrayList<String> fields, String minField, Query query, KinveyClientCallback callback)
Asynchronous request to retrieve a group by MIN on a collection or filtered collection
Generates an asynchronous request to group a collection and provide the min value of records based on a field or groups of fields. | ||||||||||
void |
save(T entity, KinveyClientCallback<T> callback)
Asynchronous request to save or update an entity to a collection.
| ||||||||||
void |
sum(ArrayList<String> fields, String sumField, Query query, KinveyClientCallback callback)
Asynchronous request to retrieveBlocking a group by SUM on a collection or filtered collection
Generates an asynchronous request to group a collection and provide a sumBlocking of records based on a field or groups of fields. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Asynchronous request to retrieve a group by AVERAGE on a collection or filtered collection
Generates an asynchronous request to group a collection and provide the average value of records based on a field or
groups of fields. The aggregate will reduce an entire collection, or a collection filtered by a Query
Sample Usage:
AppData<GenericJson> aggregate = kinveyClient.appData("events", EventEntity.class);
ArrayList<String> fields = new ArrayList<String>();
fields.add("userName");
aggregate.average(fields, "orderTotal", null, new KinveyClientCallback<EventEntity>() {
public void onSuccess(EventEntity event) { ...
public void onFailure(Throwable T) {...}
});
}
fields | ArrayList of fields to aggregate on |
---|---|
averageField | Field to get the maxBlocking value from |
query | Optional query object for filtering results to aggregate on. Set to null for entire collection. |
callback | KinveyClientCallback |
Asynchronous request to retrieve a group by COUNT on a collection or filtered collection.
Generates an asynchronous request to group a collection and provide a count of records based on a field or
groups of fields. The aggregate will reduce an entire collection, or a collection filtered by a Query
Sample Usage:
AppData<GenericJson> aggregate = kinveyClient.appData("events", EventEntity.class);
ArrayList<String> fields = new ArrayList<String>();
fields.add("userName");
aggregate.count(fields, null, new KinveyClientCallback<EventEntity>() {
public void onSuccess(EventEntity event) { ...
public void onFailure(Throwable T) {...}
});
}
fields | ArrayList of fields to aggregate on |
---|---|
query | Optional query object for filtering results to aggregate on. Set to null for entire collection. |
callback | KinveyClientCallback |
Asynchronous request to delete a collection of entites from a collection by Query.
Creates an asynchronous request to delete an entity from a collection by Entity ID. Uses KinveyDeleteCallback to return a com.kinvey.java.model.KinveyDeleteResponse.
Sample Usage:
AppData<EventEntity> myAppData = kinveyClient.appData("myCollection", EventEntity.class);
Query myQuery = new Query();
myQuery.equals("age",21);
myAppData.delete(myQuery, new KinveyDeleteCallback {
public void onFailure(Throwable t) { ...
public void onSuccess(EventEntity[] entities) { ... }
});
}
query | Query to filter the results. |
---|---|
callback | KinveyDeleteCallback |
Asynchronous request to delete an entity to a collection.
Creates an asynchronous request to delete a group of entities from a collection based on a Query object. Uses KinveyDeleteCallback to return a
com.kinvey.java.model.KinveyDeleteResponse. Queries can be constructed with Query
.
An empty Query object will delete all items in the collection.
Sample Usage:
AppData<EventEntity> myAppData = kinveyClient.appData("myCollection", EventEntity.class);
myAppData.delete(myQuery, new KinveyDeleteCallback {
public void onFailure(Throwable t) { ...
public void onSuccess(EventEntity[] entities) { ... }
});
}
entityID | the ID to delete |
---|---|
callback | KinveyDeleteCallback |
Asynchronous request to fetch an array of Entities using an array of _ids.
Constructs an asynchronous request to fetch an Array of Entities, filtering by the provided list of _ids. Uses
KinveyListCallbackQuery
.
Sample Usage:
AppData<EventEntity> myAppData = kinveyClient.appData("myCollection", EventEntity.class); myAppData.get(new String[]{"189472023", "10193583"
, new KinveyListCallback{ public void onFailure(Throwable t) { ... } public void onSuccess(EventEntity[] entities) { ... } }); }
ids | A list of _ids to query by. |
---|---|
callback | KinveyListCallback |
Asynchronous request to fetch an array of Entities using a Query object.
Constructs an asynchronous request to fetch an Array of Entities, filtering by a Query object. Uses
KinveyListCallbackQuery
.
An empty Query object will return all items in the collection.
Sample Usage:
AppData<EventEntity> myAppData = kinveyClient.appData("myCollection", EventEntity.class);
Query myQuery = new Query();
myQuery.equals("age",21);
myAppData.get(myQuery, new KinveyListCallback<EventEntity> {
public void onFailure(Throwable t) { ...
public void onSuccess(EventEntity[] entities) { ... }
});
}
query | Query to filter the results. |
---|---|
callback | KinveyListCallback |
Asynchronous request to fetch an array of all Entities in a collection.
Constructs an asynchronous request to fetch an Array of all entities in a collection. Uses
KinveyListCallback
Sample Usage:
AppData<EventEntity> myAppData = kinveyClient.appData("myCollection", EventEntity.class);
myAppData.get(new KinveyListCallback<EventEntity> {
public void onFailure(Throwable t) { ...
public void onSuccess(EventEntity[] entities) { ... }
});
}
callback | KinveyListCallback |
---|
Asynchronous request to fetch a single Entity by ID.
Constructs an asynchronous request to fetch a single Entity by its Entity ID. Returns an instance of that Entity
via KinveyClientCallback
Sample Usage:
AppData<EventEntity> myAppData = kinveyClient.appData("myCollection", EventEntity.class).get("123",
new KinveyClientCallback<EventEntity> {
public void onFailure(Throwable t) { ...
public void onSuccess(EventEntity entity) { ... }
});
}
entityID | entityID to fetch |
---|---|
callback | KinveyClientCallback |
Asynchronous request to retrieve a group by MAX on a collection or filtered collection
Generates an asynchronous request to group a collection and provide the max value of records based on a field or
groups of fields. The aggregate will reduce an entire collection, or a collection filtered by a Query
Sample Usage:
AppData<GenericJson> aggregate = kinveyClient.appData("events", EventEntity.class");
ArrayList<String> fields = new ArrayList<String>();
fields.add("userName");
aggregate.max(fields, "orderTotal", null, new KinveyClientCallback<EventEntity>() {
public void onSuccess(EventEntity event) { ...
public void onFailure(Throwable T) {...}
});
}
fields | ArrayList of fields to aggregate on |
---|---|
maxField | Field to get the max value from |
query | Optional query object for filtering results to aggregate on. Set to null for entire collection. |
callback | KinveyClientCallback |
Asynchronous request to retrieve a group by MIN on a collection or filtered collection
Generates an asynchronous request to group a collection and provide the min value of records based on a field or
groups of fields. The aggregate will reduce an entire collection, or a collection filtered by a Query
Sample Usage:
AppData<GenericJson> aggregate = kinveyClient.appData("events", EventEntity.class");
ArrayList<String> fields = new ArrayList<String>();
fields.add("userName");
aggregate.min(fields, "orderTotal", null, new KinveyClientCallback<EventEntity>() {
public void onSuccess(EventEntity event) { ...
public void onFailure(Throwable T) {...}
});
}
fields | ArrayList of fields to aggregate on |
---|---|
minField | Field to get the min value from |
query | Optional query object for filtering results to aggregate on. Set to null for entire collection. |
callback | KinveyClientCallback |
Asynchronous request to save or update an entity to a collection.
Constructs an asynchronous request to save an entity of type T to a collection. Creates the entity if it doesn't exist, updates it if it does exist. If an "_id" property is not present, the Kinvey backend will generate one.
Sample Usage:
AppData<EventEntity> myAppData = kinveyClient.appData("myCollection", EventEntity.class);
myAppData.save(entityID, new KinveyClientCallback<EventEntity> {
public void onFailure(Throwable t) { ...
public void onSuccess(EventEntity[] entities) { ... }
});
}
entity | The entity to save |
---|---|
callback | KinveyClientCallback |
Asynchronous request to retrieveBlocking a group by SUM on a collection or filtered collection
Generates an asynchronous request to group a collection and provide a sumBlocking of records based on a field or
groups of fields. The aggregate will reduce an entire collection, or a collection filtered by a Query
Sample Usage:
AppData<GenericJson> aggregate = kinveyClient.appData("events", EventEntity.class");
ArrayList<String> fields = new ArrayList<String>();
fields.add("userName");
aggregate.sumBlocking(fields, "orderTotal", null, new KinveyClientCallback<EventEntity>() {
public void onSuccess(EventEntity event) { ...
public void onFailure(Throwable T) {...}
});
}
fields | ArrayList of fields to aggregate on |
---|---|
sumField | Field to sumBlocking |
query | Optional query object for filtering results to aggregate on. Set to null for entire collection. |
callback | KinveyClientCallback |