private Builder buildAssertHelper() {
   final boolean isContactInsert = mValues.isInsert();
   ContentProviderOperation.Builder builder = null;
   if (!isContactInsert) {
     // Assert version is consistent while persisting changes
     final Long beforeId = mValues.getId();
     final Long beforeVersion = mValues.getAsLong(RawContacts.VERSION);
     if (beforeId == null || beforeVersion == null) return builder;
     builder = ContentProviderOperation.newAssertQuery(mContactsQueryUri);
     builder.withSelection(RawContacts._ID + "=" + beforeId, null);
     builder.withValue(RawContacts.VERSION, beforeVersion);
   }
   return builder;
 }
Пример #2
0
 /**
  * Takes the values in this builder and creates a new {@link ContentProviderOperation} as an
  * assert query operation.
  *
  * @see ContentProviderOperation#newAssertQuery(Uri)
  */
 public ContentProviderOperation.Builder toAssertQueryOperationBuilder() {
   return ContentProviderOperation.newAssertQuery(mContentUri).withValues(mValues);
 }