public class

EntityDelta

extends Object
implements Parcelable
java.lang.Object
   ↳ com.android.contacts.model.EntityDelta

Class Overview

Contains an Entity and records any modifications separately so the original Entity can be swapped out with a newer version and the changes still cleanly applied.

One benefit of this approach is that we can build changes entirely on an empty Entity, which then becomes an insert RawContacts case.

When applying modifications over an Entity, we try finding the original _ID rows where the modifications took place. If those rows are missing from the new Entity, we know the original data must be deleted, but to preserve the user modifications we treat as an insert.

Summary

Nested Classes
class EntityDelta.ValuesDelta Type of ContentValues that maintains both an original state and a modified version of that state. 
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<EntityDelta> CREATOR
Public Constructors
EntityDelta()
EntityDelta(EntityDelta.ValuesDelta values)
Public Methods
EntityDelta.ValuesDelta addEntry(EntityDelta.ValuesDelta entry)
void buildAssert(ArrayList<ContentProviderOperation> buildInto)
Build a list of ContentProviderOperation that will assert any "before" state hasn't changed.
void buildDiff(ArrayList<ContentProviderOperation> buildInto)
Build a list of ContentProviderOperation that will transform the current "before" Entity state into the modified state which this EntityDelta represents.
int describeContents()
boolean equals(Object object)
static EntityDelta fromBefore(Entity before)
Build an EntityDelta using the given Entity as a starting point; the "before" snapshot.
EntityDelta.ValuesDelta getEntry(Long childId)
Find entry with the given _ID value.
int getEntryCount(boolean onlyVisible)
Return the total number of EntityDelta.ValuesDelta contained.
ArrayList<EntityDelta.ValuesDelta> getMimeEntries(String mimeType)
int getMimeEntriesCount(String mimeType, boolean onlyVisible)
EntityDelta.ValuesDelta getPrimaryEntry(String mimeType)
Get the EntityDelta.ValuesDelta child marked as IS_PRIMARY, which may return null when no entry exists.
EntityDelta.ValuesDelta getSuperPrimaryEntry(String mimeType, boolean forceSelection)
Returns the super-primary entry for the given mime type
EntityDelta.ValuesDelta getSuperPrimaryEntry(String mimeType)
EntityDelta.ValuesDelta getValues()
boolean hasMimeEntries(String mimeType)
boolean isContactInsert()
void markDeleted()
Mark this entire object deleted, including any EntityDelta.ValuesDelta.
static EntityDelta mergeAfter(EntityDelta local, EntityDelta remote)
Merge the "after" values from the given EntityDelta onto the "before" state represented by this EntityDelta, discarding any existing "after" states.
void readFromParcel(Parcel source)
String toString()
void writeToParcel(Parcel dest, int flags)
Protected Methods
ContentProviderOperation.Builder buildSetAggregationMode(Long beforeId, int mode)
Build a ContentProviderOperation that changes AGGREGATION_MODE to the given value.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<EntityDelta> CREATOR

Public Constructors

public EntityDelta ()

public EntityDelta (EntityDelta.ValuesDelta values)

Public Methods

public void buildAssert (ArrayList<ContentProviderOperation> buildInto)

Build a list of ContentProviderOperation that will assert any "before" state hasn't changed. This is maintained separately so that all asserts can take place before any updates occur.

public void buildDiff (ArrayList<ContentProviderOperation> buildInto)

Build a list of ContentProviderOperation that will transform the current "before" Entity state into the modified state which this EntityDelta represents.

public int describeContents ()

public boolean equals (Object object)

public static EntityDelta fromBefore (Entity before)

Build an EntityDelta using the given Entity as a starting point; the "before" snapshot.

public EntityDelta.ValuesDelta getEntry (Long childId)

Find entry with the given _ID value.

public int getEntryCount (boolean onlyVisible)

Return the total number of EntityDelta.ValuesDelta contained.

public ArrayList<EntityDelta.ValuesDelta> getMimeEntries (String mimeType)

public int getMimeEntriesCount (String mimeType, boolean onlyVisible)

public EntityDelta.ValuesDelta getPrimaryEntry (String mimeType)

Get the EntityDelta.ValuesDelta child marked as IS_PRIMARY, which may return null when no entry exists.

public EntityDelta.ValuesDelta getSuperPrimaryEntry (String mimeType, boolean forceSelection)

Returns the super-primary entry for the given mime type

Parameters
forceSelection if true, will try to return some value even if a super-primary doesn't exist (may be a primary, or just a random item

public EntityDelta.ValuesDelta getSuperPrimaryEntry (String mimeType)

public EntityDelta.ValuesDelta getValues ()

public boolean hasMimeEntries (String mimeType)

public boolean isContactInsert ()

public void markDeleted ()

Mark this entire object deleted, including any EntityDelta.ValuesDelta.

public static EntityDelta mergeAfter (EntityDelta local, EntityDelta remote)

Merge the "after" values from the given EntityDelta onto the "before" state represented by this EntityDelta, discarding any existing "after" states. This is typically used when re-parenting changes onto an updated Entity.

public void readFromParcel (Parcel source)

public String toString ()

public void writeToParcel (Parcel dest, int flags)

Protected Methods

protected ContentProviderOperation.Builder buildSetAggregationMode (Long beforeId, int mode)

Build a ContentProviderOperation that changes AGGREGATION_MODE to the given value.