/** * Stores the objects and every object they point to in the local datastore, recursively. If * those other objects have not been fetched from Parse, they will not be stored. However, if they * have changed data, all of the changes will be retained. To get the objects back later, you can * use {@link ParseQuery#fromLocalDatastore()}, or you can create an unfetched pointer with * {@link #createWithoutData(Class, String)} and then call {@link #fetchFromLocalDatastore()} on it. * * @param name the name * @param objects the objects to be pinned * @return A {@link bolts.Task} that is resolved when pinning all completes. * @see #unpinAllInBackground(String, java.util.List) */ public static <T extends ParseObject> Task<Void> pinAllInBackground(final String name, final List<T> objects) { return pinAllInBackground(name, objects, true); }
/** * Stores the objects and every object they point to in the local datastore, recursively. If * those other objects have not been fetched from Parse, they will not be stored. However, if they * have changed data, all of the changes will be retained. To get the objects back later, you can * use {@link ParseQuery#fromLocalDatastore()}, or you can create an unfetched pointer with * {@link #createWithoutData(Class, String)} and then call {@link #fetchFromLocalDatastore()} on it. * * @param objects the objects to be pinned * @return A {@link bolts.Task} that is resolved when pinning all completes. * @see #unpinAllInBackground(java.util.List) * @see #DEFAULT_PIN */ public static <T extends ParseObject> Task<Void> pinAllInBackground(List<T> objects) { return pinAllInBackground(DEFAULT_PIN, objects); }
/** * Stores the object and every object it points to in the local datastore, recursively. If those * other objects have not been fetched from Parse, they will not be stored. However, if they have * changed data, all of the changes will be retained. To get the objects back later, you can use * {@link ParseQuery#fromLocalDatastore()}, or you can create an unfetched pointer with * {@link #createWithoutData(Class, String)} and then call {@link #fetchFromLocalDatastore()} on * it. * * @return A {@link bolts.Task} that is resolved when pinning completes. * @see #unpinInBackground(String) */ public Task<Void> pinInBackground(String name) { return pinAllInBackground(name, Collections.singletonList(this)); }
Task<Void> pinInBackground(String name, boolean includeAllChildren) { return pinAllInBackground(name, Collections.singletonList(this), includeAllChildren); }
/** * Stores the object and every object it points to in the local datastore, recursively. If those * other objects have not been fetched from Parse, they will not be stored. However, if they have * changed data, all of the changes will be retained. To get the objects back later, you can use * {@link ParseQuery#fromLocalDatastore()}, or you can create an unfetched pointer with * {@link #createWithoutData(Class, String)} and then call {@link #fetchFromLocalDatastore()} on * it. * * @return A {@link bolts.Task} that is resolved when pinning completes. * @see #unpinInBackground() * @see #DEFAULT_PIN */ public Task<Void> pinInBackground() { return pinAllInBackground(DEFAULT_PIN, Collections.singletonList(this)); }
/** * Stores the objects and every object they point to in the local datastore, recursively. If * those other objects have not been fetched from Parse, they will not be stored. However, if they * have changed data, all of the changes will be retained. To get the objects back later, you can * use {@link ParseQuery#fromLocalDatastore()}, or you can create an unfetched pointer with * {@link #createWithoutData(Class, String)} and then call {@link #fetchFromLocalDatastore()} on it. * * @param objects the objects to be pinned * @throws ParseException exception if fails * @see #unpinAll(java.util.List) * @see #DEFAULT_PIN */ public static <T extends ParseObject> void pinAll(List<T> objects) throws ParseException { ParseTaskUtils.wait(pinAllInBackground(DEFAULT_PIN, objects)); }
/** * Stores the objects and every object they point to in the local datastore, recursively. If * those other objects have not been fetched from Parse, they will not be stored. However, if they * have changed data, all of the changes will be retained. To get the objects back later, you can * use {@link ParseQuery#fromLocalDatastore()}, or you can create an unfetched pointer with * {@link #createWithoutData(Class, String)} and then call {@link #fetchFromLocalDatastore()} on it. * * @param objects the objects to be pinned * @param callback the callback * @see #unpinAllInBackground(java.util.List, DeleteCallback) * @see #DEFAULT_PIN */ public static <T extends ParseObject> void pinAllInBackground(List<T> objects, SaveCallback callback) { ParseTaskUtils.callbackOnMainThreadAsync(pinAllInBackground(DEFAULT_PIN, objects), callback); }
/** * Stores the objects and every object they point to in the local datastore, recursively. If * those other objects have not been fetched from Parse, they will not be stored. However, if they * have changed data, all of the changes will be retained. To get the objects back later, you can * use {@link ParseQuery#fromLocalDatastore()}, or you can create an unfetched pointer with * {@link #createWithoutData(Class, String)} and then call {@link #fetchFromLocalDatastore()} on it. * {@link #fetchFromLocalDatastore()} on it. * * @param name the name * @param objects the objects to be pinned * @throws ParseException exception if fails * @see #unpinAll(String, java.util.List) */ public static <T extends ParseObject> void pinAll(String name, List<T> objects) throws ParseException { ParseTaskUtils.wait(pinAllInBackground(name, objects)); }
/** * Stores the objects and every object they point to in the local datastore, recursively. If * those other objects have not been fetched from Parse, they will not be stored. However, if they * have changed data, all of the changes will be retained. To get the objects back later, you can * use {@link ParseQuery#fromLocalDatastore()}, or you can create an unfetched pointer with * {@link #createWithoutData(Class, String)} and then call {@link #fetchFromLocalDatastore()} on it. * * @param name the name * @param objects the objects to be pinned * @param callback the callback * @see #unpinAllInBackground(String, java.util.List, DeleteCallback) */ public static <T extends ParseObject> void pinAllInBackground(String name, List<T> objects, SaveCallback callback) { ParseTaskUtils.callbackOnMainThreadAsync(pinAllInBackground(name, objects), callback); }
@Override public void done(ParseException e) { if (e == null) { // Add the latest results for this query to the cache. Log.d("PARSE_PIN_WIN", pinName); ParseObject.pinAllInBackground(pinName, data); } else { Log.d("PARSE_PIN_ERROR", e.toString()); } } });
@NonNull public static <R extends ParseObject> Completable pin(@NonNull final List<R> objects) { return RxTask.completable(() -> ParseObject.pinAllInBackground(objects)); }
@NonNull public static <R extends ParseObject> Completable pin(@NonNull final String name, @NonNull final List<R> objects) { return RxTask.completable(() -> ParseObject.pinAllInBackground(name, objects)); }