Search in sources :

Example 31 with QueryPredicate

use of com.amplifyframework.core.model.query.predicate.QueryPredicate in project amplify-android by aws-amplify.

the class SyncStatus method getLastSyncMetaData.

private LastSyncMetadata getLastSyncMetaData(@NonNull String modelClassName, @NonNull Consumer<DataStoreException> onObservationError) throws DataStoreException {
    QueryPredicate hasMatchingModelClassName = QueryField.field("modelClassName").eq(modelClassName);
    List<LastSyncMetadata> syncedList = sqlQueryProcessor.queryOfflineData(LastSyncMetadata.class, Where.matches(hasMatchingModelClassName), onObservationError);
    return extractSingleResult(modelClassName, syncedList);
}
Also used : LastSyncMetadata(com.amplifyframework.datastore.syncengine.LastSyncMetadata) QueryPredicate(com.amplifyframework.core.model.query.predicate.QueryPredicate)

Aggregations

QueryPredicate (com.amplifyframework.core.model.query.predicate.QueryPredicate)31 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)12 BlogOwner (com.amplifyframework.testmodels.commentsblog.BlogOwner)11 ModelSchema (com.amplifyframework.core.model.ModelSchema)9 DataStoreException (com.amplifyframework.datastore.DataStoreException)9 HashSet (java.util.HashSet)8 List (java.util.List)7 NonNull (androidx.annotation.NonNull)6 SQLPredicate (com.amplifyframework.datastore.storage.sqlite.adapter.SQLPredicate)6 Consumer (com.amplifyframework.core.Consumer)5 Cancelable (com.amplifyframework.core.async.Cancelable)5 Model (com.amplifyframework.core.model.Model)5 SerializedModel (com.amplifyframework.core.model.SerializedModel)5 SQLiteTable (com.amplifyframework.datastore.storage.sqlite.adapter.SQLiteTable)5 Action (com.amplifyframework.core.Action)4 TimeUnit (java.util.concurrent.TimeUnit)4 AmplifyException (com.amplifyframework.AmplifyException)3 Amplify (com.amplifyframework.core.Amplify)3 ModelProvider (com.amplifyframework.core.model.ModelProvider)3