diff options
author | Fred Quintana <fredq@google.com> | 2009-05-22 14:23:31 -0700 |
---|---|---|
committer | Fred Quintana <fredq@google.com> | 2009-06-01 16:17:03 -0700 |
commit | 03d9490758c9318cee6d14d3cc5007556dce92d0 (patch) | |
tree | 58d56d848d0a1f0638157f0ba70afc9b75119601 /core/java/android/content/ContentProvider.java | |
parent | b0d031ad132dac585d1f21d46ebebcc4d13f40c7 (diff) | |
download | frameworks_base-03d9490758c9318cee6d14d3cc5007556dce92d0.zip frameworks_base-03d9490758c9318cee6d14d3cc5007556dce92d0.tar.gz frameworks_base-03d9490758c9318cee6d14d3cc5007556dce92d0.tar.bz2 |
- create a new generic ISyncAdapter implementation, SyncAdapterNew
- change the applyBatch to take an ArrayList rather than an []
- change Entity to be a final flass that contains ContentValues
- remove the ability to update/insert Entities by a ContentProviderOperation
Diffstat (limited to 'core/java/android/content/ContentProvider.java')
-rw-r--r-- | core/java/android/content/ContentProvider.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java index bb25b68..4e631c4 100644 --- a/core/java/android/content/ContentProvider.java +++ b/core/java/android/content/ContentProvider.java @@ -32,6 +32,7 @@ import android.os.ParcelFileDescriptor; import java.io.File; import java.io.FileNotFoundException; +import java.util.ArrayList; /** * Content providers are one of the primary building blocks of Android applications, providing @@ -156,7 +157,7 @@ public abstract class ContentProvider implements ComponentCallbacks { return ContentProvider.this.insertEntity(uri, entities); } - public ContentProviderResult[] applyBatch(ContentProviderOperation[] operations) + public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) throws OperationApplicationException { for (ContentProviderOperation operation : operations) { if (operation.isReadOperation()) { @@ -641,11 +642,12 @@ public abstract class ContentProvider implements ComponentCallbacks { * @throws OperationApplicationException thrown if an application fails. * See {@link ContentProviderOperation#apply} for more information. */ - public ContentProviderResult[] applyBatch(ContentProviderOperation[] operations) + public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) throws OperationApplicationException { - ContentProviderResult[] results = new ContentProviderResult[operations.length]; - for (int i = 0; i < operations.length; i++) { - results[i] = operations[i].apply(this, results, i); + final int numOperations = operations.size(); + final ContentProviderResult[] results = new ContentProviderResult[numOperations]; + for (int i = 0; i < numOperations; i++) { + results[i] = operations.get(i).apply(this, results, i); } return results; } |